/* Storious Desk Atelier — Phase 2 formal Desk integration.
   Loaded after desk-book.css. Formal layout stays inside #desk; the shared
   .app-study rules below are the approved color/contrast compatibility layer. */

/* Shared study shell -------------------------------------------------------
   Phase 2 may replace the old dark room while Shelf / Me keep their IA and
   geometry. Rebinding the shared color tokens keeps all three tabs legible. */
.app-study {
  --study-cream: var(--atelier-ink, #2b2620);
  --study-muted: var(--atelier-muted, #6f675d);
  --text: var(--atelier-ink, #2b2620);
  --muted: var(--atelier-muted, #6f675d);
  --line: var(--atelier-line, #e7dccd);
  --card: var(--atelier-card-highlight, #fefaf1);
  min-height: 100vh;
  background:
    radial-gradient(72% 48% at 24% -8%, rgb(255 255 255 / 0.92), transparent 74%),
    repeating-linear-gradient(91deg, rgb(109 81 51 / 0.012) 0 1px, transparent 1px 9px),
    var(--atelier-canvas, #fdfaf5);
  background-attachment: scroll;
  color: var(--atelier-ink, #2b2620);
}

.app-study .topbar {
  border-color: var(--atelier-line, #e7dccd);
  background: rgb(254 251 247 / 0.96);
  color: var(--atelier-ink, #2b2620);
  box-shadow: 0 7px 24px -20px rgb(var(--atelier-shadow-rgb, 78 59 40) / 0.34);
  backdrop-filter: blur(12px);
}

.app-study .brand {
  color: var(--atelier-ink, #2b2620);
}

.app-study .topbar-user,
.app-study .topbar-settings,
.app-study .lang-switch,
.app-study .topnav a {
  color: var(--atelier-muted, #6f675d);
}

.app-study .topbar-settings:hover,
.app-study .topbar-settings:focus-visible,
.app-study .topnav a:hover {
  background: color-mix(in srgb, var(--atelier-accent, #c76b42) 8%, transparent);
  color: var(--atelier-accent-strong, #a94e31);
}

.app-study .topbar .btn {
  border-color: var(--atelier-line, #e7dccd);
  background: rgb(255 255 255 / 0.5);
  color: var(--atelier-ink, #2b2620);
}

.app-study .topnav a[aria-selected="true"] {
  background: color-mix(in srgb, var(--atelier-accent, #c76b42) 9%, transparent);
  color: var(--atelier-accent-strong, #a94e31);
}

.app-study .topnav a[aria-selected="true"]::after {
  background: var(--atelier-accent, #c76b42);
}

.app-study .topbar a:focus-visible,
.app-study .dashboard-panel a:focus-visible,
.app-study .dashboard-panel button:focus-visible,
.app-study .howto-fold summary:focus-visible {
  outline: 2px solid var(--atelier-focus, #276fe8);
  outline-offset: 3px;
}

.app-study .app-main-study {
  background: transparent;
}

.app-study .dashboard-panel > h2,
.app-study .dashboard-panel > .section-head h2 {
  color: var(--atelier-ink, #2b2620);
}

.app-study .section-head .btn {
  border-color: var(--atelier-line, #e7dccd);
  background: rgb(255 255 255 / 0.58);
  color: var(--atelier-ink, #2b2620);
}

.app-study .section-head .btn::before {
  content: none;
}

.app-study .upgrade-inline,
.app-study .dashboard-panel > .muted {
  color: var(--atelier-muted, #6f675d);
}

.app-study .sitefoot {
  border-color: var(--atelier-line, #e7dccd);
  color: var(--atelier-faint, #948b7f);
}

.app-study .sitefoot a {
  color: var(--atelier-muted, #6f675d);
}

/* Shelf and Me only receive a contrast compatibility layer. */
.app-study #shelf > .section-empty {
  border-color: var(--atelier-line, #e7dccd);
  background: var(--atelier-card, #fdf9ef);
  color: var(--atelier-muted, #6f675d);
  box-shadow: 0 18px 42px -34px rgb(var(--atelier-shadow-rgb, 78 59 40) / 0.24);
}

.app-study #me .me-panel {
  border-color: var(--atelier-line, #e7dccd);
  background:
    radial-gradient(60% 55% at 25% 0%, rgb(255 255 255 / 0.68), transparent 76%),
    var(--atelier-card, #fdf9ef);
  color: var(--atelier-ink, #2b2620);
  box-shadow: 0 18px 48px -36px rgb(var(--atelier-shadow-rgb, 78 59 40) / 0.24);
}

.app-study #me .me-section {
  border-color: var(--atelier-line, #e7dccd);
  background: rgb(255 255 255 / 0.38);
}

.app-study #me .library-card {
  background: color-mix(in srgb, var(--atelier-paper, #fbf5ea) 74%, #ead9c4 26%);
}

.app-study #me .me-section-header p,
.app-study #me .me-stat-label,
.app-study #me .me-placeholder > p {
  color: var(--atelier-muted, #6f675d);
}

.app-study .howto-fold summary {
  border-color: var(--atelier-line, #e7dccd);
  background: var(--atelier-card-highlight, #fefaf1);
  color: var(--atelier-muted, #6f675d);
}

#desk {
  color: var(--atelier-ink, #2b2620);
}

#desk .section-head {
  width: min(1060px, 100%);
  margin-inline: auto;
}

#desk .desk-atelier {
  position: relative;
  isolation: isolate;
  width: min(1060px, 100%);
  max-width: 100%;
  margin: 22px auto 0;
  overflow: hidden;
  border: 1px solid rgb(145 112 77 / 0.18);
  border-radius: 18px;
  background:
    radial-gradient(65% 44% at 24% -8%, rgb(255 255 255 / 0.76), transparent 72%),
    repeating-linear-gradient(91deg, rgb(109 81 51 / 0.016) 0 1px, transparent 1px 7px),
    var(--atelier-card, #fdf9ef);
  color: var(--atelier-ink, #2b2620);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.88),
    0 18px 48px -32px rgb(var(--atelier-shadow-rgb, 78 59 40) / 0.24);
}

/* desk-book.css premium geometry is intentionally activated only in this formal scope. */
#desk .desk-atelier.desk-atelier-preview {
  margin: 22px auto 0;
}

#desk .desk-feature {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  min-height: 500px;
  align-items: center;
  gap: 52px;
  padding: 28px;
  background:
    radial-gradient(58% 58% at 25% 3%, rgb(255 255 255 / 0.66), transparent 72%),
    linear-gradient(180deg, var(--atelier-card-highlight, #fefaf1), var(--atelier-card, #fdf9ef));
}

#desk .desk-feature-book {
  display: flex;
  min-width: 0;
  min-height: 100%;
  align-items: flex-end;
  justify-content: center;
  padding: 26px 20px 0;
}

#desk .desk-feature-book .atelier-book-hero {
  margin-bottom: -1px;
}

#desk .desk-action-panel {
  min-width: 0;
  max-width: 420px;
  padding: 24px 0;
  font-family: var(--font-ui);
}

#desk .desk-action-kicker {
  margin: 0 0 13px;
  color: var(--atelier-muted, #6f675d);
  font-size: 0.78rem;
  font-weight: 720;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

#desk .desk-action-kicker.is-turn {
  color: var(--atelier-accent-strong, #a94e31);
}

#desk .desk-action-panel h3 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--atelier-ink, #2b2620);
  font-family: var(--font-brand);
  font-size: clamp(2.25rem, 3.5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.18;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

#desk .desk-action-partner,
#desk .desk-action-page,
#desk .desk-action-desc {
  margin: 0;
  color: var(--atelier-muted, #6f675d);
}

#desk .desk-action-partner {
  margin-top: 17px;
  overflow-wrap: anywhere;
}

#desk .desk-action-page {
  margin-top: 5px;
  color: var(--atelier-faint, #948b7f);
  font-size: 0.86rem;
}

#desk .desk-action-desc {
  display: -webkit-box;
  margin-top: 19px;
  overflow: hidden;
  font-size: 0.96rem;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

#desk .desk-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 25px;
}

#desk .desk-action-buttons .btn {
  min-height: 44px;
  white-space: normal;
}

#desk .desk-copy-status {
  display: block;
  min-height: 1.4em;
  margin-top: 8px;
  color: var(--atelier-muted, #6f675d);
  font-size: 0.8rem;
}

#desk .desk-atelier-edge {
  height: 54px;
  border-top: 1px solid rgb(255 255 255 / 0.86);
  border-bottom: 1px solid rgb(134 90 51 / 0.2);
  background:
    repeating-linear-gradient(2deg, transparent 0 9px, rgb(149 101 61 / 0.035) 9px 10px),
    repeating-linear-gradient(96deg, transparent 0 72px, rgb(149 101 61 / 0.055) 72px 73px),
    linear-gradient(180deg,
      #fff4e2 0 5px,
      var(--atelier-wood-top, #f5e5ce) 5px 11px,
      var(--atelier-wood-face, #e8d1b3) 11px 50px,
      var(--atelier-wood-line, #cfa77d) 50px 54px);
  box-shadow: 0 14px 22px -18px rgb(var(--atelier-shadow-rgb, 78 59 40) / 0.3);
}

#desk .desk-recent {
  min-width: 0;
  padding: 24px 28px 28px;
  background:
    radial-gradient(56% 55% at 22% 0%, rgb(255 255 255 / 0.54), transparent 72%),
    var(--atelier-card, #fdf9ef);
}

#desk .desk-filmstrip-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

#desk .desk-filmstrip-head h3 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.2rem;
  font-weight: 520;
}

#desk .desk-filmstrip-shell {
  position: relative;
  min-width: 0;
}

#desk .desk-filmstrip {
  --film-card-width: 164px;
  display: flex;
  min-width: 0;
  align-items: flex-end;
  gap: 24px;
  margin: 0;
  padding: 14px 6px 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 6px;
  scroll-snap-type: x mandatory;
  scrollbar-color: rgb(122 103 72 / 0.38) transparent;
  scrollbar-width: thin;
  list-style: none;
  touch-action: pan-x pan-y;
}

#desk .desk-filmstrip-shell.has-overflow .desk-filmstrip {
  padding-inline: 52px;
  scroll-padding-inline: 52px;
}

#desk .desk-filmstrip-arrow {
  position: absolute;
  z-index: 5;
  top: 50%;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--atelier-line, #e7dccd) 72%, #8c6b4c 28%);
  border-radius: 999px;
  background: rgb(254 250 241 / 0.96);
  color: var(--atelier-ink, #2b2620);
  box-shadow: 0 8px 22px -13px rgb(var(--atelier-shadow-rgb, 78 59 40) / 0.42);
  cursor: pointer;
  transform: translateY(-50%);
}

#desk .desk-filmstrip-arrow[hidden] {
  display: none;
}

#desk .desk-filmstrip-prev { left: 3px; }
#desk .desk-filmstrip-next { right: 3px; }

#desk .desk-filmstrip-arrow svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#desk .desk-filmstrip-arrow:disabled {
  opacity: 0.34;
  cursor: default;
}

#desk .desk-filmstrip > li {
  flex: 0 0 var(--film-card-width);
  width: var(--film-card-width);
  padding-top: 4px;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

#desk .desk-filmstrip .atelier-book-mini {
  width: var(--film-card-width);
  max-width: 100%;
}

#desk .desk-filmstrip a:focus-visible,
#desk .desk-feature-book a:focus-visible,
#desk .desk-all-stories a:focus-visible {
  outline: 2px solid var(--atelier-focus, #276fe8);
  outline-offset: 3px;
}

#desk .desk-all-stories {
  margin: 0 0 0 auto;
  font-family: var(--font-ui);
}

#desk .desk-all-stories summary {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--atelier-accent-strong, #a94e31);
  cursor: pointer;
  font-weight: 650;
}

#desk .desk-all-stories > ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  width: 100%;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

#desk .desk-all-stories[open] {
  flex: 1 0 100%;
}

#desk .desk-all-stories li {
  min-width: 0;
}

#desk .desk-all-stories a {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  padding: 8px;
  border: 1px solid var(--atelier-line, #e7dccd);
  border-radius: 10px;
  background: rgb(255 255 255 / 0.38);
  color: inherit;
  text-decoration: none;
}

#desk .desk-story-swatch {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 44px;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--cover-spine) 55%, #fff);
  border-radius: 3px 6px 6px 3px;
  background: var(--cover-bg);
  color: var(--cover-ink);
}

#desk .desk-story-swatch .cover-icon {
  width: 21px;
  height: 21px;
}

#desk .desk-all-story-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

#desk .desk-all-story-copy strong,
#desk .desk-all-story-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#desk .desk-all-story-copy span {
  color: var(--atelier-muted, #6f675d);
  font-size: 0.78rem;
}

/* Phase 3 enhanced all-stories dialog; JavaScript moves the existing list. */
.desk-stories-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 48px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--atelier-line, #e7dccd);
  border-radius: 18px;
  background: var(--atelier-card-highlight, #fefaf1);
  color: var(--atelier-ink, #2b2620);
  box-shadow: 0 28px 80px -30px rgb(var(--atelier-shadow-rgb, 78 59 40) / 0.52);
}

.desk-stories-dialog::backdrop {
  background: rgb(43 38 32 / 0.44);
}

.desk-stories-dialog-card {
  display: grid;
  max-height: inherit;
  grid-template-rows: auto minmax(0, 1fr);
}

.desk-stories-dialog-head {
  position: relative;
  padding: 24px 72px 16px 24px;
  border-bottom: 1px solid var(--atelier-line, #e7dccd);
}

.desk-stories-dialog-head h2 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.55rem;
}

.desk-stories-dialog-head p {
  margin: 5px 0 0;
  color: var(--atelier-muted, #6f675d);
}

.desk-stories-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--atelier-line, #e7dccd);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.52);
  color: var(--atelier-ink, #2b2620);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.desk-stories-dialog-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding: 18px 24px 24px;
  overflow: auto;
  list-style: none;
}

.desk-stories-dialog-list li { min-width: 0; }

.desk-stories-dialog-list a {
  display: flex;
  min-width: 0;
  min-height: 60px;
  align-items: center;
  gap: 11px;
  padding: 8px;
  border: 1px solid var(--atelier-line, #e7dccd);
  border-radius: 10px;
  background: rgb(255 255 255 / 0.42);
  color: inherit;
  text-decoration: none;
}

.desk-stories-dialog a:focus-visible,
.desk-stories-dialog-close:focus-visible {
  outline: 2px solid var(--atelier-focus, #276fe8);
  outline-offset: 2px;
}

.desk-stories-dialog .desk-story-swatch {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 44px;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--cover-spine) 55%, #fff);
  border-radius: 3px 6px 6px 3px;
  background: var(--cover-bg);
  color: var(--cover-ink);
}

.desk-stories-dialog .desk-story-swatch .cover-icon {
  width: 21px;
  height: 21px;
}

.desk-stories-dialog .desk-all-story-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.desk-stories-dialog .desk-all-story-copy strong,
.desk-stories-dialog .desk-all-story-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desk-stories-dialog .desk-all-story-copy span {
  color: var(--atelier-muted, #6f675d);
  font-size: 0.78rem;
}

#desk .desk-atelier-empty {
  display: grid;
  min-height: min(440px, 52vh);
  place-items: center;
  padding: 36px 24px;
}

#desk .desk-atelier-empty .desk-empty {
  max-width: 560px;
  margin: 0;
  padding: 0;
  text-align: center;
}

#desk .desk-atelier-empty h3 {
  margin: 7px 0 12px;
  font-family: var(--font-brand);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
}

#desk .desk-atelier-empty p:not(.eyebrow) {
  margin: 0 auto;
  color: var(--atelier-muted, #6f675d);
  line-height: 1.7;
}

#desk .desk-empty-actions {
  justify-content: center;
  margin-top: 22px;
}

@media (max-width: 900px) {
  #desk .desk-atelier {
    border-radius: 16px;
  }

  #desk .desk-feature {
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: 410px;
    gap: 30px;
    padding: 22px;
  }

  #desk .desk-feature-book {
    padding-inline: 0;
  }

  #desk .desk-action-panel h3 {
    font-size: clamp(1.875rem, 4.2vw, 2.125rem);
  }

  #desk .desk-filmstrip {
    --film-card-width: 148px;
    gap: 18px;
  }
}

@media (max-width: 520px) {
  #desk .desk-atelier {
    margin-top: 14px;
    border-radius: 12px;
  }

  #desk .desk-feature {
    grid-template-columns: 132px minmax(0, 1fr);
    min-height: 264px;
    gap: 14px;
    padding: 12px;
  }

  #desk .desk-feature-book {
    min-height: 100%;
    padding: 0;
  }

  #desk .desk-action-panel {
    padding: 8px 0;
  }

  #desk .desk-action-kicker {
    margin-bottom: 7px;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
  }

  #desk .desk-action-panel h3 {
    font-size: clamp(1.375rem, 5.8vw, 1.625rem);
    line-height: 1.12;
  }

  #desk .desk-action-partner {
    display: -webkit-box;
    margin-top: 9px;
    overflow: hidden;
    font-size: 0.8rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #desk .desk-action-page {
    font-size: 0.75rem;
  }

  #desk .desk-action-desc {
    margin-top: 9px;
    font-size: 0.78rem;
    line-height: 1.42;
    -webkit-line-clamp: 3;
  }

  #desk .desk-action-buttons {
    display: grid;
    gap: 6px;
    margin-top: 12px;
  }

  #desk .desk-action-buttons .btn {
    width: 100%;
    min-height: 44px;
    padding-inline: 8px;
    font-size: 0.78rem;
  }

  #desk .desk-copy-status {
    font-size: 0.7rem;
  }

  #desk .desk-atelier-edge {
    height: 42px;
    background:
      repeating-linear-gradient(96deg, transparent 0 56px, rgb(149 101 61 / 0.055) 56px 57px),
      linear-gradient(180deg,
        #fff4e2 0 5px,
        var(--atelier-wood-top, #f5e5ce) 5px 10px,
        var(--atelier-wood-face, #e8d1b3) 10px 39px,
        var(--atelier-wood-line, #cfa77d) 39px 42px);
  }

  #desk .desk-recent {
    padding: 18px 12px 20px;
  }

  #desk .desk-filmstrip {
    --film-card-width: 126px;
    gap: 14px;
    /* 2px outline + 3px offset needs 5px clear space at both scroll edges. */
    padding-inline: 6px;
  }

  #desk .desk-filmstrip-shell.has-overflow .desk-filmstrip {
    padding-inline: 12px;
    scroll-padding-inline: 12px;
  }

  #desk .desk-all-stories > ul {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 400px) {
  #desk .desk-feature {
    grid-template-columns: 116px minmax(0, 1fr);
    min-height: 244px;
    gap: 12px;
  }

  #desk .desk-action-panel h3 {
    font-size: clamp(1.3125rem, 5.7vw, 1.5rem);
  }

  #desk .desk-action-page {
    display: none;
  }

  #desk .desk-filmstrip {
    --film-card-width: 118px;
    gap: 12px;
  }
}

@media (max-width: 360px) {
  #desk .desk-feature {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    gap: 16px;
  }

  #desk .desk-feature-book {
    min-height: 197px;
    justify-content: center;
  }

  #desk .desk-action-panel {
    width: 100%;
    max-width: none;
  }

  #desk .desk-action-panel h3 {
    font-size: 1.65rem;
  }

  #desk .desk-action-page {
    display: block;
  }

  #desk .desk-filmstrip {
    --film-card-width: 112px;
  }
}

@media (max-width: 600px) {
  .desk-stories-dialog {
    width: 100vw;
    max-width: none;
    max-height: min(78dvh, 680px);
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 18px 18px 0 0;
  }

  .desk-stories-dialog-list {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 14px max(20px, env(safe-area-inset-bottom));
  }

  .desk-stories-dialog-head {
    padding: 20px 66px 14px 16px;
  }
}

@media (hover: none), (pointer: coarse) {
  #desk .desk-filmstrip-arrow {
    display: none !important;
  }

  #desk .desk-filmstrip-shell.has-overflow .desk-filmstrip {
    padding-inline: 12px;
    scroll-padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #desk .desk-atelier .atelier-book,
  #desk .desk-atelier .desk-book-3d,
  #desk .desk-filmstrip {
    scroll-behavior: auto;
    animation: none !important;
    transition: none !important;
  }

  .desk-stories-dialog {
    scroll-behavior: auto;
  }
}

/* Desk scene v1 -----------------------------------------------------------
   The formal Desk now uses the approved D prototype's physical hierarchy:
   one maple desk, one continuous paper mat, and books as the only story
   actions. Details and invite utilities live inside the opened book. */
#desk .desk-atelier.desk-atelier-preview {
  padding: 28px;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background:
    linear-gradient(rgb(244 225 195 / 0.28), rgb(213 181 139 / 0.12)),
    url('/atelier-assets/v2/maple-desk-light.v2.webp') center / 768px auto repeat,
    #ddc39e;
  box-shadow:
    inset 0 1px rgb(255 255 255 / 0.46),
    0 22px 48px -34px rgb(78 55 35 / 0.32);
}

#desk .desk-work-mat {
  position: relative;
  display: grid;
  min-height: 486px;
  align-items: end;
  padding: 24px 28px 26px;
  border: 1px solid #e5d7c2;
  border-radius: 5px;
  background:
    linear-gradient(rgb(251 245 232 / 0.84), rgb(251 245 232 / 0.84)),
    url('/atelier-assets/v2/ivory-paper-fiber.v2.webp') center / 640px auto repeat,
    #fbf5e8;
  box-shadow:
    6px 10px 28px rgb(78 55 35 / 0.14),
    inset 0 1px rgb(255 255 255 / 0.72);
}

#desk .desk-work-mat.has-recent {
  grid-template-columns: minmax(390px, 0.88fr) minmax(0, 1.12fr);
  gap: 28px;
}

#desk .desk-feature {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  min-height: 434px;
  align-items: flex-end;
  justify-content: center;
  padding: 0 18px 30px;
  background: transparent;
}

#desk .desk-feature-book {
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

#desk .desk-feature-book .atelier-book-hero {
  --cw: 248px;
  --bh: 394px;
  --th: 34px;
  --tilt: 7deg;
  margin: 0;
}

#desk .desk-recent {
  position: relative;
  z-index: 2;
  min-width: 0;
  align-self: end;
  padding: 0 0 30px;
  background: transparent;
}

#desk .desk-filmstrip-head {
  margin: 0 0 18px 2px;
}

#desk .desk-filmstrip-head h3 {
  color: #5b4938;
  font-size: 1rem;
}

#desk .desk-filmstrip {
  --film-card-width: 148px;
  gap: 22px;
  padding: 6px;
  overflow-y: hidden;
  scroll-padding-inline: 6px;
}

#desk .desk-filmstrip .atelier-book-mini {
  --cw: 148px;
  --bh: 210px;
  --th: 18px;
}

#desk .desk-physical-ledge {
  z-index: 5;
  height: 12px;
  border: 1px solid rgb(124 76 37 / 0.24);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.58) 0 18%, transparent 18% 70%, rgb(106 61 29 / 0.10) 70%),
    url('/atelier-assets/v2/maple-desk-light.v2.webp') center / 768px auto repeat,
    #e8c697;
  box-shadow:
    0 6px 8px -7px rgb(70 42 20 / 0.70),
    inset 0 1px rgb(255 255 255 / 0.55);
  pointer-events: none;
}

#desk .desk-shared-ledge {
  position: absolute;
  right: 18px;
  bottom: 24px;
  left: 18px;
}

#desk .desk-hero-ledge,
#desk .desk-recent-ledge {
  display: none;
}

/* Printed cover composition: the title and illustration belong to the cloth,
   rather than appearing as a second floating UI card. */
#desk .desk-atelier .atelier-book .desk-book-cover {
  display: grid;
  align-content: center;
  gap: 0;
  overflow: hidden;
  border: 0;
}

#desk .desk-atelier .atelier-book-hero .desk-book-cover {
  grid-template-rows: 24px 10px 124px 12px 68px 10px 22px;
  padding: 22px 22px 28px;
}

#desk .desk-atelier .atelier-book-mini .desk-book-cover {
  grid-template-rows: 16px 4px 66px 5px 36px 5px minmax(15px, 16px);
  padding: 9px 9px 10px;
}

#desk .desk-atelier .atelier-book .cover-face-status {
  grid-row: 1;
  align-self: center;
  justify-self: start;
  height: 100%;
  margin: 0;
  padding: 0 6px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--cover-accent) 10%, transparent);
  box-shadow: none;
  font-size: 0.68rem;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#desk .desk-atelier .atelier-book-mini .cover-face-status {
  padding-inline: 5px;
  font-size: 0.58rem;
  line-height: 16px;
}

#desk .desk-atelier .atelier-book .cover-face-imprint,
#desk .desk-atelier .atelier-book.cover-layout-vertical .cover-face-imprint,
#desk .desk-atelier .atelier-book.cover-layout-embossed .cover-face-imprint {
  position: relative;
  grid-row: 3;
  align-self: center;
  justify-self: center;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 1;
}

#desk .desk-atelier .atelier-book .cover-face-imprint .cover-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(78%, 104px);
  height: min(78%, 104px);
  transform: translate(-50%, -50%);
}

#desk .desk-atelier .atelier-book-mini .cover-face-imprint .cover-icon {
  width: min(74%, 56px);
  height: min(74%, 56px);
}

#desk .desk-atelier .cover-face-raster {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 164px;
  max-width: none;
  height: 164px;
  object-fit: contain;
  transform: translate(calc(-50% + 3px), calc(-50% + 5px));
}

#desk .desk-atelier .atelier-book-mini .cover-face-raster {
  width: 96px;
  height: 96px;
  transform: translate(calc(-50% + 2px), calc(-50% + 3px));
}

#desk .desk-atelier .cover-face-imprint.raster-loaded .cover-icon {
  opacity: 0;
}

#desk .desk-atelier .atelier-book .cover-face-label,
#desk .desk-atelier .atelier-book.cover-layout-bookplate .cover-face-label,
#desk .desk-atelier .atelier-book.cover-layout-vertical .cover-face-label,
#desk .desk-atelier .atelier-book.cover-layout-embossed .cover-face-label {
  grid-row: 5;
  align-self: center;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

#desk .desk-atelier .atelier-book .cover-face-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 1.42rem;
  font-weight: 520;
  line-height: 1.28;
  overflow-wrap: anywhere;
  text-wrap: balance;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#desk .desk-atelier .atelier-book-mini .cover-face-title {
  font-size: 0.8125rem;
  line-height: 1.22;
}

#desk .desk-atelier .atelier-book .cover-face-meta,
#desk .desk-atelier .atelier-book.cover-layout-embossed .cover-face-meta {
  grid-row: 7;
  align-self: end;
  min-width: 0;
  height: 100%;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: left;
  opacity: 0.76;
}

#desk .desk-atelier .atelier-book-mini .cover-face-meta {
  font-size: 0.59375rem;
}

#desk .desk-atelier .atelier-book .desk-book-ribbon {
  height: calc(var(--bh) + 30px);
  pointer-events: none;
}

#desk .desk-atelier .atelier-book-mini .desk-book-ribbon {
  display: none;
}

@media (max-width: 760px) {
  #desk .desk-atelier.desk-atelier-preview {
    width: min(414px, calc(100% - 16px));
    margin-top: 14px;
    padding: 10px;
    border-radius: 18px;
  }

  #desk .desk-work-mat,
  #desk .desk-work-mat.has-recent {
    display: block;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border-radius: 8px 12px 10px 8px;
  }

  #desk .desk-feature {
    min-height: 0;
    padding: 28px 8px 27px;
  }

  #desk .desk-feature-book .atelier-book-hero {
    --cw: 188px;
    --bh: 299px;
    --th: 24px;
    --tilt: 4deg;
  }

  #desk .desk-recent {
    padding: 22px 0 25px;
  }

  #desk .desk-filmstrip-head {
    margin: 0 0 14px 14px;
  }

  #desk .desk-filmstrip {
    --film-card-width: 126px;
    gap: 12px;
    padding: 6px 14px;
    scroll-padding-inline: 14px;
  }

  #desk .desk-filmstrip .atelier-book-mini {
    --cw: 126px;
    --bh: 176px;
    --th: 16px;
  }

  #desk .desk-shared-ledge {
    display: none;
  }

  #desk .desk-hero-ledge,
  #desk .desk-recent-ledge {
    position: relative;
    display: block;
    margin: -6px 4px 0;
  }

  #desk .desk-recent-ledge {
    margin-top: -6px;
  }

  #desk .desk-atelier .atelier-book .desk-book-ribbon {
    height: calc(var(--bh) + 22px);
  }

  #desk .desk-atelier .atelier-book-hero .desk-book-cover {
    grid-template-rows: 20px 6px 124px 8px 62px 8px 20px;
    padding: 14px 14px 22px;
  }

  #desk .desk-atelier .atelier-book-hero .cover-face-title {
    min-height: 0;
    font-size: 1.19rem;
  }
}

@media (max-width: 410px) {
  #desk .desk-feature-book .atelier-book-hero {
    --cw: 176px;
    --bh: 280px;
    --th: 22px;
  }

  #desk .desk-filmstrip {
    --film-card-width: 118px;
    gap: 12px;
    padding-inline: 7px;
    scroll-padding-inline: 7px;
  }

  #desk .desk-filmstrip .atelier-book-mini {
    --cw: 118px;
    --bh: 166px;
    --th: 15px;
  }

  #desk .desk-atelier .atelier-book-hero .desk-book-cover {
    grid-template-rows: 20px 6px 124px 8px 58px 8px 20px;
  }

  #desk .desk-atelier .atelier-book-hero .cover-face-title {
    font-size: 1.125rem;
  }
}

@media (forced-colors: active) {
  #desk .desk-atelier,
  #desk .desk-feature,
  #desk .desk-recent,
  #desk .desk-atelier-edge {
    border-color: CanvasText;
    background: Canvas;
    box-shadow: none;
  }

  #desk .desk-story-swatch,
  #desk .desk-all-stories a,
  .desk-stories-dialog,
  .desk-stories-dialog-list a,
  .desk-stories-dialog-close {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
    box-shadow: none;
  }
}
