/* Kahanë — Chapter One
   Direction 1a ("Whisper"). Tokens below are the source of truth; they come
   from the design handoff. No radii, no shadows — the depth in this design
   comes from the three cream tones and the hero gradient only. */

:root {
  /* Color */
  --paper:        #E8E1D3;  /* page background (oatmeal) */
  --paper-raised: #EEE8DC;  /* header band */
  --paper-sunk:   #DCD3C1;  /* footer band */
  --bloom-light:  #F1ECE1;  /* hero gradient, inner stop */
  --bloom-dark:   #DDD4C2;  /* hero gradient, outer stop */

  --ink:     #17140F;
  --ink-70:  rgba(23, 20, 15, .66);  /* nav links */
  --ink-62:  rgba(23, 20, 15, .62);  /* body copy */
  --ink-50:  rgba(23, 20, 15, .5);   /* eyebrow */
  --ink-46:  rgba(23, 20, 15, .46);  /* footer */
  --ink-40:  rgba(23, 20, 15, .4);   /* waitlist nav underline */
  --ink-38:  rgba(23, 20, 15, .38);  /* form microcopy */

  --rule:       #D6CCB9;  /* header border */
  --rule-sunk:  #CBBFA9;  /* footer border */
  --rule-form:  #A99B85;  /* form underline */
  --error:      #8A3A2A;

  /* Type */
  --serif: Cormorant, Georgia, "Times New Roman", serif;
  --sans:  Jost, system-ui, -apple-system, "Segoe UI", sans-serif;
  --urdu:  "Noto Nastaliq Urdu", var(--serif);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  /* Stop iOS inflating type when a phone is turned to landscape. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- Header */

/* Sticky. Three columns — nav / logo / balancing cell — so the logo stays
   optically centred no matter how many links sit beside it. The band is opaque
   and separated by its 1px rule alone; the design takes no shadows. */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 22px 48px;
  background: var(--paper-raised);
  border-bottom: 1px solid var(--rule);
}

.masthead__nav {
  justify-self: start;
  display: flex;
  gap: 30px;
}


.masthead__logo {
  justify-self: center;
  display: block;
  line-height: 0;
}

.masthead__logo img {
  display: block;
  width: 158px;
  height: 53px;
  /* Optical, not geometric, centring. The mark's ink spans its canvas evenly,
     but its *mass* does not: the letterforms are dense on the left and the
     flourish trails off thin to the right, which puts the visual centre of
     gravity 5.3% of the width left of the true middle. Nudge it back by that
     measured amount so it reads centred. Percentage units keep the correction
     proportional at the smaller mobile sizes. */
  transform: translateX(5.3%);
}

.navlink {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-70);
  text-decoration: none;
  transition: color 150ms ease;
}

.navlink:hover,
.navlink:focus-visible { color: var(--ink); }

.navlink--emphasis {
  border-bottom: 1px solid var(--ink-40);
  padding-bottom: 2px;
}

/* ------------------------------------------------------------------ Hero */

.hero {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding: 96px 48px 110px;
  text-align: center;
  background: radial-gradient(ellipse 900px 620px at 50% 34%,
              var(--bloom-light) 0%, var(--paper) 48%, var(--bloom-dark) 100%);
}

/* Decorative Urdu watermark — کہانی, "story". aria-hidden in the markup. */
.hero__watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--urdu);
  font-size: 300px;
  line-height: 1.6;
  color: var(--ink);
  opacity: .045;
  pointer-events: none;
  user-select: none;
  animation: drift 22s ease-in-out infinite;
  will-change: transform;
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0); }
  50%  { transform: translate3d(0, -14px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

.hero__content { position: relative; }

.hero__lockup {
  display: block;
  width: 520px;
  height: 236px;
  margin: 0 auto 14px;
}

.eyebrow {
  margin: 0;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--ink-50);
}

.hero__title {
  margin: 26px 0 0;
  font-weight: 300;
  font-size: 96px;
  line-height: .98;
  letter-spacing: -.01em;
}

.hero__title em { font-style: italic; }

.hero__copy {
  margin: 34px auto 0;
  max-width: 470px;
  font-size: 20px;
  line-height: 1.7;
  color: var(--ink-62);
}

/* -------------------------------------------------------------- Waitlist */
/* Styled as a written line, not a boxed field. */

.waitlist {
  margin: 46px auto 0;
  max-width: 440px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  border-bottom: 1px solid var(--rule-form);
  padding-bottom: 10px;
  transition: border-color 150ms ease, opacity 200ms ease;
}

/* The underline is the field's focus indicator — never remove it. */
.waitlist:focus-within {
  border-bottom-width: 1.5px;
  border-bottom-color: var(--ink);
  padding-bottom: 9.5px;
}

.waitlist__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--serif);
  font-size: 19px;
  color: var(--ink);
  padding: 0;
}

.waitlist__input::placeholder {
  color: var(--ink-38);
  opacity: 1;
}

.waitlist__submit {
  flex: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 0 0 1px;
  transition: opacity 150ms ease;
}

.waitlist__submit:hover { opacity: .55; }

.waitlist__submit:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

/* In flight: the whole line dims and stops accepting input. */
.waitlist.is-submitting { opacity: .55; }
.waitlist.is-submitting .waitlist__submit { cursor: progress; }

.waitlist__note {
  margin: 12px auto 0;
  max-width: 440px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-38);
}

.waitlist__error {
  margin: 10px auto 0;
  max-width: 440px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--error);
}

/* Success replaces the form entirely, in the same voice as the body copy. */
.waitlist__success {
  margin: 46px auto 0;
  max-width: 470px;
  font-size: 20px;
  line-height: 1.7;
  color: var(--ink-62);
  animation: fade-in 400ms ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- Footer */

.colophon {
  padding: 26px 48px;
  background: var(--paper-sunk);
  border-top: 1px solid var(--rule-sunk);
  display: flex;
  justify-content: center;
  gap: 22px;
  text-align: center;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--ink-46);
}

/* Centred, the two labels need joining or they read as two stray items. */
.colophon span + span::before {
  content: "·";
  margin-right: 22px;
  color: var(--ink-38);
}

/* ------------------------------------------------------------ Responsive */

/* The design is meant to hold on a single screen with nothing below the fold.
   At the reference spacing the stack measures ~970px, so a 900px-tall laptop
   would scroll. Compress the vertical rhythm only when the viewport is
   actually short — anything taller keeps the handoff values exactly. */
@media (min-width: 821px) and (max-height: 1000px) {
  .hero {
    padding-top: clamp(40px, 6vh, 96px);
    padding-bottom: clamp(48px, 7vh, 110px);
  }

  .hero__lockup {
    width: min(520px, 44vh);
    height: auto;
  }

  .hero__title { font-size: clamp(64px, 9.5vh, 96px); }

  .hero__copy { margin-top: clamp(20px, 3.4vh, 34px); }

  .waitlist,
  .waitlist__success { margin-top: clamp(28px, 4.6vh, 46px); }
}

@media (max-width: 820px) {
  /* The header is sticky, so its height is permanent screen cost — keep it
     slim and on one row rather than stacking. */
  .masthead {
    padding: 14px 20px;
    gap: 12px;
  }

  .masthead__logo img {
    width: 132px;
    height: 44px;
  }

  .masthead__nav { gap: 18px; }

  .navlink {
    font-size: 9.5px;
    letter-spacing: .16em;
  }

  .hero { padding: 56px 24px 72px; }

  .hero__watermark { font-size: 150px; }

  .hero__lockup {
    width: min(84vw, 420px);
    height: auto;
  }

  .hero__title { font-size: clamp(52px, 16vw, 96px); }

  /* Keep the 44px touch target without moving the label off the underline. */
  /* Both controls get a 44px touch target. Centring the row (rather than the
     desktop flex-end) is what keeps the field text and the button label on the
     same line once they're both 44px tall. */
  .waitlist { align-items: center; }

  .waitlist__input {
    min-height: 44px;
    font-size: 18px;
  }

  .waitlist__submit {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding-bottom: 0;
  }

  .colophon {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 22px 24px;
  }

  /* Stacked, they no longer need the separator. */
  .colophon span + span::before { content: none; }
}

/* Narrow phones: shrink the mark before the header row can collide. */
@media (max-width: 380px) {
  .masthead { padding: 12px 16px; }

  .masthead__logo img {
    width: 112px;
    height: 38px;
  }

  .navlink {
    font-size: 9px;
    letter-spacing: .12em;
  }
}

/* Short portrait phones (SE-class): claw back vertical space so the form
   sits as close to the first screen as the content allows. */
@media (max-width: 820px) and (max-height: 700px) and (orientation: portrait) {
  .hero {
    padding-top: 32px;
    padding-bottom: 40px;
  }

  .hero__title { font-size: clamp(44px, 13vw, 72px); }

  .hero__copy {
    margin-top: 22px;
    font-size: 18px;
  }

  .waitlist,
  .waitlist__success { margin-top: 32px; }

  .colophon { padding: 16px 24px; }
}

/* Landscape phones: almost no vertical room, so trade scale for fit. */
@media (max-height: 520px) and (orientation: landscape) {
  .masthead { padding: 10px 20px; }

  .masthead__logo img {
    width: 118px;
    height: 40px;
  }

  .hero {
    padding-top: 28px;
    padding-bottom: 36px;
  }

  .hero__lockup { width: min(360px, 40vh); }

  .hero__title { font-size: clamp(40px, 12vh, 72px); }

  .hero__copy {
    margin-top: 18px;
    font-size: 17px;
  }

  .waitlist { margin-top: 26px; }

  .hero__watermark { font-size: 120px; }
}

/* Below 360px the button label needs its own line, right-aligned. */
@media (max-width: 359px) {
  .waitlist {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .waitlist__input { flex-basis: 100%; }
}

/* Touch targets belong to the input device, not the viewport width — a phone
   held sideways is 844px wide and would otherwise miss the rules above. */
@media (pointer: coarse) {
  .waitlist { align-items: center; }

  .waitlist__input {
    min-height: 44px;
    font-size: 18px;
  }

  .waitlist__submit {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding-bottom: 0;
  }

  /* Hover styling is meaningless on touch and leaves elements stuck in the
     hovered state after a tap. */
  .navlink:hover { color: var(--ink-70); }
  .waitlist__submit:hover { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__watermark { animation: none; }
  .waitlist__success { animation: none; }
  * { transition-duration: .01ms !important; }
}
