/* ==========================================================================
   The Prophet is Coming! — design system
   Read DESIGN.md before changing anything in this file.
   Two surfaces only: .night (deep purple sky, default) and .daylight (cream).
   ========================================================================== */

:root {
  /* Night sky — sampled from the launch poster and the book jacket */
  --night-900: #140A33;
  --night-800: #1C1049;
  --night-700: #2A1760;
  --night-600: #3A2178;
  --night-500: #4B2A85;

  /* Golden light — the ribbon of light on the cover */
  --gold-300: #FFE7A8;
  --gold-400: #FFD97A;
  --gold-500: #F5C451;
  --gold-600: #E0A83A;

  /* Illustration accents */
  --coral: #EE7A62;
  --teal: #5FC5D4;
  --pink: #F3A6C6;
  --sky: #A8D8F0;

  /* Ink */
  --cream: #FFF6E6;
  --cream-dim: rgba(255, 246, 230, 0.74);
  --cream-faint: rgba(255, 246, 230, 0.52);
  --ink: #241653;
  --ink-dim: #5A4A86;

  /* Surfaces */
  --panel: rgba(255, 255, 255, 0.055);
  --panel-line: rgba(245, 196, 81, 0.42);
  --hairline: rgba(255, 246, 230, 0.14);

  --wide: 68rem;
  --measure: 36rem;
  /* One canonical page gutter. Both .wrap and .bar-inner use it so the header
     and the content below it always share an edge. */
  --gutter: clamp(1.5rem, 5vw, 2rem);
  --radius: 22px;

  --shadow-lift: 0 24px 60px -24px rgba(6, 2, 24, 0.85);
  --shadow-book: 0 40px 70px -26px rgba(6, 2, 24, 0.9);

  --font-display: "Baloo 2", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --font-body: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--night-800);
  color: var(--cream);
  font: 400 1.0625rem/1.7 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* height:auto is load-bearing — the cover carries width/height attributes and
   would render stretched without it. */
img { max-width: 100%; height: auto; display: block; }

a { color: var(--gold-400); }

::selection { background: var(--gold-500); color: var(--night-900); }

:focus-visible {
  outline: 3px solid var(--gold-400);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--gold-400);
  color: var(--night-900);
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  z-index: 100;
}
.skip:focus { left: 0; }

/* --- Surfaces ------------------------------------------------------------ */

/* One continuous sky for the whole document, not a gradient per section —
   per-section gradients band visibly where sections meet.
   It lives on a fixed, z-index:-1 pseudo-element rather than
   `background-attachment: fixed`, which is expensive and unreliable on mobile
   Safari. The stars stay put while the page scrolls, like a real sky, and the
   pattern never has to repeat however long the page gets. */
html { background: var(--night-900); }

.night { color: var(--cream); background: transparent; }

.night::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-repeat: no-repeat;
  background-image:
    /* starfield */
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255,255,255,.85), transparent),
    radial-gradient(1px 1px at 28% 62%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.5px 1.5px at 44% 12%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 63% 44%, rgba(255,255,255,.55), transparent),
    radial-gradient(2px 2px at 78% 22%, rgba(255,255,255,.8), transparent),
    radial-gradient(1px 1px at 88% 70%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.5px 1.5px at 8% 82%, rgba(255,255,255,.65), transparent),
    radial-gradient(1px 1px at 52% 88%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 70% 92%, rgba(255,255,255,.6), transparent),
    radial-gradient(1px 1px at 36% 34%, rgba(255,255,255,.45), transparent),
    radial-gradient(1px 1px at 94% 40%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 20% 48%, rgba(255,255,255,.5), transparent),
    /* the glow the ribbon of light throws up into the sky */
    radial-gradient(70rem 40rem at 50% -8rem, rgba(126, 74, 194, 0.55), transparent 70%),
    linear-gradient(180deg, var(--night-700) 0%, var(--night-800) 45%, var(--night-900) 100%);
}

/* Sections only host sparkles; they must stay transparent so the sky shows
   through. `clip` not `hidden` — `hidden` would make this a scroll container
   and break the sticky order summary and header inside it. */
[data-sparkles] {
  position: relative;
  overflow: hidden;
  overflow: clip;
}

.daylight {
  background: var(--cream);
  color: var(--ink);
}
.daylight a { color: #B0651C; }

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

/* Sparkles injected by app.js. Without JS the CSS starfield alone still reads. */
.sparkle {
  position: absolute;
  pointer-events: none;
  line-height: 1;
  animation: twinkle 4s ease-in-out infinite;
  will-change: opacity, transform;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.1); }
}

/* --- Type ---------------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0;
}

h1 { font-size: clamp(2.9rem, 8.5vw, 5rem); }
h2 { font-size: clamp(1.9rem, 4.4vw, 2.85rem); }
h3 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.005em; }

p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.1rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-400);
}
.eyebrow::before, .eyebrow::after { content: "\2726"; font-size: 0.85em; opacity: 0.9; }
.daylight .eyebrow { color: #C08419; }

.lede {
  font-size: clamp(1.125rem, 2.2vw, 1.3125rem);
  line-height: 1.62;
  color: var(--cream-dim);
  max-width: var(--measure);
}
.daylight .lede { color: var(--ink-dim); }

.byline {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--cream-faint);
}

.fineprint {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--cream-faint);
}
.daylight .fineprint { color: var(--ink-dim); }

/* --- Layout -------------------------------------------------------------- */

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--wide);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* Logical properties on purpose: .wrap and .section are sometimes the same
   element, and shorthand `padding` on one would silently zero the other's. */
.section { padding-block: clamp(3.5rem, 9vw, 6rem); }
.section-narrow { max-width: var(--measure); }

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

.bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(42, 23, 96, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}

.bar-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.9rem var(--gutter);
}

.mark {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--cream);
  margin-right: auto;
  white-space: nowrap;
}

.bar nav { display: none; gap: 1.75rem; font-size: 0.9375rem; font-weight: 600; }
.bar nav a { text-decoration: none; color: var(--cream-dim); }
.bar nav a:hover { color: var(--gold-400); }

@media (min-width: 48rem) {
  .bar nav { display: flex; }
}

/* --- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.95rem 1.75rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-gold {
  background: linear-gradient(180deg, var(--gold-400), var(--gold-600));
  color: var(--night-900);
  box-shadow: 0 10px 30px -10px rgba(245, 196, 81, 0.65);
}
.btn-gold:hover:not(:disabled) {
  box-shadow: 0 14px 38px -10px rgba(245, 196, 81, 0.8);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: rgba(255, 217, 122, 0.5);
  color: var(--cream);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(245, 196, 81, 0.12);
  border-color: var(--gold-400);
}

.btn-sm { padding: 0.55rem 1.15rem; font-size: 0.875rem; }
.btn-block { width: 100%; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin: 2rem 0 1.1rem;
}

/* --- Panel (the gold-bordered box from the launch poster) ---------------- */

.panel {
  background: rgba(12, 5, 34, 0.42);
  border: 1.5px solid var(--panel-line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.25rem);
}
.daylight .panel {
  background: #fff;
  border-color: rgba(224, 168, 58, 0.4);
}

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

.hero {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
  align-items: center;
  padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(3rem, 8vw, 5rem);
}

@media (min-width: 56rem) {
  .hero { grid-template-columns: 1.05fr 0.95fr; }
}

.hero h1 {
  background: linear-gradient(180deg, #FFFDF6 20%, var(--gold-300) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(255, 217, 122, 0.28);
}

/* Cover, framed in white and tipped like the poster. */
.cover-stage {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.cover-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 118%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 217, 122, 0.34) 0%, rgba(255, 217, 122, 0) 68%);
}

.cover-frame {
  padding: 10px;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-book);
  transform: rotate(-2.5deg);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.3, 1);
  max-width: 26rem;
}
.cover-frame:hover { transform: rotate(0deg) scale(1.02); }
.cover-frame img { border-radius: 12px; }

.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cream-dim);
  list-style: none;
  margin: 0;
  padding: 0;
}
.trust li { display: flex; align-items: center; gap: 0.45rem; }
.trust li::before { content: "\2726"; color: var(--gold-500); font-size: 0.75em; }

/* --- Hadith ------------------------------------------------------------- */

.hadith {
  max-width: 40rem;
  margin: 0 auto;
  text-align: center;
}
.hadith blockquote {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.4vw, 1.375rem);
  font-weight: 500;
  line-height: 1.65;
  letter-spacing: -0.005em;
  color: var(--cream);
}
.hadith cite {
  font-style: normal;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-400);
}

/* --- Peek inside --------------------------------------------------------- */

.spreads {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  margin-top: 2.5rem;
}
@media (min-width: 44rem) {
  .spreads { grid-template-columns: 1fr 1fr; }
}
.spread {
  margin: 0;
  border: 1px solid rgba(36, 22, 83, 0.1);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 40px -22px rgba(36, 22, 83, 0.55);
}
.spread img { width: 100%; }

/* --- Forms --------------------------------------------------------------- */

.field { margin-bottom: 1.1rem; }
.field-row {
  display: grid;
  gap: 1.1rem;
}
@media (min-width: 34rem) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row.thirds { grid-template-columns: 2fr 1fr 1fr; }
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream-faint);
}
.daylight label { color: var(--ink-dim); }

input, select, textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1.5px solid rgba(255, 246, 230, 0.22);
  border-radius: 12px;
  background: rgba(12, 5, 34, 0.5);
  color: var(--cream);
  font: 400 1rem/1.5 var(--font-body);
}
input::placeholder, textarea::placeholder { color: rgba(255, 246, 230, 0.35); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(245, 196, 81, 0.2);
}
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold-400) 50%),
                    linear-gradient(135deg, var(--gold-400) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 55%, calc(100% - 0.8rem) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}
select option { background: var(--night-800); color: var(--cream); }
textarea { resize: vertical; min-height: 5.5rem; }

.checkline {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--cream-dim);
}
.checkline input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  margin-top: 0.18rem;
  accent-color: var(--gold-500);
}

/* Inline waitlist: one field + one button on a line */
.inline-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
@media (min-width: 34rem) {
  .inline-form { grid-template-columns: 1fr auto; align-items: start; }
}

.form-note {
  margin-top: 0.9rem;
  font-size: 0.875rem;
  min-height: 1.25rem;
}
.form-note.ok    { color: var(--gold-300); font-weight: 700; }
.form-note.error { color: #FFB3A0; font-weight: 700; }

/* --- Checkout ------------------------------------------------------------ */

.checkout {
  display: grid;
  gap: clamp(2rem, 5vw, 3rem);
  align-items: start;
}
@media (min-width: 58rem) {
  .checkout { grid-template-columns: 1.35fr 0.85fr; }
  .summary { position: sticky; top: 5.5rem; }
}

.step {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1.35rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
}
.step-n {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  flex: none;
  border-radius: 50%;
  background: var(--gold-500);
  color: var(--night-900);
  font-size: 0.9375rem;
  font-weight: 800;
}

.summary-book {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--hairline);
}
.summary-book img {
  width: 5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lift);
}

.lines { margin: 1.25rem 0 0; font-size: 0.9375rem; }
.lines div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  color: var(--cream-dim);
}
.lines .total {
  margin-top: 0.6rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--cream);
}

.next-up {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--cream-faint);
}
.next-up li {
  counter-increment: step;
  display: flex;
  gap: 0.6rem;
  padding: 0.4rem 0;
}
.next-up li::before {
  content: counter(step);
  flex: none;
  display: grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.1rem;
  border: 1px solid var(--panel-line);
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.6875rem;
  color: var(--gold-400);
}

/* The honorific. Amiri is loaded subset to this one glyph — see index.html. */
.pbuh {
  font-family: "Amiri", serif;
  font-size: 1.3em;
  line-height: 1;
  color: var(--gold-300);
}

/* Square's card iframe mounts here. */
#card-container {
  min-height: 5.5rem;
  padding: 0.35rem;
  border: 1.5px solid rgba(255, 246, 230, 0.22);
  border-radius: 12px;
  background: rgba(12, 5, 34, 0.5);
}

.spinner {
  width: 1.05rem;
  height: 1.05rem;
  border: 2.5px solid rgba(20, 10, 51, 0.3);
  border-top-color: var(--night-900);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- FAQ ----------------------------------------------------------------- */

.faq { margin-top: 2rem; }
.faq details {
  border-bottom: 1px solid var(--hairline);
  padding: 1.1rem 0;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--gold-400); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: "\2013"; }
.faq details p { margin: 0.85rem 0 0; color: var(--cream-dim); max-width: var(--measure); }

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

footer {
  border-top: 1px solid var(--hairline);
  padding: 2.5rem 0 3.5rem;
  font-size: 0.875rem;
  color: var(--cream-faint);
}
footer a { color: var(--gold-400); }
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  justify-content: space-between;
  align-items: center;
}

/* --- Confirmation -------------------------------------------------------- */

.confirm {
  max-width: 34rem;
  margin: 0 auto;
  text-align: center;
  padding-block: clamp(3.5rem, 12vw, 7rem);
}
.confirm .badge {
  display: grid;
  place-items: center;
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1.75rem;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-400), var(--gold-600));
  color: var(--night-900);
  font-size: 2.4rem;
  box-shadow: 0 16px 44px -12px rgba(245, 196, 81, 0.65);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
