:root {
  color-scheme: dark;
  --ink: #060c13;
  --ink-soft: #09111b;
  --silver: #d9e1e6;
  --silver-dim: #98a6b1;
  --silver-faint: #71818d;
  --gold: #b79a62;
  --gold-bright: #e2c58b;
  --rule: rgba(174, 192, 204, 0.17);
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --page-gutter: clamp(1.75rem, 6vw, 7.5rem);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-color: #35404a var(--ink);
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--silver);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(199, 163, 99, 0.28); color: #f0e6d2; }
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: #35404a; border: 2px solid var(--ink); border-radius: 10px; }

a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 1px solid var(--gold-bright); outline-offset: 0.45rem; }

#liminal-light {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 8, 13, 0.19), transparent 48%, rgba(3, 8, 13, 0.08)),
    linear-gradient(180deg, rgba(3, 8, 13, 0.12), transparent 28%, rgba(3, 8, 13, 0.12));
}

.site-header, main, .site-footer { position: relative; z-index: 2; }

.site-header {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: calc(2rem + env(safe-area-inset-top)) var(--page-gutter) 2rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.wordmark { color: #cbd5dc; letter-spacing: 0.22em; transition: color 350ms ease; }
.wordmark:hover { color: var(--gold-bright); }
.location { margin: 0; color: var(--silver-dim); }
.location span { margin: 0 0.45rem; color: var(--gold); }

.hero { position: relative; min-height: 100vh; min-height: 100svh; padding: 0 var(--page-gutter); }

.hero-copy {
  position: absolute;
  top: 21%;
  left: var(--page-gutter);
  max-width: 52rem;
}

.eyebrow {
  margin: 0 0 2.25rem;
  color: var(--silver-dim);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  line-height: 1.5;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 0.5rem;
  color: #dce3e7;
  font-family: var(--serif);
  font-size: clamp(4.4rem, 10vw, 9.5rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.98;
  text-shadow: 0 0 3rem rgba(164, 190, 207, 0.06);
}

.pronunciation {
  margin: 1.15rem 0 0 0.25rem;
  color: var(--silver-dim);
  font-family: var(--serif);
  font-size: clamp(0.9rem, 1.25vw, 1.08rem);
  letter-spacing: 0.075em;
}

.etymology-mark {
  margin: 2.5rem 0 0 0.25rem;
  color: #a3b0ba;
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.etymology-mark span { margin: 0 0.65rem; color: var(--gold); }

.hero-note {
  position: absolute;
  right: var(--page-gutter);
  bottom: 19%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: rgba(175, 189, 199, 0.56);
  font-family: var(--serif);
  font-size: 0.76rem;
  font-style: italic;
  letter-spacing: 0.045em;
  line-height: 1.85;
}

.scroll-cue {
  position: absolute;
  bottom: calc(2.25rem + env(safe-area-inset-bottom));
  left: var(--page-gutter);
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--silver-faint);
  font-size: 0.6rem;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  transition: color 300ms ease;
}

.scroll-cue i { position: relative; display: block; width: 2.5rem; height: 1px; overflow: hidden; background: var(--rule); }
.scroll-cue i::after { position: absolute; inset: 0; background: var(--gold); content: ""; transform: translateX(-70%); transition: transform 500ms ease; }
.scroll-cue:hover { color: var(--silver); }
.scroll-cue:hover i::after { transform: translateX(0); }

.section { position: relative; min-height: 100vh; min-height: 100svh; padding: 9rem var(--page-gutter); }

.section-index {
  position: absolute;
  top: 4rem;
  left: var(--page-gutter);
  color: var(--silver-faint);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.threshold { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.76fr); align-items: center; }
.threshold-copy { grid-column: 2; max-width: 34rem; padding-left: clamp(0rem, 4vw, 4rem); }

h2 {
  color: #d4dde2;
  font-family: var(--serif);
  font-size: clamp(2.75rem, 5.5vw, 5.8rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.threshold h2 { margin-bottom: 2.75rem; }
.statement { max-width: 29rem; margin-bottom: 2rem; color: #bcc8cf; font-family: var(--serif); font-size: clamp(1.1rem, 1.65vw, 1.38rem); line-height: 1.65; }
.annotation { max-width: 27rem; margin: 0; color: var(--silver-dim); font-size: 0.78rem; line-height: 1.9; }
.origins { min-height: auto; padding-top: 12rem; padding-bottom: 12rem; }
.origins-heading { width: 52%; margin-bottom: 9rem; }
.origins-heading h2 { margin: 0; }
.origin-list { margin-left: clamp(0rem, 12vw, 13rem); }

.origin {
  display: grid;
  grid-template-columns: minmax(9rem, 0.65fr) minmax(18rem, 1fr);
  gap: clamp(2rem, 7vw, 8rem);
  max-width: 65rem;
  padding: 3.25rem 0 3.75rem;
  border-top: 1px solid var(--rule);
}

.origin:last-child { border-bottom: 1px solid var(--rule); }
.origin-key { position: relative; padding-left: 2rem; }
.origin-number { position: absolute; top: 0.35rem; left: 0; color: var(--gold); font-family: var(--serif); font-size: 0.65rem; }
.origin h3 { margin-bottom: 1rem; color: #cbd5dc; font-family: var(--serif); font-size: clamp(1.6rem, 2.3vw, 2.25rem); font-weight: 400; letter-spacing: -0.025em; line-height: 1.2; }
.root { margin: 0; color: var(--silver-faint); font-size: 0.63rem; letter-spacing: 0.17em; text-transform: uppercase; }
.origin-text { max-width: 31rem; color: #a9b6bf; font-size: 0.88rem; line-height: 1.95; }
.origin-text > p:first-child { margin-bottom: 1.6rem; }
.origin-note { margin: 0; color: #d1c5ae; font-family: var(--serif); font-size: 0.92rem; font-style: italic; }

.observer { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(16rem, 0.55fr); gap: 5rem; align-items: center; }
.observer-copy { max-width: 55rem; }
.observer-kicker { margin-bottom: 2.5rem; color: var(--gold); font-size: 0.62rem; letter-spacing: 0.25em; text-transform: uppercase; }
.observer h2 { margin: 0; font-size: clamp(2.7rem, 5vw, 5.2rem); }
.singapore-note { align-self: end; max-width: 20rem; margin-bottom: 8vh; padding-left: 1.5rem; border-left: 1px solid rgba(183, 154, 98, 0.38); color: var(--silver-dim); font-size: 0.75rem; line-height: 1.9; }
.singapore-note p:last-child { margin: 1.5rem 0 0; color: #b8c3ca; }

.site-footer {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 5rem;
  padding: 7rem var(--page-gutter) calc(3rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  background: rgba(4, 9, 15, 0.44);
}

.footer-name { margin-bottom: 0.65rem; color: #ccd6dc; font-family: var(--serif); font-size: 1.6rem; letter-spacing: -0.02em; }
.footer-signoff p:last-child { color: var(--silver-faint); font-family: var(--serif); font-size: 0.78rem; font-style: italic; }
.external-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
.external-links a { display: flex; min-width: 0; flex-direction: column; gap: 0.45rem; align-self: start; color: #bac6cd; font-size: 0.75rem; letter-spacing: 0.06em; transition: color 300ms ease; }
.external-links a::before { width: 1.6rem; height: 1px; margin-bottom: 0.85rem; background: #8d774e; content: ""; transform-origin: left; transition: width 400ms ease, background-color 400ms ease; }
.external-links a:hover { color: #eee3cf; }
.external-links a:hover::before { width: 3rem; background: var(--gold-bright); }
.handle { overflow-wrap: anywhere; color: var(--silver-faint); font-size: 0.63rem; letter-spacing: 0; }
.colophon { grid-column: 1 / -1; margin: 5rem 0 0; color: var(--silver-faint); font-size: 0.55rem; letter-spacing: 0.18em; text-transform: uppercase; }

.motion-ok .hero-copy, .motion-ok .hero-note, .motion-ok .scroll-cue { opacity: 0; animation: arrive 1800ms cubic-bezier(0.2, 0.65, 0.25, 1) forwards; }
.motion-ok .hero-note { animation-delay: 700ms; }
.motion-ok .scroll-cue { animation-delay: 1100ms; }
.motion-ok .reveal { opacity: 0; transform: translateY(1.5rem); transition: opacity 1400ms cubic-bezier(0.2, 0.65, 0.25, 1), transform 1400ms cubic-bezier(0.2, 0.65, 0.25, 1); }
.motion-ok .reveal.is-visible { opacity: 1; transform: translateY(0); }

@keyframes arrive {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tablet and narrow landscape: move text away from the off-centre bead,
   tighten the horizontal field, and avoid a half-desktop/half-mobile layout. */
@media (max-width: 1100px) {
  :root { --page-gutter: clamp(2rem, 5vw, 4rem); }
  .hero-copy { top: 19%; }
  h1 { font-size: clamp(4.3rem, 11vw, 7.5rem); }
  .hero-note { bottom: 14%; }
  .threshold { grid-template-columns: 0.85fr 1.15fr; }
  .origin-list { margin-left: 5vw; }
  .observer { grid-template-columns: 1fr; align-content: center; gap: 4rem; }
  .singapore-note { align-self: auto; justify-self: end; margin-bottom: 0; }
  .site-footer { grid-template-columns: 1fr; gap: 3rem; }
}

/* Portrait phones: recompose vertically rather than shrinking the desktop.
   The title occupies the upper field; the canvas line and bead sit near the
   lower third, with reading controls kept inside the safe areas. */
@media (max-width: 700px) {
  :root { --page-gutter: max(1.5rem, env(safe-area-inset-left)); }
  .site-header { align-items: flex-start; padding-top: calc(1.5rem + env(safe-area-inset-top)); font-size: 0.57rem; }
  .location { max-width: 7rem; text-align: right; }
  .location span { margin: 0 0.2rem; }
  .hero-copy { top: 17%; right: var(--page-gutter); }
  .eyebrow { max-width: 15rem; margin-bottom: 1.6rem; font-size: 0.56rem; line-height: 1.8; }
  h1 { font-size: clamp(3.55rem, 17vw, 5.6rem); letter-spacing: -0.06em; }
  .pronunciation { margin-top: 1rem; font-size: 0.82rem; }
  .etymology-mark { margin-top: 1.75rem; font-size: 0.56rem; }
  .hero-note { display: none; }
  .scroll-cue { bottom: calc(1.5rem + env(safe-area-inset-bottom)); font-size: 0.52rem; }
  .section { min-height: 100svh; padding-top: 8rem; padding-bottom: 8rem; }
  .section-index { top: 3rem; }
  .threshold { display: flex; align-items: flex-end; }
  .threshold-copy { width: 100%; max-width: 28rem; padding: 0 0 5vh; }
  h2 { font-size: clamp(2.65rem, 12vw, 4.2rem); }
  .threshold h2 { margin-bottom: 2rem; }
  .statement { font-size: 1.05rem; }
  .origins { min-height: auto; padding-top: 9rem; padding-bottom: 9rem; }
  .origins-heading { width: 100%; margin-bottom: 5rem; }
  .origin-list { margin-left: 0; }
  .origin { grid-template-columns: 1fr; gap: 2rem; padding: 2.75rem 0 3rem; }
  .origin-key { padding-left: 1.75rem; }
  .origin h3 { margin-bottom: 0.75rem; font-size: 1.8rem; }
  .origin-text { font-size: 0.84rem; }
  .observer { display: flex; flex-direction: column; justify-content: center; gap: 4rem; }
  .observer h2 { font-size: clamp(2.5rem, 11vw, 3.8rem); }
  .singapore-note { align-self: flex-end; max-width: 17rem; }
  .site-footer { gap: 3.5rem; padding-top: 5rem; }
  .external-links { grid-template-columns: 1fr; gap: 2.5rem; }
  .external-links a { display: grid; grid-template-columns: 5rem minmax(0, 1fr); column-gap: 1rem; }
  .external-links a::before { grid-column: 1 / -1; }
  .handle { font-size: 0.68rem; }
  .colophon { margin-top: 2rem; }
}

@media (max-height: 600px) and (min-width: 701px) {
  .hero-copy { top: 20%; }
  .eyebrow { margin-bottom: 1rem; }
  h1 { font-size: clamp(3.8rem, 9vw, 6.5rem); }
  .etymology-mark { margin-top: 1.25rem; }
  .hero-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
  .motion-ok .hero-copy, .motion-ok .hero-note, .motion-ok .scroll-cue, .motion-ok .reveal { opacity: 1; transform: none; }
}
