/* Roberts Assistant — shared styles
   Palette: petrol ink, cool chalk paper, mulberry signal. */

:root {
  color-scheme: light;

  --paper:      #ecede9;
  --surface:    #f6f7f4;
  --ink:        #12242d;
  --ink-soft:   #4a5a62;
  --rule:       #d3d7d0;
  --rule-faint: #e0e3dd;
  --beam:       #bcc3ba;
  --accent:     #8a3b58;
  --accent-dim: #b98ba0;

  --measure: 68ch;
  --page: 1120px;

  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
          Georgia, "Times New Roman", serif;

  --step-0: 1.0625rem;
  --step-1: 1.1875rem;
  --step-2: clamp(1.35rem, 1.1rem + 0.9vw, 1.6rem);
  --step-3: clamp(2.1rem, 1.4rem + 3.1vw, 3.15rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --paper:      #0e1a20;
    --surface:    #14242e;
    --ink:        #e6eae4;
    --ink-soft:   #a3b1b1;
    --rule:       #2a3b45;
    --rule-faint: #1e2e37;
    --beam:       #2f434d;
    --accent:     #d68ba4;
    --accent-dim: #6d4757;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.68;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.shell {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3.5rem);
}

/* ---------- Links ---------- */

a {
  color: inherit;
  text-decoration-color: var(--accent-dim);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover { text-decoration-color: var(--accent); }

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

/* ---------- Masthead ---------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 2rem 1.25rem;
  border-bottom: 1px solid var(--rule-faint);
}

.wordmark {
  font-size: var(--step-1);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.wordmark .mark {
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.06em;
}

.masthead nav ul {
  display: flex;
  gap: 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.masthead nav a[aria-current="page"] {
  color: var(--ink-soft);
  text-decoration: none;
}

/* ---------- Home ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 4rem);
  align-items: center;
  padding-block: clamp(2.5rem, 8vw, 5.5rem) clamp(2rem, 5vw, 3.5rem);
}

@media (min-width: 62rem) {
  .hero {
    grid-template-columns: minmax(0, 27rem) minmax(0, 1fr);
  }
  .hero-figure { order: 2; }
}

.hero h1 {
  margin: 0 0 1.5rem;
  font-size: var(--step-3);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.hero p {
  margin: 0 0 1.25rem;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: var(--step-1);
}

.hero-note {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  max-width: 34ch;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.hero-note p { margin: 0 0 0.4rem; font-size: inherit; max-width: none; }
.hero-note p:last-child { margin-bottom: 0; }

/* ---------- Hero drawing ---------- */

.hero-figure { margin: 0; }

.hero-figure svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 62vh;
  overflow: visible;
}

.beam {
  fill: none;
  stroke: var(--beam);
  stroke-width: 1.1;
}

.beam--lit {
  stroke: var(--accent);
  stroke-width: 1.6;
}

.ring {
  fill: none;
  stroke: var(--beam);
  stroke-width: 1;
}

.ring--outer { stroke: var(--rule-faint); }

.node { fill: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .beam {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 1s cubic-bezier(0.33, 0.9, 0.3, 1) forwards;
    animation-delay: calc(120ms + var(--d) * 40ms);
  }
  .ring, .node {
    opacity: 0;
    animation: settle 700ms ease-out forwards;
    animation-delay: 900ms;
  }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes settle { to { opacity: 1; } }
}

/* ---------- Documents ---------- */

.doc {
  padding-block: clamp(2.5rem, 6vw, 4rem) 1rem;
  max-width: var(--measure);
}

.doc h1 {
  margin: 0 0 0.75rem;
  font-size: var(--step-2);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.dateline {
  margin: 0;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.lede {
  margin: 1.75rem 0 0;
  font-size: var(--step-1);
}

.doc section { margin-top: 2.5rem; }

.doc h2 {
  margin: 0 0 0.6rem;
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--accent);
}

.doc h2 .num {
  display: inline-block;
  min-width: 1.9em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.doc p, .doc li { margin: 0 0 1rem; }
.doc p:last-child, .doc li:last-child { margin-bottom: 0; }

.doc ul {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
}

.doc li { padding-left: 0.35rem; }
.doc li::marker { color: var(--accent-dim); }

.doc h2 + p, .doc h2 + ul { margin-top: 0; }

/* Indented for reference: section bodies align under the numbering. */
@media (min-width: 46rem) {
  .doc section > :not(h2) { margin-left: 1.9em; }
}

.disclosure {
  margin: 2.5rem 0 0;
  padding: 1.4rem 1.5rem;
  background: var(--surface);
  border-left: 2px solid var(--accent);
}

.disclosure h2 { margin-bottom: 0.6rem; }
.disclosure p:last-child { margin-bottom: 0; }
.disclosure > :not(h2) { margin-left: 0 !important; }

.wordbreak { overflow-wrap: anywhere; }

.doc code {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
  color: var(--ink);
  background: var(--surface);
  padding: 0.05em 0.28em;
  border: 1px solid var(--rule-faint);
}

/* ---------- Foot ---------- */

.foot {
  margin-top: clamp(3.5rem, 8vw, 6rem);
  padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--rule-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot p { margin: 0; }

/* The home page carries its own quiet; it needs less air above the foot. */
body:has(.hero) .foot { margin-top: clamp(2rem, 5vw, 3.5rem); }
