/* Aadhi Raat — styles */

:root {
  --ink: #05060c;
  --ink-2: #0b0d18;
  --ink-3: #12152a;
  --paper: #ebe6da;
  --mute: #8d8b97;
  --line: rgba(235, 230, 218, 0.14);
  --line-strong: rgba(235, 230, 218, 0.32);
  --sodium: #ffae3d;
  --moon: #d9ddff;

  --serif: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --deva: 'Tiro Devanagari Hindi', 'Noto Serif Devanagari', serif;

  --gutter: clamp(16px, 4vw, 72px);
  --ease: cubic-bezier(0.22, 0.75, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  background: var(--ink);
  color: var(--paper);
  scroll-behavior: smooth;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: default;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--sodium); color: var(--ink); }

/* ---------- overlays ---------- */

.curtain {
  position: fixed; inset: 0; z-index: 60;
  background: var(--ink);
  transform-origin: 50% 0;
  transition: transform 1.1s var(--ease) 0.2s;
  pointer-events: none;
}
body:not(.is-loading) .curtain { transform: scaleY(0); }

.grain {
  position: fixed; inset: -100%; z-index: 50;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 4%); }
  100% { transform: translate(-1%, 3%); }
}

.cursor {
  position: fixed; left: 0; top: 0; z-index: 70;
  width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--paper);
  mix-blend-mode: difference;
  pointer-events: none;
  opacity: 0;
  transition: width 0.35s var(--ease), height 0.35s var(--ease), margin 0.35s var(--ease), opacity 0.3s;
  display: none;
}
.cursor::after {
  content: attr(data-label);
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink);
  opacity: 0; transition: opacity 0.2s;
}
body.has-cursor { cursor: none; }
body.has-cursor a, body.has-cursor button, body.has-cursor select, body.has-cursor input { cursor: none; }
body.has-cursor .cursor { display: block; }
.cursor.is-on { opacity: 1; }
.cursor.is-hover { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
.cursor.is-label { width: 72px; height: 72px; margin: -36px 0 0 -36px; mix-blend-mode: normal; background: var(--sodium); }
.cursor.is-label::after { opacity: 1; }

.progress {
  position: fixed; left: 0; top: 0; right: 0; z-index: 46;
  height: 2px; pointer-events: none;
}
.progress i {
  display: block; height: 100%; width: 100%;
  background: var(--sodium);
  transform: scaleX(0); transform-origin: 0 50%;
}

/* ---------- nav ---------- */

.nav {
  position: fixed; left: 0; right: 0; top: 0; z-index: 45;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: clamp(14px, 3vw, 40px);
  padding: 18px var(--gutter);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  mix-blend-mode: difference;
}
.nav__mark { display: inline-flex; align-items: baseline; gap: 10px; }
.nav__deva { font: 400 20px/1 var(--deva); text-transform: none; letter-spacing: 0; }
.nav__latin { font: italic 400 18px/1 var(--serif); text-transform: none; letter-spacing: 0; }
.nav__clock { display: inline-flex; align-items: center; gap: 10px; justify-self: start; font-variant-numeric: tabular-nums; }
.nav__city { color: var(--mute); }
.nav__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mute); }
.nav__dot.is-open { background: var(--sodium); box-shadow: 0 0 10px var(--sodium); }
.nav__links { display: flex; gap: clamp(12px, 2vw, 26px); }
.nav__links a { position: relative; padding: 4px 0; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 0.4s var(--ease);
}
.nav__links a:hover::after { transform: scaleX(1); }

.sound {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 8px 14px;
  letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px;
  cursor: pointer;
  transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}
.sound:hover { border-color: var(--paper); }
.sound[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.sound__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.sound__bars i { width: 2px; height: 3px; background: currentColor; }
.sound[aria-pressed="true"] .sound__bars i { animation: bars 0.9s ease-in-out infinite alternate; }
.sound__bars i:nth-child(2) { animation-delay: 0.15s; }
.sound__bars i:nth-child(3) { animation-delay: 0.3s; }
.sound__bars i:nth-child(4) { animation-delay: 0.45s; }
@keyframes bars { from { height: 3px; } to { height: 12px; } }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
  isolation: isolate;
}
.hero__sky {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  display: block;
}
.hero__ghost {
  position: absolute; z-index: 1;
  left: 50%; top: 12%;
  transform: translateX(-50%);
  font: 400 clamp(110px, 24vw, 380px)/1 var(--deva);
  color: transparent;
  -webkit-text-stroke: 1px rgba(235, 230, 218, 0.22);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.hero__inner {
  position: relative; z-index: 2;
  width: 100%;
  padding: 120px var(--gutter) clamp(40px, 7vh, 80px);
}
.hero__eyebrow {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  margin: 0 0 clamp(14px, 2vw, 28px);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--mute);
}
.hero__eyebrow span { display: inline-flex; align-items: center; gap: 10px; }
.hero__eyebrow span + span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--sodium); }

.hero__title {
  margin: 0;
  font: 400 clamp(84px, 17.5vw, 256px)/0.84 var(--serif);
  letter-spacing: -0.025em;
  text-transform: none;
}
.hero__line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.hero__line > span { display: block; transform: translateY(105%); transition: transform 1.2s var(--ease); }
.hero__line:nth-child(2) > span { transition-delay: 0.1s; }
.hero__title em { font-style: italic; color: var(--sodium); }
body:not(.is-loading) .hero__line > span { transform: translateY(0); }

.hero__foot {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 60px);
  align-items: end;
  margin-top: clamp(22px, 4vh, 48px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.hero__dek { margin: 0; max-width: 46ch; color: rgba(235, 230, 218, 0.82); }

.clock { display: grid; justify-items: end; text-align: right; gap: 2px; }
.clock__label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.clock__time { font: 400 clamp(48px, 7vw, 104px)/1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.clock__state { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sodium); }

.hero__scroll {
  position: absolute; z-index: 2;
  right: var(--gutter); top: 50%;
  width: 1px; height: 64px;
  overflow: hidden;
  background: var(--line);
}
.hero__scroll i { position: absolute; left: 0; top: 0; width: 100%; height: 50%; background: var(--paper); animation: scrollhint 1.8s var(--ease) infinite; }
@keyframes scrollhint { 0% { transform: translateY(-100%); } 60% { transform: translateY(200%); } 100% { transform: translateY(200%); } }

/* ---------- marquee ---------- */

.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  background: var(--ink);
}
.marquee__track { display: flex; width: max-content; animation: marquee 38s linear infinite; }
.marquee__track span { display: inline-flex; align-items: center; gap: 28px; padding-right: 28px; white-space: nowrap; }
.marquee__track span::after { content: ""; width: 6px; height: 6px; background: var(--sodium); transform: rotate(45deg); }
.marquee__track span[lang="ne"] { font: 400 16px/1 var(--deva); text-transform: none; letter-spacing: 0; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */

.sec {
  position: relative;
  padding: clamp(80px, 12vh, 150px) var(--gutter);
  border-bottom: 1px solid var(--line);
}
.sec__head {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: clamp(28px, 5vh, 56px);
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--mute);
}
.sec__num { color: var(--sodium); }
.sec__name::before { content: ""; display: inline-block; width: 40px; height: 1px; background: var(--line-strong); vertical-align: middle; margin-right: 16px; }

.statement {
  margin: 0 0 clamp(44px, 8vh, 96px);
  max-width: 20ch;
  font: 400 clamp(38px, 5.6vw, 92px)/1 var(--serif);
  letter-spacing: -0.02em;
}
.statement .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.statement .w > span { display: inline-block; transform: translateY(110%); transition: transform 0.9s var(--ease); transition-delay: var(--d, 0s); }
.statement.in .w > span { transform: translateY(0); }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* rule */
.rule__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.rule__cell {
  padding: 28px 28px 32px 0;
  border-right: 1px solid var(--line);
  margin-right: 28px;
}
.rule__cell:nth-child(2) { transition-delay: 0.12s; }
.rule__cell:nth-child(3) { transition-delay: 0.24s; border-right: 0; margin-right: 0; }
.rule__k { display: block; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); margin-bottom: 20px; }
.rule__big { margin: 0 0 14px; font: 400 clamp(34px, 3.6vw, 56px)/1 var(--serif); letter-spacing: -0.02em; }
.rule__arrow { color: var(--sodium); font-style: italic; }
.rule__cell p:last-child { margin: 0; color: rgba(235, 230, 218, 0.78); max-width: 34ch; }

/* midnight */
.you {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "k zone time" "k note time";
  align-items: center;
  gap: 4px 24px;
  padding: 24px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}
.you__k { grid-area: k; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sodium); }
.you__zone { grid-area: zone; font: italic 400 clamp(22px, 2.6vw, 36px)/1.1 var(--serif); }
.you__note { grid-area: note; font-size: 12px; color: var(--mute); letter-spacing: 0.06em; text-transform: uppercase; }
.you__time { grid-area: time; font: 400 clamp(44px, 6vw, 96px)/1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.cities {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-top: 0;
}
.cities li {
  background: var(--ink);
  padding: 20px 18px 22px;
  display: grid; gap: 6px;
  transition: background-color 0.4s;
}
.cities li:hover { background: var(--ink-2); }
.cities li.is-ktm { background: var(--sodium); color: var(--ink); }
.cities li.is-ktm .c__meta { color: rgba(5, 6, 12, 0.7); }
.cities .c__name { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.cities .c__time { font: 400 clamp(36px, 3.2vw, 48px)/1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cities .c__meta { font-size: 11px; color: var(--mute); letter-spacing: 0.06em; text-transform: uppercase; }

/* hours */
.sec--hours { padding-right: 0; padding-left: 0; }
.sec--hours .sec__head, .sec--hours .statement { margin-left: var(--gutter); margin-right: var(--gutter); }
.track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 4px var(--gutter) 24px;
  scrollbar-width: none;
  cursor: grab;
}
.track::-webkit-scrollbar { display: none; }
.track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.hour {
  position: relative;
  flex: 0 0 clamp(290px, 30vw, 420px);
  scroll-snap-align: start;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 20px;
  aspect-ratio: 3 / 4;
  padding: 22px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  transition: border-color 0.4s, transform 0.6s var(--ease);
  user-select: none;
}
.hour:hover { border-color: var(--sodium); }
.hour header, .hour footer { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); }
.hour__n { font: 400 clamp(72px, 7vw, 112px)/0.8 var(--serif); letter-spacing: -0.03em; color: var(--paper); }
.hour__wave { width: 100%; height: 100%; min-height: 80px; display: block; }
.hour__line { margin: 0; font: italic 400 clamp(22px, 2vw, 28px)/1.15 var(--serif); color: var(--paper); }
.hour__cat { color: var(--sodium); }
.hour--last { border-color: rgba(255, 174, 61, 0.5); }
.hour--last .hour__n { color: var(--sodium); }

/* check */
.checker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: start; }
.checker__fields { display: grid; gap: 22px; }
.field { display: grid; gap: 10px; }
.field__k { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.field__in {
  width: 100%;
  background: var(--ink-2);
  color: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 16px 18px;
  font: 400 16px/1.3 var(--mono);
  color-scheme: dark;
  appearance: none; -webkit-appearance: none;
  transition: border-color 0.3s;
}
.field__in:focus { outline: none; border-color: var(--sodium); }
select.field__in {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ebe6da' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 18px center;
  padding-right: 44px;
}
.verdict {
  display: grid; gap: 8px;
  padding: 24px 0 0;
  border-top: 1px solid var(--line-strong);
}
.verdict__time { font: 400 clamp(72px, 10vw, 160px)/0.9 var(--serif); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; transition: color 0.4s; }
.verdict__k { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.verdict__msg { margin-top: 10px; max-width: 40ch; color: rgba(235, 230, 218, 0.82); }
.verdict.is-ok .verdict__time { color: var(--sodium); }
.verdict.is-no .verdict__time { color: var(--mute); }

/* send */
.gate { display: grid; gap: 18px; max-width: 880px; }
.gate__btn {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 16px;
  width: 100%;
  padding: 28px 30px;
  background: none;
  border: 1px solid var(--line-strong);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.4s, background-color 0.4s, color 0.4s;
}
.gate__btn:disabled { cursor: not-allowed; color: var(--mute); }
.gate__btn:not(:disabled) { border-color: var(--sodium); color: var(--paper); }
.gate__btn:not(:disabled):hover { background: var(--sodium); color: var(--ink); }
.gate__status { font: 400 clamp(30px, 4vw, 56px)/1 var(--serif); letter-spacing: -0.02em; }
.gate__when { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.gate__local { margin: 0; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.gate__panel { padding: 24px 0 0; border-top: 1px solid var(--line); }
.gate__lead { margin: 0 0 16px; font: italic 400 clamp(22px, 2.4vw, 32px)/1.15 var(--serif); }
.gate__steps { margin: 0; padding-left: 1.4em; display: grid; gap: 8px; max-width: 56ch; color: rgba(235, 230, 218, 0.82); }
.gate__steps li::marker { color: var(--sodium); }

/* ---------- footer ---------- */

.foot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 24px 40px;
  padding: 48px var(--gutter) 40px;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mute);
}
.foot__mark { display: grid; gap: 6px; color: var(--paper); }
.foot__deva { font: 400 clamp(40px, 5vw, 64px)/1 var(--deva); text-transform: none; letter-spacing: 0; }
.foot__latin { font: italic 400 20px/1 var(--serif); text-transform: none; letter-spacing: 0; }
.foot__meta { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.foot__ctl { display: grid; justify-items: end; gap: 14px; }
.foot__top { color: var(--paper); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .rule__grid { grid-template-columns: 1fr; }
  .rule__cell { border-right: 0; margin-right: 0; padding-right: 0; border-bottom: 1px solid var(--line); }
  .rule__cell:last-child { border-bottom: 0; }
  .checker { grid-template-columns: 1fr; }
  .foot { grid-template-columns: 1fr; align-items: start; }
  .foot__ctl { justify-items: start; }
}

@media (max-width: 720px) {
  .nav { grid-template-columns: auto 1fr auto; gap: 12px; padding: 14px var(--gutter); }
  .nav__links { display: none; }
  .nav__latin { display: none; }
  .nav__city { display: none; }
  .sound span[data-sound-label] { display: none; }
  .sound { padding: 8px 10px; }
  .hero__inner { padding-top: 96px; }
  .hero__ghost { top: 14%; }
  .hero__foot { grid-template-columns: 1fr; }
  .clock { justify-items: start; text-align: left; }
  .hero__scroll { display: none; }
  .you { grid-template-columns: 1fr; grid-template-areas: "k" "zone" "time" "note"; gap: 6px; }
  .cities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cities li { padding: 16px 14px 18px; }
  .cities .c__time { font-size: 34px; }
  .hour { flex-basis: min(78vw, 340px); }
  .hour__n { font-size: 64px; }
  .statement { max-width: none; }
  .gate__btn { grid-template-columns: 1fr; padding: 22px; }
  .verdict__time { font-size: 64px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .curtain { display: none; }
  .grain { animation: none; }
  .cursor { display: none !important; }
  body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: auto; }
  .hero__line > span { transform: none; }
  .statement .w > span { transform: none; }
  .reveal { opacity: 1; transform: none; }
  .hero__scroll i { animation: none; transform: translateY(50%); }
  .marquee__track { animation: none; }
}
