* { box-sizing: border-box; }
:root {
  --paper: #e7d8b8;
  --paper-deep: #cfb889;
  --ink: #3b2f21;
  --muted: #66543f;
  --fox: #cf6f2f;
  --rust: #96543f;
  --olive: #66713f;
  --blue: #4c6378;
  --card: rgba(240, 226, 194, .94);
  --line: rgba(86, 68, 44, .28);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
html, body { background: var(--paper); }
body { margin: 0; min-height: 900vh; color: var(--ink); font-family: Georgia, "Times New Roman", serif; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-underline-offset: .25em; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
#world, #ship3d { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#world { background: var(--paper); z-index: 1; }
#ship3d { background: transparent; pointer-events: none; z-index: 2; }
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; padding: clamp(18px, 3vw, 38px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 16px; }
.hud-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.identity { max-width: min(690px, 75vw); }
.eyebrow, .kicker { margin: 0 0 8px; font: 700 .75rem/1.45 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--rust); }
h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.375rem); line-height: 1.05; font-weight: 700; letter-spacing: -.035em; }
.subtitle { margin: 11px 0 0; max-width: 65ch; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.identity-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 20px; }
.identity, .identity-actions > *, .detail, .waypoint-nav, .chapter button { pointer-events: auto; }
.button-primary { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 11px 17px; border: 1px solid var(--ink); border-radius: 3px; background: var(--ink); color: #f8edd7; text-decoration: none; font: 700 .875rem/1.4 var(--mono); }
.button-primary:hover { background: #59402b; }
.text-link { display: inline-block; padding: 4px 0; border: 0; background: transparent; color: var(--ink); font: 600 .875rem/1.55 var(--mono); text-align: left; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .3em; }
.text-link:hover { color: var(--rust); }
.telemetry { min-width: 115px; padding: 8px 10px; text-align: right; color: var(--muted); font: 700 .75rem/1.75 var(--mono); border-right: 1px solid var(--line); background: linear-gradient(90deg, transparent, rgba(255, 248, 227, .22)); }
.telemetry strong { color: var(--ink); }
.detail { position: relative; align-self: center; justify-self: end; width: min(420px, 36vw); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 22px 24px; border: 0; border-radius: 24px; background: transparent; transform: rotate(-.45deg); scrollbar-color: var(--rust) transparent; scrollbar-width: thin; }
.detail-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.detail-heading .kicker { margin: 0; }
.detail-rule { flex: 1; min-width: 16px; height: 1px; background: var(--line); }
.detail h2 { margin: 0; font-size: clamp(1.4rem, 2.1vw, 1.875rem); line-height: 1.12; letter-spacing: -.025em; }
.detail p { margin: 13px 0 0; color: #594a36; font-size: 1rem; line-height: 1.5; }
.detail .detail-proof { padding-top: 13px; border-top: 1px solid var(--line); color: var(--ink); }
.detail-action { margin-top: 15px; min-height: 44px; }
.detail .waypoint-status { font: .75rem/1.45 var(--mono); color: var(--muted); margin-top: 13px; }
.hud-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.journey-controls { min-width: 0; }
.hint { margin: 0 0 12px; color: var(--muted); font-size: .875rem; line-height: 1.45; }
.hint b { color: var(--ink); }
.waypoint-nav { display: flex; flex-wrap: wrap; gap: 6px; max-width: 760px; }
.waypoint-nav button { min-height: 46px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; background: rgba(240, 226, 194, .92); font: 600 .875rem/1.35 var(--mono); }
.waypoint-nav button span { font-size: .75rem; color: var(--rust); }
.waypoint-nav button:hover { background: #f4e6c9; border-color: var(--rust); }
.waypoint-nav button[aria-current="step"] { background: var(--ink); color: #f8edd7; border-color: var(--ink); }
.waypoint-nav button[aria-current="step"] span { color: #f0b483; }
.chapter { text-align: right; flex-shrink: 0; max-width: 260px; }
.chapter .kicker { display: block; margin-bottom: 3px; }
.chapter .name { display: block; font-size: clamp(1.125rem, 2vw, 1.5rem); font-weight: 700; }
.chapter .text-link { margin-top: 5px; font-size: .75rem; }
dialog { width: min(980px, calc(100% - 48px)); max-width: none; max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 1px solid #9b7b50; border-radius: 4px; background: #f3e7cf; color: var(--ink); box-shadow: 0 25px 100px rgba(42, 29, 17, .3); overscroll-behavior: contain; scrollbar-color: var(--rust) transparent; }
dialog::backdrop { background: rgba(48, 37, 24, .48); }
body.reading-brief { overflow: hidden; }
.brief-toolbar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 26px; border-bottom: 1px solid var(--line); background: #ecddbd; }
.brief-toolbar .eyebrow { margin: 0; font-size: .75rem; }
.brief-toolbar form { flex-shrink: 0; }
.close-button { min-height: 44px; display: flex; align-items: center; gap: 16px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 3px; background: transparent; font: 600 .875rem/1.4 var(--mono); }
.close-button:hover { background: #f3e7cf; }
.close-button span { font: 1.5rem/1 Georgia, serif; }
.brief-content { padding: clamp(24px, 6vw, 70px); padding-top: 50px; }
.brief-content p { max-width: 70ch; font-size: 1.0625rem; line-height: 1.75; }
.brief-intro h2 { margin: 20px 0 24px; font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.02; letter-spacing: -.045em; }
.brief-intro .brief-lead { font-size: clamp(1.25rem, 2.4vw, 1.5rem); line-height: 1.5; color: var(--rust); }
.experience-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 36px; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.experience-strip strong { display: block; font-size: 1.1875rem; line-height: 1.4; }
.experience-strip span { display: block; margin-top: 6px; font: .8125rem/1.6 var(--mono); color: var(--muted); }
.brief-section { margin-top: 56px; padding-top: 34px; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.brief-section:focus, #briefTitle:focus { outline: none; }
.brief-section h3, .brief-contact h3 { margin: 12px 0 16px; max-width: 24ch; font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.025em; line-height: 1.15; }
.brief-section .section-deck { margin-top: -2px; font-size: 1.1875rem; color: var(--rust); }
.case-study { margin: 24px 0; }
.case-study > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; padding: 17px 0; border-top: 1px solid var(--line); }
.case-study dt { padding-top: 3px; font: 700 .8125rem/1.55 var(--mono); color: var(--rust); }
.case-study dd { margin: 0; font-size: 1.0625rem; line-height: 1.7; }
.brief-section .margin-note { padding-left: 17px; border-left: 2px solid var(--rust); font-size: .9375rem; color: var(--muted); }
.source-links { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
blockquote { margin: 30px 0; padding: 18px 0 18px 24px; border-left: 3px solid var(--fox); font-size: 1.5rem; line-height: 1.5; font-style: italic; }
blockquote cite { display: block; margin-top: 15px; font: .8125rem/1.5 var(--mono); color: var(--muted); }
.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
.principles h4 { font-size: 1.125rem; line-height: 1.4; margin: 0; }
.principles p { font-size: 1rem; margin-bottom: 0; }
.method-list { margin: 25px 0 0; padding-left: 26px; }
.method-list li { padding: 0 0 22px 12px; font-size: 1.0625rem; line-height: 1.6; }
.method-list li::marker { color: var(--rust); font: 700 .875rem var(--mono); }
.method-list strong, .method-list span { display: block; }
.method-list span { color: var(--muted); margin-top: 3px; }
.role-fit { border-top: 3px solid var(--rust); }
.role-fit .source-date { font: .75rem/1.7 var(--mono); color: var(--muted); }
.brief-contact { margin-top: 56px; padding-top: 34px; border-top: 1px solid var(--line); }
.script-notice { position: fixed; bottom: 0; z-index: 10; padding: 18px; background: #f3e7cf; font-size: 1rem; }
@media (max-width: 900px) {
  #hud { padding: 20px; gap: 12px; }
  .identity { max-width: 78vw; }
  .detail { width: min(420px, 46vw); padding: 18px 20px; }
  .waypoint-nav { max-width: 540px; }
  .chapter { max-width: 180px; }
}
@media (max-width: 600px) {
  #hud { padding: 16px; gap: 14px; }
  .hud-top { gap: 8px; }
  .identity { max-width: none; min-width: 0; }
  .identity .eyebrow { font-size: .75rem; letter-spacing: .035em; }
  h1 { font-size: 2rem; }
  .subtitle { font-size: 1rem; line-height: 1.4; }
  .identity-actions { gap: 8px 14px; margin-top: 13px; }
  .telemetry { min-width: 54px; padding: 4px; font-size: .75rem; }
  .detail { width: min(100%, 420px); align-self: start; padding: 16px 18px; transform: none; }
  .detail h2 { font-size: 1.375rem; }
  .detail p { margin-top: 10px; }
  .detail-heading { margin-bottom: 10px; }
  .detail-action { margin-top: 8px; }
  .hud-bottom { flex-direction: column-reverse; align-items: stretch; gap: 9px; }
  .chapter { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 10px; max-width: none; text-align: left; }
  .chapter .kicker { margin: 0; }
  .chapter .name { font-size: 1rem; }
  .chapter .text-link { margin: 0 0 0 auto; min-height: 36px; display: flex; align-items: center; }
  .hint { margin-bottom: 7px; }
  .waypoint-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; gap: 5px; }
  .waypoint-nav button { padding: 8px 6px; gap: 4px; justify-content: center; font-size: .875rem; }
  dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  .brief-toolbar { padding: 8px 12px; }
  .brief-toolbar .eyebrow { max-width: 150px; letter-spacing: .035em; }
  .close-button { gap: 10px; font-size: .8125rem; }
  .brief-content { padding: 30px 22px; }
  .experience-strip { grid-template-columns: 1fr; gap: 16px; }
  .experience-strip > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
  .experience-strip span { margin-top: 0; }
  .case-study > div { grid-template-columns: 1fr; gap: 8px; }
  .principles { grid-template-columns: 1fr; gap: 25px; }
  .brief-section { margin-top: 36px; padding-top: 28px; }
  .brief-content .eyebrow { font-size: .75rem; }
}
/* Keep every control and paragraph reachable on short screens and with
   enlarged text. Scroll the content region rather than removing copy. */
@media (max-height: 700px) and (min-width: 601px) {
  #hud { padding: 16px 22px; gap: 8px; }
  h1 { font-size: 2rem; }
  .identity-actions { margin-top: 10px; }
  .detail { padding: 14px 18px; }
  .detail-heading { margin-bottom: 8px; }
  .detail h2 { font-size: 1.375rem; }
  .hint { margin-bottom: 7px; }
}
@media (max-height: 520px), (max-height: 740px) and (max-width: 600px) {
  #hud { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; pointer-events: auto; }
  .hud-top, .detail, .hud-bottom { flex: 0 0 auto; }
  .detail { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  body { min-height: 300vh; }
  .hint::after { content: " Reduced-motion mode is active."; }
}
