/* ==========================================================================
   Alexis Collins portfolio (one page)
   The valley art is a raster image with painted signs. Real, accessible
   links sit exactly over each painted sign and open a full-content card.
   Day art shows 06:00 to 17:59 local time, night art otherwise.
   ========================================================================== */

:root {
  --parchment: #FAF4E4;      /* Parchment */
  --parchment-deep: #F1E8CF; /* Old Paper */
  --parchment-edge: #D8C09C; /* Warm Sand */
  --ink: #2E3831;            /* Forest Ink */
  --ink-soft: #4C5A4F;
  --link: #2E3831;   /* link text: Forest Ink; the underline carries Golden Thread */

  --wood-light: #D8C09C;     /* Warm Sand */
  --wood: #C9A27A;
  --wood-dark: #8B6542;
  --wood-deep: #57452B;      /* Earth Brown */
  --wood-night: #3E2B1B;
  --gold: #C29C44;           /* Golden Thread */
  --gold-soft: #D4B262;
  --teal: #3F8F88;

  --ph-bg: #FFF1C9;
  --ph-border: #C99A2E;

  --font-display: "Averia Serif Libre", "Iowan Old Style", Georgia, serif;  /* all headings */
  --font-body: "EB Garamond", Garamond, "Iowan Old Style", Georgia, serif;  /* all body text and buttons */

  --focus-ring: #12466A;
  --focus-halo: #FFE9A8;

  --shadow-sign: inset 0 -3px 0 rgba(60, 35, 15, 0.25), 0 3px 0 var(--wood-deep);
  --measure: 64ch;

  /* One type scale for the whole site. Every size below uses one of these three. */
  --fs-body: 1.25rem;   /* all body text, buttons, labels, lists */
  --fs-h3: 1.5rem;      /* section headings inside cards */
  --fs-h2: 1.9rem;      /* card titles and welcome headings */

  /* Theme (day default) */
  --page-bg: #EAF2E6;
  --band: var(--wood-deep);
  --sky-fallback: #8EC5DE;
  --letterbox: #24341F;
}
[data-time="night"] {
  --page-bg: #16233A;
  --band: var(--wood-night);
  --sky-fallback: #18264A;
  --letterbox: #0D1526;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--page-bg);
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0 0 0.6rem; }
h1, h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-body); margin: 0 0 0.3rem; }
p { margin: 0 0 1rem; max-width: var(--measure); }
ul { padding-left: 1.2em; margin: 0 0 1rem; }
li { margin-bottom: 0.35em; max-width: var(--measure); }
a { color: var(--link); text-decoration-color: var(--gold); text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
@media (hover: hover) { a:hover { text-decoration-thickness: 3px; } }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px var(--focus-halo);
  border-radius: 6px;
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Buttons ----------
   Every button on the site uses the same painted green plaque (assets/button.webp).
   border-image keeps the rounded gold end caps at their natural shape and
   stretches only the middle, so any label length looks right.            */
.btn {
  --btn-h: 50px;
  --btn-cap: calc(var(--btn-h) * 105 / 224);   /* end-cap width at this height */
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--btn-h); min-width: calc(var(--btn-h) * 2.6);
  /* EB Garamond sits low in its line box and the plaque's green face sits slightly
     above the art's center, so nudge labels up to look optically centered. */
  padding: 0 0.5rem 0.2em;
  border-style: solid; border-width: 0 var(--btn-cap); border-color: transparent;
  border-image: url("assets/button.webp") 0 105 fill / 0 var(--btn-cap) / 0 stretch;
  background: none; box-shadow: none; border-radius: 0;
  font: 700 var(--fs-body)/1 var(--font-body); letter-spacing: 0.02em;
  color: #FAF4E4; text-decoration: none; white-space: nowrap; cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45), 0 0 6px rgba(20, 50, 40, 0.5);
  transition: filter 0.2s ease, transform 0.15s ease;
}
@media (hover: hover) { .btn:hover {
  filter: brightness(1.06) drop-shadow(0 0 10px rgba(255, 214, 120, 0.75)) drop-shadow(0 0 22px rgba(255, 200, 90, 0.4));
} }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: none; filter: brightness(1.06) drop-shadow(0 0 10px rgba(255, 214, 120, 0.9)) drop-shadow(0 0 24px rgba(255, 200, 90, 0.55)); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.btn-text {
  background: none; border: 0; padding: 0.4rem 0.2rem; min-height: 44px;
  font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer;
}

/* ---------- The valley ---------- */
.world {
  container-type: size;
  /* Cover the whole viewport (no letterbox bars). The art scales as one box,
     so hotspots stay locked to the painted signs. Horizontal crop is biased
     left (80%) so every sign, from Contact to Vision, stays on screen.
     Example: a 1920 x 960 browser window trims about 12px from the top and 108px from the bottom. */
  --ww: max(100vw, calc(100vh * 1671 / 941));
  --ww: max(100vw, calc(100dvh * 1671 / 941));
  position: absolute;
  width: var(--ww);
  height: calc(var(--ww) * 941 / 1671);
  left: calc((100vw - var(--ww)) * 0.8);
  /* Vertical crop comes mostly off the bottom foliage so the star ornament at the top stays. */
  top: calc((100vh - var(--ww) * 941 / 1671) * 0.1);
  top: calc((100dvh - var(--ww) * 941 / 1671) * 0.1);
  background-color: var(--sky-fallback);
  background-size: cover;
  background-position: center;
  /* Only the active theme's image downloads. */
  background-image: url("assets/valley-day-1672.jpg");
  background-image: image-set(url("assets/valley-day-1000.webp") type("image/webp") 1x, url("assets/valley-day-1672.webp") type("image/webp") 2x, url("assets/valley-day-1672.jpg") type("image/jpeg") 1x);
}
@media (min-width: 900px) {
  .world { background-image: url("assets/valley-day-1672.jpg"); background-image: image-set(url("assets/valley-day-1672.webp") type("image/webp"), url("assets/valley-day-1672.jpg") type("image/jpeg")); }
}
[data-time="night"] .world {
  background-image: url("assets/valley-night-1672.jpg");
  background-image: image-set(url("assets/valley-night-1000.webp") type("image/webp") 1x, url("assets/valley-night-1672.webp") type("image/webp") 2x, url("assets/valley-night-1672.jpg") type("image/jpeg") 1x);
}
@media (min-width: 900px) {
  [data-time="night"] .world { background-image: url("assets/valley-night-1672.jpg"); background-image: image-set(url("assets/valley-night-1672.webp") type("image/webp"), url("assets/valley-night-1672.jpg") type("image/jpeg")); }
}
.world-frame { position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; background: var(--letterbox); }

/* Hotspots. Coordinates are percentages of the 1672 x 941 art. */
.signs { list-style: none; margin: 0; padding: 0; }
.signs li { margin: 0; }
.hot {
  position: absolute;
  left: var(--x); top: var(--y); width: var(--w); height: var(--h);
  display: block; color: transparent; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.object { z-index: 1; border-radius: 40px; cursor: pointer; }
.sign {
  z-index: 2; border-radius: 14px; cursor: pointer;
  outline: none;
}
/* Soft golden light over the painted sign. No ring, no movement. */
.sign::before,
.sign::after {
  content: ""; position: absolute; pointer-events: none;
  opacity: 0; transition: opacity 0.25s ease;
}
/* Halo around the sign */
.sign::before {
  inset: 8px;
  border-radius: 14px;
  box-shadow: 0 0 30px 18px rgba(255, 214, 120, 0.7), 0 0 70px 30px rgba(255, 200, 90, 0.35);
}
/* Warm light washing over the sign face */
.sign::after {
  inset: 0;
  border-radius: 12px;
  background: radial-gradient(ellipse at center, rgba(255, 236, 170, 0.5) 0%, rgba(255, 220, 130, 0.28) 60%, rgba(255, 210, 110, 0.12) 100%);
  mix-blend-mode: screen;
}
.sign.is-current::before, .sign.is-current::after,
.sign:focus-visible::before, .sign:focus-visible::after { opacity: 1; }
@media (hover: hover) {
  .sign:hover::before, .sign:hover::after,
  .object:hover + .sign::before, .object:hover + .sign::after { opacity: 1; }
}
/* Keyboard focus uses the same glow, so focus is always visible without a ring. */
.sign:focus-visible { outline: none; box-shadow: none; }

/* ---------- Cards (native <dialog>) ----------
   Every card uses the same illustrated frame (1468 x 730). Positions below
   are percentages of that artwork, so text stays inside the parchment.
   Long content scrolls inside the frame.                                    */
.card {
  /* Full-screen transparent dialog: the frame is centered and the gold X sits
     in the screen's top-right corner. Clicking outside the frame closes it. */
  padding: 0; border: 0; background: transparent; overflow: hidden; color: var(--ink);
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; inset: 0;
}
.card[open] { display: grid; place-items: center; }
.card-horizontal .card-frame { width: min(94vw, 1180px, calc(86vh * 1468 / 730)); }
.card::backdrop { background: rgba(14, 22, 34, 0.5); backdrop-filter: blur(3px); }

.card-frame {
  position: relative; container-type: inline-size;
  background: center / 100% 100% no-repeat;
  filter: drop-shadow(0 20px 34px rgba(10, 15, 25, 0.5));
}
.card-horizontal .card-frame { aspect-ratio: 1468 / 730;  background-image: url("assets/card-horizontal.webp"); }

/* Title sits inside the painted name tag, between its two leaf marks. */
.card-title {
  position: absolute; margin: 0;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap; font-weight: 700; color: var(--ink); line-height: 1;
}
.card-horizontal .card-title { left: 16.4%; top: 6.6%;  width: 16.6%; height: 10.5%; font-size: var(--fs-h2); }

/* Close: the shared button, sitting on the top edge of the frame. */

/* Readable area inside the parchment. Long content scrolls inside the frame. */
.card-body {
  position: absolute; overflow-y: auto; overscroll-behavior: contain;
  padding-right: 0.6rem;
  scrollbar-width: thin; scrollbar-color: var(--wood) transparent;
}
.card-horizontal .card-body { left: 13.5%; top: 24.5%; right: 12%;   bottom: 14%; }
.card-body::-webkit-scrollbar { width: 8px; }
.card-body::-webkit-scrollbar-thumb { background: var(--wood); border-radius: 8px; }
.card-body > section + section { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px dashed var(--parchment-edge); }
.card-body p, .card-body li, .card-body .ph, .card-body .outcome-band { max-width: none; }
.card .lede { font-size: var(--fs-body); }
.card .muted { color: var(--ink-soft); }
/* Soft fade at the bottom edge so scrollable cards read as scrollable. */
.card-body { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.6rem), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 1.6rem), transparent); padding-bottom: 1.6rem; }

@media (prefers-reduced-motion: no-preference) {
  .card[open] .card-frame { animation: card-in 0.22s ease-out; }
  .card[open] .card-close { animation: fade-in 0.22s ease-out; }
  .card[open]::backdrop { animation: fade-in 0.22s ease-out; }
}
@keyframes card-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Resume entries */
.role { margin: 0 0 1.2rem; }
.role-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.1rem 1rem; }
.role-head h4 { margin: 0; font-size: var(--fs-body); }
.role-dates { color: var(--ink-soft); font-weight: 500; }
.org-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.1rem 1rem; margin: 1.2rem 0 0.4rem; padding-bottom: 0.2rem; border-bottom: 1px solid var(--parchment-edge); }
.org-head:first-of-type { margin-top: 0.4rem; }
.role-org { margin: 0; color: var(--wood-deep); font-weight: 700; font-size: var(--fs-body); }
.figures { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); margin: 0 0 1.2rem; padding: 0; list-style: none; }
.figures li { margin: 0; background: #FFFBEF; border: 2px solid var(--parchment-edge); border-left: 6px solid var(--wood); border-radius: 6px 12px 12px 6px; padding: 0.7rem 0.9rem; line-height: 1.35; }
.figures strong { display: block; font-family: var(--font-display); font-size: var(--fs-h3); color: var(--ink); }

/* Explore card: guide list */
.guide { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.6rem; }
.guide li { margin: 0; max-width: none; }
.guide-item {
  display: grid; grid-template-columns: 40px 1fr; gap: 0.8rem; align-items: center; width: 100%;
  text-align: left; font: inherit; color: var(--ink); text-decoration: none; cursor: pointer;
  background: #FFFBEF; border: 2px solid var(--parchment-edge); border-left: 6px solid var(--wood);
  border-radius: 6px 12px 12px 6px; padding: 0.7rem 0.9rem;
}
@media (hover: hover) { .guide-item:hover { border-left-color: var(--ink); } }
.guide-icon { width: 32px; height: 32px; image-rendering: pixelated; image-rendering: crisp-edges; display: block; margin: 0 auto; }
@supports (image-rendering: pixelated) { .guide-icon { image-rendering: pixelated; } }
.guide-item b { font-family: var(--font-display); font-size: var(--fs-body); display: block; }
.guide-item span span { color: var(--ink-soft); }

/* Contact */
.contact-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.contact-list li { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; padding: 0.7rem 0; border-bottom: 1px dashed var(--parchment-edge); max-width: none; margin: 0; }
.contact-list .label { min-width: 6.5rem; color: var(--ink-soft); }

.portrait {
  float: right; width: 9.5rem; aspect-ratio: 4 / 5; margin: 0 0 1rem 1.25rem;
  display: grid; place-items: center; text-align: center; padding: 0.8rem;
  background: var(--parchment-deep); border: 3px solid var(--wood);
  border-radius: 50% 50% 10px 10px / 36% 36% 10px 10px;
  font-size: var(--fs-body); color: var(--ink-soft);
}
@media (max-width: 520px) { .portrait { float: none; margin: 0 auto 1rem; } }

/* Placeholders Alexis must fill in: dashed box plus a text label (not color alone). */
.ph {
  display: block; background: var(--ph-bg); border: 2px dashed var(--ph-border); border-radius: 6px;
  padding: 0.55rem 0.8rem; margin: 0 0 1rem; color: #5A4410; font-size: var(--fs-body); max-width: var(--measure);
}
.ph::before { content: "Placeholder: "; font-weight: 700; }
span.ph { display: inline; padding: 0.05rem 0.4rem; margin: 0; }

/* ---------- Without JavaScript: cards render as normal sections below the map ---------- */
html:not(.js) .card { display: block; position: static; margin: 2rem auto; width: auto; height: auto; overflow: visible; }
html:not(.js) .card-close, html:not(.js) [data-needs-js] { display: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* ---------- Print: printing while the Experience card is open prints the resume ---------- */
@media print {
  body { background: #fff; font-size: 10.5pt; }
  .world-frame, .welcome, .card-close, .no-print { display: none !important; }
  .card { display: none !important; }
  .card[open] { display: block !important; position: static; width: 100%; height: auto; overflow: visible; filter: none; }
  .card[open] .card-frame { background: none; aspect-ratio: auto; filter: none; width: 100%; }
  .card[open] .card-title { position: static; display: block; font-size: 20pt; text-align: left; margin-bottom: 8pt; }
  .card[open] .card-body { position: static; overflow: visible; padding: 0; }
  .card::backdrop { display: none; }
  .figures li { border: 1px solid #999; background: #fff; }
}


.card-title:focus, .card-title:focus-visible { outline: none; box-shadow: none; }

/* ---------- Welcome dialogue (shown on open) ----------
   Desktop and tablet: the illustrated panel with text laid over the parchment.
   Positions are percentages of the 1627 x 644 panel art.
   Phones: the portrait sits above a CSS parchment box so the text stays readable. */
.welcome {
  /* The dialog covers the whole screen (transparent) so the skip X can sit in
     the screen's top-right corner; the panel is centered inside it. */
  padding: 0; border: 0; background: transparent; overflow: hidden;
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none; margin: 0; inset: 0;
}
.welcome[open] { display: grid; place-items: center; }
.welcome::backdrop {
  background: rgba(20, 24, 30, 0.28);
  -webkit-backdrop-filter: grayscale(0.55) brightness(0.88);
  backdrop-filter: grayscale(0.55) brightness(0.88);
}
.welcome-inner { position: relative; container-type: inline-size; width: min(94vw, 1080px, calc(88vh * 1627 / 644)); }
.welcome-art img { display: block; width: 100%; height: auto; filter: drop-shadow(0 18px 30px rgba(10, 15, 25, 0.45)); }
.welcome-copy {
  /* One fixed text box for every step: same left edge, same width, and the
     heading always starts at the same spot, so nothing shifts between steps. */
  position: absolute; left: 33.2%; top: 31.5%; width: 58%; height: 41%;
  padding-top: 2.4cqi;
  display: flex; flex-direction: column; justify-content: flex-start;
  font-family: var(--font-body);
  color: var(--ink);
}
.welcome-copy h2 {
  font-family: var(--font-display); font-weight: 700; margin: 0 0 0.35em;
  font-size: var(--fs-h2); line-height: 1.1;
}
.welcome-copy p {
  margin: 0; max-width: none;
  font-size: var(--fs-body); line-height: 1.5;
}
.welcome-next {
  position: absolute; left: 75.7%; top: 73.9%; width: 14.9%; height: 11.3%;
  display: grid; place-items: center; padding: 0 0 0.2em;
  background: transparent; border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--font-body); font-weight: 700;
  font-size: var(--fs-body); letter-spacing: 0.02em;
  color: #FBF4E2; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45), 0 0 6px rgba(20, 50, 40, 0.5);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
@media (hover: hover) { .welcome-next:hover { box-shadow: 0 0 0 3px rgba(242, 213, 142, 0.9), 0 0 18px 4px rgba(242, 213, 142, 0.55); } }
.welcome-next:active { transform: translateY(1px); }
.welcome-next:focus-visible { outline: none; box-shadow: none; }
.kbd .welcome-next:focus-visible { box-shadow: 0 0 22px 8px rgba(255, 214, 120, 0.85); }

@media (prefers-reduced-motion: no-preference) {
  .welcome[open] .welcome-inner { animation: card-in 0.3s ease-out; }
  .welcome[open] .welcome-skip { animation: fade-in 0.3s ease-out; }
  .welcome[open]::backdrop { animation: fade-in 0.3s ease-out; }
}

@media (max-width: 600px) and (orientation: portrait) {
  /* Phones: a dedicated tall dialogue panel (929 x 1380) with the portrait built in.
     Positions are percentages of that art. */
  .welcome-inner { width: min(92vw, calc(86vh * 929 / 1380)); width: min(92vw, calc(86dvh * 929 / 1380)); }
  .welcome-copy { left: 18%; top: 42.5%; width: 70%; height: 40%; padding-top: 0; }
  .welcome-next { left: 53.1%; top: 86.2%; width: 29.5%; height: 6.5%; }
}

/* ---------- Vision: design system swatches ---------- */
.card-body h4 { margin-top: 1.1rem; }
.type-list, .swatches { list-style: none; padding: 0; margin: 0 0 1rem; }
.type-list li { margin: 0 0 0.8rem; }
.type-sample { font-size: var(--fs-body); }
.type-display { font-family: var(--font-display); font-weight: 700; }
.type-body { font-weight: 400; }
.swatches li { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.75rem; align-items: start; margin: 0 0 0.85rem; max-width: none; }
.swatch {
  width: 2.6rem; height: 2.6rem; border-radius: 8px;
  border: 2px solid var(--wood-deep);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.swatches code {
  font-family: var(--font-body); font-size: 1em; letter-spacing: 0.02em;
  color: var(--ink-soft); background: var(--parchment-deep);
  border: 1px solid var(--parchment-edge); border-radius: 5px; padding: 0 0.35rem;
}

/* Gold X in the top-right corner of the screen: skips the welcome and closes cards. */
.x-close {
  position: absolute; z-index: 5; top: clamp(0.75rem, 2vw, 1.5rem); right: clamp(0.75rem, 2vw, 1.5rem);
  width: 58px; height: 58px; padding: 6px;
  background: none; border: 0; border-radius: 50%; cursor: pointer;
  filter: drop-shadow(0 2px 3px rgba(20, 15, 5, 0.55));
  transition: filter 0.2s ease, transform 0.15s ease;
}
.x-close svg { display: block; width: 100%; height: 100%; }
@media (hover: hover) { .x-close:hover { filter: drop-shadow(0 2px 3px rgba(20, 15, 5, 0.55)) drop-shadow(0 0 10px rgba(255, 214, 120, 0.85)) drop-shadow(0 0 20px rgba(255, 200, 90, 0.45)); } }
.x-close:active { transform: scale(0.94); }
.x-close:focus-visible { outline: none; box-shadow: none; }
.kbd .x-close:focus-visible { filter: drop-shadow(0 0 10px rgba(255, 214, 120, 0.95)) drop-shadow(0 0 22px rgba(255, 200, 90, 0.6)); }

/* ==========================================================================
   Phones (portrait, up to 600px wide). Tablets and landscape phones use the
   desktop layout. Same content and interactions; phone-specific art, a tall
   card frame, and a phone-sized type scale.
   ========================================================================== */
@media (max-width: 600px) and (orientation: portrait) {
  :root {
    --fs-body: 1.0625rem;  /* 17px, the standard iOS body size */
    --fs-h3: 1.25rem;      /* 20px */
    --fs-h2: 1.375rem;     /* 22px */
  }
  [data-time="day"]   { --letterbox: #646D4D; }   /* matches the bottom edge of the day art */
  [data-time="night"] { --letterbox: #152930; }

  /* The art fits the screen's full width. If it is taller than the screen,
     the page scrolls a little; if shorter, the matching color fills below. */
  .world-frame { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; display: block; }
  .world, [data-time="night"] .world {
    position: relative; left: 0; top: 0;
    width: 100vw; height: calc(100vw * 1672 / 941);
  }
  .world {
    background-image: url("assets/valley-day-mobile.jpg");
    background-image: image-set(url("assets/valley-day-mobile.webp") type("image/webp"), url("assets/valley-day-mobile.jpg") type("image/jpeg"));
  }
  [data-time="night"] .world {
    background-image: url("assets/valley-night-mobile.jpg");
    background-image: image-set(url("assets/valley-night-mobile.webp") type("image/webp"), url("assets/valley-night-mobile.jpg") type("image/jpeg"));
  }

  /* Sign and object positions differ between the day and night phone art,
     so each has its own map (percentages of the 941 x 1672 art). */
  .hot { left: var(--mx); top: var(--my); width: var(--mw); height: var(--mh); }
  [data-time="day"] .sign[data-open="about"]   { --mx:17.85%; --my:29.19%; --mw:22.85%; --mh:4.31%; }
  [data-time="day"] .object[data-open="about"] { --mx:0.00%; --my:30.50%; --mw:45.70%; --mh:26.32%; }
  [data-time="day"] .sign[data-open="explore"]   { --mx:45.91%; --my:41.39%; --mw:21.25%; --mh:3.59%; }
  [data-time="day"] .object[data-open="explore"] { --mx:45.70%; --my:38.28%; --mw:17.00%; --mh:19.74%; }
  [data-time="day"] .sign[data-open="experience"]   { --mx:39.64%; --my:62.32%; --mw:24.34%; --mh:3.77%; }
  [data-time="day"] .object[data-open="experience"] { --mx:31.88%; --my:66.39%; --mw:47.82%; --mh:8.37%; }
  [data-time="day"] .sign[data-open="vision"]   { --mx:79.91%; --my:56.04%; --mw:18.92%; --mh:3.77%; }
  [data-time="day"] .object[data-open="vision"] { --mx:80.77%; --my:46.65%; --mw:18.60%; --mh:27.51%; }
  [data-time="day"] .sign[data-open="contact"]   { --mx:19.45%; --my:77.27%; --mw:20.19%; --mh:3.83%; }
  [data-time="day"] .object[data-open="contact"] { --mx:4.25%; --my:72.67%; --mw:15.94%; --mh:13.46%; }
  [data-time="night"] .sign[data-open="about"]   { --mx:19.77%; --my:30.92%; --mw:19.98%; --mh:3.89%; }
  [data-time="night"] .object[data-open="about"] { --mx:0.00%; --my:27.21%; --mw:41.45%; --mh:29.01%; }
  [data-time="night"] .sign[data-open="explore"]   { --mx:43.78%; --my:41.57%; --mw:20.19%; --mh:3.41%; }
  [data-time="night"] .object[data-open="explore"] { --mx:42.51%; --my:38.88%; --mw:17.00%; --mh:18.54%; }
  [data-time="night"] .sign[data-open="experience"]   { --mx:38.68%; --my:62.02%; --mw:25.40%; --mh:3.65%; }
  [data-time="night"] .object[data-open="experience"] { --mx:31.88%; --my:65.79%; --mw:42.51%; --mh:7.78%; }
  [data-time="night"] .sign[data-open="vision"]   { --mx:79.70%; --my:58.97%; --mw:18.70%; --mh:3.59%; }
  [data-time="night"] .object[data-open="vision"] { --mx:81.83%; --my:49.94%; --mw:17.00%; --mh:24.22%; }
  [data-time="night"] .sign[data-open="contact"]   { --mx:19.13%; --my:77.57%; --mw:20.62%; --mh:3.89%; }
  [data-time="night"] .object[data-open="contact"] { --mx:3.72%; --my:73.27%; --mw:15.41%; --mh:14.06%; }

  /* Cards use the tall frame (1001 x 1517). The name tag's leaf marks were
     removed from this art so section titles fit across the full tag. */
  .card-horizontal .card-frame { width: min(94vw, calc(84vh * 1001 / 1517)); width: min(94vw, calc(84dvh * 1001 / 1517)); margin-top: 2.5rem; }
  .card-horizontal .card-frame { aspect-ratio: 1001 / 1517; background-image: url("assets/card-vertical.webp"); }
  .card-horizontal .card-title { left: 16.5%; top: 3%; width: 27%; height: 3.6%; font-size: 1rem; }
  .card-horizontal .card-body  { left: 13.5%; top: 11.5%; right: 12.5%; bottom: 11%; }
  .card-body { padding-right: 0.35rem; }
  .card-body a { overflow-wrap: anywhere; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .figures li { padding: 0.6rem 0.7rem; }
  .contact-list .label { min-width: 0; width: 100%; }
  .guide-item { grid-template-columns: 32px 1fr; gap: 0.6rem; padding: 0.6rem 0.7rem; }
  .btn { --btn-h: 46px; }
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Typewriter: untyped part of the sentence holds its space but is invisible. */
#welcome-text .untyped { color: transparent; }

/* Desktop sign words: the desktop art has blank signs, so the section names are
   set in the heading font and scale with the art (cqw = 1% of the art's width). */
.sign-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding-bottom: 0.08em;
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.6cqw; line-height: 1; white-space: nowrap;
  color: var(--wood-deep);
  text-shadow: 0 1px 0 rgba(255, 248, 228, 0.6);
  pointer-events: none;
  z-index: 1;   /* above the hover glow, so the word stays crisp */
  transition: color 0.2s ease;
}
/* On hover/focus the word lightens to a warm light brown (#A3784A). The words are
   large and bold, so this still meets contrast guidelines for large text (3.2:1). */
.sign.is-current .sign-label,
.sign:focus-visible .sign-label { color: #A3784A; }
@media (hover: hover) {
  .sign:hover .sign-label,
  .object:hover + .sign .sign-label { color: #A3784A; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .sign-label { display: none; }   /* phone art has the words painted on its signs */
}

/* ---------- Ambient motion layer (built by script.js) ---------- */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.world { will-change: transform; transform-origin: 50% 50%; }

/* Lantern and window glow: an uneven, candle-like flicker. */
.fx-light {
  position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 130, 0.75) 0%, rgba(255, 180, 80, 0.35) 38%, rgba(255, 170, 60, 0) 70%);
  mix-blend-mode: screen;
  animation: flicker var(--d, 3.5s) ease-in-out var(--delay, 0s) infinite;
}
.fx-window { animation-name: flicker-soft; }
@keyframes flicker {
  0%   { opacity: 0.55; transform: translate(-50%, -50%) scale(1); }
  12%  { opacity: 0.85; }
  18%  { opacity: 0.5;  transform: translate(-50%, -50%) scale(0.96); }
  33%  { opacity: 0.9;  transform: translate(-50%, -50%) scale(1.04); }
  47%  { opacity: 0.62; }
  58%  { opacity: 1;    transform: translate(-50%, -50%) scale(1.06); }
  71%  { opacity: 0.58; transform: translate(-50%, -50%) scale(0.98); }
  86%  { opacity: 0.88; }
  100% { opacity: 0.55; transform: translate(-50%, -50%) scale(1); }
}
@keyframes flicker-soft {
  0%, 100% { opacity: 0.35; }
  30% { opacity: 0.55; }
  55% { opacity: 0.4; }
  80% { opacity: 0.6; }
}

/* Pond: rings spreading from the fountain plus a slow moving sheen. */
.fx-pond { position: absolute; clip-path: ellipse(50% 50% at 50% 50%); }
.fx-ripple {
  position: absolute; left: 50%; top: 50%; width: 100%; height: 100%;
  border-radius: 50%; border: 2px solid rgba(220, 250, 255, 0.55);
  transform: translate(-50%, -50%) scale(0.08); opacity: 0;
  mix-blend-mode: screen;
  animation: ripple 6.6s ease-out var(--delay, 0s) infinite;
}
@keyframes ripple {
  0%   { transform: translate(-50%, -50%) scale(0.08); opacity: 0; }
  10%  { opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(0.95); opacity: 0; }
}
.fx-sheen {
  position: absolute; inset: -20%;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0) 0 22px, rgba(225, 252, 255, 0.22) 30px, rgba(255, 255, 255, 0) 40px);
  mix-blend-mode: screen; opacity: 0.6;
  animation: sheen 9s linear infinite;
}
@keyframes sheen { from { transform: translateX(-12%); } to { transform: translateX(12%); } }

/* Waterfall: streaks sliding downward, faded at the edges. */
.fx-falls {
  position: absolute; mix-blend-mode: screen; opacity: 0.7;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0) 0 10px, rgba(230, 252, 255, 0.45) 14px, rgba(255, 255, 255, 0) 22px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0) 0 17px, rgba(210, 245, 255, 0.3) 21px, rgba(255, 255, 255, 0) 30px);
  background-size: 40% 44px, 60% 60px;
  background-position: 15% 0, 80% 0;
  background-repeat: repeat-y;
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, #000 40%, transparent 100%);
  animation: falls 0.9s linear infinite;
}
@keyframes falls { to { background-position: 15% 44px, 80% 60px; } }

/* Glints on the lake: moonlight at night, sun sparkles by day. */
.fx-glint {
  position: absolute; width: 0.9%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(0);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 12%, rgba(255, 255, 255, 0) 45%),
    linear-gradient(90deg, transparent 46%, rgba(255, 255, 255, 0.8) 50%, transparent 54%),
    linear-gradient(0deg, transparent 46%, rgba(255, 255, 255, 0.8) 50%, transparent 54%);
  mix-blend-mode: screen;
  animation: glint var(--d, 3s) ease-in-out var(--delay, 0s) infinite;
}
.fx-glint-night { width: 1.6%; aspect-ratio: 3 / 1;
  background: radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255, 248, 220, 0.9), rgba(255, 248, 220, 0) 70%); }
@keyframes glint {
  0%, 100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  40% { transform: translate(-50%, -50%) scale(0.2); opacity: 0.2; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .fx-glint { width: 1.6%; }
  .fx-glint-night { width: 3%; }
}
@media (prefers-reduced-motion: reduce) { .fx { display: none; } }
