/* Beyond Being: homepage.
   Palette: the Āmārā set (night navy, dark blue, champagne, cream).
   Rule of the page: nothing is boxed. Panels are clearings where the lines stop. */

:root {
  --navy: #101924;
  --blue: #173047;
  --cream: #F7F2E9;
  --champagne: #D6AF78;

  /* These five are driven by scroll (js/home.js): night at the top, paper in the middle, night again. */
  --bg: #101924;
  --fg: #F7F2E9;
  --line: #D6AF78;
  --accent: #D6AF78;
  --pline: #D6AF78;

  --serif: "Noto Serif Display", "Cormorant Garamond", Georgia, serif;
  --sans: Inter, system-ui, "Segoe UI", sans-serif;
  --gutter: clamp(18px, 4.4vw, 64px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.5 var(--sans);
  overflow-x: clip;
}
p { margin: 0; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px var(--gutter);
  font: 500 10.5px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg); pointer-events: none;
}
.top-title { font: italic 400 15px/1 var(--serif); letter-spacing: .03em; text-transform: none; opacity: 0; transition: opacity .5s; }
.past-hero .top-title { opacity: 1; }

/* the thread */
.thread { position: fixed; left: calc(var(--gutter) * .42); top: 0; bottom: 0; width: 1px; z-index: 15; pointer-events: none; }
.thread-line { position: absolute; inset: 14vh 0; background: var(--line); opacity: .4; }
.thread-bead { position: absolute; left: -3px; top: calc(14vh + var(--p, 0) * 72vh); width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.thread-label {
  position: absolute; left: -7px; top: 18px; writing-mode: vertical-rl; white-space: nowrap;
  font: italic 400 13px/1.5 var(--serif); letter-spacing: .03em; color: var(--fg);
  opacity: 0; transition: opacity .5s;
}
.has-carry .thread-label { opacity: .85; }

/* LAYER 1: sky */
.sky { position: relative; }
.field { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* stroke-opacity, never opacity: opacity on a path this large makes the browser allocate a full-size layer for each one */
.field path { fill: none; stroke: #D6AF78; stroke-width: .7; stroke-opacity: .5; }
.field path.low { stroke: var(--line); } /* only the band just above the wall has to change colour with the light */

/* minmax(0, 1fr): the column must never grow to fit the wordmark, or the wordmark could not be fitted to the column */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 0 var(--gutter); }
.hero-clearing { width: min(84%, 1400px); padding: clamp(10px, 2vw, 26px) 0; }
.wordmark {
  margin: 0; text-align: center; white-space: nowrap;
  font: 400 11vw/.84 var(--serif); letter-spacing: -.012em; text-transform: uppercase;
}
.wm-in { display: inline-block; }
.hero-row {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: baseline;
  margin-top: clamp(18px, 2.4vw, 34px);
  font: 500 10.5px/1.5 var(--sans); letter-spacing: .22em; text-transform: uppercase;
}
.hero-row span:last-child { text-align: right; }
.hero-sub { font: italic 300 clamp(1.05rem, 1.75vw, 1.6rem)/1.3 var(--serif); letter-spacing: .01em; text-transform: none; color: var(--accent); text-align: center; }

.amara { position: relative; height: max(105vh, 700px); margin: 0 var(--gutter); }
.amara-mark { position: absolute; left: 4%; top: 0; font: 300 clamp(1.7rem, 3.1vw, 2.7rem)/1 var(--serif); letter-spacing: .42em; margin-right: -.42em; }
.take { position: absolute; left: 9%; top: 29%; font: 500 10px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--accent); }
.voices { list-style: none; margin: 0; padding: 0; }
.voices li { position: absolute; left: var(--x); top: var(--y); }
.voices li:nth-child(1) { --x: 36%; --y: 9%; }
.voices li:nth-child(2) { --x: 9%; --y: 36%; }
.voices li:nth-child(3) { --x: 54%; --y: 45%; }
.voices li:nth-child(4) { --x: 22%; --y: 66%; }
.voices li:nth-child(5) { --x: 60%; --y: 80%; }
.voice {
  all: unset; display: block; cursor: pointer; max-width: min(22ch, 74vw);
  font: italic 300 clamp(1.3rem, 2.35vw, 2.15rem)/1.22 var(--serif); color: var(--fg);
  transition: color .3s, opacity .4s;
}
.voice::before { content: "\201C"; }
.voice::after { content: "\201D"; }
.voice:hover, .voice[aria-pressed="true"] { color: var(--accent); }
.voice:focus-visible { outline: 1px solid var(--accent); outline-offset: 8px; }
.has-carry .voice[aria-pressed="false"] { opacity: .42; }
.has-carry .voice[aria-pressed="false"]:hover { opacity: 1; }

.explore { display: inline-flex; flex-direction: column; gap: 12px; text-decoration: none; color: var(--fg); }
.explore-k { font: 500 10px/1 var(--sans); letter-spacing: .24em; color: var(--accent); }
.explore-t { display: inline-flex; align-items: center; gap: 16px; font: 500 12px/1 var(--sans); letter-spacing: .26em; text-transform: uppercase; }
.arr { width: 60px; height: 10px; flex: none; transition: transform .35s; }
.arr path { fill: none; stroke: var(--accent); stroke-width: 1; }
.explore:hover .arr, .explore:focus-visible .arr { transform: translateX(8px); }
.amara .explore { position: absolute; right: 4%; top: 13%; }

.wall { display: block; position: relative; width: 100%; height: 170px; }
.wall path, .wall circle { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.wall .inner { stroke-width: .7; stroke-opacity: .6; }

/* LAYER 2: street */
.street { position: relative; height: 340vh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.scene { position: absolute; inset: 0; opacity: var(--scene, 1); }
.strip { position: absolute; display: flex; transform-origin: 0 0; will-change: transform; }
.strip img { display: block; flex: none; height: 100%; width: auto; user-select: none; -webkit-user-drag: none; }
.persp { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.persp path, .persp circle { fill: none; stroke: var(--pline); stroke-width: .9; stroke-linecap: round; }
.persp .pl { stroke-opacity: .78; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--draw, 1)); }
.persp .soft { stroke-opacity: .36; }

.sign { position: absolute; right: 6%; top: 49%; width: min(34vw, 430px); display: grid; gap: 46px; justify-items: start; }
.board { position: relative; width: 100%; padding: 22px 18px 20px; text-align: center; }
.board-ink { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.board-ink path { fill: none; stroke: var(--pline); stroke-width: 1.2; stroke-linecap: round; }
.board-si { font: 600 clamp(2rem, 4.3vw, 3.7rem)/1.2 "Noto Sans Sinhala", "Nirmala UI", sans-serif; letter-spacing: .03em; }
.board-row { display: flex; justify-content: center; align-items: baseline; gap: .7em; margin-top: .1em; font: 600 clamp(1.45rem, 3vw, 2.6rem)/1.25 "Noto Sans Tamil", "Nirmala UI", sans-serif; }
.board-en { font: 500 .92em/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; margin-right: -.2em; }
.board-carry { margin-top: 12px; font: italic 400 clamp(.95rem, 1.35vw, 1.2rem)/1.3 var(--serif); color: var(--accent); }
.sign .explore { margin-left: calc(5% + 26px); } /* sits between the two posts, clear of both */

/* LAYER 3: night */
.night { position: relative; height: max(150vh, 1000px); }
.stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.stars path { fill: none; stroke: var(--pline); stroke-linecap: round; }
.stars .ray { stroke-width: .9; stroke-opacity: .78; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--q, 1)); }
.stars .edge { stroke-width: .6; stroke-opacity: calc(.6 * var(--q2, 1)); }
.stars .spec { stroke-dasharray: 3 5; }
.stars .node { opacity: var(--q2, 1); }
.stars .dot { fill: var(--line); }
.stars .halo { fill: var(--line); opacity: .16; }
.stars .mote { fill: var(--fg); opacity: calc(.28 * var(--q, 1)); }
.stars .ring { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.stars .brick { fill: none; stroke: var(--line); stroke-width: 1.1; }
.stars text { font: 500 10.5px var(--sans); letter-spacing: .16em; text-transform: uppercase; fill: var(--fg); opacity: .78; }
.stars text.mine { font: italic 400 15px var(--serif); letter-spacing: .02em; text-transform: none; fill: var(--accent); opacity: 1; }

.whatif { position: absolute; right: 6%; bottom: 13%; display: grid; gap: 30px; justify-items: start; }
.whatif-t { font: italic 300 clamp(2.6rem, 6.2vw, 5.4rem)/1 var(--serif); }

.foot { display: flex; justify-content: space-between; gap: 16px; padding: 30px var(--gutter); font: 500 10px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--fg); opacity: .6; }

@media (max-width: 700px) {
  .wm-in > span { display: block; }
  .wordmark { line-height: .9; }
  .hero-row { grid-template-columns: 1fr; text-align: center; gap: 10px; }
  .hero-row span:first-child, .hero-row span:last-child { text-align: center; }
  .thread-label { display: none; }
  .amara { height: max(118vh, 760px); }
  .amara-mark { left: 6%; top: 1%; }
  .amara .explore { right: 4%; top: 2%; }
  .take { left: 8%; top: 17%; }
  .voices li:nth-child(1) { --x: 8%; --y: 23%; }
  .voices li:nth-child(2) { --x: 20%; --y: 38%; }
  .voices li:nth-child(3) { --x: 8%; --y: 55%; }
  .voices li:nth-child(4) { --x: 24%; --y: 68%; }
  .voices li:nth-child(5) { --x: 10%; --y: 84%; }
  .sign { left: 8%; right: 8%; width: auto; top: 54%; gap: 34px; }
  .stars text { font-size: 9.5px; letter-spacing: .12em; }
  .stars text.mine { font-size: 13.5px; }
  .whatif { right: 8%; bottom: 7%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Revision 2 (after review): no phrases, no cloud wall, a drawn perspective instead of the flipped strip ---------- */
.top { justify-content: flex-end; }
.hero-sub { display: block; margin-top: clamp(18px, 2.4vw, 34px); }

.amara { height: max(100vh, 640px); }
.amara-mark { left: 4%; top: 30%; font-size: clamp(3.4rem, 10.5vw, 9.5rem); letter-spacing: .3em; margin-right: -.3em; }
.amara .explore { top: auto; right: 4%; bottom: 14%; }

.street { height: 230vh; }
.scene { transform-origin: 64% 44%; will-change: transform; }
.scene svg { position: absolute; color: var(--pline); overflow: visible; }
.scene svg .con { stroke-opacity: .38; }
.scene svg .cloud { stroke-opacity: .8; }
.street .explore { position: absolute; right: 6%; bottom: 9%; }

@media (max-width: 700px) {
  .amara { height: max(100vh, 620px); }
  .amara-mark { left: 6%; top: 30%; }
  .amara .explore { top: auto; right: 6%; bottom: 12%; }
  .street .explore { right: 8%; bottom: 7%; }
}

/* Soften the join between the sky's lines and the street drawing until one continuous hand drawing replaces both. */
.field { -webkit-mask-image: linear-gradient(#000 calc(100% - 300px), transparent); mask-image: linear-gradient(#000 calc(100% - 300px), transparent); }
.scene { -webkit-mask-image: linear-gradient(transparent, #000 22%); mask-image: linear-gradient(transparent, #000 22%); }

/* Revision 3: the constellation is unlabelled points of light that turn slowly */
.stars line { stroke: var(--pline); stroke-linecap: round; }
.stars line.ray { stroke-width: .9; stroke-opacity: .7; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--q, 1)); }
.stars line.edge { stroke-width: .5; stroke-opacity: calc(.42 * var(--q2, 1)); }
.stars .node { opacity: 1; }
.stars .node circle { opacity: var(--q2, 1); }


/* Revision 4: the hand-drawn sheet and the Kandy drawing replace the generated lines.
   Each drawing is white line art on transparent; the page colours it, so the light can change it. */
.art { position: absolute; inset: 0; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.field { position: absolute; inset: 0; pointer-events: none; -webkit-mask-image: none; mask-image: none; }
.art-sky { background: var(--line); -webkit-mask-image: url(../assets/art/sky.png); mask-image: url(../assets/art/sky.png); -webkit-mask-size: cover; mask-size: cover; -webkit-mask-position: top center; mask-position: top center; opacity: .78; }
.scene { inset: auto; -webkit-mask-image: none; mask-image: none; }
.art-street { background: var(--pline); -webkit-mask-image: url(../assets/art/street.png); mask-image: url(../assets/art/street.png); opacity: .62; }
.art-kandy { background: var(--pline); -webkit-mask-image: url(../assets/art/kandy.png); mask-image: url(../assets/art/kandy.png); opacity: .92; }

/* a clearing is a patch where the lines stop: it is the page colour, with a wide soft-edged margin */
.hero-clearing, .amara-mark, .amara .explore, .street .explore { background: var(--bg); box-shadow: 0 0 0 clamp(14px, 2vw, 30px) var(--bg); }
.hero-clearing { border-radius: 2px; }

.stage { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--edge, 0px)); mask-image: linear-gradient(to bottom, transparent 0, #000 var(--edge, 0px)); }
.art-street { opacity: .42; }


/* Revision 5: the sheet is one whole drawing. The sky shows its upper part and the street its lower part, with no cut. */
.sky { height: var(--sky-h, 200vh); }
.amara { height: calc(var(--sky-h, 200vh) - 100svh); }
.field { overflow: hidden; }
.art { inset: auto; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-position: 0 0; mask-position: 0 0; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; background: var(--pline); }
.art.sheet { -webkit-mask-image: url(../assets/art/sheet.png); mask-image: url(../assets/art/sheet.png); opacity: .88; }
.art.kandy { -webkit-mask-image: url(../assets/art/kandy.png); mask-image: url(../assets/art/kandy.png); opacity: .92; }
.street { height: 100vh; height: 100svh; }
.stage { position: relative; height: 100vh; height: 100svh; overflow: hidden; -webkit-mask-image: none; mask-image: none; }
.scene { position: absolute; inset: 0; transform: none !important; overflow: hidden; opacity: 1; }
.stars { overflow: visible; }
.stars path.ray { fill: none; }


/* Revision 6: the drawing is a stack of layers behind the sky and the street */
.world { position: relative; }
.world > section { position: relative; z-index: 1; }
.art-stack { position: absolute; top: 0; z-index: 0; pointer-events: none; }
.art-stack .art { position: absolute; inset: 0; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; opacity: 1; background: var(--pline); }
.art.layer-persp { -webkit-mask-image: url(../assets/art/persp.png); mask-image: url(../assets/art/persp.png); opacity: .9; }
.art.layer-swirls { -webkit-mask-image: url(../assets/art/sky.png);   mask-image: url(../assets/art/sky.png);   opacity: .9; }
.art.layer-occ { -webkit-mask-image: url(../assets/art/occ.png);   mask-image: url(../assets/art/occ.png);   background: var(--bg); }
.art.layer-board { -webkit-mask-image: url(../assets/art/board.png); mask-image: url(../assets/art/board.png); }
.art.layer-kandy { -webkit-mask-image: url(../assets/art/kandy.png); mask-image: url(../assets/art/kandy.png); opacity: .92; }
.stage { overflow: visible; }

/* On a narrow screen the drawing is wider than the screen (it is cropped to the middle); it must never widen the page */
.world { overflow-x: clip; }
html { overflow-x: clip; }
