/* ==========================================================================
   LAFZ — main stylesheet
   Mobile-first: base styles target phones; larger screens are layered on
   with min-width media queries at the bottom of each section.
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face {
  font-family: "Crimson Pro";
  src: url("../fonts/crimson-pro-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("../fonts/crimson-pro-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
/* Subset to the single word لفظ (4 KB instead of 165 KB) */
@font-face {
  font-family: "Noto Nastaliq Urdu";
  src: url("../fonts/noto-nastaliq-lafz.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens: LAFZ brand colour reference ---------- */
:root {
  /* Brand palette */
  --stadium-paper: #F2EAD0;
  --butter:        #EDD980;
  --aicher-sky:    #A8C8DC;
  --pistachio:     #B8C49A;
  --classic-orange:#F37021;
  --walnut-ink:    #3D2A18;

  /* Roles */
  --bg:        var(--stadium-paper);
  --bg-raised: #F7F1DF;           /* a lift of Stadium Paper for cards */
  --ink:       var(--walnut-ink);
  --ink-soft:  #5E4A37;           /* secondary text; passes WCAG AA on every palette colour except orange */
  --hair:      rgba(61, 42, 24, .16);
  --accent:    var(--classic-orange); /* decoration only — never small text (contrast 2.4:1 on paper) */

  /* Type */
  --serif: "Crimson Pro", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --urdu:  "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;

  /* Spacing */
  --gutter: 20px;
  --section-y: 96px;
  --nav-h: 64px;
  --radius: 16px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
h1, h2, .hero__caption, .hero__caption span, .waitlist__lede, .volume__desc { text-wrap: balance; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }

/* ---------- Accessibility helpers ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 200;
  background: var(--ink); color: var(--bg);
  font-family: var(--mono); font-size: 14px;
  padding: 12px 16px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Shared type styles ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
/* Accent words: ink text with an orange underline (orange text fails contrast) */
.accent {
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: .075em;
  text-underline-offset: .14em;
  text-decoration-skip-ink: none;
}
/* The nuqta — the brand dot */
.nuqta {
  display: inline-block;
  width: .14em; height: .14em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: baseline;
  margin-left: .06em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 14px 26px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .25s ease, color .25s ease, gap .25s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn::after { content: "→"; letter-spacing: 0; }
.btn--plain::after { content: none; }
@media (hover: hover) {
  .btn:hover { background: var(--accent); color: var(--ink); gap: 16px; }
}
.btn:active { background: var(--accent); color: var(--ink); }

/* ==========================================================================
   Falling circles ("the rain") — decorative, sits behind content
   ========================================================================== */
.rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.rain__inner {
  position: absolute;
  inset: 0;
  transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}
.circle {
  position: absolute;
  top: 0;
  border-radius: 50%;
  animation: fall linear infinite;
  animation-duration: var(--dur);
  animation-delay: var(--delay);
  will-change: transform;
}
@keyframes fall {
  from { transform: translate3d(0, -110%, 0) translateY(-20vh); }
  to   { transform: translate3d(var(--drift), 0, 0) translateY(120vh); }
}
.is-paused .circle { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .circle {
    animation: none;
    top: var(--y);
    transform: none;
  }
}

/* Paper grain — very light, no blend mode (cheap to render on phones) */
.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.8 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Content always above the rain */
.site-header, main, .site-footer { position: relative; z-index: 10; }

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(242, 234, 208, .94);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--hair); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  text-decoration: none;
  color: var(--ink);
}
.brand__latin {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: .32em;
  margin-right: -.32em;          /* cancel trailing letter-spacing */
}
.brand__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: -4px;
}
.brand__urdu {
  font-family: var(--urdu);
  font-size: 18px;
  line-height: 1;
  color: var(--ink-soft);
  transform: translateY(2px);
}
.site-header .btn {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 12px;
  letter-spacing: .16em;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  min-height: 100vh;
  min-height: 100svh;            /* stable height on mobile browsers */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: calc(var(--nav-h) + 48px) var(--gutter) 96px;
  position: relative;
}
.badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}
.badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  .badge::before { animation: blink 1.8s ease-in-out infinite; }
}
@keyframes blink { 50% { opacity: .3; } }

.wordmark {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(56px, min(21vw, 30vh), 240px);
  line-height: 1;
  letter-spacing: .14em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}
.wordmark__text { margin-right: -.1em; }
.wordmark .nuqta { width: .16em; height: .16em; margin-left: 0; }

.hero__caption {
  margin-top: 40px;
  max-width: 24ch;
  font-size: clamp(22px, 5.8vw, 34px);
  line-height: 1.25;
  font-style: italic;
  background: var(--bg);
  padding: 14px 20px;
  border-radius: 12px;
}
.hero__caption span { display: block; }

.scroll-cue {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.scroll-cue::after {
  content: "";
  width: 1px; height: 32px;
  background: var(--ink-soft);
  transform-origin: top;
}
@media (prefers-reduced-motion: no-preference) {
  .scroll-cue::after { animation: scrollLine 2s ease-in-out infinite; }
}
@keyframes scrollLine { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
@media (max-height: 620px) { .scroll-cue { display: none; } }

/* ==========================================================================
   The finding
   ========================================================================== */
.finding {
  padding: var(--section-y) var(--gutter);
}
.finding__inner {
  max-width: 1120px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 32px 22px;
}
.finding .eyebrow { margin-bottom: 28px; }
.finding__title {
  font-weight: 400;
  font-size: clamp(36px, 9.6vw, 104px);
  line-height: 1.02;
  letter-spacing: -.015em;
  max-width: 20ch;
}
.finding__title em { font-style: italic; }

.citation {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--hair);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
}
.citation__index {
  font-size: 48px;
  line-height: .85;
  color: var(--ink);
  position: relative;
}
.citation__index::after {
  content: "";
  position: absolute;
  right: -8px; bottom: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.citation__body {
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.citation__authors {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 6px;
}
.citation__note {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--ink);
}

/* ==========================================================================
   Volume I
   ========================================================================== */
.volume {
  padding: var(--section-y) var(--gutter);
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  gap: 40px;
}
.volume__art {
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: 0 20px 50px rgba(61, 42, 24, .10);
}
.volume__art .shape { position: absolute; border-radius: 50%; }
.volume__art .s1 { width: 48%; height: 48%; background: var(--ink);    left: 8%;  top: 12%; }
.volume__art .s2 { width: 32%; height: 32%; background: var(--bg-raised); left: 16%; top: 20%; }
.volume__art .s3 { width: 14%; height: 14%; background: var(--ink);    left: 25%; top: 29%; }
.volume__art .s4 { width: 40%; height: 40%; background: var(--accent); right: 8%; bottom: 16%; }
.volume__art .s5 { width: 24%; height: 8%;  background: var(--ink);    right: 16%; bottom: 30%; border-radius: 999px; transform: rotate(-12deg); }
.volume__art .s6 { width: 8%;  height: 8%;  background: var(--aicher-sky); right: 36%; top: 20%; }
.volume__art .s7 { width: 18%; height: 18%; background: var(--butter); left: 12%; bottom: 12%; }
.volume__label {
  position: absolute;
  left: 18px; right: 18px; bottom: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
}

.volume__info {
  background: var(--bg);
  border-radius: var(--radius);
}
.volume__info .eyebrow { margin-bottom: 22px; }
.volume__title {
  font-weight: 400;
  font-size: clamp(48px, 13vw, 112px);
  line-height: .95;
  letter-spacing: -.02em;
  margin-bottom: 24px;
}
.volume__title .nuqta { width: .12em; height: .12em; }
.volume__desc {
  font-style: italic;
  font-size: clamp(20px, 5vw, 24px);
  line-height: 1.4;
  max-width: 34ch;
  margin-bottom: 32px;
}
.specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.specs dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.specs dd {
  margin-top: 6px;
  font-size: 20px;
  line-height: 1.2;
}
.volume .btn { margin-top: 32px; width: 100%; }

/* ==========================================================================
   Waitlist
   ========================================================================== */
.waitlist {
  padding: var(--section-y) var(--gutter) 64px;
  display: flex;
  justify-content: center;
}
.waitlist__inner {
  width: 100%;
  max-width: 760px;
  text-align: center;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.waitlist__title {
  font-weight: 400;
  font-size: clamp(40px, 11vw, 96px);
  line-height: 1;
  letter-spacing: -.015em;
  max-width: 15ch;
}
.waitlist__title em { font-style: italic; }
.waitlist__lede {
  font-style: italic;
  font-size: 20px;
  line-height: 1.4;
  color: var(--ink-soft);
  max-width: 36ch;
}

.signup {
  width: 100%;
  max-width: 480px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.signup__row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.signup__field {
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: 1px solid rgba(61, 42, 24, .45);
  border-radius: 999px;
  background: var(--bg-raised);
  font-family: var(--serif);
  font-size: 18px;               /* ≥16px stops iOS zooming on focus */
  text-align: center;
}
.signup__field::placeholder { color: var(--ink-soft); opacity: 1; font-style: italic; }
.signup__field:focus-visible { outline-offset: 2px; }
.signup .btn { width: 100%; min-height: 52px; }
.signup__consent {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 40ch;
  margin: 4px auto 0;
}
.signup__consent a { color: var(--ink); text-underline-offset: .15em; display: inline-block; padding: 6px 2px; margin: -6px -2px; }
.signup__status {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  margin: 0;
}
.signup__status:not(:empty) {
  margin: 14px auto 6px;
  padding: 10px 14px;
  max-width: 40ch;
  background: var(--bg-raised);
  border-left: 3px solid var(--ink);
  border-radius: 4px;
  text-align: left;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  margin-top: 32px;
  padding: 36px var(--gutter) max(36px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hair);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.site-footer .brand { min-height: 44px; }
.site-footer .brand__latin { font-size: 14px; }
.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
}
.footer-links a {
  display: inline-block;
  padding: 12px 4px;             /* comfortable tap target */
  text-decoration: none;
  color: var(--ink);
}
@media (hover: hover) {
  .footer-links a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .3em; }
}

/* ==========================================================================
   Simple content pages (privacy, 404)
   ========================================================================== */
.page {
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--nav-h) + 48px) var(--gutter) 80px;
  max-width: 720px;
  margin: 0 auto;
}
.page__card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 8px 0;
}
.page h1 {
  font-weight: 400;
  font-size: clamp(40px, 10vw, 72px);
  line-height: 1.02;
  letter-spacing: -.015em;
  margin: 20px 0 24px;
}
.page h2 {
  font-weight: 400;
  font-size: 26px;
  line-height: 1.2;
  margin: 36px 0 10px;
}
.page p, .page li { font-size: 19px; line-height: 1.55; }
.page p + p { margin-top: 14px; }
.page ul { padding-left: 1.2em; }
.page li + li { margin-top: 6px; }
.page .btn { margin-top: 32px; }
.page--center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

/* ==========================================================================
   Small phones (iPhone SE 1st gen, compact Androids)
   ========================================================================== */
@media (max-width: 359px) {
  :root { --gutter: 16px; }
  .badge { font-size: 10.5px; letter-spacing: .06em; padding: 9px 12px; gap: 8px; }
  .eyebrow { font-size: 11px; letter-spacing: .14em; }
  .btn { letter-spacing: .12em; padding-left: 18px; padding-right: 18px; }
  .volume__label { font-size: 10px; letter-spacing: .08em; left: 14px; right: 14px; }
  .brand__urdu { display: none; }
}

/* ==========================================================================
   Tablet and up
   ========================================================================== */
@media (min-width: 720px) {
  :root {
    --gutter: 40px;
    --section-y: 128px;
    --nav-h: 76px;
    --radius: 20px;
  }
  .brand__latin { font-size: 17px; }
  .site-header .btn { padding: 12px 22px; }
  .hero__caption span { display: inline; }
  .hero__caption { max-width: 30ch; }
  .finding__inner { padding: 48px 44px; }
  .citation { gap: 28px; }
  .citation__index { font-size: 64px; }
  .volume .btn { width: auto; }
  .specs { gap: 24px; padding: 24px 0; }
  .specs dd { font-size: 24px; }
  .volume__label { left: 24px; right: 24px; bottom: 20px; }
  .signup__row {
    flex-direction: row;
    padding: 6px;
    border: 1px solid rgba(61, 42, 24, .45);
    border-radius: 999px;
    background: var(--bg-raised);
  }
  .signup__row:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }
  .signup__field {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    text-align: left;
  }
  .signup__field:focus-visible { outline: none; }
  .signup .btn { width: auto; min-height: 48px; }
  .waitlist__inner { padding: 48px 40px; }
  .site-footer {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* ==========================================================================
   Desktop
   ========================================================================== */
@media (min-width: 1024px) {
  :root { --gutter: 56px; --section-y: 160px; }
  .volume {
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
  }
  .volume__info { padding: 24px; }
  .finding__inner { padding: 64px 56px; }
}

/* Spam trap on the waitlist form: hidden from people, visible to bots */
.signup__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ==========================================================================
   Private launch page (public homepage): one screen, logo + sign-up only
   ========================================================================== */
body.is-private {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.is-private main { flex: 1; display: flex; }
.hero--private {
  flex: 1;
  min-height: 0;
  padding: calc(var(--nav-h) + env(safe-area-inset-top) + 24px) var(--gutter) 24px;
}
.hero--private .badge { margin-bottom: 28px; }
.hero--private .wordmark { font-size: clamp(56px, min(21vw, 24vh), 220px); }
.signup--hero {
  margin-top: 36px;
  padding: 16px;
  background: rgba(242, 234, 208, .94);   /* keeps text readable over the moving circles */
  border-radius: var(--radius);
}
.signup--hero .signup__consent { font-size: 14px; }
.signup--hero .signup__status:not(:empty) { margin: 6px 0 2px; max-width: none; }
.site-footer--mini {
  margin-top: 0;
  padding: 12px var(--gutter) max(12px, env(safe-area-inset-bottom));
  justify-content: center;
  text-align: center;
  font-size: 11px;
}
.site-footer--mini a {
  color: var(--ink);
  display: inline-block;
  padding: 10px 4px;                      /* 44px tap target */
}
@media (max-height: 640px) {
  .hero--private .badge { margin-bottom: 16px; }
  .signup--hero { margin-top: 20px; }
}
@media (min-width: 720px) {
  .signup--hero { padding: 20px; }
}
