/* Porebada — site styles
   Tokens, type, scenes. No framework. See docs/creative-direction/CREATIVE_DIRECTION.md */

/* ---------- Fonts (self-hosted, SIL OFL) ---------- */
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/instrument-serif-regular.woff") format("woff"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/instrument-serif-italic.woff") format("woff"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/instrument-sans-regular.woff") format("woff"); }

/* ---------- Tokens ---------- */
:root {
  --bone: #f3efe6;
  --bone-2: #e9e3d6;
  --ink: #1c1b19;
  --ink-2: #4a4741;
  --mute: #8a857b;
  --reef: #3a7588;
  --sand: #c9b8a0;
  --deep: #22475c;

  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(20px, 3.4vw, 56px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-reveal: 1.2s;
  --t-settle: 1.6s;
  --shadow-type: 0 1px 18px rgba(28, 27, 25, 0.28);
  --vh: 100vh;
}
@supports (height: 100svh) { :root { --vh: 100svh; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bone); color: var(--ink); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bone);
  color: var(--ink);
  overflow-x: clip;
}
img, picture { display: block; max-width: 100%; }
figure { margin: 0; }
h1, h2, p { margin: 0; font-weight: 400; }
a { color: inherit; text-decoration: none; }
ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--reef); outline-offset: 4px; }
.skip { position: absolute; left: var(--gutter); top: -100px; z-index: 100; padding: 8px 12px; background: var(--ink); color: var(--bone); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.skip:focus { top: 12px; }

/* ---------- Type roles ---------- */
.label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  line-height: 1;
}
.caption { font-family: var(--serif); font-size: 20px; line-height: 1.4; }
.caption-ink { color: var(--ink-2); }
.line {
  font-family: var(--serif);
  font-size: clamp(40px, 5vw, 84px);
  line-height: 1.05;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.line em { font-style: italic; }
.line-sm { font-size: clamp(26px, 2.6vw, 40px); line-height: 1.15; }
.title {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 64px);
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.title-lg { font-size: clamp(48px, 6vw, 96px); letter-spacing: -.02em; text-transform: none; }
.word {
  font-family: var(--serif);
  text-transform: uppercase;
  line-height: .85;
  letter-spacing: 0;
  color: var(--ink);
  pointer-events: none;
  user-select: none;
}

/* Wordmark */
.mark {
  font-family: var(--serif);
  font-size: clamp(72px, 9.5vw, 168px);
  line-height: .86;
  letter-spacing: -.025em;
  color: var(--bone);
  text-shadow: var(--shadow-type);
}
.mark-a, .mark-b { display: block; }
.mark-b { padding-left: 1.6em; font-style: italic; }
.mark-sm { font-size: clamp(56px, 6.5vw, 112px); }
.meta {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  line-height: 1.9;
  color: var(--bone);
  text-shadow: var(--shadow-type);
}
.meta span { display: block; }

/* ---------- Photographs ---------- */
picture.full { position: absolute; inset: 0; }
picture.full img { width: 100%; height: 100%; object-fit: cover; }
.frame { position: relative; overflow: hidden; background: var(--deep); }
.frame picture, .frame img { width: 100%; height: 100%; }
.frame img { object-fit: cover; }
.scrim { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(28,27,25,.22) 0%, rgba(28,27,25,0) 38%); }
.scrim-low { background: linear-gradient(to top, rgba(28,27,25,.30) 0%, rgba(28,27,25,0) 28%); }

/* ---------- Header ---------- */
.head {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--gutter);
  color: var(--bone);
  transition: color .5s ease;
  pointer-events: none;
}
.head > * { pointer-events: auto; }
.head-mark { font-family: var(--serif); font-size: 22px; letter-spacing: -.01em; line-height: 1; text-shadow: var(--shadow-type); }
.head-menu { font-family: var(--sans); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; line-height: 1; padding: 8px 0; text-shadow: var(--shadow-type); }
body[data-tone="light"] .head { color: var(--ink); }
body[data-tone="light"] .head-mark, body[data-tone="light"] .head-menu { text-shadow: none; }

/* ---------- Floating email ---------- */
.mail {
  position: fixed; right: 3.2vw; top: 56%; z-index: 41;
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 0 0 12px;
  border: 1px solid currentColor; border-radius: 999px;
  color: var(--bone);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  max-width: 40px; overflow: hidden;
  transition: max-width .6s var(--ease), color .5s ease, background-color .5s ease;
}
.mail svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.mail-label { font-family: var(--sans); font-size: 11px; letter-spacing: .12em; white-space: nowrap; padding-right: 16px; opacity: 0; transition: opacity .4s ease .15s; }
.mail:hover, .mail:focus-visible { max-width: 240px; }
.mail:hover .mail-label, .mail:focus-visible .mail-label { opacity: 1; }
body[data-tone="light"] .mail { color: var(--ink); background: rgba(243,239,230,.55); }
body[data-tone="dark"] .mail { background: rgba(28,27,25,.18); }

/* ---------- Scenes ---------- */
.scene { position: relative; }

/* 01 Opening */
.s-opening { height: var(--vh); min-height: 560px; overflow: hidden; background: var(--deep); }
.s-opening .mark { position: absolute; left: var(--gutter); bottom: 11vh; z-index: 2; }
.s-opening .meta { position: absolute; right: var(--gutter); bottom: 12vh; z-index: 2; text-align: right; }
.cue {
  position: absolute; left: 50%; bottom: 4vh; transform: translateX(-50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--bone); font-family: var(--sans); font-size: 10px; letter-spacing: .32em; text-transform: uppercase; opacity: .85;
  text-shadow: var(--shadow-type);
}
.cue i { display: block; width: 1px; height: 36px; background: currentColor; opacity: .7; }

/* 02 Land — pinned word behind an offset photograph */
.s-land { height: 170vh; view-timeline-name: --land; }
.s-land-pin { position: sticky; top: 0; height: var(--vh); overflow: hidden; }
.word-land {
  position: absolute; left: var(--gutter); top: 50%; z-index: 1;
  font-size: 19vw; transform: translateY(-50%);
}
.frame-land {
  position: absolute; right: 0; top: 12vh; z-index: 2;
  width: 62vw; height: 76vh;
}
@supports (animation-timeline: view()) {
  .js .word-land { animation: land-slide linear both; animation-timeline: --land; animation-range: entry 0% exit 100%; }
  @keyframes land-slide { from { transform: translate(6vw, -50%); } to { transform: translate(-22vw, -50%); } }
}

/* 03 Coast — rotated wide frame, rule, display line */
.s-coast { padding: 18vh var(--gutter) 22vh; overflow: clip; }
.frame-coast {
  width: 85vw; height: 62vh; min-height: 340px;
  margin-left: 2vw;
  transform: rotate(-2deg);
  transform-origin: 30% 60%;
}
.frame-coast img { object-position: 50% 18%; }
.s-coast .rule { margin: 8vh 0 0 calc(2vw + 0.5em); width: min(40vw, 480px); }
.s-coast .line { margin: 4vh 0 0 calc(2vw + 0.5em); max-width: 12ch; }

/* 04 Haidana — pinned photograph, captions change with scroll */
.s-haidana { height: 300vh; background: var(--deep); }
.s-haidana-pin { position: sticky; top: 0; height: var(--vh); overflow: hidden; }
.s-haidana-text { position: absolute; left: var(--gutter); bottom: 10vh; z-index: 2; color: var(--bone); text-shadow: var(--shadow-type); }
.s-haidana-text .title { margin-bottom: 18px; }
.s-haidana-text .caption { position: absolute; left: 0; top: 100%; margin-top: 0; white-space: nowrap; opacity: 0; transform: translateY(10px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.s-haidana-text .caption.is-on { opacity: 1; transform: none; }
.s-haidana-steps { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr 1fr 1fr; pointer-events: none; }

/* 05 Sea — tall + small offset, then a wide frame that enters from the right */
.s-sea {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 1.5vw;
  padding: 20vh var(--gutter) 10vh; align-items: start;
}
.s-sea .label { grid-column: 1 / 3; grid-row: 1; margin-bottom: 4vh; color: var(--ink-2); }
.frame-reef { grid-column: 1 / 6; grid-row: 2; aspect-ratio: 4 / 5; }
.frame-shore { grid-column: 8 / 13; grid-row: 2; margin-top: 34vh; aspect-ratio: 1.9; }
.s-sea .line-sm { grid-column: 8 / 12; grid-row: 3; margin-top: 4vh; max-width: 14ch; }
.frame-water {
  grid-column: 4 / 13; grid-row: 4; margin-top: 16vh;
  margin-right: calc(-1 * var(--gutter));
  aspect-ratio: 1.655;
}

/* 06 Hills — oversized words clipped by the viewport, panorama, second frame */
.s-hills { padding: 22vh 0 14vh; overflow: clip; }
.word-ridge { position: relative; left: calc(var(--gutter) - .04em); font-size: 26vw; margin-bottom: -.12em; white-space: nowrap; }
.frame-pano { width: 100%; aspect-ratio: 5000 / 1400; }
.s-hills-second { position: relative; margin-top: 14vh; padding: 0 0 6vw var(--gutter); }
.frame-hills { width: 70vw; aspect-ratio: 3900 / 1450; position: relative; z-index: 2; }
.word-sky { position: absolute; right: -.18em; bottom: 0; z-index: 1; font-size: 30vw; line-height: .8; }

/* 07 Porebada — text left, photograph offset right */
.s-village {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 1.5vw; align-items: end;
  padding: 14vh 0 18vh var(--gutter);
}
.frame-village { grid-column: 7 / 13; grid-row: 1; aspect-ratio: 2300 / 2213; }
.s-village-text { grid-column: 1 / 6; grid-row: 1; align-self: end; padding-bottom: 8vh; }
.s-village-text .rule { width: 8vw; margin-bottom: 4vh; }
.s-village-text .title-lg { margin-bottom: 3vh; }

/* 08 Closing — monumental image under a diagonal edge */
.s-closing {
  height: var(--vh); min-height: 560px; overflow: hidden; background: var(--deep);
  clip-path: polygon(0 0, 100% 5vw, 100% 100%, 0 100%);
  margin-top: -1px;
}
.s-closing-text { position: absolute; left: var(--gutter); bottom: 20vh; z-index: 2; }
.meta-stack { margin-top: 24px; }
.foot {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px 0; border-top: 1px solid rgba(243,239,230,.35);
  color: var(--bone); font-size: 12px; letter-spacing: .06em; text-shadow: var(--shadow-type);
}
.foot a:hover, .foot a:focus-visible { border-bottom: 1px solid currentColor; }

/* 404 */
.nf { min-height: var(--vh); display: grid; place-content: center; text-align: center; gap: 18px; padding: 24px; }
.nf h1 { font-family: var(--serif); font-size: clamp(48px, 8vw, 120px); line-height: .9; letter-spacing: -.02em; }
.nf a { font-size: 11px; letter-spacing: .24em; text-transform: uppercase; border-bottom: 1px solid currentColor; padding-bottom: 3px; }

/* Rules that draw themselves */
.rule { height: 1px; background: var(--ink); transform-origin: left; }

/* ---------- Menu overlay ---------- */
.menu { position: fixed; inset: 0; z-index: 50; }
.menu[hidden] { display: none; }
.menu-inner {
  position: absolute; inset: 0;
  background: color-mix(in srgb, var(--ink) 88%, var(--reef));
  color: var(--bone);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto;
  padding: 22px var(--gutter);
}
@supports not (background: color-mix(in srgb, red, blue)) { .menu-inner { background: #1f2d33; } }
.menu-close { position: absolute; top: 22px; right: var(--gutter); font-family: var(--sans); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; padding: 8px 0; }
.menu-nav { grid-column: 1; grid-row: 1; align-self: center; }
.menu-nav a { font-family: var(--serif); font-size: clamp(36px, 5vw, 72px); line-height: 1.12; display: inline-block; padding: 2px 0; color: var(--bone); opacity: .92; transition: opacity .3s, transform .3s; }
.menu-nav a:hover, .menu-nav a:focus-visible { opacity: 1; transform: translateX(6px); }
.menu-foot { grid-column: 1; grid-row: 2; align-self: end; display: flex; gap: 32px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; opacity: .8; }
.menu-photo { grid-column: 2; grid-row: 1 / 3; margin: -22px calc(-1 * var(--gutter)) -22px 4vw; overflow: hidden; }
.menu-photo picture, .menu-photo img { width: 100%; height: 100%; object-fit: cover; }
body.menu-open { overflow: hidden; }
body.menu-open .head, body.menu-open .mail { visibility: hidden; }

/* ---------- Motion (progressive) ---------- */
.js [data-reveal] { opacity: .1; transform: translateY(24px); transition: opacity var(--t-reveal) var(--ease), transform var(--t-reveal) var(--ease); }
.js [data-reveal][data-delay="1"] { transition-delay: .15s; }
.js [data-reveal][data-delay="2"] { transition-delay: .3s; }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal].rule { transform: scaleX(0); opacity: 1; transition: transform 1.4s var(--ease); }
.js [data-reveal].rule.is-in { transform: scaleX(1); }
.js [data-settle] img { transform: scale(1.06); transition: transform var(--t-settle) var(--ease); }
.js [data-settle].is-in img { transform: scale(1); }
.js [data-enter] { transform: translateX(10vw); }
.js [data-enter].is-in { transform: none; }
.js .s-opening picture.full img { animation: hero-settle 2.4s var(--ease) both; }
@keyframes hero-settle { from { transform: scale(1.06); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal], .js [data-enter] { opacity: 1; transform: none; transition: opacity .3s ease; }
  .js [data-reveal].rule { transform: none; }
  .js [data-settle] img, .js .s-opening picture.full img { transform: none; animation: none; transition: none; }
  .js .word-land { animation: none; }
  .frame-coast { transform: none; }
  .s-haidana-text .caption { transition: opacity .3s ease; transform: none; }
  .mail, .menu-nav a { transition: none; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .frame-land { width: 66vw; height: 64vh; top: 18vh; }
  .word-land { font-size: 22vw; }
  .frame-shore { margin-top: 26vh; grid-column: 8 / 13; }
  .frame-reef { grid-column: 1 / 7; }
  .s-sea .line-sm { grid-column: 7 / 12; }
  .s-village-text { grid-column: 1 / 6; }
  .frame-village { grid-column: 6 / 13; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  :root { --gutter: 20px; }
  .head { padding: 18px var(--gutter); }
  .head-mark { font-size: 20px; }

  .mail { right: 16px; top: auto; bottom: 88px; height: 36px; max-width: 36px; padding-left: 10px; }
  .mail:hover, .mail:focus-visible { max-width: 36px; }
  .mail-label { display: none; }

  .mark { font-size: clamp(64px, 20vw, 88px); }
  .mark-b { padding-left: 1.2em; }
  .s-opening .mark { bottom: 22vh; }
  .s-opening .meta { left: var(--gutter); right: auto; bottom: 13vh; text-align: left; }
  .cue { bottom: 3vh; }

  .s-land { height: auto; padding: 16vh 0 6vh; }
  .s-land-pin { position: static; height: auto; overflow: visible; }
  .word-land { position: static; transform: none; font-size: 31vw; margin: 0 0 -.06em var(--gutter); }
  .frame-land { position: static; width: 100%; height: auto; aspect-ratio: 1900 / 2300; }
  .js .word-land { animation: none; }

  .s-coast { padding: 10vh 0 16vh; }
  .frame-coast { width: 100%; height: auto; aspect-ratio: 4 / 5; margin: 0; transform: none; }
  .s-coast .rule { margin: 6vh 0 0 var(--gutter); width: 40vw; }
  .s-coast .line { margin: 3vh var(--gutter) 0; font-size: clamp(34px, 9.5vw, 44px); }

  .s-haidana { height: 260vh; }
  .s-haidana-text { bottom: 12vh; right: var(--gutter); }
  .s-haidana-text .caption { white-space: normal; font-size: 18px; }

  .s-sea { display: block; padding: 14vh 0 4vh; }
  .s-sea .label { margin: 0 0 3vh var(--gutter); }
  .frame-reef { width: 100%; aspect-ratio: 4 / 5; }
  .frame-shore { width: 72vw; margin: -8vh 0 0 auto; aspect-ratio: 1.9; position: relative; z-index: 2; }
  .s-sea .line-sm { margin: 5vh var(--gutter) 0; max-width: 100%; }
  .frame-water { margin: 8vh 0 0 var(--gutter); width: calc(100% - var(--gutter)); aspect-ratio: 1.3; }

  .s-hills { padding: 14vh 0 8vh; }
  .word-ridge { font-size: 42vw; left: calc(var(--gutter) - .04em); margin-bottom: -.04em; }
  .frame-pano { aspect-ratio: 5000 / 1400; }
  .s-hills-second { margin-top: 8vh; padding-left: 0; }
  .frame-hills { width: 100%; aspect-ratio: 1800 / 1653; }
  .word-sky { font-size: 46vw; right: -.12em; bottom: 0; }
  .s-hills-second { padding-bottom: 12vw; }
  .s-closing .scrim-low { background: linear-gradient(to top, rgba(28,27,25,.42) 0%, rgba(28,27,25,0) 55%); }

  .s-village { display: block; padding: 12vh 0 10vh; }
  .s-village-text { padding: 0 var(--gutter) 6vh; }
  .s-village-text .rule { width: 24vw; margin-bottom: 3vh; }
  .frame-village { aspect-ratio: 1800 / 1913; }
  .s-closing-text { bottom: 20vh; }

  .s-closing { clip-path: polygon(0 0, 100% 9vw, 100% 100%, 0 100%); }
  .s-closing-text { bottom: 22vh; }
  .foot { flex-direction: column; align-items: flex-start; gap: 6px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }

  .menu-inner { grid-template-columns: 1fr; }
  .menu-photo { display: none; }
  .menu-nav a { font-size: clamp(40px, 12vw, 56px); }
  .menu-foot { flex-direction: column; gap: 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}

@media (max-width: 767px) and (max-height: 640px) {
  .s-opening .mark { bottom: 24vh; }
  .mark { font-size: 17vw; }
}
