/* Layout and scroll timing adapted from Floo Landing Scroll Story by floo.design.
   https://21st.dev/@floodesign/components/floo-landing-scroll
   The warm sky and masked contour bank use the public demo's two landscape layers. */
@font-face {
  font-family: Newsreader;
  src: url(assets/newsreader.ttf);
  font-weight: 200 800;
  font-display: swap;
}
:root {
  --ink:#201e19; --paper:#faf9f5; --surface:#fffefa; --sheet:#eee9df; --line:#d9d4c9;
  --accent:#47433b; --secondary:#605d54; --contrast:#fffdf6; --face:Newsreader,Georgia,serif;
}
body {padding: 16px;}
.stage {overflow: visible; border-radius:0;}
.hero-scene {position:relative; isolation:isolate; overflow:hidden; border-radius:clamp(20px,2.65vw,38px); background:#eee8d9;}
.hero-scene .scenery {background:var(--scene-image,url(assets/fieldwork-scene.webp)) center/100% 100% no-repeat; border-radius:0; clip-path:none; height:100%;}
.hero-scene header {grid-template-columns:1fr auto 1fr; padding:clamp(16px,2.5vh,26px) clamp(16px,3vw,44px);}
.hero-scene .brand {font-size:clamp(18px,1.7vw,24px);gap:9px;}
.hero-scene .brand .mark {width:1.36em;height:1.36em;padding:5px;background:var(--ink);color:var(--surface);border-radius:7px;}
.hero-scene nav {display:flex;background:var(--surface);border-radius:13px;gap:4px;padding:4px;}
.hero-scene nav a {display:grid;place-items:center;padding:0;border-radius:9px;width:clamp(30px,3.2vw,46px);height:clamp(32px,4.8vh,48px);}
.hero-scene nav a[aria-current] {background:var(--ink);color:var(--surface);}
.hero-scene nav svg {width:16px;height:16px;}
.study-link {justify-self:end;display:grid;place-items:center;background:var(--surface);border-radius:7px;padding:0 18px;min-width:clamp(88px,8.7vw,125px);height:clamp(36px,4.8vh,48px);font-size:13px;}
.study-link:hover {background:var(--sheet);}
.intro {z-index:4;text-align:center;}
.intro .study-badge {width:max-content;height:28px;display:inline-flex;align-items:center;gap:6px;margin:0 auto;padding:0 9px;background:var(--surface);border-radius:4px;font-size:11px;}
.study-badge b {display:grid;place-items:center;width:14px;height:14px;background:var(--ink);color:var(--surface);border-radius:2px;font-weight:400;}
.study-badge span {font:10px ui-monospace,Menlo,monospace;}
.intro h1,.second-title {font-family:Newsreader,Georgia,serif;font-variation-settings:"opsz" 72;font-weight:450;letter-spacing:-.048em;}
.intro h1 {font-size:clamp(40px,min(5.14vw,7.4svh),90px);line-height:1.054;}
.intro .action {justify-content:center;min-width:158px;height:clamp(43px,5.8svh,58px);border-radius:9px;font-size:14px;font-weight:400;}
.opening-desk {position:absolute;left:50%;width:min(49%,850px);transform:translateX(-50%);border-radius:clamp(17px,1.9vw,27px);padding:clamp(16px,1.9vw,27px);background:#f4f3ef;box-shadow:0 20px 50px -30px #37332966;z-index:2;}
.opening-desk-head {display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:clamp(13px,2vw,30px);font-size:clamp(16px,1.8vw,26px);letter-spacing:-.035em;}
.opening-desk-head i {color:#78766f;font-style:normal;}
.workspace-name {display:flex;align-items:center;gap:8px;background:var(--surface);padding:6px 12px 6px 7px;border-radius:28px;letter-spacing:0;}
.workspace-name b {display:grid;place-items:center;background:var(--ink);color:white;width:25px;height:25px;border-radius:6px;font-size:15px;}
.workspace-name strong,.workspace-name small {display:block;font-size:10px;}
.workspace-name small {font-size:9px;color:var(--secondary);}
.opening-grid {display:grid;grid-template-columns:1fr .23fr 1.28fr;gap:clamp(6px,.8vw,13px);}
.metrics,.rail,.thread-mini {background:var(--surface);padding:clamp(9px,.9vw,14px);border-radius:12px;font-size:clamp(10px,.85vw,13px);}
.metrics>span {color:var(--secondary);}
.metrics>div {display:flex;gap:14%;margin:18px 0 12px;}
.metrics strong {font-weight:400;font-size:clamp(20px,2.15vw,32px);line-height:1.1;}
.metrics small {display:block;font-size:10px;}
.metrics hr {border:none;border-top:1px solid var(--line);}
.metrics p {margin-top:8px;}
.rail {display:flex;align-items:center;flex-direction:column;gap:13px;padding-inline:0;}
.rail i {display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--sheet);font-style:normal;font-size:10px;}
.rail i:first-child {background:var(--ink);color:var(--surface);}
.thread-mini p,.reply {margin-top:9px;background:#f0efea;padding:10px;border-radius:8px;line-height:1.4;}
.reply {background:#e8e3d8;}
.hero-scene .foreground {display:block;inset:auto 0 0;height:40%;background:var(--bank-image,url(assets/contour-bank.webp)) center bottom/100% 100% no-repeat;z-index:3;border-radius:0;pointer-events:none;}
.scroll-hint {position:absolute;bottom:3.5%;left:50%;transform:translateX(-50%);z-index:4;width:20px;height:33px;border:2px solid var(--ink);border-radius:16px;display:grid;justify-content:center;padding-top:5px;background:#f7f3e4ad;}
.scroll-hint i {width:2px;height:7px;background:var(--ink);border-radius:2px;}
.second-title {display:none;text-align:center;line-height:1.03;}
footer .options {top:auto;bottom:calc(100% + 5px);left:0;right:auto;}
footer .chooser {margin-left:8px;}
footer .chooser summary {border:1px solid var(--line);}

@media (min-width:761px) and (min-height:630px) and (prefers-reduced-motion:no-preference),
       (max-width:760px) and (min-height:550px) and (prefers-reduced-motion:no-preference) {
  .story {height:355svh;}
  .stage {position:sticky;top:12px;height:calc(100svh - 32px);container-type:size;--opening:1;--detail:0;--collapse:0;--lift:0;--retreat:0;}
  .hero-scene {position:absolute;inset:0 0 auto;height:calc(100% - 63.6% * var(--collapse));animation:unfold .8s cubic-bezier(.2,.75,.3,1) both;}
  .hero-scene .scenery {height:100cqh;}
  .intro {display:block;min-height:0;position:absolute;inset:17.7cqh 0 auto;padding:0;opacity:var(--opening);transform:translateY(calc(-11cqh * (1 - var(--opening))));}
  .intro h1 {margin:3.15cqh 0 0;}
  .intro h1 span {animation:line-arrives .65s both;}
  .intro h1 span:nth-child(2) {animation-delay:.14s;}
  .intro h1 span:nth-child(3) {animation-delay:.28s;}
  .intro .action {margin-top:2.8cqh;animation:line-arrives .65s .38s both;}
  .opening-desk {top:62.9cqh;opacity:calc(1 - var(--retreat));transform:translate(-50%,calc(-25cqh * var(--lift) + 33cqh * var(--retreat))) scale(calc(1 + .04 * var(--lift)));animation:desk-arrives .8s .2s both;}
  .opening-desk .reply {opacity:var(--lift);translate:0 calc(8px * (1 - var(--lift)));}
  .hero-scene .foreground {top:60cqh;bottom:auto;height:40cqh;}
  .scroll-hint {opacity:var(--opening);}
  .second-title {display:block;position:absolute;left:0;right:0;bottom:13%;font-size:clamp(32px,min(3.5vw,5.15svh),60px);opacity:var(--detail);}
  .desk-area {position:absolute;inset:40% 0 0;width:auto;margin:0;transform:none;opacity:var(--detail);filter:blur(calc(6px * (1 - var(--detail))));}
  .desk {position:relative;height:100%;border:0;background:none;border-radius:0;overflow:visible;}
  .desk:before,.desk:after {content:"";position:absolute;top:0;bottom:0;width:49.55%;border-radius:clamp(16px,2.4vw,38px);}
  .desk:before {left:0;background:#f2f1eb;}
  .desk:after {right:0;background:var(--sheet) var(--print-image,url(assets/fault-print.webp)) center/cover;}
  .desk-top,.study-head {display:none;}
  .tabs {position:absolute;z-index:1;top:0;left:0;width:49.55%;padding:0 2.3vw;height:16%;align-items:stretch;gap:clamp(14px,3vw,50px);}
  .tabs button {font-size:clamp(12px,1vw,16px);}
  .panel {position:absolute;inset:0;padding:0;display:block;min-height:0;}
  .explanation {position:absolute;z-index:1;left:2.3%;bottom:12%;width:41%;}
  .explanation h3 {font-size:clamp(32px,min(3.5vw,5.5svh),60px);margin:12px 0;}
  .explanation p {max-width:42ch;}
  .screen-slot {position:absolute;z-index:1;width:32%;left:58.75%;top:50%;transform:translateY(-50%);min-height:190px;border:0;border-radius:20px;background:var(--surface);padding:12px;box-shadow:0 12px 35px #322e2421;}
  .screen-head {padding:10px 9px 15px;}
  .screen-head::after {content:"Illustrative";font:10px ui-monospace,monospace;color:var(--secondary);}
  .screen-head span:last-child {display:none;}
}
@keyframes unfold {from{clip-path:inset(0 0 90% round 38px)}to{clip-path:inset(0 round 38px)}}
@keyframes line-arrives {from{opacity:0;filter:blur(8px);translate:0 10px}to{opacity:1;filter:blur(0);translate:0}}
@keyframes desk-arrives {from{translate:0 60px}to{translate:0}}
@media (min-width:761px) and (max-height:629px),(max-width:760px) and (max-height:549px),(prefers-reduced-motion:reduce) {
  .hero-scene {height:clamp(535px,90svh,890px);}
  .hero-scene .intro {position:absolute;inset:18% 8px auto;min-height:0;padding:0;display:block;}
  .intro h1 {margin:22px 0 15px;}
  .opening-desk {top:64%;width:clamp(295px,75%,690px);}
  .desk-area {width:min(92%,840px);margin:22px auto 0;}
  .scroll-hint {height:28px;}
}
@media(max-width:760px) {
  body {padding:8px;}
  .hero-scene header {padding:14px 12px;gap:3px;}
  .hero-scene nav {gap:1px;padding:2px;}
  .hero-scene nav a {width:29px;height:31px;}
  .hero-scene nav svg {width:13px;height:13px;}
  .hero-scene .brand {font-size:18px;gap:5px;}
  .study-link {font-size:11px;padding:0 8px;min-width:0;}
  .intro h1 {font-size:clamp(35px,8vw,57px);}
  .opening-desk {width:87%;padding:13px;}
  footer .chooser {margin-left:0;}
}
@media(max-width:390px) {
  .hero-scene nav a {width:24px;}
  .hero-scene header {padding-inline:8px;}
  footer>span {display:none;}
}
.study-notes-link {display:inline-flex;align-items:center;padding:13px 22px;margin-top:20px;border-radius:8px;background:var(--ink);color:var(--surface);font-size:13px;}
.study-notes-link:hover {background:var(--accent);}

/* Editions share the page geometry. These overrides supply only ink, stock and plates. */
:root[data-edition="glacier"] {
  --ink:#243f50; --paper:#f2f5f5; --surface:#f8faf9; --sheet:#d7e2e7; --line:#c3d2d8;
  --accent:#375366; --secondary:#4c626e; --contrast:#fcfdfd;
  --scene-image:url(assets/editions/glacier/scene.webp);
  --bank-image:url(assets/editions/glacier/bank.webp);
  --print-image:url(assets/editions/glacier/print.webp);
}
:root[data-edition="sienna"] {
  --ink:#663820; --paper:#faf3e9; --surface:#fff8ed; --sheet:#e5c9ac; --line:#d8bea6;
  --accent:#774529; --secondary:#705540; --contrast:#fff8ea;
  --scene-image:url(assets/editions/sienna/scene.webp);
  --bank-image:url(assets/editions/sienna/bank.webp);
  --print-image:url(assets/editions/sienna/print.webp);
}
:root[data-edition="carbon"] {
  --ink:#fff1d8; --paper:#091e20; --surface:#153636; --sheet:#214947; --line:#416965;
  --accent:#efa875; --secondary:#bed1c2; --contrast:#102a29;
  --scene-image:url(assets/editions/carbon/scene.webp);
  --bank-image:url(assets/editions/carbon/bank.webp);
  --print-image:url(assets/editions/carbon/print.webp);
}
[data-edition] .hero-scene { background-color:var(--sheet); }
[data-edition] .opening-desk, [data-edition] .desk:before { background-color:color-mix(in srgb,var(--paper) 62%,var(--sheet)); }
[data-edition] .opening-desk-head i { color:var(--secondary); }
[data-edition] .workspace-name b { color:var(--surface); }
[data-edition] .thread-mini p { background-color:var(--paper); }
[data-edition] .reply { background-color:var(--sheet); }
[data-edition] .scroll-hint { background-color:color-mix(in srgb,var(--surface) 75%,transparent); }
[data-edition] .chip.fieldwork { background:linear-gradient(145deg,var(--sheet) 45%,var(--ink) 46%); }


/* Portrait uses the same progress-driven layers, with the spread stacked. */
@media(max-width:760px) {
  .hero-scene header {grid-template-columns:auto 1fr;gap:8px;}
  .hero-scene nav {justify-self:end;}
  .hero-scene nav a {width:clamp(32px,9vw,42px);height:42px;}
  .hero-scene .study-link {display:none;}
  .hero-scene nav svg {width:15px;height:15px;}
  .hero-scene .scenery,.hero-scene .foreground {background-size:max(100%,100svh) 100%;background-position:56% bottom;}
  .intro h1 {font-size:clamp(36px,10.3vw,65px);}
}
@media(max-width:760px) and (min-height:550px) and (prefers-reduced-motion:no-preference) {
  .stage {height:calc(100svh - 24px);}
  .hero-scene {height:calc(100% - 75% * var(--collapse));}
  .second-title {bottom:8%;font-size:clamp(26px,min(7.6vw,4.6svh),45px);}
  .desk-area {inset:26.5% 0 0;padding:0;}
  .desk {--copy-height:clamp(160px,27cqh,240px);}
  .desk:before,.desk:after {width:100%;border-radius:18px;}
  .desk:before {height:var(--copy-height);}
  .desk:after {top:calc(var(--copy-height) + 8px);}
  .tabs {width:100%;height:40px;padding-inline:16px;justify-content:space-between;gap:5px;}
  .tabs button {padding:5px 0;font-size:13px;}
  .panel {min-height:0;pointer-events:none;}
  .explanation {top:48px;bottom:auto;left:16px;width:calc(100% - 32px);}
  .explanation .step-count {display:none;}
  .explanation h3 {font-size:clamp(25px,6.8vw,37px);margin:2px 0 5px;}
  .explanation p {font-size:clamp(12px,3.4vw,15px);line-height:1.38;}
  .explanation .study-notes-link {margin:4px 0 0;padding:5px 0;background:transparent;color:var(--ink);text-decoration:underline;text-underline-offset:3px;font-size:12px;pointer-events:auto;}
  .screen-slot {left:7%;width:86%;top:calc(50% + var(--copy-height)/2 + 4px);min-height:0;max-height:calc(100% - var(--copy-height) - 24px);overflow:auto;padding:5px;border-radius:12px;pointer-events:auto;}
  .screen-head {padding:7px 9px;}
}

/* The map fault and the controls use the same copper ink. */
[data-edition="carbon"] .intro .action,
[data-edition="carbon"] .hero-scene nav a[aria-current],
[data-edition="carbon"] .hero-scene .brand .mark {
  color:var(--contrast);
  background:var(--accent);
}
[data-edition="carbon"] .intro .action:hover {background:#ffbf90;}
[data-edition="carbon"] .tabs button[aria-selected=true] {color:var(--accent);}

/* Floo gives the interface its own light surface above the scenery. */
[data-edition="carbon"] :is(.opening-desk, .desk, .hero-scene nav, .study-link, .study-badge) {
  --ink: #192f2c;
  --paper: #f3f1e9;
  --surface: #fffdf7;
  --sheet: #e4ebe3;
  --line: #cbd3c9;
  --secondary: #495d54;
  --accent: #96502b;
  --contrast: #fffdf7;
  color: var(--ink);
}
[data-edition="carbon"] .opening-desk {
  background: #eeeee6;
  box-shadow: 0 20px 50px -26px #03151699;
}
[data-edition="carbon"] .opening-desk .reply { background: #e0eae1; }
[data-edition="carbon"] .desk:before { background: #f5f3ec; }
[data-edition="carbon"] .hero-scene nav a[aria-current] {
  background: var(--ink);
  color: var(--surface);
}
[data-edition="carbon"] .screen-slot {
  background: #efefe8;
  box-shadow: 0 14px 36px -14px #03151699;
}
[data-edition="carbon"] .screen-slot :is(.thread, .chart, .receipt) {
  background: var(--surface);
  border-radius: 9px;
}
