/*
 * STATE — design system
 * Register: brand. North Star: "The House Memo" (see DESIGN.md).
 * Restrained color, serif display + plain sans body, flat surfaces, restrained motion.
 * Square corners throughout (The Square Corner Rule): a memo has sharp edges, not rounded ones.
 */

/* ============================================================
   Tokens
   ============================================================ */
:root {
  /* Color: warm tinted neutrals carry the page; one accent, used only on interaction. */
  --color-paper: oklch(97% 0.008 55);
  --color-paper-dim: oklch(94% 0.01 55);
  --color-ink: oklch(22% 0.012 55);
  --color-ink-soft: oklch(42% 0.012 55);
  --color-border: oklch(85% 0.012 55);
  --color-accent: oklch(48% 0.12 35);

  /* Spacing: 4pt base */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Typography */
  --font-display: "Source Serif 4", Georgia, serif;
  --font-body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.375rem;
  --text-xl: clamp(1.75rem, 1rem + 3vw, 2.75rem);
  --text-display: clamp(2.5rem, 1.5rem + 5vw, 4.25rem);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
ul { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: none; }
a { text-decoration: none; }

/* ============================================================
   Base
   ============================================================ */
body {
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  font-optical-sizing: auto;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

/* Title tier (DESIGN.md): bold sans, not serif. Distinct from Display/Headline. */
h3 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-base);
  line-height: 1.3;
  text-wrap: balance;
  margin: 0 0 var(--space-sm) 0;
}

p { margin: 0; text-wrap: pretty; }

a {
  color: var(--color-ink);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 0.15em;
  transition: color 150ms var(--ease-out), text-decoration-color 150ms var(--ease-out);
}
a:hover, a:focus-visible {
  color: var(--color-accent);
  text-decoration-color: currentColor;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   Scroll reveal
   Sections fade and rise slightly into view, one consistent
   effect, no stagger. Added via JS only (reveal_controller);
   if JS never runs, sections are visible by default, no FOUC.
   ============================================================ */
main section.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}
main section.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

/* Reading measure for body copy. Left-aligned within .container, not centered:
   the empty space to the right at wide viewports is deliberate, not a bug. */
.prose {
  max-width: 70ch;
}

main section {
  padding-block: var(--space-3xl);
}
main section + section {
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   Header / Navigation
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--color-border);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-block: var(--space-md);
  gap: var(--space-md);
}

.site-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--color-ink);
}
.site-logo:hover, .site-logo:focus-visible { color: var(--color-accent); }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
}
.nav-toggle-icon {
  position: relative;
  width: 20px;
  height: 14px;
}
.nav-toggle-icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-ink);
}
.nav-toggle-icon span:nth-child(1) { top: 0; }
.nav-toggle-icon span:nth-child(2) { top: 6px; }
.nav-toggle-icon span:nth-child(3) { top: 12px; }

.nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-ink);
}
.nav-link:hover, .nav-link:focus-visible { color: var(--color-accent); }

.nav-panel {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  width: 100%;
  transition: grid-template-rows 250ms var(--ease-out);
}
.nav-panel.is-open { grid-template-rows: 1fr; }

.nav-panel-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
  padding-block: var(--space-md);
  min-height: 0;
}

@media (min-width: 640px) {
  .nav-toggle { display: none; }
  .nav-panel {
    display: block;
    width: auto;
    overflow: visible;
  }
  .nav-panel-inner {
    flex-direction: row;
    align-items: center;
    padding-block: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-panel { transition: none; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--color-ink);
  border-radius: 0;
  background: var(--color-ink);
  color: var(--color-paper);
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 150ms var(--ease-out);
}
.btn:not([disabled]):hover, .btn:not([disabled]):focus-visible {
  background: var(--color-accent);
  border-color: var(--color-accent);
  transform: scale(1.02);
}
.btn[disabled] {
  background: transparent;
  color: var(--color-ink-soft);
  border-color: var(--color-border);
  cursor: not-allowed;
}

/* ============================================================
   Hero
   ============================================================ */
.hero { padding-block: var(--space-4xl); }

.hero .kicker {
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
  margin-bottom: var(--space-lg);
}
.hero .kicker a {
  color: var(--color-ink-soft);
  text-decoration-color: var(--color-border);
}
.hero .kicker a:hover, .hero .kicker a:focus-visible { color: var(--color-accent); }

.hero .lead {
  font-size: var(--text-lg);
  margin-bottom: var(--space-xl);
}

.hero .btn { margin-bottom: var(--space-md); }

.hint {
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
}

/* ============================================================
   Page-level typography
   Reusable across any section's prose content, not just Home's.
   ============================================================ */
h1 {
  font-size: var(--text-display);
  margin-bottom: var(--space-lg);
}

main section h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-lg);
}

.lede {
  font-size: var(--text-lg);
  margin-bottom: var(--space-lg);
}

main ul {
  list-style: disc;
  padding-left: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
main ul li::marker { color: var(--color-accent); }

.prose p + p { margin-top: var(--space-lg); }

.prose .forward-link {
  font-weight: 500;
  margin-top: var(--space-2xl);
}
.prose .forward-link a::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.4em;
  vertical-align: middle;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transition: transform 150ms var(--ease-out);
}
.prose .forward-link a:hover::after,
.prose .forward-link a:focus-visible::after {
  transform: translateX(3px);
}

/* ============================================================
   Pricing tiers
   The one place a multi-column layout earns its keep: comparing
   plans is the literal task here. Dividers, not cards: no fill,
   no shadow, no "Most Popular" badge on Pro. Plain before clever.
   ============================================================ */
.tier-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

.tier h2 { font-size: var(--text-lg); }

.tier p {
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
}

@media (min-width: 780px) {
  .tier-grid { grid-template-columns: repeat(3, 1fr); }
  .tier-grid .tier + .tier {
    border-left: 1px solid var(--color-border);
    padding-left: var(--space-2xl);
  }
}

main aside {
  padding-block: var(--space-2xl);
  border-top: 1px solid var(--color-border);
}
main aside p {
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
}

/* ============================================================
   Stacked prose blocks (differentiators, use cases)
   Deliberately not cards: divider line only, same visual
   language as section/tier dividers elsewhere on the site.
   ============================================================ */
article + article {
  margin-top: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   Numbered steps ("How it works")
   The step number is the visual device, not an icon.
   ============================================================ */
.steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  margin-bottom: var(--space-lg);
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-lg);
  align-items: start;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xl);
  color: var(--color-accent);
  line-height: 1;
}

/* ============================================================
   Status chain (Differentiators)
   One continuous bordered strip per group, items separated by
   vertical dividers, not gapped floating pills: | FLOOR |
   STOCKROOM | BREAK | CLOSING |. Neutral, no direction, no
   accent: that distinction is reserved for the Use Cases
   trigger pairs.
   ============================================================ */
.status-chain {
  display: flex;
  flex-direction: row;
  list-style: none;
  width: fit-content;
  max-width: 100%;
  margin: var(--space-lg) auto;
  padding: 0;
  gap: var(--space-md);
  overflow-x: auto;
}
.status-chain li {
  flex: none;
  border: 1px solid var(--color-border);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-ink);
  white-space: nowrap;
}

/* Two example sets stacked as their own rows, divider between,
   each row still independently centered via .status-chain. */
.status-chain-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}
.status-chain-group .status-chain {
  margin: 0 auto;
}
.status-chain-group .status-chain + .status-chain {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-md);
}

/* ============================================================
   Trigger pair (Use Cases)
   A causal relationship, not a neutral set: accent-colored
   connector and effect node, distinct from the status chain's
   neutral, undirected styling.
   ============================================================ */
.trigger-pair {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  margin: var(--space-lg) auto;
  width: fit-content;
  max-width: 100%;
}
.trigger-pair .node {
  display: inline-block;
  border: 1px solid var(--color-border);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: var(--color-ink);
}
.trigger-pair .node-effect {
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.trigger-arrow {
  display: inline-block;
  position: relative;
  width: 28px;
  height: 1px;
  background: var(--color-accent);
  flex: none;
}
.trigger-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--color-accent);
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--color-paper-dim);
  border-top: 1px solid var(--color-border);
}
.site-footer .container { padding-block: var(--space-2xl); }

.footer-cta { margin-bottom: var(--space-xl); }
.footer-cta h2 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-md);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
}
.footer-links a {
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
}
.footer-links a:hover, .footer-links a:focus-visible { color: var(--color-accent); }

.footer-meta p {
  font-size: var(--text-xs);
  color: var(--color-ink-soft);
}
.footer-meta p + p { margin-top: var(--space-xs); }
