/* Fatima: black water below a lit frame.  Design: docs/DESIGN.md.
   Two numbers on <html> are set by assets/water.js: --unrest (0..1, what the title and the frame's glow answer to)
   and --stone (0..2: 0 not there, 0..1 surfacing, 1 resting, 1..2 lifted out).  States on <html>: is-on (permanent),
   is-playing (follows the video), is-answered (1:56 to 2:55, follows the clock), is-found (past 4:29, permanent),
   is-kin (past 5:01, permanent), is-still (reduced motion).  Without JavaScript the water is the still mirror picture
   and the small lights are lit. */

:root {
  --night: #020405; --deep: #06141b; --teal: #006581; --teal-lit: #62bcd9;
  --copper: #e08000; --copper-lit: #f2a54a; --paper: #f6e8d3; --sand: #dfc6ad; --sky: #91d4f1;
  --unrest: .35; --stone: 0;
  /* the frame is as wide as the screen's height allows while leaving about 200px of water in the first screen (R4) */
  --fw: min(94vw, max(300px, min(calc((100vh - 372px) * 16 / 9), 1120px)));
  --fh: calc(var(--fw) * 9 / 16);
  --wh: clamp(190px, calc(var(--fh) * .62), 400px);
  --sw: clamp(96px, calc(var(--fw) * .17), 190px);
}
@supports (height: 100svh) {
  :root { --fw: min(94vw, max(300px, min(calc((100svh - 372px) * 16 / 9), 1120px))); }
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--night); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: linear-gradient(#010203, var(--night) 640px); color: var(--paper);
  font: 400 17px/1.55 Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--teal-lit); }
:focus-visible { outline: 2px solid var(--copper-lit); outline-offset: 4px; }


/* ---- the top bar and the head ---- */
.top { display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 16px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font: 600 12px/1 Figtree, sans-serif; letter-spacing: .22em; text-transform: uppercase; color: var(--sand); text-decoration: none; }
.brand:hover { color: var(--paper); }

.head { padding: 0 16px 14px; text-align: center; }
.title {
  margin: 0; font: 400 clamp(58px, 9.4vh, 100px)/1.04 Playball, "Brush Script MT", cursive; letter-spacing: .01em;
  color: var(--paper); text-shadow: 0 0 28px rgba(0, 101, 129, .55), 0 0 2px rgba(0, 0, 0, .8);
}
.sub { margin: .35em 0 0; font: 600 13px/1.4 Figtree, sans-serif; letter-spacing: .26em; text-transform: uppercase; color: var(--teal-lit); }

/* M4: the letters hunt in proportion to the unrest, and settle one by one when the stone is out (JS sets --lk per letter) */
.title .ch { display: inline-block; animation: hunt 5.3s ease-in-out infinite alternate; animation-delay: calc(var(--i, 0) * -.83s); }
.title .ch:nth-child(1) { --ux: 2.4;  --uy: -1.8; --ur: -1.4; }
.title .ch:nth-child(2) { --ux: -2;   --uy: 2.2;  --ur: 1.1; }
.title .ch:nth-child(3) { --ux: 2.8;  --uy: 1.3;  --ur: -.9; }
.title .ch:nth-child(4) { --ux: -2.6; --uy: -2;   --ur: 1.4; }
.title .ch:nth-child(5) { --ux: 1.8;  --uy: 2.6;  --ur: -1.2; }
.title .ch:nth-child(6) { --ux: -2.2; --uy: -1.5; --ur: 1; }
@keyframes hunt {
  from { translate: calc(var(--ux, 0) * var(--unrest) * var(--lk, 1) * 1px) calc(var(--uy, 0) * var(--unrest) * var(--lk, 1) * 1px); rotate: calc(var(--ur, 0) * var(--unrest) * var(--lk, 1) * 1deg); }
  to   { translate: calc(var(--ux, 0) * var(--unrest) * var(--lk, 1) * -1px) calc(var(--uy, 0) * var(--unrest) * var(--lk, 1) * -1px); rotate: calc(var(--ur, 0) * var(--unrest) * var(--lk, 1) * -1deg); }
}

/* ---- the stage: the frame at the horizon, the water below it ---- */
.stage { position: relative; }
.stage::before {                                   /* the teal haze behind the frame: the night is not black, it is lit from the frame */
  content: ""; position: absolute; left: 0; right: 0; top: -110px; height: calc(var(--fh) + 330px); pointer-events: none;
  background: radial-gradient(ellipse 58% 52% at 50% 46%, rgba(0, 101, 129, .30), transparent 72%);
}
.frame { position: relative; z-index: 2; width: var(--fw); margin: 0 auto; }
.frame::before {                                   /* M5: the glow shimmers with the unrest and is steady when the stone is out */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 2px;
  box-shadow: 0 0 64px 6px rgba(0, 101, 129, .52), 0 0 160px 26px rgba(0, 101, 129, .28);
  animation: glow 4.6s ease-in-out infinite alternate;
}
@keyframes glow { from { opacity: calc(1 - .18 * var(--unrest)); } to { opacity: 1; } }
.screen {
  position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(224, 128, 0, .5), 0 0 24px rgba(224, 128, 0, .2);
}
.is-found .screen { box-shadow: 0 0 0 1px rgba(242, 165, 74, .85), 0 0 30px rgba(224, 128, 0, .28); }
.poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .6s ease; }
.screen[data-live] .poster { opacity: 0; pointer-events: none; }
.slot { position: absolute; inset: 0; }
.slot iframe { display: block; width: 100%; height: 100%; border: 0; }

/* M3: the play control is three thin rings that breathe; they draw in toward the triangle on hover and focus */
.begin {
  position: absolute; left: 50%; top: 50%; width: 104px; height: 104px; margin: -52px 0 0 -52px; z-index: 3;
  display: grid; place-items: center; border-radius: 50%; color: #fff3e0; text-decoration: none; transition: opacity .35s ease;
}
.begin::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: rgba(2, 4, 5, .52); }
.begin .ring { position: absolute; border-radius: 50%; border: 2px solid rgba(255, 235, 210, .92); }
.begin .r1 { inset: 0; }
.begin .r2 { inset: -17px; border-width: 1.5px; opacity: .55; animation: breathe 2.8s ease-in-out infinite; }
.begin .r3 { inset: -35px; border-width: 1px; opacity: .3; animation: breathe 2.8s ease-in-out -.95s infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes draw { to { transform: scale(.82); opacity: .95; } }
.begin:hover .r2, .begin:focus-visible .r2, .begin:hover .r3, .begin:focus-visible .r3 { animation: draw .45s ease-out forwards; }
.begin:hover .r1, .begin:focus-visible .r1 { border-color: var(--copper-lit); }
.begin .tri { position: relative; margin-left: 7px; border-left: 27px solid #fff3e0; border-top: 17px solid transparent; border-bottom: 17px solid transparent; }
.begin:focus-visible { outline: 2px solid var(--copper-lit); outline-offset: 12px; }
.is-on .begin { opacity: 0; pointer-events: none; visibility: hidden; transition: opacity .35s ease, visibility 0s .35s; }

/* ---- the water ---- */
.water { position: relative; height: var(--wh); background: linear-gradient(#05121a, var(--night) 92%); }
.mirror { position: absolute; top: 0; left: 50%; width: var(--fw); height: auto; transform: translateX(-50%); display: block; }
.surface { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.water-on .surface { opacity: 1; }
.water-on .mirror { visibility: hidden; }

/* M7: the stone surfaces, rests, and is lifted into the frame's glow at the waterline (clipped by .deep: it never crosses the video) */
.deep { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.stone {
  --a: clamp(0, var(--stone), 1); --b: clamp(0, calc(var(--stone) - 1), 1);
  position: absolute; left: 50%; top: calc(var(--wh) * .5); width: var(--sw); height: var(--sw); margin: calc(var(--sw) / -2) 0 0 calc(var(--sw) / -2);
  mix-blend-mode: screen; opacity: calc(var(--a) * (1 - var(--b) * var(--b)));
  transform: translateY(calc((1 - var(--a)) * 40% - var(--b) * var(--wh) * .54)) scale(calc(.8 + .2 * var(--a)));
  filter: brightness(calc(1 + var(--b) * .9)) blur(calc(var(--b) * var(--b) * 3px));
  transition: opacity .25s linear, transform .25s linear, filter .25s linear;
}
.stone img { display: block; width: 100%; height: 100%; }

/* M9: four small lights for the family she names; lit by the furthest time reached, and they stay */
.lamps { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; }
.lamp {
  position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; mix-blend-mode: screen;
  background: radial-gradient(circle, #fff6e6 0 30%, var(--copper-lit) 54%, rgba(224, 128, 0, 0) 76%); box-shadow: 0 0 16px 5px rgba(224, 128, 0, .5);
}
.lamp::after { content: ""; position: absolute; left: 50%; top: 100%; width: 14px; height: 58px; margin-left: -7px; background: radial-gradient(ellipse 50% 100% at 50% 0, rgba(242, 165, 74, .5), rgba(242, 165, 74, 0) 100%); filter: blur(2.2px); }
.l-a { left: 15%; top: 21%; } .l-b { left: 31%; top: 43%; } .l-c { left: 70%; top: 35%; } .l-d { left: 86%; top: 17%; }
.js .lamp { opacity: 0; transform: scale(.3); transition: opacity 1.4s ease, transform 1.4s ease; }
.js .lamp.is-lit { opacity: 1; transform: none; animation: shimmer 3.2s ease-in-out 1.4s 3; }
@keyframes shimmer { 50% { box-shadow: 0 0 22px 9px rgba(224, 128, 0, .72); } }

/* the two keys at the water's edge: rings (M10: a ring answers hover and focus) */
.keys { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.keys .key {
  position: relative; display: grid; place-items: center; width: 56px; height: 56px; padding: 0; margin: 0; border-radius: 50%; cursor: pointer;
  background: rgba(2, 4, 5, .55); color: var(--paper); border: 1px solid rgba(98, 188, 217, .65);
  box-shadow: 0 0 0 6px rgba(0, 101, 129, .15), 0 0 0 13px rgba(0, 101, 129, .07);
  font: 600 15px/1 Figtree, sans-serif; pointer-events: auto; transition: border-color .3s ease, background .3s ease;
}
.keys .key:hover, .keys .key:focus-visible { background: rgba(0, 101, 129, .45); border-color: var(--sky); color: #fff; }
.keys .key::before { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid rgba(98, 188, 217, .7); opacity: 0; pointer-events: none; }
.keys .key:hover::before, .keys .key:focus-visible::before { animation: keyring 1.1s ease-out; }
@keyframes keyring { from { opacity: .85; transform: scale(1); } to { opacity: 0; transform: scale(1.9); } }
.key .glyph { font-size: 15px; letter-spacing: -.02em; }
.key .kl { position: absolute; top: calc(100% + 11px); left: 50%; transform: translateX(-50%); font: 600 11px/1 Figtree, sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--sand); white-space: nowrap; }
.key-menu { position: absolute; left: max(12px, calc((100% - var(--fw)) / 2 - 78px)); top: 16px; }
.keys .share { position: absolute; right: max(12px, calc((100% - var(--fw)) / 2 - 78px)); top: 16px; display: block;
  /* share.css loads after this file and sets the same variables on .share: a longer selector wins (GOTCHAS 35) */
  --share-btn-bg: rgba(2, 4, 5, .55); --share-btn-fg: var(--paper); --share-accent: var(--teal-lit); --share-on-accent: var(--night);
  --share-panel-bg: var(--deep); --share-panel-fg: var(--paper); --share-field-bg: var(--night); --share-radius: 10px; --share-radius-sm: 8px; }
.keys .share[hidden] { display: none; }
.keys .share-btn.key { position: relative; min-width: 56px; min-height: 56px; padding: 0; font-weight: 600; box-shadow: 0 0 0 6px rgba(0, 101, 129, .15), 0 0 0 13px rgba(0, 101, 129, .07); }

/* ---- in the video: nine short lines, each a link to its moment ---- */
.words { max-width: 800px; margin: 0 auto; padding: 56px 20px 18px; }
.words-title { margin: 0; font: 600 13px/1.3 Figtree, sans-serif; letter-spacing: .28em; text-transform: uppercase; color: var(--teal-lit); }
.words-note { margin: .5em 0 26px; color: var(--sand); font-size: 15px; }
.lines { margin: 0; padding: 0; list-style: none; }
.line { position: relative; display: grid; grid-template-columns: 76px 1fr; align-items: center; column-gap: 18px; padding: 12px 10px 12px 14px; border-left: 1px solid rgba(98, 188, 217, .25); transition: border-color .5s ease, background .5s ease; }
.line + .line { margin-top: 4px; }
.line q { quotes: "\201C" "\201D"; font: italic 400 clamp(18px, 2.3vw, 22px)/1.5 Figtree, sans-serif; color: var(--paper); text-wrap: pretty; }
/* Not justified on purpose (found by looking): the owner's full-justification rule is for body paragraphs; these are nine short quotations,
   and justified they left gaps in the first line of every two-line quote ("He   took   his   hand   in   my   heart") on a phone and on a laptop. */
.q-time {
  position: relative; display: inline-grid; place-items: center; min-width: 64px; min-height: 44px; padding: 0 10px; border-radius: 999px; text-decoration: none;
  font: 600 15px/1 Figtree, sans-serif; font-variant-numeric: tabular-nums; color: var(--copper-lit); border: 1px solid rgba(242, 165, 74, .35);
  transition: background .3s ease, color .3s ease, border-color .3s ease;
}
.q-time::before { content: ""; position: absolute; inset: -1px; border-radius: 999px; border: 1px solid rgba(242, 165, 74, .7); opacity: 0; pointer-events: none; }
.q-time:hover, .q-time:focus-visible { background: rgba(224, 128, 0, .16); color: #ffd9a0; border-color: var(--copper-lit); }
.q-time:hover::before, .q-time:focus-visible::before { animation: timering 1s ease-out; }
@keyframes timering { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.5, 1.9); } }
/* the line being spoken: a copper ring */
.line.is-now { border-left-color: var(--copper-lit); background: linear-gradient(90deg, rgba(224, 128, 0, .09), transparent 70%); }
.line.is-now .q-time { border-color: var(--copper-lit); box-shadow: 0 0 0 4px rgba(224, 128, 0, .16), 0 0 0 9px rgba(224, 128, 0, .07); color: #ffd9a0; }

/* ---- the foot ---- */
.foot { max-width: 800px; margin: 0 auto; padding: 44px 20px 54px; text-align: center; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; font: 600 14px/1 Figtree, sans-serif; letter-spacing: .06em; color: var(--teal-lit); text-decoration: none; border-radius: 999px; }
.foot-links a:hover, .foot-links a:focus-visible { background: rgba(0, 101, 129, .3); color: #fff; }
.foot-name { margin: 22px 0 0; font: 600 12px/1 Figtree, sans-serif; letter-spacing: .3em; text-transform: uppercase; color: var(--sand); }

/* ---- small screens ---- */
@media (max-width: 640px) {
  .begin { width: 84px; height: 84px; margin: -42px 0 0 -42px; }
  .begin .r2 { inset: -13px; }
  .begin .r3 { inset: -27px; }
  .begin .tri { margin-left: 6px; border-left-width: 22px; border-top-width: 14px; border-bottom-width: 14px; }
  .line { grid-template-columns: 1fr; row-gap: 8px; padding: 12px 6px 14px 12px; }
  .q-time { justify-self: start; }
  .words { padding-top: 44px; }
  .key .kl { font-size: 10px; letter-spacing: .16em; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .title { font-size: 54px; }
  .top { height: 38px; }
}

/* ---- reduced motion: the same end states at once; nothing moves ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .stone { display: none; }
  .js .lamp { opacity: 1; transform: none; }
}
.is-still *, .is-still *::before, .is-still *::after { animation: none !important; transition-duration: .01ms !important; }
.is-still .stone { display: none; }
.is-still .lamp, .js.is-still .lamp { opacity: 1; transform: none; }
