/* =========================================================================
   BubOps — Certificate Apocalypse Survival Broadcast
   Concept: browser cert-error interstitial × Emergency Alert System.
   Palette is mapped, not decorative:
     charcoal base · EAS amber (signal) · cert-error red (alarm) ·
     phosphor green (the "it's fine if you automate" reassurance)
   ========================================================================= */

:root {
  --base:      #141210;   /* warm charcoal — the emergency screen */
  --base-2:    #1e1b18;   /* raised panel */
  --base-3:    #272320;   /* raised panel, higher */
  --hair:      #3a342e;   /* hairline */
  --bone:      #ede6d8;   /* primary text — old broadcast bone-white */
  --muted:     #9c9186;   /* secondary text */
  --amber:     #f2a900;   /* EAS amber — brand / signal */
  --amber-dim: #b9820c;
  --red:       #d3352b;   /* cert-error red — alarm / countdown */
  --red-deep:  #7d1a15;
  --green:     #3df07a;   /* phosphor — terminal / reassurance */

  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --maxw: 1120px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 4px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--base);
  color: var(--bone);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.075rem);
  line-height: 1.6;
  /* faint scanline atmosphere — the CRT emergency screen */
  background-image: repeating-linear-gradient(
    0deg, rgba(0,0,0,0.16) 0 1px, transparent 1px 3px);
  background-attachment: fixed;
}

h1, h2, h3 { font-family: var(--font-mono); font-weight: 800; line-height: 1.05; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }
strong { color: var(--bone); font-weight: 600; }
a { color: var(--amber); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: #ffcb4d; }

.phosphor { color: var(--green); }

/* Accessibility ------------------------------------------------------------ */
.skip-link {
  position: absolute; left: 0.5rem; top: 0.5rem; z-index: 100;
  transform: translateY(-150%);
  background: var(--amber); color: #1a1206; font-family: var(--font-mono);
  font-weight: 700; padding: 0.6rem 1rem; border-radius: var(--radius);
  transition: transform 0.15s ease;
}
.skip-link:focus { transform: translateY(0); }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

/* =========================================================================
   Emergency Alert System bar
   ========================================================================= */
.eas {
  position: sticky; top: 0; z-index: 40;
  background: repeating-linear-gradient(45deg, #1a1206 0 14px, #241906 14px 28px);
  border-bottom: 2px solid var(--amber);
  overflow: hidden;
}
.eas__track {
  display: flex; width: max-content;
  color: var(--amber); font-family: var(--font-mono); font-weight: 700;
  font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.5rem 0; white-space: nowrap;
  animation: marquee 34s linear infinite;
}
.eas__track > span { padding-right: 2rem; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* =========================================================================
   HERO — cert-error interstitial
   ========================================================================= */
.hero {
  position: relative;
  padding: clamp(3rem, 8vh, 6rem) var(--gutter) clamp(3.5rem, 9vh, 6.5rem);
  border-bottom: 1px solid var(--hair);
  /* subtle red vignette bleeding up from the alarm */
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(211,53,43,0.16), transparent 60%),
    radial-gradient(80% 60% at 50% 120%, rgba(242,169,0,0.06), transparent 70%);
}
.hero__inner { max-width: 760px; margin: 0 auto; }

.hero__glyph { color: var(--red); margin-bottom: 1.5rem; }

.hero__eyebrow {
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--red); margin: 0 0 0.5rem;
}
.hero__errcode {
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(0.85rem, 0.8rem + 0.6vw, 1.05rem);
  letter-spacing: 0.06em; color: var(--muted);
  background: var(--base-2); border: 1px solid var(--hair);
  display: inline-block; padding: 0.4rem 0.7rem; border-radius: var(--radius);
  margin: 0 0 1.75rem;
}
.hero__title {
  font-size: clamp(2.4rem, 1.6rem + 4.6vw, 4.5rem);
  margin: 0 0 1.5rem;
}
.hero__title-accent { color: var(--red); }

.hero__lede {
  font-size: clamp(1.05rem, 1rem + 0.5vw, 1.3rem);
  color: var(--bone); max-width: 60ch; margin-bottom: 2rem;
}

/* Live "Valid until" certificate field */
.cert-field {
  background: var(--base-2); border: 1px solid var(--hair);
  border-left: 3px solid var(--red);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  font-family: var(--font-mono); margin-bottom: 2rem;
}
.cert-field__row {
  display: flex; gap: 1rem; align-items: baseline;
  padding: 0.35rem 0; flex-wrap: wrap;
}
.cert-field__row + .cert-field__row { border-top: 1px dashed var(--hair); }
.cert-field__key {
  color: var(--muted); font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase; min-width: 5.5rem; flex-shrink: 0;
}
.cert-field__val { color: var(--bone); font-size: 0.92rem; }
.cert-field__row--countdown { align-items: center; }

.countdown { display: flex; gap: 0.9rem; }
.countdown__unit { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.countdown__unit b {
  font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2.4rem); font-weight: 800;
  color: var(--red); font-variant-numeric: tabular-nums;
}
.countdown__unit i {
  font-style: normal; font-size: 0.6rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted); margin-top: 0.35rem;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }

/* Buttons ------------------------------------------------------------------ */
.btn {
  --btn-bg: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem;
  letter-spacing: 0.02em; text-decoration: none;
  padding: 0.85rem 1.4rem; border-radius: var(--radius);
  border: 1px solid var(--hair); background: var(--btn-bg);
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { --btn-bg: var(--amber); color: #1a1206; border-color: var(--amber); }
.btn--primary:hover { --btn-bg: #ffcb4d; color: #1a1206; }
.btn--ghost { color: var(--bone); }
.btn--ghost:hover { border-color: var(--amber); color: var(--amber); }

/* =========================================================================
   Section scaffolding
   ========================================================================= */
.section {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3.5rem, 8vh, 6rem) var(--gutter);
}
.section__head { max-width: 720px; margin-bottom: 2.75rem; }
.eyebrow {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--amber); margin: 0 0 0.75rem;
}
.section__title { font-size: clamp(1.8rem, 1.3rem + 2.2vw, 2.9rem); margin: 0 0 1.1rem; }
.section__intro { color: var(--muted); font-size: 1.075rem; max-width: 62ch; }
.section__intro strong { color: var(--bone); }

/* =========================================================================
   THE CRISIS — shrinking certificate cards (the signature)
   Card height scales with --span (398 → 47) so validity literally collapses.
   ========================================================================= */
.timeline {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
  align-items: end;
}
.certcard {
  position: relative;
  /* height maps to validity: 398d → ~330px, 47d → ~150px */
  min-height: calc(150px + (var(--span) / 398) * 190px);
  background: var(--base-2); border: 1px solid var(--hair);
  border-radius: var(--radius); padding: 1.1rem 1rem 1.15rem;
  display: flex; flex-direction: column;
  overflow: hidden;
  transform-origin: bottom;
}
/* amber "validity remaining" fill rising from the base of each card */
.certcard::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: calc((var(--span) / 398) * 100%);
  background: linear-gradient(180deg, rgba(242,169,0,0.14), rgba(242,169,0,0.05));
  border-top: 1px solid rgba(242,169,0,0.35);
  z-index: 0;
}
.certcard > * { position: relative; z-index: 1; }
.certcard--now { border-color: var(--amber); }
.certcard--doom::before {
  background: linear-gradient(180deg, rgba(211,53,43,0.2), rgba(211,53,43,0.06));
  border-top-color: rgba(211,53,43,0.5);
}
.certcard--doom { border-color: var(--red-deep); }

.certcard__tag {
  align-self: flex-start;
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: #1a1206; background: var(--amber);
  padding: 0.2rem 0.5rem; border-radius: 999px; margin-bottom: 0.6rem;
}
.certcard__tag--soon { background: var(--bone); }
.certcard__tag--doom { background: var(--red); color: #fff; }
.certcard__days {
  font-family: var(--font-mono); font-weight: 800;
  font-size: clamp(2rem, 1.5rem + 2.2vw, 3.2rem); line-height: 1;
  color: var(--bone); font-variant-numeric: tabular-nums;
}
.certcard--doom .certcard__days { color: var(--red); }
.certcard__unit {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem;
}
.certcard__when {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--amber);
  letter-spacing: 0.04em; margin-bottom: 0.6rem;
}
.certcard--doom .certcard__when { color: var(--red); }
.certcard__note { font-size: 0.82rem; color: var(--muted); margin-top: auto; }

.crisis__foot {
  margin-top: 2.5rem; font-family: var(--font-mono); font-size: 0.95rem;
  color: var(--muted); border-top: 1px solid var(--hair); padding-top: 1.5rem;
}

/* =========================================================================
   FIELD REPORTS — testimonials as intercepted transmissions
   ========================================================================= */
.reports__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.25rem;
}
.report {
  margin: 0; background: var(--base-2); border: 1px solid var(--hair);
  border-radius: var(--radius); padding: 1.5rem 1.4rem;
  position: relative;
}
.report::before {
  content: "▮ REC"; position: absolute; top: 0.9rem; right: 1rem;
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em;
  color: var(--red);
}
.report--good::before { content: "▮ SAFE"; color: var(--green); }
.report blockquote {
  margin: 0 0 1.1rem; font-size: 1.05rem; color: var(--bone); line-height: 1.5;
}
.report figcaption { display: flex; flex-direction: column; gap: 0.1rem; }
.report__who { font-family: var(--font-mono); font-weight: 700; color: var(--amber); font-size: 0.85rem; }
.report--good .report__who { color: var(--green); }
.report__role { font-size: 0.78rem; color: var(--muted); }

/* =========================================================================
   SURVIVAL RUNBOOK — terminal runbook, phosphor green
   ========================================================================= */
.survive {
  background: #0f0d0b; border: 1px solid var(--hair); border-radius: var(--radius);
  max-width: var(--maxw); margin-left: auto; margin-right: auto;
}
.runbook { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.step {
  display: grid; grid-template-columns: auto 1fr; gap: 1.5rem;
  padding: 1.6rem 0; border-top: 1px solid var(--hair);
}
.step:first-child { border-top: 0; }
.step__num {
  font-family: var(--font-mono); font-weight: 800; font-size: 1.4rem;
  color: var(--green); line-height: 1;
}
.step__num::before { content: "$ "; color: var(--muted); }
.step__title { font-size: 1.2rem; margin: 0 0 0.5rem; color: var(--bone); }
.step__body p { margin: 0; color: var(--muted); }
.step__body p strong,
.step:hover .step__title { color: var(--green); }

/* =========================================================================
   PRICING — stages of grief (satire, non-functional)
   ========================================================================= */
.plans {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem;
  align-items: start;
}
.plan {
  position: relative; background: var(--base-2); border: 1px solid var(--hair);
  border-radius: var(--radius); padding: 1.75rem 1.5rem;
  display: flex; flex-direction: column;
}
.plan--featured { border-color: var(--amber); background: var(--base-3); }
.plan__badge {
  position: absolute; top: -0.7rem; left: 1.5rem;
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: #1a1206;
  background: var(--amber); padding: 0.25rem 0.6rem; border-radius: 999px;
}
.plan__name { font-size: 1.4rem; margin: 0 0 0.75rem; }
.plan--featured .plan__name { color: var(--amber); }
.plan__price { display: flex; align-items: baseline; gap: 0.4rem; margin: 0 0 0.75rem; }
.plan__amount { font-family: var(--font-mono); font-weight: 800; font-size: 2rem; color: var(--bone); }
.plan__per { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.plan__pitch { font-style: italic; color: var(--bone); margin: 0 0 1.1rem; }
.plan__list { list-style: none; margin: 0 0 1.5rem; padding: 0; flex: 1; }
.plan__list li {
  font-size: 0.9rem; color: var(--muted); padding: 0.45rem 0 0.45rem 1.4rem;
  position: relative; border-top: 1px dashed var(--hair);
}
.plan__list li:first-child { border-top: 0; }
.plan__list li::before { content: "▸"; position: absolute; left: 0; color: var(--amber); }
.plan__cta { width: 100%; }

/* =========================================================================
   FOOTER — the fine print / certificate details panel
   ========================================================================= */
.footer {
  border-top: 2px solid var(--amber);
  background: var(--base-2);
  padding: clamp(3rem, 7vh, 5rem) var(--gutter) 3rem;
}
.footer__grid {
  max-width: var(--maxw); margin: 0 auto 2.5rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2.5rem;
}
.footer__h { font-size: 1.15rem; margin: 0 0 0.9rem; color: var(--amber); }
.footer__block p { color: var(--muted); }
.footer__links { list-style: none; margin: 1rem 0 0; padding: 0; }
.footer__links li { padding: 0.25rem 0; font-family: var(--font-mono); font-size: 0.85rem; }
.footer__seal {
  max-width: var(--maxw); margin: 0 auto 1.75rem;
  border: 1px dashed var(--hair); border-radius: var(--radius);
  padding: 1rem 1.15rem; overflow-x: auto;
}
.footer__seal-label {
  display: block; font-family: var(--font-mono); font-size: 0.62rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem;
}
.footer__seal code { font-family: var(--font-mono); font-size: 0.8rem; color: var(--green); white-space: nowrap; }
.footer__legal {
  max-width: var(--maxw); margin: 0 auto; text-align: center;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted);
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 720px) {
  .timeline { grid-template-columns: repeat(2, 1fr); }
  .certcard { min-height: calc(130px + (var(--span) / 398) * 120px); }
  .step { grid-template-columns: 1fr; gap: 0.5rem; }
  .countdown { gap: 0.7rem; }
}
@media (max-width: 420px) {
  .timeline { grid-template-columns: 1fr; }
  .certcard { min-height: auto; }
  .certcard::before { height: 100%; opacity: 0.5; }
}

/* =========================================================================
   Motion — flicker on load, reveal on scroll; all opt-out under reduce
   ========================================================================= */
#errcode { animation: flicker 1.4s steps(2) 1; }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  8%, 24% { opacity: 0.35; }
  16% { opacity: 0.8; }
}
.certcard { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.certcard.is-in { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .eas__track { animation: none; }
  #errcode { animation: none; }
  .certcard { opacity: 1; transform: none; transition: none; }
  .btn:hover { transform: none; }
}
