/* =====================================================================
   Access to Robotics — Finley Robotics Initiative
   Stylesheet: "Editorial Engineering"
   Typography: Fraunces (display) / IBM Plex Sans (body) / JetBrains Mono (mono)
   ===================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding-left: 0; }
img, picture, svg { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

/* ---------- Tokens ---------- */
:root {
  --paper:       #F2EDE4;
  --paper-2:     #EBE5D9;
  --paper-dim:   #E4DDCC;
  --ink:         #18202E;
  --ink-2:       #2B3445;
  --mute:        #6B6358;
  --rule:        #C8BFAE;
  --accent:      #B85A28;
  --accent-deep: #8F4520;
  --highlight:   #E8DDC9;

  --ff-display: "Fraunces", "Times New Roman", Georgia, serif;
  --ff-body:    "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ff-mono:    "JetBrains Mono", "SFMono-Regular", "Menlo", monospace;

  --container:  74rem;       /* ~1184px max */
  --gutter:     clamp(1.25rem, 4vw, 2.5rem);

  --step-0:    clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --step-1:    clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  --step-2:    clamp(1.125rem, 1.05rem + 0.4vw, 1.25rem);
  --step-3:    clamp(1.375rem, 1.2rem + 0.7vw, 1.625rem);
  --step-4:    clamp(1.75rem, 1.45rem + 1.3vw, 2.5rem);
  --step-5:    clamp(2.25rem, 1.8rem + 2.2vw, 3.75rem);
  --step-6:    clamp(3rem,   2rem + 4.5vw,   6rem);
}

/* ---------- Base ---------- */
html {
  font-family: var(--ff-body);
  font-size: 100%;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

body {
  font-size: var(--step-1);
  font-weight: 400;
  background:
    radial-gradient(1200px 800px at 90% -10%, rgba(184,90,40,0.06), transparent 60%),
    radial-gradient(1000px 700px at -10% 110%, rgba(24,32,46,0.05), transparent 55%),
    var(--paper);
  background-attachment: fixed;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* subtle paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0.07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  z-index: 0;
}

main, header, footer, section { position: relative; z-index: 1; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--ff-display);
  font-weight: 450;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  letter-spacing: -0.015em;
  line-height: 1.05;
  color: var(--ink);
}

h1 { font-size: var(--step-6); font-weight: 420; letter-spacing: -0.025em; }
h2 { font-size: var(--step-5); font-weight: 440; }
h3 { font-size: var(--step-4); font-weight: 450; letter-spacing: -0.01em; }
h4 { font-size: var(--step-3); font-weight: 500; line-height: 1.2; }

p { max-width: 60ch; }
p + p { margin-top: 1em; }

a {
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

p a, li a, .prose a {
  text-decoration: underline;
  text-decoration-color: var(--rule);
}
p a:hover, li a:hover, .prose a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

strong { font-weight: 600; }
em { font-style: italic; }

::selection { background: var(--accent); color: var(--paper); }

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(3rem, 6vw, 6rem);
}

.section--tight { padding-block: clamp(2rem, 4vw, 3.5rem); }

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: 0;
}

/* ---------- Mono kicker / labels ---------- */
.kicker, .eyebrow {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.kicker--accent { color: var(--accent); }

.kicker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.kicker-row::before {
  content: "";
  width: 1.5rem; height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

/* numbered section badge */
.section-number {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  color: var(--mute);
  letter-spacing: 0.1em;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(242, 237, 228, 0.85);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand:hover { color: var(--accent); }
.brand-mark {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2px 6px;
  border: 1px solid var(--accent);
  align-self: center;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 1.75rem;
  margin: 0;
}

.nav-list a {
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}
.nav-list a:hover,
.nav-list a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--rule);
  width: 40px; height: 40px;
  padding: 0;
  position: relative;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  position: absolute;
  width: 18px; height: 1.5px;
  background: var(--ink);
  transition: transform 220ms ease, top 220ms ease, opacity 160ms ease;
}
.nav-toggle span { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.nav-toggle span::before { content: ""; top: -6px; left: 0; }
.nav-toggle span::after  { content: ""; top:  6px; left: 0; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after  { top: 0; transform: rotate(-45deg); }

@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .nav-list {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem var(--gutter) 1.5rem;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 220ms ease, opacity 220ms ease;
  }
  .nav-list.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-list li { border-top: 1px solid var(--rule); }
  .nav-list a { display: block; padding: 1rem 0; font-size: 0.85rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.95rem 1.4rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease, transform 200ms ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
}
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}
.btn--accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn .arrow {
  display: inline-block;
  transition: transform 200ms ease;
}
.btn:hover .arrow { transform: translateX(3px); }

/* text link with arrow */
.tlink {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}
.tlink:hover { color: var(--accent); border-bottom-color: var(--accent); }
.tlink .arrow { transition: transform 200ms ease; }
.tlink:hover .arrow { transform: translateX(3px); }

/* ---------- Hero ---------- */
.hero {
  padding-top: clamp(3rem, 6vw, 6rem);
  padding-bottom: clamp(3rem, 6vw, 6rem);
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: end;
}

@media (min-width: 880px) {
  .hero-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 4rem; }
}

.hero-headline {
  font-size: var(--step-6);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: 380;
  font-variation-settings: "opsz" 144, "SOFT" 30;
}
.hero-headline .accent { color: var(--accent); font-style: italic; font-weight: 380; }

.hero-sub {
  margin-top: 1.5rem;
  font-size: var(--step-2);
  max-width: 48ch;
  color: var(--ink-2);
  line-height: 1.5;
}

.hero-actions {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-aside {
  border-left: 1px solid var(--rule);
  padding-left: 1.5rem;
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--ink-2);
}
.hero-aside dt {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mute);
  font-size: 0.7rem;
  margin-top: 1rem;
}
.hero-aside dt:first-child { margin-top: 0; }
.hero-aside dd { margin-left: 0; color: var(--ink); }

@media (max-width: 879px) {
  .hero-aside { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 1.5rem; }
}

/* ---------- Section header pattern ---------- */
.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 720px) {
  .section-head {
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 2rem;
  }
}

.section-head h2 {
  font-size: var(--step-4);
  letter-spacing: -0.015em;
}

.section-head .section-meta {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  color: var(--mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Cards / Pillars ---------- */
.pillars {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--rule);
}

@media (min-width: 720px) {
  .pillars { grid-template-columns: repeat(3, 1fr); }
  .pillars > * { border-right: 1px solid var(--rule); padding-right: 2rem; }
  .pillars > *:last-child { border-right: 0; padding-right: 0; }
}

.pillar {
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 720px) {
  .pillar { border-bottom: 0; padding: 2.5rem 2rem 2.5rem 0; }
  .pillars > *:not(:first-child) { padding-left: 2rem; }
}

.pillar .num {
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  display: block;
  margin-bottom: 1rem;
}

.pillar h3 {
  font-size: var(--step-3);
  margin-bottom: 0.75rem;
}

.pillar p {
  color: var(--ink-2);
  font-size: 1rem;
}

/* ---------- Prose blocks ---------- */
.prose {
  max-width: 60ch;
}
.prose > * + * { margin-top: 1.2em; }
.prose h2 { margin-top: 2em; font-size: var(--step-4); }
.prose h3 { margin-top: 1.6em; font-size: var(--step-3); }
.prose ul, .prose ol {
  padding-left: 1.2em;
  list-style-position: outside;
}
.prose ul { list-style: none; padding-left: 0; }
.prose ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-top: 0.6em;
}
.prose ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--ff-mono);
}
.prose ol { padding-left: 1.5em; }
.prose ol li { margin-top: 0.6em; padding-left: 0.4em; }
.prose ol li::marker { font-family: var(--ff-mono); color: var(--accent); font-size: 0.9em; }

.prose blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 1.5em 0;
  font-family: var(--ff-display);
  font-size: var(--step-3);
  font-style: italic;
  line-height: 1.3;
  color: var(--ink);
  font-weight: 400;
}

/* ---------- Two-column with sticky sidebar ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 880px) {
  .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 4rem; }
  .two-col .sidebar { position: sticky; top: 96px; align-self: start; }
}
.sidebar .kicker { display: block; margin-bottom: 0.5rem; }
.sidebar h1 { font-size: var(--step-5); line-height: 1; }

/* ---------- Page header (non-home pages) ---------- */
.page-head {
  padding-top: clamp(2.5rem, 5vw, 5rem);
  padding-bottom: clamp(2.5rem, 5vw, 5rem);
  border-bottom: 1px solid var(--rule);
}
.page-head .container { display: grid; gap: 1.5rem; }
.page-head h1 {
  font-size: var(--step-6);
  line-height: 0.98;
  font-weight: 380;
  letter-spacing: -0.025em;
  max-width: 18ch;
}
.page-head .deck {
  font-size: var(--step-2);
  color: var(--ink-2);
  max-width: 55ch;
  line-height: 1.5;
}

/* ---------- Stats / Facts row ---------- */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.5rem 0;
}
.fact .num {
  font-family: var(--ff-display);
  font-size: var(--step-5);
  line-height: 1;
  font-weight: 400;
  color: var(--accent);
  display: block;
}
.fact .label {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  margin-top: 0.5rem;
  display: block;
}

/* ---------- Process / Steps ---------- */
.steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  counter-reset: step;
  list-style: none;
  padding: 0;
}
.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
}
.step:last-child { border-bottom: 1px solid var(--rule); }
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  padding-top: 0.4em;
}
.step h3 {
  font-size: var(--step-3);
  margin-bottom: 0.4em;
}
.step p { color: var(--ink-2); max-width: 56ch; }

/* ---------- Forms (contact) ---------- */
.form {
  display: grid;
  gap: 1.25rem;
  max-width: 36rem;
}
.field { display: grid; gap: 0.4rem; }
.field label {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.field input,
.field textarea,
.field select {
  font: inherit;
  color: var(--ink);
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--rule);
  padding: 0.85rem 1rem;
  border-radius: 0;
  transition: border-color 160ms ease, background 160ms ease;
  width: 100%;
}
.field textarea { min-height: 9rem; resize: vertical; font-family: var(--ff-body); }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.7);
}
.form-note {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  color: var(--mute);
  letter-spacing: 0.04em;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding-block: clamp(2.5rem, 5vw, 4rem);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}
@media (min-width: 720px) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
}
.footer-brand h4 {
  font-family: var(--ff-display);
  font-size: var(--step-3);
  font-weight: 450;
  margin-bottom: 0.5rem;
}
.footer-brand p {
  color: var(--ink-2);
  font-size: 0.95rem;
  max-width: 42ch;
}
.footer-col h5 {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 500;
  margin-bottom: 1rem;
}
.footer-col ul { list-style: none; display: grid; gap: 0.6rem; }
.footer-col a {
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  transition: color 160ms ease;
}
.footer-col a:hover { color: var(--accent); }

.footer-base {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--mute);
}
.footer-base a { color: var(--mute); }
.footer-base a:hover { color: var(--accent); }

/* ---------- Misc utilities ---------- */
.text-mute { color: var(--mute); }
.text-accent { color: var(--accent); }
.mono { font-family: var(--ff-mono); font-size: 0.85rem; }
.display { font-family: var(--ff-display); }
.center { text-align: center; }
.hidden { display: none !important; }

.banner {
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem var(--gutter);
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-align: center;
}
.banner a { color: var(--paper); text-decoration: underline; text-decoration-color: var(--accent); }

/* ---------- Status pill ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--rule);
  background: rgba(255,255,255,0.4);
  color: var(--ink-2);
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}

/* ---------- Image frames ---------- */
.frame {
  border: 1px solid var(--rule);
  padding: 0.75rem;
  background: var(--paper-dim);
}
.frame img { width: 100%; height: auto; display: block; }
.frame figcaption {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--mute);
  padding-top: 0.75rem;
}

/* ---------- Reveal animation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms ease, transform 600ms ease; }
  .reveal.is-visible { opacity: 1; transform: translateY(0); }
}

/* ---------- Focus styles ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Print ---------- */
@media print {
  body { background: white; }
  .site-header, .site-footer, .nav-toggle { display: none; }
  body::before { display: none; }
  a { text-decoration: underline; }
}
:target {
  scroll-margin-top: 6rem;
}
/* AI-ER course CTA layout */
.cta-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
}
.cta-art { display: flex; align-items: center; justify-content: center; }
.cta-art img { max-width: 200px; width: 100%; height: auto; }
@media (max-width: 720px) {
  .cta-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .cta-art { justify-content: flex-start; }
}
