/* Shared styles for the apex landing surfaces (landing.html, landing_docs_index.html).
   Warm cream/purple palette with light + dark variants. The --gol-* tokens are
   read by life.js so the Game of Life canvas tracks the same theme. */

:root {
  color-scheme: light dark;
  --brand: #4e49d1;
  --brand-hover: #3f3bb0;
  /* Hyperlink accent — a sky blue, deliberately distinct from the indigo
     `--brand` used for the wordmark and card-hover glow. */
  --link: #0284c7;
  --link-hover: #0369a1;
  --bg: #f8efd7;
  --fg: #1a1a1a;
  --muted: #57534e;
  --border: #e7e5e4;
  --card-bg: #fdf8e9;

  /* Game of Life canvas tokens (light). */
  --gol-bg: #f4f1e8;
  --gol-grid: rgba(20, 20, 20, 0.07);
  --gol-grid-major: rgba(20, 20, 20, 0.14);
  --gol-origin: rgba(20, 20, 20, 0.3);
  --gol-cell: #4e49d1;
  --gol-cell-ghost: rgba(78, 73, 209, 0.25);
  --gol-hover: #4e49d1;
  --gol-selection: #4e49d1;
  --gol-selection-fill: rgba(78, 73, 209, 0.12);

  /* Type. */
  --font-body:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
    'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Instrument Serif', ui-serif, Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1817;
    --fg: #f8efd7;
    --muted: #a8a29e;
    --border: #2d2926;
    --card-bg: #25221f;
    /* Lighter sky blue so links keep their pop against the dark background. */
    --link: #38bdf8;
    --link-hover: #7dd3fc;

    --gol-bg: #1a1817;
    --gol-grid: rgba(255, 255, 255, 0.05);
    --gol-grid-major: rgba(255, 255, 255, 0.1);
    --gol-origin: rgba(255, 255, 255, 0.18);
    --gol-cell: #7c78e6;
    --gol-cell-ghost: rgba(124, 120, 230, 0.25);
    --gol-hover: #7c78e6;
    --gol-selection: #7c78e6;
    --gol-selection-fill: rgba(124, 120, 230, 0.14);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

header.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

header.site-header h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0;
  color: var(--brand);
  font-weight: 400;
  letter-spacing: 0.01em;
}

header.site-header a.back-home {
  font-family: var(--font-display);
  color: var(--brand);
  text-decoration: none;
  font-size: 1.25rem;
}

header.site-header a.back-home:hover,
header.site-header a.back-home:focus-visible {
  text-decoration: underline;
}

header.site-header a.open-app {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

header.site-header a.open-app:hover,
header.site-header a.open-app:focus-visible {
  color: var(--link);
  text-decoration: underline;
}

section.intro {
  margin-bottom: 28px;
}

section.intro h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  margin: 0 0 0.4rem;
  letter-spacing: 0.01em;
}

section.intro p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 48rem;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

a.doc-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

a.doc-card:hover,
a.doc-card:focus-visible {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -18px rgba(78, 73, 209, 0.55);
}

a.doc-card h3 {
  margin: 0;
  font-size: 1.08rem;
  color: var(--fg);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

a.doc-card p.excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

a.doc-card span.byline {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.empty-state {
  padding: 32px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.browse-all {
  margin-top: 24px;
  text-align: right;
}

.browse-all a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.browse-all a:hover,
.browse-all a:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

nav.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
}

nav.page-nav a,
nav.page-nav span.disabled {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--font-mono);
}

nav.page-nav a {
  color: var(--brand);
  border: 1px solid var(--border);
}

nav.page-nav a:hover,
nav.page-nav a:focus-visible {
  border-color: var(--brand);
}

nav.page-nav span.disabled {
  color: var(--muted);
  opacity: 0.5;
  border: 1px solid var(--border);
}

nav.page-nav .page-info {
  color: var(--muted);
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

footer {
  padding: 16px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Game of Life preview block at the bottom of the landing page. The framed
   #life-stage box itself is styled in life.css (.life-stage--preview). */
.life-preview-section {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 56px;
}

.life-preview-section h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: 0 0 0.3rem;
  letter-spacing: 0.01em;
}

.life-preview-section > p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1rem;
  max-width: 48rem;
}

.life-preview-section > p a {
  color: var(--link);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  white-space: nowrap;
}

.life-preview-section > p a:hover,
.life-preview-section > p a:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

/* "Public docs" band, now anchored at the bottom of the landing page below the
   Streams and Game-of-Life sections. Shares the centered-band shape with
   `.life-preview-section`; the cards inside reuse `.doc-grid` / `.doc-card`. */
.docs-section {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 56px;
}

.docs-section h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: 0 0 0.3rem;
  letter-spacing: 0.01em;
}

.docs-section > p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1rem;
  max-width: 48rem;
}
