/* 960 — Pascal Finette. A short book, coming 2026. */

/* ---- Self-hosted iA Writer Mono (SIL OFL 1.1, see /fonts/LICENSE.md) ---- */
@font-face {
  font-family: "iA Writer Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/iAWriterMonoS-Regular.woff2") format("woff2"),
       url("fonts/iAWriterMonoS-Regular.woff") format("woff");
}
@font-face {
  font-family: "iA Writer Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/iAWriterMonoS-Italic.woff2") format("woff2"),
       url("fonts/iAWriterMonoS-Italic.woff") format("woff");
}

/* ---- Tokens ---- */
:root {
  --ground: #E5EBE7;          /* mint silver */
  --ink: #101412;             /* near-black */
  --accent: #FF3D5C;          /* the one spark — used once, on the spent months */
  --ink-quiet: rgba(16, 20, 18, 0.62);
  --dot-empty: rgba(16, 20, 18, 0.16);
  --rule: rgba(16, 20, 18, 0.14);
  --mono: "iA Writer Mono", ui-monospace, "SF Mono", "Cascadia Code",
          "Roboto Mono", Menlo, Consolas, monospace;
}

/* ---- Reset-ish ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Layout ---- */
.page {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(1.75rem, 5vw, 2.75rem);
  width: 100%;
  max-width: 38rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 8vw, 5rem) 1.5rem clamp(1.5rem, 5vw, 3rem);
}

.eyebrow {
  margin: 0;
  font-size: clamp(0.72rem, 2.4vw, 0.82rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* ---- Signature: the life grid (960 dots, one per month) ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(40, 1fr);
  gap: clamp(2px, 0.9vw, 5px);
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
}
.dot {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--dot-empty);
}
.dot.is-spent { background: var(--accent); }

/* ---- The number ---- */
.number {
  margin: 0;
  font-size: clamp(5.5rem, 26vw, 14rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0.02em;
}

/* ---- The hook ---- */
.subhead {
  margin: 0 auto;
  max-width: 26ch;
  font-size: clamp(1rem, 4.2vw, 1.18rem);
  line-height: 1.55;
  text-wrap: balance;
}
.subhead em { font-style: italic; }

/* ---- The one quiet invitation: the essay that started it ---- */
.seed {
  margin: 0;
  font-size: clamp(0.82rem, 3vw, 0.92rem);
  color: var(--ink-quiet);
}
.seed a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
.seed a:hover { color: var(--accent); }

/* ---- Placeholder for later: buy / read online (kept inert in v1) ---- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}
.cta {
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  padding: 0.7em 1.4em;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.cta[disabled] {
  border-color: var(--rule);
  color: var(--ink-quiet);
  cursor: not-allowed;
}

/* ---- Footer ---- */
.colophon {
  flex: 0 0 auto;
  width: 100%;
  max-width: 38rem;
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-size: clamp(0.78rem, 3vw, 0.88rem);
  line-height: 1.6;
  color: var(--ink-quiet);
}
.colophon a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  white-space: nowrap;
}
.colophon a:hover { color: var(--accent); }

/* ---- Focus ---- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ---- Responsive: keep the wide 40-col field, just tighten it on small screens
       (transposing to 24 cols would make the grid 40 rows tall and bury the number) ---- */
@media (max-width: 600px) {
  .grid {
    gap: 2px;
    max-width: 20rem;
  }
}

/* ---- Motion: one restrained touch, off by default for reduced-motion users ---- */
@media (prefers-reduced-motion: no-preference) {
  .page > * { animation: rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .eyebrow { animation-delay: 0.05s; }
  .grid    { animation-delay: 0.15s; }
  .number  { animation-delay: 0.25s; }
  .subhead { animation-delay: 0.35s; }

  /* the spent months settle in last */
  .dot.is-spent {
    background: var(--dot-empty);
    animation: spend 0.9s ease 0.95s forwards;
  }

  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes spend {
    to { background: var(--accent); }
  }
}
