/* Archive Desk — heritage palette (owner brief, 11 Nov 2026). */
.fiji-archive-desk {
  --parch: #F3EFE6; --terra: #A84232; --brass: #C5A880; --teal: #2E5A54; --ink: #1E1E1C;
  --paper: #F3EFE6; --paper-edge: #E4DAC4; --fs: 17px;
  position: relative; isolation: isolate; overflow: hidden;
  min-height: calc(100vh - 80px); padding: 22px clamp(14px, 3vw, 40px) 30px;
  color: var(--ink); font-family: Manrope, system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 30% 0%, rgba(197,168,128,.35), transparent 60%),
    radial-gradient(900px 500px at 90% 100%, rgba(46,90,84,.25), transparent 60%),
    linear-gradient(180deg, #EAE2D2, #D9CCB2);
}
.fiji-archive-desk[data-light="sepia"] { --paper: #EBDCC0; --paper-edge: #D2BC93; }
.fiji-archive-desk *, .fiji-archive-desk *::before, .fiji-archive-desk *::after { box-sizing: border-box; }
.fiji-archive-desk button { font: inherit; cursor: pointer; }
.fiji-archive-desk :focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.fad-dust { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: .7; }

/* Top bar + HUD */
.fad-top { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: end; justify-content: space-between; }
.fad-eyebrow { margin: 0; font: 700 12px/1 Sora, sans-serif; letter-spacing: .18em; color: var(--terra); }
.fad-intro h1 { margin: 6px 0 0; font: 700 clamp(26px, 3.4vw, 42px)/1.05 Sora, sans-serif; letter-spacing: -.02em; }
.fad-intro h1 span { color: var(--teal); }
.fad-hud { display: flex; gap: 6px; padding: 6px; border-radius: 999px;
  background: rgba(243,239,230,.55); border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 10px 30px rgba(30,30,28,.15), inset 0 1px 0 #fff; backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); }
.fad-hud button { display: grid; text-align: left; border: 0; border-radius: 999px; padding: 9px 18px; background: transparent; color: var(--ink); transition: background .25s, color .25s; }
.fad-hud button b { font: 600 14px/1.1 Sora, sans-serif; }
.fad-hud button small { font-size: 11px; opacity: .7; }
.fad-hud button[aria-selected="true"] { background: var(--ink); color: var(--parch); box-shadow: 0 6px 16px rgba(30,30,28,.3); }
.fad-hud button[aria-selected="true"] small { color: var(--brass); opacity: 1; }

/* Thread chips */
.fad-threads { display: flex; gap: 8px; overflow-x: auto; padding: 16px 2px 6px; scrollbar-width: thin; }
.fad-threads button { flex: none; display: grid; gap: 2px; text-align: left; border: 1px solid rgba(30,30,28,.15); border-radius: 14px; padding: 8px 12px; background: rgba(243,239,230,.7); color: var(--ink); }
.fad-threads button small { font: 700 10px/1 Sora, sans-serif; letter-spacing: .08em; color: var(--terra); text-transform: uppercase; }
.fad-threads button span { font-size: 13px; font-weight: 600; white-space: nowrap; }
.fad-threads button[aria-current="true"] { background: var(--teal); color: var(--parch); border-color: var(--teal); }
.fad-threads button[aria-current="true"] small { color: var(--brass); }

/* Stage */
.fad-stage { position: relative; display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(16px, 3vw, 40px); align-items: center; margin-top: 14px; min-height: 560px; perspective: 1800px; }
.fad-bookzone, .fad-platezone { position: relative; min-width: 0; transform-style: preserve-3d; }
.fad-bookzone { z-index: 3; }
.fad-turn { position: relative; z-index: 6; }

/* Book */
.fad-cradle { perspective: 1800px; padding: 30px 0 46px; position: relative; }
.fad-cradle::after { /* archival cradle */ content: ""; position: absolute; left: 6%; right: 6%; bottom: 14px; height: 30px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(30,30,28,.45), transparent); filter: blur(4px); z-index: -1; }
.fad-book { --tilt: 15deg; position: relative; display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 1.45; max-height: 520px; margin: 0 auto;
  transform-style: preserve-3d; transform: rotateX(var(--tilt)) rotateZ(-1deg); transition: transform .6s; }
.fad-page { position: relative; overflow: hidden; padding: clamp(16px, 2.6vw, 34px); background: var(--paper);
  box-shadow: inset 0 0 40px rgba(122,96,52,.18); backface-visibility: hidden; }
.fad-page--left { border-radius: 10px 2px 2px 10px; background-image: linear-gradient(90deg, var(--paper-edge) 0, var(--paper) 6%, var(--paper) 86%, rgba(30,30,28,.18) 100%); }
.fad-page--right { border-radius: 2px 10px 10px 2px; background-image: linear-gradient(270deg, var(--paper-edge) 0, var(--paper) 6%, var(--paper) 86%, rgba(30,30,28,.2) 100%); }
.fad-book::before { /* page block + cloth cover */ content: ""; position: absolute; inset: -10px -12px -14px; border-radius: 14px; z-index: -1;
  background: linear-gradient(180deg, #b44c3a, var(--terra) 40%, #7d2f23); box-shadow: 0 30px 60px rgba(30,30,28,.35), 0 0 0 2px rgba(197,168,128,.5) inset; transform: translateZ(-6px); }
.fad-spine { position: absolute; top: 0; bottom: 0; left: 50%; width: 60px; margin-left: -30px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(30,30,28,.28) 45%, rgba(30,30,28,.38) 50%, rgba(30,30,28,.28) 55%, transparent); transform: translateZ(1px); }
.fad-leaf { position: absolute; top: 0; bottom: 0; left: 50%; width: 50%; transform-origin: left center; transform-style: preserve-3d; z-index: 5; }
.fad-leaf > .fad-page { position: absolute; inset: 0; display: block !important; border-radius: 2px 10px 10px 2px; }
.fad-leaf > .fad-page--back { transform: rotateY(180deg); }

.fad-kicker { margin: 0 0 6px; font: 700 11px/1.2 Sora, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--terra); }
.fad-page h2 { margin: 0 0 12px; font: 700 clamp(18px, 1.9vw, 26px)/1.15 Sora, sans-serif; color: var(--ink); }
.fad-text p { margin: 0 0 .8em; font-size: var(--fs); line-height: 1.6; color: #2a2926; }
.fad-text { max-height: 100%; overflow: auto; padding-right: 4px; scrollbar-width: thin; }
.fad-pageno { position: absolute; bottom: 10px; right: 18px; font: 600 11px Sora, sans-serif; color: rgba(30,30,28,.5); }
.fad-page--left .fad-pageno { left: 18px; right: auto; }
.fad-badge { display: inline-flex; align-items: center; gap: 4px; margin: 2px 6px 6px 0; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--brass);
  background: rgba(197,168,128,.18); color: var(--teal); font: 600 12px Sora, sans-serif; }
.fad-badge:hover { background: var(--brass); color: var(--ink); }
.fad-more { display: inline-block; margin-top: 4px; color: var(--teal); font-weight: 700; font-size: 13px; }

/* Left page = facing plate */
.fad-facing { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 10px; }
.fad-facing figure { margin: 0; display: grid; place-items: center; min-height: 0; border: 1px solid var(--brass); padding: 8px; background: rgba(255,255,255,.35); cursor: zoom-in; }
.fad-facing img { max-width: 100%; max-height: 100%; object-fit: contain; filter: sepia(.15) contrast(1.03); }
.fad-facing figcaption { font-size: 12.5px; line-height: 1.4; color: #4a463e; }

/* Turn controls */
.fad-turn { display: flex; align-items: center; justify-content: center; gap: 14px; }
.fad-turn button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(30,30,28,.2); background: var(--parch); color: var(--ink); font-size: 24px; line-height: 1; box-shadow: 0 4px 12px rgba(30,30,28,.15); }
.fad-turn button:disabled { opacity: .35; cursor: default; }
.fad-folio { font: 600 13px Sora, sans-serif; min-width: 9em; text-align: center; }

/* Reading tools (Read mode only) */
.fad-readtools { display: none; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 4px; }
.fad-seg { display: inline-flex; border-radius: 999px; padding: 3px; background: rgba(243,239,230,.7); border: 1px solid rgba(30,30,28,.12); }
.fad-seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink); }
.fad-seg button[aria-pressed="true"] { background: var(--teal); color: var(--parch); }

/* Manuscript (continuous scroll) */
.fad-manuscript { max-width: 760px; margin: 0 auto; max-height: 70vh; overflow: auto; padding: clamp(20px, 4vw, 48px); border-radius: 12px;
  background: var(--paper); box-shadow: 0 30px 60px rgba(30,30,28,.25), inset 0 0 50px rgba(122,96,52,.15); }
.fad-manuscript article { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid rgba(197,168,128,.6); scroll-margin-top: 10px; }
.fad-manuscript article:last-child { border: 0; }
.fad-manuscript article.is-current h2 { color: var(--terra); }

/* Photo stack */
.fad-stack { position: relative; height: min(520px, 62vh); transform-style: preserve-3d; }
.fad-plate { position: absolute; left: 50%; top: 50%; width: min(78%, 380px); margin: 0; padding: 10px 10px 34px; border: 0; background: #fbf8f1; text-align: left;
  border-radius: 4px; box-shadow: 0 20px 40px rgba(30,30,28,.3), 0 0 0 1px rgba(30,30,28,.06); transform-style: preserve-3d; will-change: transform; color: var(--ink); }
.fad-plate::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--accent, var(--brass)); }
.fad-plate img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e8e0cf; filter: sepia(.12); }
.fad-plate span { position: absolute; left: 12px; right: 12px; bottom: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fad-plate.is-linked::after { content: "On this page"; position: absolute; top: 16px; right: 16px; padding: 3px 8px; border-radius: 999px; background: var(--terra); color: var(--parch); font: 700 10px Sora, sans-serif; letter-spacing: .06em; }

/* Lightbox (Watch mode) */
.fad-lightbox { display: grid; gap: 14px; }
.fad-inspect { margin: 0; display: grid; gap: 8px; }
.fad-inspect__frame { position: relative; overflow: hidden; height: min(52vh, 520px); border-radius: 6px; background: #1E1E1C; box-shadow: 0 30px 60px rgba(30,30,28,.4), 0 0 0 6px #fbf8f1, 0 0 0 7px var(--brass); }
.fad-inspect__frame img { width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 50%; }
.fad-inspect figcaption { font-size: 14px; line-height: 1.45; }
.fad-inspect figcaption small { display: block; margin-top: 2px; color: #5b564c; font-size: 12px; }
.fad-inspect figcaption a { color: var(--teal); font-weight: 700; }
.fad-loupe { position: absolute; width: 180px; height: 180px; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%);
  border: 4px solid var(--brass); box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 20px rgba(0,0,0,.35); background-repeat: no-repeat; background-color: #1E1E1C; }
.fad-inspect__frame.is-loupe { cursor: none; }
.fad-ring { position: relative; height: 130px; perspective: 900px; }
.fad-ring__inner { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.fad-ring button { position: absolute; width: 120px; height: 90px; margin: -45px 0 0 -60px; padding: 0; border: 2px solid #fbf8f1; border-radius: 4px; overflow: hidden; background: #ccc; box-shadow: 0 8px 18px rgba(30,30,28,.35); }
.fad-ring button img { width: 100%; height: 100%; object-fit: cover; }
.fad-ring button[aria-current="true"] { border-color: var(--terra); }
.fad-lighttools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.fad-lighttools button { border: 1px solid rgba(30,30,28,.2); border-radius: 999px; padding: 8px 16px; background: var(--parch); color: var(--ink); font-weight: 700; font-size: 13px; }
.fad-lighttools button[aria-pressed="true"] { background: var(--ink); color: var(--parch); }
.fad-subtitle { min-height: 2.8em; margin: 0; text-align: center; font-size: 15px; font-style: italic; color: #34322d; }

/* Floating side card */
.fad-sidecard { position: fixed; right: clamp(10px, 3vw, 40px); top: 50%; z-index: 40; width: min(360px, 88vw); padding: 12px 12px 14px; background: #fbf8f1; border-radius: 6px;
  box-shadow: 0 30px 70px rgba(30,30,28,.45), 0 0 0 1px var(--brass); transform: translateY(-50%) rotateY(-8deg); transform-origin: right center; }
.fad-sidecard img { width: 100%; max-height: 50vh; object-fit: contain; background: #e8e0cf; }
.fad-sidecard p { margin: 8px 0 2px; font-size: 14px; font-weight: 600; }
.fad-sidecard small { font-size: 12px; color: #5b564c; }
.fad-sidecard__close { position: absolute; top: -12px; right: -12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--ink); color: var(--parch); font-size: 20px; }

.fad-sources { margin-top: 18px; font-size: 13px; color: #3c3a35; text-align: center; }
.fad-sources a { color: var(--teal); font-weight: 700; }
.fad-sources .fad-review { display: block; margin-top: 4px; font-size: 12px; color: #6a6458; }
.fad-noscript { text-align: center; padding: 30px; }

/* ===== Modes ===== */
/* Watch: book tucks into a bottom story drawer */
.fiji-archive-desk[data-mode="watch"] .fad-stage { grid-template-columns: 1fr; }
.fiji-archive-desk[data-mode="watch"] .fad-platezone { order: 1; max-width: 980px; width: 100%; margin: 0 auto; }
.fiji-archive-desk[data-mode="watch"] .fad-stack { display: none; }
.fiji-archive-desk[data-mode="watch"] .fad-bookzone { order: 2; position: sticky; bottom: 0; z-index: 10; max-width: 760px; width: 100%; margin: 0 auto;
  padding: 10px 16px; border-radius: 18px 18px 0 0; background: rgba(243,239,230,.8); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 -10px 30px rgba(30,30,28,.2); }
.fiji-archive-desk[data-mode="watch"] .fad-cradle { padding: 0; }
.fiji-archive-desk[data-mode="watch"] .fad-book { aspect-ratio: auto; max-height: none; grid-template-columns: 1fr; transform: none; }
.fiji-archive-desk[data-mode="watch"] .fad-book::before, .fiji-archive-desk[data-mode="watch"] .fad-spine, .fiji-archive-desk[data-mode="watch"] .fad-page--left { display: none; }
.fiji-archive-desk[data-mode="watch"] .fad-page--right { background: transparent; box-shadow: none; padding: 4px 4px 0; max-height: 96px; }
.fiji-archive-desk[data-mode="watch"] .fad-page--right .fad-text p:not(:first-child), .fiji-archive-desk[data-mode="watch"] .fad-pageno, .fiji-archive-desk[data-mode="watch"] .fad-badges { display: none; }
.fiji-archive-desk[data-mode="watch"] .fad-page--right h2 { font-size: 17px; margin-bottom: 4px; }
.fiji-archive-desk[data-mode="watch"] .fad-text p { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fiji-archive-desk:not([data-mode="watch"]) .fad-lightbox { display: none; }
/* Read: centred book, plates hidden (summoned as side cards) */
.fiji-archive-desk[data-mode="read"] .fad-stage { grid-template-columns: 1fr; }
.fiji-archive-desk[data-mode="read"] .fad-platezone { display: none; }
.fiji-archive-desk[data-mode="read"] .fad-bookzone { max-width: 1000px; width: 100%; margin: 0 auto; }
.fiji-archive-desk[data-mode="read"] .fad-readtools { display: flex; }
.fiji-archive-desk[data-mode="read"] .fad-book { --tilt: 6deg; }
.fiji-archive-desk[data-mode="read"][data-view="scroll"] .fad-cradle { display: none; }

/* Phones */
@media (max-width: 860px) {
  .fad-stage { grid-template-columns: 1fr; min-height: 0; }
  .fad-hud { width: 100%; justify-content: space-between; }
  .fad-hud button { padding: 8px 10px; flex: 1; }
  .fad-hud button small { display: none; }
  .fad-book { grid-template-columns: 1fr; aspect-ratio: auto; --tilt: 8deg; }
  .fad-page--left { display: none; }
  .fad-page--right { min-height: 340px; border-radius: 10px; }
  .fad-leaf { left: 0; width: 100%; }
  .fad-spine { display: none; }
  .fad-stack { height: 360px; margin-top: 40px; }
  .fad-platezone { z-index: 1; }
  .fad-inspect__frame { height: 46vh; }
  .fad-loupe { width: 130px; height: 130px; }
  .fad-sidecard { top: auto; bottom: 12px; right: 50%; transform: translateX(50%); }
}
@media (prefers-reduced-motion: reduce) {
  .fad-book, .fad-hud button { transition: none; }
}
