:root {
  --sand: #f6ecd8;
  --sand-deep: #e9d7b3;
  --sea: #2f8fa3;
  --sea-deep: #1f6b7c;
  --wood: #7a4a24;
  --ink: #2b2118;
  --ink-soft: #5c4b3b;
  --paper: #fffaf0;
  --deep: #123a47;
  --deep-line: #2a5361;
  --surf: #fffaf0;
  --sand-text: #f3e3c8;
  --sun: #ffd27a;
  --focus: #1f6b7c;
  --hob-game: #33507f;
  --hob-boat: #1f6b7c;
  --hob-tool: #a8471f;
  --hob-sci: #8a3f6b;
  --max: 1100px;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--sand);
  line-height: 1.6;
}
a { color: var(--sea-deep); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; }
h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- top bar ---------- */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
}
.brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--wood);
  text-decoration: none;
  letter-spacing: .02em;
}
.brand span { color: var(--sea-deep); }
.topbar nav a {
  color: var(--wood);
  text-decoration: none;
  margin-left: 1.25rem;
  font-weight: 600;
  font-size: .95rem;
}
.topbar nav a:hover { text-decoration: underline; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  background: linear-gradient(#fbe3b6 0%, #f9c98a 55%, #f4a86d 100%);
}
.scene {
  position: absolute;
  inset: 0;
}
.scene svg {
  width: 100%;
  height: 100%;
  display: block;
}
.hero-copy {
  position: relative;
  z-index: 2;
  padding: clamp(5rem, 14vh, 9rem) 1.5rem 0;
  max-width: 560px;
  pointer-events: none;
}
.hero-copy > * { pointer-events: auto; width: fit-content; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .75rem;
  color: var(--wood);
  font-weight: 700;
  margin-bottom: .5rem;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  color: var(--ink);
  margin-bottom: .3em;
}
.lede {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 34ch;
}
.hint {
  font-size: .85rem;
  color: var(--wood);
}

/* hut interaction */
.hut { cursor: pointer; outline: none; }
.hut .hut-body { transition: transform .25s ease, filter .25s ease; }
.hut .shadow { transition: transform .25s ease, opacity .25s ease; transform-box: fill-box; transform-origin: center; }
.hut:hover .hut-body, .hut:focus-visible .hut-body, .hut.active .hut-body {
  transform: translateY(-8px);
  filter: drop-shadow(0 10px 8px rgba(80, 40, 10, .28));
}
.hut:hover .shadow, .hut:focus-visible .shadow, .hut.active .shadow { transform: scale(1.06); opacity: .35; }
.hut .sign { animation: sway 3s ease-in-out infinite; transform-origin: 0 -8px; }
@keyframes sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}
.wave { animation: drift 9s linear infinite; }
.wave.w2 { animation-duration: 12s; animation-direction: reverse; }
.wave.w3 { animation-duration: 15s; }
/* Each wave repeats every 120 units (crest + trough), so shift a full period per loop. */
@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(-120px); }
}
/* ---------- gulls: gentle wandering sway ---------- */
.gull { animation: gull-sway 7s ease-in-out infinite; }
.gull2 { animation-duration: 9s; animation-delay: -3s; }
.gull3 { animation-duration: 8s; animation-delay: -5s; }
@keyframes gull-sway {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(7px, -5px) rotate(4deg); }
  50% { transform: translate(15px, 1px) rotate(-2deg); }
  75% { transform: translate(6px, 6px) rotate(3deg); }
}

/* ---------- snorkeler: drifts gently between the two huts ---------- */
.snorkeler {
  animation: snorkel-swim 48s ease-in-out infinite;
}
.snorkeler .bob { animation: snorkel-bob 3.2s ease-in-out infinite; }
@keyframes snorkel-swim {
  0%   { transform: translateX(-160px) scaleX(1); }
  48%  { transform: translateX(160px) scaleX(1); }
  50%  { transform: translateX(160px) scaleX(-1); }
  98%  { transform: translateX(-160px) scaleX(-1); }
  100% { transform: translateX(-160px) scaleX(1); }
}
@keyframes snorkel-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(2px); }
}

@media (prefers-reduced-motion: reduce) {
  .wave, .hut .sign, .gull, .snorkeler, .snorkeler .bob, .disc { animation: none; }
}

.hut-captions {
  position: relative;
  z-index: 2;
  padding: 0 1.5rem 1.5rem;
  min-height: 5.5rem;
  pointer-events: none;
}
.caption.show { pointer-events: auto; }
.caption {
  display: none;
  background: rgba(255, 250, 240, .92);
  border: 1px solid rgba(122, 74, 36, .25);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  max-width: 520px;
  color: var(--ink-soft);
  box-shadow: 0 8px 24px rgba(80, 40, 10, .12);
}
.caption strong { color: var(--ink); display: block; margin-bottom: .15rem; }
.caption.show { display: block; }

/* ---------- sections ---------- */
.section { padding: clamp(3rem, 8vw, 5.5rem) 0; }
.section.alt { background: var(--paper); }

/* The page dips below the waterline for the origin story: the one dark band. */
.section.deep {
  position: relative;
  overflow: hidden;
  background: var(--deep);
  color: var(--sand-text);
  --focus: var(--sun);
  padding: clamp(2.4rem, 5vw, 4rem) 0 clamp(3rem, 7vw, 4.5rem);
}
.section.deep > .wrap { position: relative; z-index: 1; }
/* Light coming down through the water, so the band has a source and a direction. */
.shafts { position: absolute; inset: 0 0 auto; height: 100%; pointer-events: none; }
.shafts svg { width: 100%; height: 100%; display: block; filter: blur(26px); }
.section.deep h2 { color: var(--paper); }
.section.deep .prose { color: var(--sand-text); }
.section.deep a { color: var(--sun); }

/* Wave edges between the sand-lit sections and the deep one. */
.tide { background: var(--sand); line-height: 0; }
.tide-up { background: var(--paper); }
.tide svg { display: block; width: 100%; height: clamp(34px, 4.5vw, 62px); }
.tide-up svg { transform: scaleY(-1); }

/* Origin: story column beside the thing that started it. */
.origin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: 1.5rem 3.5rem;
  align-items: center;
}
.origin-grid .prose { max-width: none; }
.rotor { margin: 0; }
.rotor svg { width: 100%; height: auto; display: block; }
.disc { animation: rotor-spin 90s linear infinite; transform-origin: 210px 200px; }
@keyframes rotor-spin { to { transform: rotate(360deg); } }

/* The line the whole story turns on, finally set like it matters. */
.pull {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.5vw, 1.85rem);
  line-height: 1.28;
  color: var(--sun);
  max-width: 24ch;
  margin: clamp(1.4rem, 3vw, 2rem) 0;
  padding-left: 1.1rem;
  border-left: 4px solid var(--sun);
}

/* "What I'm building" is a signpost, not a chapter: give it a slim band. */
.section.strip { padding: clamp(1.9rem, 4vw, 2.6rem) 0; }
.strip-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.2rem 2.5rem;
  align-items: center;
}
.strip h2 { font-size: clamp(1.3rem, 2.2vw, 1.65rem); margin-bottom: .35em; }
.strip p { margin: 0; color: var(--ink-soft); max-width: 64ch; }
.section-intro { color: var(--ink-soft); max-width: 60ch; margin-bottom: 2rem; }
.prose { max-width: 62ch; font-size: 1.05rem; }
.prose.two-col { max-width: none; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }

/* ---------- project cards ---------- */
.cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
}
.card {
  background: var(--sand);
  border: 1px solid var(--sand-deep);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem 1.1rem;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(80, 40, 10, .12); }
.card-icon {
  width: 44px; height: 44px;
  color: var(--sea-deep);
  margin-bottom: .8rem;
}
.card-icon svg { width: 100%; height: 100%; }
.card p { font-size: .95rem; margin: 0; }
.card h2 { font-size: 1.25rem; }

/* ---------- people ---------- */
.people {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem 2.5rem;
}
.people li { border-top: 2px solid var(--sand-deep); padding-top: 1rem; }
.people h3 { color: var(--wood); margin-bottom: .3rem; }
.people p { margin: 0; color: var(--ink-soft); }
.aside {
  background: var(--paper);
  border: 1px solid var(--sand-deep);
  border-radius: 18px;
  padding: 1.4rem 1.5rem 1.5rem;
}
.aside h3 { color: var(--wood); font-size: 1.1rem; margin-bottom: 1rem; }
.hobbies { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.hob {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: .9rem;
  align-items: start;
  color: var(--ink-soft);
  font-size: .95rem;
}
.hob .ico {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--tint);
  color: var(--c);
  display: grid;
  place-items: center;
}
.hob .ico svg { width: 26px; height: 26px; display: block; }
.hob-game { --c: var(--hob-game); --tint: #e6ebf4; }
.hob-boat { --c: var(--hob-boat); --tint: #e2eef1; }
.hob-tool { --c: var(--hob-tool); --tint: #f6e6de; }
.hob-sci  { --c: var(--hob-sci);  --tint: #f2e5ee; }

.button {
  display: inline-block;
  background: var(--sea-deep);
  color: #fff;
  text-decoration: none;
  padding: .7rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  transition: background .2s ease, transform .2s ease;
}
.button:hover { background: var(--sea); transform: translateY(-1px); }

/* ---------- subpages ---------- */
.subpage .topbar { position: sticky; background: var(--sand); border-bottom: 1px solid var(--sand-deep); }
.subpage .topbar a[aria-current="page"] { text-decoration: underline; }
.page-head { padding-bottom: 1.5rem; }
.page-head h1 { font-size: clamp(2rem, 4vw, 3rem); }
.card .meta { margin-top: .9rem; font-size: .85rem; color: var(--wood); }
.card p + p { margin-top: .6rem; }

/* ---------- footer ---------- */
.footer {
  background: var(--wood);
  color: #f3e3c8;
  padding: 1.5rem 0;
  font-size: .9rem;
}
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; }
.footer p { margin: 0; }
.footer .links a { color: #f3e3c8; margin-right: 1.25rem; }
.footer .links a:last-child { margin-right: 0; }

/* ---------- responsive ---------- */
/* Below 960px the scene is cropped to the huts and sits under the copy (see script.js). */
@media (max-width: 959px) {
  .hero { min-height: 92vh; min-height: 92svh; }
  .hero-copy { padding-top: 5rem; max-width: none; }
  .scene { top: auto; height: 62%; }
  .hut-captions { min-height: 0; }
  .caption { font-size: .92rem; }
}
@media (max-width: 860px) {
  .prose.two-col { grid-template-columns: 1fr; gap: 1.75rem; }
  .origin-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .rotor { max-width: 250px; margin: 0 auto; }
  .strip-inner { grid-template-columns: 1fr; }
  .pull { max-width: none; }
}
@media (max-width: 720px) {
  .topbar { padding: .85rem 1rem; }
  .topbar nav a { margin-left: .8rem; font-size: .85rem; }
  .prose.two-col { grid-template-columns: 1fr; gap: 1rem; }
  .hero-copy { padding-top: 4.5rem; }
}
@media (max-width: 420px) {
  .topbar nav a { margin-left: .6rem; font-size: .78rem; }
  .brand { font-size: 1.15rem; }
}

/* ---------- second hut stage ---------- */
.js .people { display: none; }
html:not(.js) .hut-stage { display: none; }

.hut-stage { display: grid; gap: .5rem; margin: 1.25rem 0 1.5rem; }
.stage {
  display: grid;
  grid-template-columns: minmax(0, 300px) 1fr;
  gap: 1rem 3rem;
  align-items: center;
}
.stage-svg { width: 100%; height: auto; display: block; overflow: visible; --win: #ffd98a; }
.visitor-blurb { min-height: 7rem; transition: opacity .3s ease; padding: 0 .25rem; max-width: 60ch; }
.visitor-blurb.swap { opacity: 0; }
.visitor-name { color: var(--wood); margin: .5rem 0 .3rem; font-size: 1.3rem; font-family: var(--serif); font-weight: 700; line-height: 1.15; }
.visitor-text { margin: 0; color: var(--ink-soft); }

.closer {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.4vw, 2.5rem);
  line-height: 1.2;
  color: var(--wood);
  margin: clamp(2rem, 5vw, 3.2rem) 0 0;
  padding-top: clamp(1.6rem, 4vw, 2.4rem);
  border-top: 2px solid var(--sand-deep);
}

.cloud-hint { color: var(--ink-soft); font-size: .95rem; text-align: center; margin-bottom: 1rem; }
.cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .7rem 1rem;
  padding: 1rem .5rem;
}
.chip {
  --chip: var(--wood);
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.1;
  color: var(--chip);
  background: var(--paper);
  border: 2px solid var(--sand-deep);
  border-radius: 999px;
  padding: .35em .85em;
  cursor: pointer;
  transform: rotate(var(--tilt, 0deg));
  transition: transform .2s ease, background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.chip.s1 { font-size: .95rem; }
.chip.s2 { font-size: 1.2rem; }
.chip.s3 { font-size: 1.5rem; }
.chip:hover, .chip:focus-visible { transform: rotate(0deg) translateY(-2px) scale(1.05); border-color: var(--chip); }
.chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.chip[aria-pressed="true"] {
  background: var(--chip);
  border-color: var(--chip);
  color: #fff;
  transform: rotate(0deg) scale(1.08);
  box-shadow: 0 6px 16px rgba(80, 40, 10, .18);
}

/* visitors walk in from the left and leave to the right */
.visitor { animation: walk-in .9s cubic-bezier(.2,.7,.3,1) both; }
.visitor .bob { animation: bob .3s ease-in-out 3; }
.visitor.leave { animation: walk-out .55s ease-in both; }
.visitor.leave .bob { animation: bob .28s ease-in-out 2; }
@keyframes walk-in {
  from { transform: translateX(-150px); opacity: 0; }
  20% { opacity: 1; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes walk-out {
  from { transform: translateX(0); opacity: 1; }
  80% { opacity: 1; }
  to { transform: translateX(150px); opacity: 0; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .visitor, .visitor.leave, .visitor .bob { animation: none; }
  .visitor.leave { display: none; }
}

@media (max-width: 800px) {
  .stage { grid-template-columns: 1fr; gap: .5rem; max-width: 360px; margin: 0 auto; }
  .visitor-blurb { min-height: 0; }
}

/* ---------- the 2017 sketch ---------- */
.name-story {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 300px);
  gap: 1.5rem 3rem;
  align-items: start;
}
.sketch {
  margin: 0;
  background: #fffdf7;
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(120, 160, 200, .25) 27px 28px);
  border: 1px solid var(--sand-deep);
  border-radius: 6px;
  padding: 1rem 1rem .6rem;
  box-shadow: 0 8px 22px rgba(80, 40, 10, .1);
  transform: rotate(-1.5deg);
}
.sketch-svg { width: 100%; height: auto; display: block; }
.sketch figcaption { font-size: .8rem; color: var(--ink-soft); font-style: italic; text-align: center; margin-top: .4rem; }

/* draw-on when scrolled into view */
.js .sketch .ink path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .sketch .ink path[fill="#2b2118"] { fill-opacity: 0; }
.sketch.drawn .ink path { animation: draw 1.1s ease-out forwards; }
.sketch.drawn .stroke-group:nth-child(1) path { animation-delay: .1s; }
.sketch.drawn .stroke-group:nth-child(2) path { animation-delay: .7s; }
.sketch.drawn .stroke-group:nth-child(3) path { animation-delay: 1.6s; }
.sketch.drawn .stroke-group:nth-child(4) path { animation-delay: 2.0s; }
.sketch.drawn .stroke-group:nth-child(5) path { animation-delay: 2.9s; }
.sketch.drawn .ink path[fill="#2b2118"] { animation-name: draw-fill; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes draw-fill { from { fill-opacity: 0; } 60% { fill-opacity: 0; stroke-dashoffset: 0; } to { stroke-dashoffset: 0; fill-opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  /* The [fill] selector matches the doorway rule's specificity so fill-opacity: 1 wins there too. */
  .js .sketch .ink path, .js .sketch .ink path[fill="#2b2118"] { stroke-dashoffset: 0; fill-opacity: 1; animation: none !important; }
}
@media (max-width: 800px) {
  .name-story { grid-template-columns: 1fr; }
  .sketch { max-width: 320px; margin: .5rem auto 0; }
}
