/*
 * caast.ai manifesto landing — dark Caast theme.
 *
 * Brand accent values mirror src/content/design-tokens.ts (the activate design system's
 * single source of truth). This is a separate marketing surface (own Cloud Run service), so
 * it cannot import the TS token module — values are copied verbatim with this note. If a brand
 * accent changes in design-tokens.ts, update the matching --accent* var here.
 *
 *   --accent     #F43460  = palette.primaryPink
 *   --accent-2   #EC274F  = gradients.primaryToSupport end stop
 *   --pink-soft  #E7A6C9  = palette.pinkHighlight
 *   --plum       #81226B  = palette.plum (logo dot)
 *
 * Dark surface/ink values below are manifesto-only (the activate system is white-bg).
 */

/* Self-hosted Poppins (latin woff2) — no third-party font dependency, no FOUT/privacy leak. */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/poppins-700.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: italic; font-weight: 600; font-display: swap; src: url("fonts/poppins-600-italic.woff2") format("woff2"); }

:root {
  /* Brand accents (match src/content/design-tokens.ts). */
  --accent: #f43460;       /* primaryPink */
  --accent-2: #ec274f;     /* primaryToSupport end stop */
  --pink-soft: #e7a6c9;    /* pinkHighlight */
  --plum: #81226b;         /* plum (logo dot) */

  /* Light surface — Caast activate/playground system. */
  --bg: #ffffff;           /* palette.background */
  --bg-top: #fdf2f8;       /* palette.primaryPinkSoft — faint warm crown */
  --ink: #1d1d1f;          /* palette.headingPlum (default body text) */
  --ink-dim: #5c5e68;      /* palette.bodyWarmGray */
  --wash-1: rgba(244, 52, 96, 0.06);
  --wash-2: rgba(129, 34, 107, 0.05);
  --wash-3: rgba(231, 166, 201, 0.12);
  --atmos: linear-gradient(180deg, rgba(255, 255, 255, 0) 55%, rgba(253, 242, 248, 0.6) 100%);
  --grain-opacity: 0.02;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  /* Washes balanced to fill the right column on wide viewports (left-weighted text). */
  background:
    radial-gradient(90% 70% at 88% 26%, var(--wash-1), transparent 60%),
    radial-gradient(70% 80% at 100% 74%, var(--wash-2), transparent 55%),
    radial-gradient(100% 90% at 6% 104%, var(--wash-3), transparent 52%),
    linear-gradient(180deg, var(--bg-top), var(--bg));
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Poppins", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100%;
  overflow-x: hidden;
}

/* Layered atmosphere over the base gradient for depth toward the bottom. */
.atmos {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--atmos);
}
/* Subtle film grain — pure CSS noise, very low opacity. */
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative; z-index: 2;
  min-height: 100%;
  display: flex; flex-direction: column;
  padding: clamp(22px, 5vw, 52px);
  max-width: 1280px; margin: 0 auto;
}

/* ---------- header ---------- */
.head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
  opacity: 0; animation: rise 0.9s 0.1s forwards cubic-bezier(0.2, 0.7, 0.2, 1);
}
.mark {
  display: inline-flex; align-items: flex-end;
  font-size: clamp(26px, 3.4vw, 34px); font-weight: 600; letter-spacing: -0.02em;
  line-height: 1; color: var(--accent); text-decoration: none;
}
.mark .dot {
  width: 0.22em; height: 0.22em; border-radius: 50%;
  background: var(--plum); margin-left: 0.08em; margin-bottom: 0.1em;
  animation: dot-rotate 3.6s ease-in-out infinite;
}

/* ---------- manifesto ---------- */
.manifesto {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  /* px-based width: `ch` here would resolve against the 16px body font, not the
     headline, collapsing the column to ~160px and wrapping every word. */
  max-width: min(100%, 56rem); margin: clamp(28px, 6vh, 72px) 0;
}

/* Hero "Sorry." — deadpan opener; pink period echoes the Caast. wordmark dot. */
.hero {
  display: block;
  font-size: clamp(64px, 12vw, 128px); font-weight: 700; line-height: 1;
  letter-spacing: -0.04em; color: var(--ink);
  margin-bottom: clamp(10px, 1.6vh, 16px);
  opacity: 0; transform: translateY(22px);
  animation: rise 1s 0.2s forwards cubic-bezier(0.2, 0.7, 0.2, 1);
}
.hero-dot { color: var(--accent); }

/* Deadpan placeholder-page subtitle under the hero. */
.subhero {
  display: block;
  font-size: clamp(15px, 2.2vw, 22px); font-weight: 400; color: var(--ink-dim);
  letter-spacing: 0.01em;
  margin-bottom: clamp(26px, 4.5vh, 48px);
  opacity: 0; transform: translateY(22px);
  animation: rise 1s 0.35s forwards cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lines {
  font-weight: 600; font-size: clamp(30px, 5.5vw, 62px); line-height: 1.06;
  letter-spacing: -0.025em; color: var(--ink); text-wrap: balance;
}
.line {
  display: block;
  opacity: 0; transform: translateY(22px);
  animation: rise 1s forwards cubic-bezier(0.2, 0.7, 0.2, 1);
}
.line:nth-child(1) { animation-delay: 0.6s; }
.line:nth-child(2) { animation-delay: 0.85s; }

.faded { color: var(--ink-dim); }
.glow {
  font-style: italic; font-weight: 600;
  color: var(--accent);
}

/* ---------- footer / cta ---------- */
.foot {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 20px 24px; flex-wrap: wrap;
  opacity: 0; animation: rise 1s 1.5s forwards;
}
.drop {
  font-size: 12px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 14px;
}
.mailrow { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.mail {
  position: relative; text-decoration: none; color: var(--ink);
  font-weight: 600; font-size: clamp(17px, 2.4vw, 26px); letter-spacing: -0.01em;
  padding-bottom: 4px; transition: color 0.25s;
}
.mail::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left;
}
.mail:hover, .mail:focus-visible { color: var(--accent); }

/* Flat icon button — copy glyph swaps to a check on success. ink-dim icon clears
   WCAG 1.4.11 non-text contrast (~6.5:1 on the dark bg). */
.copy {
  appearance: none; border: 0; background: transparent; color: var(--ink-dim);
  padding: 6px; border-radius: 6px; cursor: pointer; line-height: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.2s;
}
.copy:hover, .copy:focus-visible { color: var(--accent); }
.copy.done { color: var(--accent); }
.copy .icon { width: 18px; height: 18px; display: block; }
.copy .icon-check { display: none; }
.copy.done .icon-copy { display: none; }
.copy.done .icon-check { display: block; }

.est {
  font-size: 10px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-dim); white-space: nowrap;
}

/* ---------- focus / sr-only ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- animations ---------- */
@keyframes rise { to { opacity: 1; transform: translateY(0); } }
@keyframes dot-rotate {
  0%, 100% { background-color: var(--plum); }
  50%      { background-color: var(--pink-soft); }
}

@media (max-width: 540px) {
  .manifesto { max-width: 100%; }
  /* Stack the footer so the email + copy icon keep one row and EST sits below. */
  .foot { flex-direction: column; align-items: flex-start; gap: 16px; }
  .mail { font-size: clamp(15px, 5vw, 24px); }
}

/* Short / landscape viewports — scale type by HEIGHT so nothing clips below the
   fold (width-based clamps alone overflow a short, wide screen). */
@media (max-height: 600px) and (orientation: landscape) {
  .wrap { padding-block: clamp(12px, 3vh, 24px); }
  .manifesto { justify-content: flex-start; margin: clamp(10px, 3vh, 24px) 0; }
  .hero { font-size: clamp(38px, 9vh, 72px); margin-bottom: clamp(4px, 1.2vh, 12px); }
  .subhero { font-size: clamp(12px, 3vh, 18px); margin-bottom: clamp(8px, 2.4vh, 20px); }
  .lines { font-size: clamp(20px, 5vh, 40px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero, .subhero, .line, .head, .foot { opacity: 1; transform: none; }
}
