/* ── Daily Blindness Fact ─────────────────────────────────────────────
   Self-contained vanilla site. No framework, no runtime.
   Accent is a warm amber that echoes the emboss / braille motif.       */

:root {
  --accent: oklch(0.8 0.14 66);
  --accent-glow: oklch(0.8 0.14 66 / 0.55);
  --ink: #ece7df;
  --stage-pad: clamp(16px, 3vw, 56px);
  --card-pad: clamp(30px, 6vw, 76px);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: #050505;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ── Stage: dark backdrop, card fills the viewport ──────────────────── */
.stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--stage-pad);
  background: #050505;
}

/* ── Card ───────────────────────────────────────────────────────────── */
.card {
  position: relative;
  width: 100%;
  max-width: 1160px;
  min-height: max(560px, calc(100dvh - 2 * var(--stage-pad)));
  padding: var(--card-pad);
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(32px, 6vh, 64px);
  background: radial-gradient(125% 95% at 18% -5%, #191410 0%, #0b0908 52%, #070605 100%);
  box-shadow: 0 50px 130px rgba(0, 0, 0, 0.65);
}

/* ── Background braille dot-field (populated by JS) ──────────────────── */
.dot-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.dot-field span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.09);
  opacity: 0;
  animation: dotRise 0.8s ease forwards;
}

/* ── Ripple rings ───────────────────────────────────────────────────── */
.ripple {
  position: absolute;
  left: 82%;
  top: 60%;
  pointer-events: none;
  z-index: 1;
}
.ripple span {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-glow);
  animation: ripple 5s ease-out infinite;
}
.ripple span:nth-child(2) { animation-delay: 1.66s; }
.ripple span:nth-child(3) { animation-delay: 3.33s; }

/* ── Header: braille "fact" glyph + eyebrow ─────────────────────────── */
.card__head {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.braille--glyph-in { animation: glyphIn 0.7s ease both; }

.eyebrow {
  display: flex;
  align-items: baseline;
  gap: 16px;
  animation: glyphIn 0.7s ease both 0.1s;
}
.eyebrow__label {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.34em;
  color: var(--accent);
  font-weight: 500;
}
.eyebrow__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, oklch(0.8 0.14 66 / 0.4), transparent);
}
.eyebrow__date {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: #78706651;
  white-space: nowrap;
}

/* Narrow screens: the eyebrow can't fit label + rule + date on one line,
   so drop the rule and let the date sit on its own line under the label. */
@media (max-width: 560px) {
  .eyebrow { flex-wrap: wrap; gap: 6px 12px; }
  .eyebrow__label { letter-spacing: 0.2em; }
  .eyebrow__rule { display: none; }
  .eyebrow__date { flex-basis: 100%; }
}

/* ── Fact text: hidden by default, revealed under the cursor ─────────── */
.fact {
  position: relative;
  z-index: 2;
  max-width: 920px;
}
.fact__text {
  margin: 0;
  font-family: "Codystar", "Space Grotesk", sans-serif;
  font-size: clamp(30px, 5.6vw, 62px);
  line-height: 1.32;
  font-weight: 400;
  letter-spacing: 0.01em;
}
.fact__text span {
  display: inline-block;
  margin-right: 0.30em;
  opacity: 0;
  color: #000;
  transition: color 0.12s linear, text-shadow 0.12s linear;
  animation: wordReveal 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.fact__scan {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 22px 4px oklch(0.8 0.14 66 / 0.5);
  animation: scanBar 2.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s 1 both;
  pointer-events: none;
}

/* ── Footer link ────────────────────────────────────────────────────── */
.card__foot {
  position: relative;
  z-index: 2;
}
.learn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--ink);
  padding: 14px 22px;
  border: 1px solid #2a2521;
  border-radius: 999px;
  background: #0e0b0980;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.learn:hover,
.learn:focus-visible {
  border-color: var(--accent);
  color: oklch(0.85 0.14 66);
  outline: none;
}
.learn__arrow {
  display: inline-block;
  color: var(--accent);
  animation: linkArrow 1.8s ease-in-out infinite;
}

/* ── Touch / no-cursor devices: the spotlight can't work, so keep the
      fact permanently legible. JS also sets this class as a guard. ───── */
.no-hover .fact__text span {
  color: oklch(0.92 0.11 72);
  text-shadow: 0 0 14px oklch(0.82 0.14 66 / 0.35);
}

/* ── Keyframes ──────────────────────────────────────────────────────── */
@keyframes dotRise {
  0%   { opacity: 0; transform: scale(0) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes wordReveal {
  0%   { opacity: 0; filter: blur(8px); transform: translateY(6px); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}
@keyframes ripple {
  0%   { transform: translate(-50%, -50%) scale(0.25); opacity: 0.55; }
  100% { transform: translate(-50%, -50%) scale(9); opacity: 0; }
}
@keyframes scanBar {
  0%   { left: -2%; opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { left: 102%; opacity: 0; }
}
@keyframes glyphIn {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes linkArrow {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(5px); }
}

/* ── Reduced motion: no animation, fact stays readable ──────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .dot-field span { opacity: 1; }
  /* Show the words instantly (no fade) but keep them dark, so the fact isn't
     given away on load — the cursor spotlight still reveals it on hover. The
     touch fallback (.no-hover) below stays lit, since touch has no hover. */
  .fact__text span { opacity: 1; }
  .fact__scan, .ripple { display: none; }
}
