/* Home: the descent. (concept v2: a descent in greyscale and terminal type. Scroll is travel through the real sky (Yale Bright
     Star Catalogue) into a vortex that straightens into a glowing kundli with the form at its heart; then the
     page fills in as an editorial document. One mono family for everything; Devanagari only for the logo and mantra. */
  :root {
    --k0: #000; --k1: #0b0b0b; --k2: #141414; --k3: #262626; --k4: #4d4d4d; --k5: #8c8c8c; --k6: #cfcfcf; --k7: #fff;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace; --dev: "Noto Sans Devanagari", "Kohinoor Devanagari", sans-serif;
    --mant: clamp(13px, 1.3vw, 16px);
    color-scheme: dark;
  }
  * { box-sizing: border-box; }
  html { background: var(--k0); }
  body { margin: 0; background: var(--k0); color: var(--k6); font-family: var(--mono); font-size: 15px; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
  a { color: inherit; text-decoration: none; }
  :focus-visible { outline: 2px solid var(--k7); outline-offset: 3px; }

  /* ===== descent ===== */
  #scroll { height: 520vh; position: relative; }
  #stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--k0); }
  #sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  #dot { position: absolute; left: 50%; top: 42%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 24px 6px rgba(255,255,255,.55); pointer-events: none; }
  #frames { position: absolute; left: 50%; top: 50%; width: min(150vw, 150vh); height: min(150vw, 150vh); transform: translate(-50%, -50%); pointer-events: none; overflow: visible; }
  #frames rect, #frames path { fill: none; stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; }
  #kund path.base { stroke-width: 1.6; }
  #kund path.sweep { stroke-width: 3; stroke-dasharray: 70 930; filter: drop-shadow(0 0 5px #fff); }
  #kund { filter: drop-shadow(0 0 3px rgba(255,255,255,.6)); }

  .hud { position: absolute; z-index: 4; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--k5); pointer-events: none; }
  #logo { left: clamp(16px, 3vw, 40px); top: clamp(14px, 2.6vw, 32px); display: flex; flex-direction: column; align-items: flex-start; gap: 1px; pointer-events: auto; color: var(--k7); }
  #logo .dv { font-family: var(--dev); font-weight: 500; font-size: var(--mant); letter-spacing: .02em; text-transform: none; line-height: 1.55; display: block; color: var(--k7); }
  #logo .en { font-size: max(7.5px, calc(var(--mant) * 0.5)); letter-spacing: .14em; color: var(--k5); line-height: 1.6; display: block; margin-top: 5px; }
  #ctl { right: clamp(16px, 3vw, 40px); top: clamp(14px, 2.6vw, 32px); text-align: right; display: grid; gap: 6px; pointer-events: auto; font-size: 9.5px; color: var(--k4); }
  #motion { all: unset; cursor: pointer; color: var(--k5); text-decoration: underline; text-underline-offset: 4px; }
  #motion:hover { color: var(--k7); }
  #meta { left: clamp(16px, 3vw, 40px); bottom: clamp(14px, 3vw, 32px); display: grid; gap: 5px; }
  #meta > span:last-child { color: var(--k6); text-transform: none; letter-spacing: .02em; font-size: 11.5px; }
  #mantra { right: clamp(16px, 3vw, 40px); bottom: clamp(14px, 3vw, 32px); text-align: right; font-family: var(--dev); font-weight: 500; font-size: var(--mant); letter-spacing: .02em; line-height: 1.55; text-transform: none; color: var(--k7); min-height: 6.2em; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; }
  #mantra span { display: block; white-space: pre; } #mantra span.g { color: var(--k5); }

  .line { position: absolute; z-index: 3; left: 50%; top: 62%; width: min(90vw, 38ch); transform: translate(-50%, -50%); text-align: center; font-family: var(--mono); font-weight: 500; line-height: 1.25; letter-spacing: -.03em; color: var(--k7); font-size: clamp(16px, 2.625vw, 39px); pointer-events: none; text-wrap: balance; }
  .line > span { display: block; clip-path: inset(0 50% 0 50%); transition: clip-path .6s steps(10); }
  .line.on > span { clip-path: inset(0 0 0 0); }
  .line.out > span { clip-path: inset(0 50% 0 50%); transition: clip-path .3s steps(5); }

  /* form at the heart of the kundli */
  #core { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(400px, 86vw); max-height: 90vh; max-height: 90svh; overflow: auto; background: var(--k0); border: 1px solid var(--k5); padding: clamp(26px, 3.4vw, 40px); opacity: 0; visibility: hidden; transition: opacity .45s steps(5); scrollbar-width: none; }
  #core.on { opacity: 1; visibility: visible; }
  #core .k { margin: 0 0 clamp(22px, 3vw, 32px); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--k7); }
  .f { display: grid; gap: clamp(20px, 2.6vw, 28px); }
  .f label { display: grid; gap: 8px; font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--k5); }
  .f input, .f select { width: 100%; background: transparent; color: var(--k7); border: 0; border-bottom: 1px solid var(--k3); border-radius: 0; font-family: var(--mono); font-size: 14px; padding: 4px 0 9px; appearance: none; -webkit-appearance: none; }
  .f input::placeholder { color: var(--k4); }
  .f select:required:invalid { color: var(--k4); }
  .f select option { color: var(--k7); background: var(--k0); }
  .f fieldset.grp { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 8px; }
  .f fieldset.grp legend { padding: 0; margin-bottom: 8px; font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--k5); }
  .f select.err { border-bottom-color: var(--k7); }
  .f input:focus, .f select:focus { outline: none; border-bottom-color: var(--k7); }
  .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .row.two { grid-template-columns: 1.7fr 1fr; }
  .go { margin-top: 4px; background: transparent; color: var(--k7); border: 1px solid var(--k7); padding: 15px; font-family: var(--mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; cursor: pointer; }
  .go:hover { background: var(--k7); color: var(--k0); }

  /* ===== after: the page fills ===== */
  #after { position: relative; background: var(--k0); border-top: 1px solid var(--k3); }
  .wrap { max-width: 1240px; margin: 0 auto; padding: clamp(48px, 8vw, 120px) clamp(16px, 4vw, 48px); }
  .manifesto { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 80px); align-items: start; }
  .manifesto h2 { margin: 0; font-weight: 500; font-size: clamp(18px, 2.55vw, 37.5px); line-height: 1.24; letter-spacing: -.035em; color: var(--k7); text-wrap: balance; }
  .manifesto .txt { display: grid; gap: 18px; font-size: clamp(14px, 1.15vw, 16px); line-height: 1.8; color: var(--k6); max-width: 60ch; }
  .manifesto .txt p { margin: 0; }
  .journal { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 28%); gap: 1px; background: var(--k3); border: 1px solid var(--k3); overflow-x: auto; scroll-snap-type: x mandatory; margin-top: 16px; }
  .journal article { background: var(--k0); display: grid; scroll-snap-align: start; }
  .journal .in { padding: 22px 20px 22px; display: grid; align-content: space-between; gap: 18px; min-height: 230px; }
  .journal p { margin: 0; font-size: 12px; line-height: 1.65; color: var(--k5); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .jhead { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: clamp(48px, 7vw, 96px); }
  .jhead h2 { margin: 0; font-weight: 500; font-size: clamp(18px, 2vw, 26px); letter-spacing: -.03em; color: var(--k7); }
  .jhead a { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--k5); }
  .jhead a:hover { color: var(--k7); }
  .journal h3 { margin: 0; font-weight: 500; font-size: 18px; line-height: 1.25; letter-spacing: -.02em; color: var(--k7); }
  .journal small { font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--k5); }
  .journal article { position: relative; cursor: pointer; }
  .journal article::before, .journal article::after { content: ""; position: absolute; z-index: 3; width: 16px; height: 16px; border: 1px solid var(--k7); opacity: 0; pointer-events: none; transition: transform .24s steps(4); }
  .journal article::before { left: 12px; top: 12px; border-right: 0; border-bottom: 0; transform: translate(10px, 10px); }
  .journal article::after { right: 12px; bottom: 12px; border-left: 0; border-top: 0; transform: translate(-10px, -10px); }
  .journal .s2 { display: none; }
  @media (hover: hover) {
    .journal article:hover { background: var(--k2); }
    .journal article:hover::before, .journal article:hover::after { opacity: 1; transform: none; }
    .journal article:hover .s1 { display: none; } .journal article:hover .s2 { display: inline; color: var(--k7); }
  }
  @keyframes drift { to { background-position: 28px 0; } }
  @keyframes scan { from { top: -4px; } to { top: 100%; } }
  footer { border-top: 1px solid var(--k3); }
  footer .wrap { padding-block: 40px; display: grid; gap: 14px; }
  footer p { margin: 0; max-width: none; font-size: 12.5px; line-height: 1.7; color: var(--k5); }
  footer p.m { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--k4); }

  /* tablet and phone */
  @media (max-width: 900px) {
    .manifesto { grid-template-columns: 1fr; }
    .journal { grid-auto-columns: minmax(240px, 46%); }
    .line { font-size: clamp(16px, 3.75vw, 30px); width: min(86vw, 34ch); top: 61%; }
    #meta { max-width: 46vw; }
  }
  @media (max-width: 560px) {
    .journal { grid-auto-columns: 78%; }
    /* top right: the star catalogue note (the sky and motion preview controls are desktop only) */
    #sky-state, #motion { display: none; }
    #ctl { font-size: 9px; }
    #meta { left: auto; right: clamp(16px, 3vw, 40px); top: clamp(14px, 2.6vw, 32px); bottom: auto; text-align: right; max-width: 34vw; font-size: 7px; }
    #meta > span:last-child { font-size: 8px; }
    #meta.lower { top: calc(clamp(14px, 2.6vw, 32px) + 22px); }
    /* the gayatri mantra sits centred at the foot of the screen */
    #mantra { left: 50%; right: auto; transform: translateX(-50%); text-align: center; align-items: center; }
    .line { font-size: clamp(15px, 4.65vw, 21px); width: min(88vw, 28ch); top: 58%; }
    #core { padding: 24px 20px; } .f { gap: 18px; } .row { gap: 10px; }
    :root { --mant: 12.5px; }
  }
  /* reduced motion: a static, readable composition */
  .rm #scroll { height: auto; } .rm #stage { position: relative; height: auto; min-height: 100svh; padding: 90px 16px 120px; display: grid; gap: 28px; align-content: start; }
  .rm .line { position: relative; left: auto; top: auto; transform: none; width: auto; max-width: 30ch; margin: 0 auto; } .rm .line > span { clip-path: none !important; }
  .rm #core { position: relative; left: auto; top: auto; transform: none; margin: 30px auto 0; opacity: 1; visibility: visible; }
  .rm #dot { display: none; }

/* ===== real-site additions ===== */
.f .note { margin: 0; min-height: 1.2em; font-size: 10.5px; letter-spacing: .08em; color: var(--k5); }
.f input.err { border-bottom-color: var(--k7); }
#loader { position: fixed; inset: 0; z-index: 50; background: var(--k0); display: none; place-items: center; align-content: center; gap: 22px; text-align: center; }
#loader.on { display: grid; }
#loader .t { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--k7); }
#loader .b { width: min(280px, 60vw); height: 1px; background: var(--k3); position: relative; overflow: hidden; }
#loader .b::after { content: ""; position: absolute; inset: 0; width: 28%; background: var(--k7); animation: load 1.2s steps(12) infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(360%); } }
#ctl a { color: var(--k7); text-decoration: underline; text-underline-offset: 4px; }

.journal .stretch { position: absolute; inset: 0; z-index: 4; }
