/* ─────────────────────────────────────────────────────────────
   Pixel Loom · Base
   Reset, typography, layout, dividers, lists, headings.
   Assumes tokens/{linen|indigo}.css already loaded.
   ───────────────────────────────────────────────────────────── */

/* ─── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--on-background);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { max-width: 100%; display: block; }
code { font-family: var(--font-mono); font-size: 0.92em; }

/* ─── Layout ──────────────────────────────────────────── */
.page {
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--space-xl) var(--margin);
}
@media (max-width: 720px) {
  .page { padding: var(--space-lg) var(--space-sm); }
}

section { margin: var(--space-lg) 0; }

/* ─── Pixel-stitch divider ────────────────────────────── */
.stitch {
  border: none;
  height: 1px;
  background-image: linear-gradient(to right, var(--outline) 50%, transparent 50%);
  background-size: 8px 1px;
  background-repeat: repeat-x;
  margin: var(--space-lg) 0;
}

/* ─── Masthead ────────────────────────────────────────── */
.masthead { margin-bottom: var(--space-lg); }

.meta-line {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--on-surface-variant);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  flex-wrap: wrap;
}
.meta-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--secondary-fixed-dim);
  flex-shrink: 0;
}
.meta-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.meta-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4f6f3a;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}
.brand-mark {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}
h1.brand {
  font-family: var(--font-headline);
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--on-surface);
}
@media (max-width: 720px) {
  h1.brand { font-size: 40px; }
  .brand-mark { width: 24px; height: 24px; }
}
.tagline {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  color: var(--on-surface-variant);
  margin: 0;
  max-width: 600px;
}
.tagline.italic {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 22px;
  font-weight: 500;
  color: var(--primary);
}

/* ─── Headings ────────────────────────────────────────── */
h2 {
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 var(--space-md) 0;
  color: var(--on-surface);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}
h2::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--primary);
  flex-shrink: 0;
}

/* ─── Intro / lede ────────────────────────────────────── */
.lede {
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--on-surface);
  margin: 0 0 var(--space-md) 0;
  max-width: 720px;
}
@media (max-width: 720px) {
  .lede { font-size: 22px; }
}
.intro p {
  font-size: 17px;
  line-height: 1.65;
  margin: 0 0 var(--space-sm) 0;
  max-width: 720px;
}

/* ─── Stitched list ───────────────────────────────────── */
.stitched-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 720px;
}
.stitched-list li {
  padding: var(--space-sm) 0;
  border-bottom: 1px dashed var(--outline-variant);
  font-size: 17px;
  line-height: 1.5;
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}
.stitched-list li::before {
  content: '';
  flex-shrink: 0;
  width: 4px;
  height: 4px;
  background: var(--primary-container);
  margin-top: 9px;
}
.stitched-list li:last-child { border-bottom: none; }

/* ─── Links ───────────────────────────────────────────── */
a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid var(--outline-variant);
  padding-bottom: 1px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
a:hover, a:focus {
  border-bottom-color: var(--primary);
  color: var(--primary-container);
}

/* ─── Selection & focus ───────────────────────────────── */
::selection {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─── Theme toggle (light ⇄ dark) ─────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 4px;
  background: transparent;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  color: var(--on-surface-variant);
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--primary);
  border-color: var(--outline);
}
.theme-toggle::after {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 4px;
  height: 4px;
  background: var(--secondary-fixed-dim);
}
.theme-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Show moon by default (suggesting "click for dark"), swap to sun in dark. */
.theme-toggle-sun { display: none; }
.theme-toggle-moon { display: block; }

:root.theme-dark .theme-toggle-sun { display: block; }
:root.theme-dark .theme-toggle-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) .theme-toggle-sun { display: block; }
  :root:not(.theme-light) .theme-toggle-moon { display: none; }
}

/* Smooth color transitions when theme flips (excluded from page load by
   limiting to specific properties to avoid expensive re-paints). */
html.has-theme-transition,
html.has-theme-transition *,
html.has-theme-transition *::before,
html.has-theme-transition *::after {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

/* ─── Prefers-reduced-motion ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
