/* Opscale AI — site styles */
:root {
  --bg: #f7f5f0;
  --paper: #fbfaf6;
  --ink: #1b1b18;
  --ink-2: #3f3e39;
  --muted: #64625b;
  --line: #dcd8cd;
  --accent: #2e5a4c;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 1200px;
  --gutter: clamp(20px, 4vw, 48px);
  --section: clamp(64px, 9vw, 128px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--ink); color: var(--bg);
  padding: 10px 14px; z-index: 50;
}
.skip-link:focus { top: 12px; color: var(--bg); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* Type */
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 400; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 5.6vw, 4.9rem); line-height: 1.03; letter-spacing: -0.018em; max-width: 17ch; }
h2 { font-size: clamp(1.85rem, 3.3vw, 2.85rem); line-height: 1.1; letter-spacing: -0.012em; max-width: 22ch; }
h3 { font-size: 1.375rem; line-height: 1.25; font-weight: 500; letter-spacing: -0.005em; }
h1 em, h2 em { font-style: italic; color: var(--accent); }

.label {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.label .num { color: var(--accent); margin-right: 0.6em; font-variant-numeric: tabular-nums; }

.lede {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.1vw, 1.6rem);
  line-height: 1.4;
  color: var(--ink-2);
  max-width: 34em;
  text-wrap: pretty;
}
.body-copy { color: var(--ink-2); max-width: 38em; text-wrap: pretty; }
.body-copy p + p, .lede + .body-copy, .lede + .lede { margin-top: 1.1em; }
.stack > * + * { margin-top: 1.5rem; }
.stack-lg > * + * { margin-top: 2.5rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.nav { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 12px 32px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: baseline; gap: 0.4em; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-name { font-family: var(--serif); font-size: 1.45rem; font-weight: 500; letter-spacing: -0.01em; }
.brand-suffix { font-size: 0.68rem; font-weight: 500; letter-spacing: 0.16em; color: var(--muted); }
.nav-links { display: flex; gap: 8px 32px; flex-wrap: wrap; font-size: 0.95rem; }
.nav-links a { text-decoration: none; color: var(--ink-2); padding: 6px 0; }
.nav-links a:hover { color: var(--accent); }
.nav-links a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }

/* Buttons and links */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; margin-top: 2.75rem; }
.button {
  display: inline-flex; align-items: center; gap: 0.6em;
  min-height: 50px; padding: 0 1.5rem;
  background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink); border-radius: 2px;
  font-size: 0.95rem; font-weight: 500; text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.button:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.link-arrow { font-weight: 500; font-size: 0.95rem; text-decoration: underline; text-decoration-color: var(--line); }
.link-arrow::after { content: "\2192"; margin-left: 0.45em; display: inline-block; }
.link-arrow:hover { text-decoration-color: currentColor; }

/* Sections */
.hero { padding: clamp(72px, 11vw, 152px) 0 clamp(64px, 8vw, 112px); }
.hero .label { margin-bottom: 2rem; }
.hero-copy { margin-top: 2rem; font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.55; color: var(--ink-2); max-width: 36em; text-wrap: pretty; }
.audience { margin-top: clamp(56px, 7vw, 96px); padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem; max-width: 60em; }

.section { padding: var(--section) 0; border-top: 1px solid var(--line); }

.row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: 1.5rem clamp(32px, 5vw, 72px); }
.row > .label { padding-top: 0.55rem; }

/* Tonal bands */
.band-sand { background: #efebe3; border-top-color: transparent; }
.band-stone { background: #e7e2d7; border-top-color: transparent; }
.band-ink { background: #1e2320; color: #ece9e1; border-top-color: transparent; }
.band-ink h2, .band-ink h3, .band-ink .statement, .band-ink .phase-strip p { color: #f3f0e8; }
.band-ink .lede, .band-ink .body-copy { color: #cfcbc1; }
.band-ink .label { color: #a9a69d; }
.band-ink .label .num, .band-ink h2 em { color: #9cc3b3; }
.band-ink .phase-strip li { border-top-color: #3d4440; }
.band-ink .button { background: #f3f0e8; color: #1e2320; border-color: #f3f0e8; }
.band-ink .button:hover { background: #9cc3b3; border-color: #9cc3b3; color: #1e2320; }
.band-ink a:hover { color: #9cc3b3; }
.band-ink .link-arrow { text-decoration-color: #5a615c; }
.band-ink + .site-footer, .band-sand + .site-footer, .band-stone + .site-footer { border-top-color: transparent; }

/* Principles */
.principles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px clamp(32px, 5vw, 72px); margin-top: clamp(48px, 6vw, 80px); }
.principles li { padding-top: 1.25rem; border-top: 1px solid var(--ink); }
.principles .num { display: block; font-family: var(--serif); font-style: italic; color: var(--accent); font-size: 1.05rem; margin-bottom: 0.75rem; }
.principles p { margin-top: 0.6rem; color: var(--ink-2); max-width: 30em; }

/* Phases (compact, homepage) */
.phase-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 32px; margin-top: 3rem; }
.phase-strip li { padding-top: 1rem; border-top: 1px solid var(--line); }
.phase-strip .label { display: block; margin-bottom: 0.5rem; }
.phase-strip p { font-family: var(--serif); font-size: 1.15rem; line-height: 1.35; }

/* Article index */
.index-list { margin-top: clamp(40px, 5vw, 64px); border-top: 1px solid var(--ink); }
.index-list a {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: 8px 24px;
  padding: 1.75rem 0; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.index-list .num { font-family: var(--serif); font-style: italic; color: var(--accent); padding-top: 0.2rem; }
.index-list h3 { font-size: clamp(1.35rem, 2.2vw, 1.75rem); transition: color 0.15s ease; }
.index-list p { margin-top: 0.5rem; color: var(--muted); max-width: 40em; }
.index-list .meta { color: var(--muted); font-size: 0.875rem; white-space: nowrap; padding-top: 0.45rem; }
.index-list a:hover h3 { color: var(--accent); }
.index-list + .actions { margin-top: 2rem; }

/* Articles */
.article { padding: var(--section) 0; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.article-aside { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); align-self: start; }
.article-aside .label { margin-bottom: 0.5rem; }
.article-aside a { margin-top: 1rem; font-size: 0.875rem; }
.article-title { font-size: clamp(2rem, 3.8vw, 3.1rem); max-width: 20ch; }
.prose { margin-top: 2.5rem; font-family: var(--serif); font-size: 1.2rem; line-height: 1.62; color: var(--ink-2); max-width: 34em; }
.prose p + p { margin-top: 1.1em; }
.prose p:first-child { font-size: 1.35rem; line-height: 1.5; color: var(--ink); }
.prose h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; letter-spacing: 0; margin: 2.4em 0 0.8em; color: var(--ink); }
.prose p:last-child { color: var(--ink); }

/* Diagnostic */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(32px, 5vw, 72px); margin-top: clamp(40px, 5vw, 64px); border-top: 1px solid var(--ink); }
.facts div { padding: 1.25rem 0 1.5rem; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 0.78rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin-top: 0.4rem; font-family: var(--serif); font-size: 1.25rem; line-height: 1.4; }

.phases { margin-top: clamp(48px, 6vw, 80px); border-top: 1px solid var(--ink); }
.phases > li { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: 1rem clamp(32px, 5vw, 72px); padding: 2.25rem 0; border-bottom: 1px solid var(--line); }
.phases .phase-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem clamp(24px, 4vw, 56px); }
.phases h3 { font-size: clamp(1.4rem, 2.2vw, 1.75rem); }
.phases ul li { color: var(--ink-2); padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.phases ul li:first-child { padding-top: 0.2rem; }
.phases ul li:last-child { border-bottom: 0; }

.statement { font-family: var(--serif); font-size: clamp(2rem, 4.2vw, 3.4rem); line-height: 1.12; letter-spacing: -0.012em; max-width: 20ch; text-wrap: balance; }

/* About */
.portrait {
  aspect-ratio: 4 / 5; width: 100%; max-width: 360px;
  background: repeating-linear-gradient(135deg, #ebe8e0 0 10px, #e4e0d6 10px 20px);
  display: grid; place-items: center;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.8rem; color: var(--muted);
}
.portrait-caption { margin-top: 1rem; font-size: 0.95rem; color: var(--muted); max-width: 360px; }
.portrait-caption strong { display: block; color: var(--ink); font-weight: 500; }
.portrait-caption a { display: inline-block; margin-top: 0.5rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--ink); padding: clamp(56px, 7vw, 88px) 0 32px; font-size: 0.95rem; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 3fr) minmax(0, 3fr); gap: 40px clamp(32px, 5vw, 72px); }
.footer-grid .label { margin-bottom: 0.9rem; }
.footer-grid p { color: var(--ink-2); }
.footer-grid p + p { margin-top: 0.4rem; }
.footer-tagline { margin-top: 0.9rem; font-family: var(--serif); font-size: 1.3rem; line-height: 1.35; max-width: 20ch; color: var(--ink); }
.footer-nav li + li { margin-top: 0.4rem; }
.footer-nav a { text-decoration: none; color: var(--ink-2); }
.footer-nav a:hover { color: var(--accent); }
.footer-email { font-family: var(--serif); font-size: 1.2rem; }
.footer-base { margin-top: clamp(48px, 6vw, 80px); padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }

/* Responsive */
@media (max-width: 900px) {
  .row, .phases > li { grid-template-columns: 1fr; }
  .row > .label { padding-top: 0; }
  .phase-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .article-aside { flex-direction: row; flex-wrap: wrap; gap: 0.25rem 1.25rem; align-items: baseline; }
  .article-aside .label { margin-bottom: 0; width: 100%; }
  .article-aside a { margin-top: 0; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .nav { min-height: 0; padding: 18px 0; }
  .nav-links { gap: 4px 22px; font-size: 0.92rem; }
  .principles, .facts, .phases .phase-body, .phase-strip { grid-template-columns: 1fr; }
  .principles { gap: 32px; }
  .index-list a { grid-template-columns: 2rem minmax(0, 1fr); }
  .index-list .meta { grid-column: 2; padding-top: 0; }
  .prose { font-size: 1.125rem; }
  .prose p:first-child { font-size: 1.25rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .button { width: 100%; justify-content: center; }
}

@media print {
  .site-header nav, .actions, .skip-link { display: none; }
  body { background: #fff; }
}
