/* =====================================================================
   DRAFTING-ROOM INTRO
   The overlay is a blueprint "drafting table" that sits ABOVE the hero
   text but BELOW the 3D book (#dossierBook), so it can fade away behind
   the book while the book glides to its hero slot.
   Every cover variable below defaults to its finished value (1 / 0), so
   when no intro runs the book renders exactly as before.
   ===================================================================== */

/* ---- Cover layers driven by the intro (--fill, --detail, --ink ...) ---- */
.db-cover{background:none;box-shadow:none;isolation:isolate}
.db-cover__bg{
  position:absolute;inset:0;z-index:-1;border-radius:inherit;pointer-events:none;
  opacity:var(--fill,1);
  background:
    linear-gradient(90deg,rgba(0,0,0,.42),rgba(255,255,255,.07) 3.2%,rgba(0,0,0,.12) 5.5%,transparent 8%),
    repeating-linear-gradient(135deg,rgba(255,255,255,.022) 0 2px,transparent 2px 5px),
    radial-gradient(ellipse 90% 60% at 25% 0%,rgba(120,147,172,.3),transparent 65%),
    var(--navy-blueprint);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.06),inset -2px 0 0 rgba(0,0,0,.25);
}
.db-cover::before,.db-cover::after{opacity:var(--fill,1)}
.db-cover > .ds-cover__eyebrow,.db-cover > .ds-cover__sub,.db-cover > .ds-cover__fig,.db-cover > .ds-cover__block{opacity:var(--detail,1)}
.db-cover > .ds-cover__rule{opacity:var(--detail,1);transform:scaleX(var(--rule,1));transform-origin:0 50%}

/* Title: outline strokes first (--ink 0), then solid ink (--ink 1) */
.ds-cover__titles{position:relative;display:block;opacity:var(--detail,1)}
.ds-cover__title{
  color:color-mix(in srgb,#F4EFE4 calc(var(--ink,1) * 100%),transparent);
  -webkit-text-stroke:calc((1 - var(--ink,1)) * .7px) rgba(232,223,207,.9);
}
.ds-cover__title em{color:color-mix(in srgb,var(--gold-light) calc(var(--ink,1) * 100%),transparent)}

/* Plate drawings on the cover draw themselves in (--plate 0 -> 1) */
.db-plate-draw{stroke-dasharray:1;stroke-dashoffset:calc(1 - var(--plate,1))}

/* One lighting pass across the cover while it binds */
.db-cover__sheen{
  position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(105deg,transparent 32%,rgba(255,255,255,.22) 47%,rgba(255,255,255,.06) 54%,transparent 68%);
  transform:translateX(calc(var(--sheen,0) * 160% - 80%));
  opacity:var(--sheen-on,0);
}

/* While the plate is still a wireframe, only the cover exists */
html.dr-intro-run .db-book:not(.dr-solid) :is(.db-leaf:not(.db-leaf--cover),.db-backcover,.db-block,.db-spine,.db-shadow,.db-leaf--cover .db-edge){visibility:hidden}

/* Before the script's first frame the cover is "not yet drafted" */
html.dr-intro-run .db-book{--detail:0;--plate:0;--ink:0;--fill:0;--rule:0}

/* ---- Layering + hero hand-off ---- */
html.dr-intro-run .ds-scene{z-index:4}
html.dr-intro-run :is(.ds-eyebrow,.ds-title,.ds-role,.ds-lede,.ds-actions,.ds-specs,.ds-footnote){clip-path:inset(0 0 100% 0)}
html.dr-intro-run .ds-intro,html.dr-intro-done .ds-intro{animation:none}
html.dr-intro-run .theme-toggle-fixed{opacity:0;pointer-events:none}
html.dr-intro-run body{overflow:hidden}

/* ---- The drafting table ---- */
.dr-intro{display:none}
html.dr-intro-run .dr-intro{
  display:block;position:fixed;inset:0;z-index:3;pointer-events:none;overflow:hidden;
  color:#D6E2EF;font-family:var(--font-mono);
  /* Same 32/160px grid and origin as the hero desk (.ds-desk is inset -4%) */
  background:
    radial-gradient(ellipse 52% 48% at 50% 48%,rgba(108,160,214,.32),transparent 72%),
    radial-gradient(ellipse 120% 95% at 50% 50%,transparent 55%,rgba(5,16,32,.45) 100%),
    linear-gradient(rgba(214,226,239,.15) 1px,transparent 1px) -4vw -4vh / 160px 160px,
    linear-gradient(90deg,rgba(214,226,239,.15) 1px,transparent 1px) -4vw -4vh / 160px 160px,
    linear-gradient(rgba(214,226,239,.065) 1px,transparent 1px) -4vw -4vh / 32px 32px,
    linear-gradient(90deg,rgba(214,226,239,.065) 1px,transparent 1px) -4vw -4vh / 32px 32px,
    #1B416C;
}
.dr-construct{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.dr-construct .dr-line{fill:none;stroke:rgba(222,232,243,.78);stroke-width:1;stroke-dasharray:1;stroke-dashoffset:1;vector-effect:non-scaling-stroke}
.dr-construct .dr-line--soft{stroke:rgba(222,232,243,.45)}
.dr-construct .dr-line--gold{stroke:#C9A86A}
.dr-construct .dr-dot{fill:#DDBF85}
.dr-construct text{fill:rgba(222,232,243,.85);font:500 11px var(--font-mono);letter-spacing:.12em}
.dr-construct .dr-plate{fill:#DDBF85;font-size:10px;letter-spacing:.2em;text-transform:uppercase}

.dr-crop{position:absolute;width:22px;height:22px;border:0 solid rgba(222,232,243,.6)}
.dr-crop--tl{top:calc(env(safe-area-inset-top,0px) + 18px);left:calc(env(safe-area-inset-left,0px) + 18px);border-top-width:1.5px;border-left-width:1.5px}
.dr-crop--tr{top:calc(env(safe-area-inset-top,0px) + 18px);right:calc(env(safe-area-inset-right,0px) + 18px);border-top-width:1.5px;border-right-width:1.5px}
.dr-crop--bl{bottom:calc(env(safe-area-inset-bottom,0px) + 18px);left:calc(env(safe-area-inset-left,0px) + 18px);border-bottom-width:1.5px;border-left-width:1.5px}
.dr-crop--br{bottom:calc(env(safe-area-inset-bottom,0px) + 18px);right:calc(env(safe-area-inset-right,0px) + 18px);border-bottom-width:1.5px;border-right-width:1.5px}

.dr-head{
  position:absolute;top:calc(env(safe-area-inset-top,0px) + 22px);left:0;right:0;
  display:flex;justify-content:center;align-items:center;gap:.7rem;
  font-size:.62rem;font-weight:600;letter-spacing:.3em;text-transform:uppercase;color:#E6EEF6;
}
.dr-head i{width:4px;height:4px;border-radius:50%;background:#DDBF85}
.dr-progress{
  position:absolute;left:50%;bottom:calc(env(safe-area-inset-bottom,0px) + 34px);
  width:min(380px,calc(100vw - 48px));transform:translateX(-50%);
}
.dr-progress__row{display:flex;justify-content:space-between;font-size:.64rem;font-weight:600;letter-spacing:.24em;text-transform:uppercase;color:#E6EEF6}
.dr-progress__bar{height:2px;margin:.6rem 0 .75rem;background:rgba(222,232,243,.18);overflow:hidden}
.dr-progress__bar i{display:block;height:100%;background:#DDBF85;transform-origin:0 50%;transform:scaleX(0)}
.dr-status{display:flex;justify-content:center;align-items:center;gap:.55rem;font-size:.6rem;letter-spacing:.24em;text-transform:uppercase;color:rgba(222,232,243,.8)}
.dr-status i{width:6px;height:6px;border-radius:50%;background:#DDBF85}

/* ---- Controls ---- */
.dr-skip{display:none}
html.dr-intro-run .dr-skip{
  display:inline-flex;align-items:center;gap:.4rem;position:fixed;z-index:6;
  top:calc(env(safe-area-inset-top,0px) + 14px);right:calc(env(safe-area-inset-right,0px) + 52px);
  min-height:36px;padding:0 .9rem;border:1px solid rgba(222,232,243,.35);border-radius:999px;
  background:rgba(13,33,61,.55);color:#E6EEF6;cursor:pointer;
  font:600 .58rem var(--font-mono);letter-spacing:.2em;text-transform:uppercase;
}
.dr-skip span{font-family:var(--font-body);letter-spacing:0}
.dr-skip:hover{border-color:#DDBF85;color:#DDBF85}
.dr-skip:focus-visible{outline:2px solid #DDBF85;outline-offset:3px}

.ds-replay{
  position:absolute;z-index:2;left:50%;bottom:calc(4% + 16px);transform:translateX(-50%);
  display:inline-flex;align-items:center;gap:.4rem;min-height:32px;padding:0 .8rem;
  border:0;border-radius:999px;background:transparent;cursor:pointer;
  font:600 .54rem var(--font-mono);letter-spacing:.2em;text-transform:uppercase;color:var(--st-soft);
  transition:color .2s ease,opacity .3s ease;
}
.ds-replay span{font-family:var(--font-body);font-size:.9rem;letter-spacing:0}
.ds-replay:hover{color:var(--st-link)}
.ds-replay:focus-visible{outline:2px solid var(--st-focus);outline-offset:2px}
html.dr-intro-run .ds-replay,html.dossier-open .ds-replay{opacity:0;pointer-events:none}
html[data-dossier-mode="notebook"] .ds-replay{
  left:calc(env(safe-area-inset-left,0px) + 10px);bottom:auto;top:calc(env(safe-area-inset-top,0px) + 8px);transform:none;min-height:40px;
}

@media (max-width:600px){
  .dr-head{font-size:.5rem;letter-spacing:.22em}
  .dr-progress__row,.dr-status{font-size:.52rem}
  html.dr-intro-run .dr-skip{top:calc(env(safe-area-inset-top,0px) + 46px);right:calc(env(safe-area-inset-right,0px) + 14px);min-height:32px}
}

/* Reduced motion: no intro, the hero simply fades in */
@media (prefers-reduced-motion:reduce){
  html.dossier-closed .dossier-stage{animation:dr-fade .4s ease both!important}
}
@keyframes dr-fade{from{opacity:0}to{opacity:1}}
