/* =========================================================
   Applied Markets — Design System
   ========================================================= */

:root {
  --bg: #ffffff;
  --ink: #2c4a22;
  --muted: #6b6b6b;
  --rule: #ebebeb;
  --line: #e0e0e0;
  --accent: #3a5930;
  --accent-muted: #7a906e;

  --font-serif: Charter, 'Iowan Old Style', Palatino, Georgia, serif;
  --font-sans: 'Avenir Next', 'Gill Sans', 'Trebuchet MS', sans-serif;
  --font-mono: 'SFMono-Regular', Menlo, Monaco, 'Cascadia Mono', monospace;

  --max-w: min(1080px, calc(100% - 3rem));
}

/* ── Reset ─────────────────────────────────────────────── */

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

ul {
  list-style: none;
}

/* ── Nav ────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.85rem 0;
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.nav-brand {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
}

.nav-links a {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a.active {
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
}

/* ── Page Layout ────────────────────────────────────────── */

main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 4rem 0 7rem;
}

section + section {
  margin-top: 4.5rem;
}

/* ── Typography ─────────────────────────────────────────── */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

h2 {
  font-family: var(--font-sans);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

h3 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.section-lede {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--muted);
  max-width: 60ch;
  line-height: 1.65;
  margin-bottom: 1.5rem;
  text-align: justify;
  hyphens: auto;
}

/* ── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: 2px;
  text-decoration: none;
  transition: opacity 0.15s;
  cursor: pointer;
}

.btn:hover {
  opacity: 0.72;
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
  border: 1px solid var(--ink);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

/* ── Hero ───────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 3rem;
  align-items: start;
}

.hero-left .eyebrow {
  margin-bottom: 0.75rem;
}

.hero-left h1 {
  font-family: var(--font-sans);
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.08;
  max-width: 14ch;
  margin-bottom: 1.25rem;
}

.hero-left .lede {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.72;
  max-width: 52ch;
  margin-bottom: 1.75rem;
  text-align: justify;
  hyphens: auto;
}

.hero-buttons {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.signal-bar {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.signal-bar span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Hero — right rail */

.hero-right {
  border-left: 1px solid var(--rule);
  padding-left: 2.5rem;
}

.hero-right .eyebrow {
  margin-bottom: 0.6rem;
}

.hero-rail-intro {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  text-align: justify;
  hyphens: auto;
}

.stack-list li {
  border-top: 1px solid var(--rule);
  padding: 0.85rem 0;
}

.stack-list li:last-child {
  border-bottom: 1px solid var(--rule);
}

.stack-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-style: normal;
  display: block;
  margin-bottom: 0.25rem;
}

.stack-title {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.35rem;
}

.stack-list span {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  display: block;
  text-align: justify;
  hyphens: auto;
}

/* ── At a Glance ────────────────────────────────────────── */

.glance-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem;
  margin-top: 1.25rem;
}

.glance-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 0.5rem;
}

.glance-value {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
}

.release-pattern {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.rp-row {
  display: flex;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.rp-key {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 4.5rem;
}

.rp-val {
  color: var(--ink);
}

/* ── Research Pillars ───────────────────────────────────── */

.pillars-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-top: 1.25rem;
}

.pillar-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-style: normal;
  display: block;
  margin-bottom: 0.35rem;
}

.pillar p {
  font-size: 0.95rem;
  line-height: 1.68;
  color: var(--ink);
  margin-bottom: 1.1rem;
  text-align: justify;
  hyphens: auto;
}

.pillar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
}

/* ── Operating Loop ─────────────────────────────────────── */

.loop-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem;
  margin-top: 1.25rem;
}

.loop-step-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-style: normal;
  display: block;
  margin-bottom: 0.5rem;
}

.loop-step h4 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.loop-step p {
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--muted);
  text-align: justify;
  hyphens: auto;
}

/* ── Editorial Boundary ─────────────────────────────────── */

.editorial-list {
  margin-top: 1.25rem;
}

.editorial-list li {
  border-top: 1px solid var(--rule);
  padding: 0.8rem 0;
  display: flex;
  gap: 2rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.editorial-list li:last-child {
  border-bottom: 1px solid var(--rule);
}

.rule-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 9rem;
  padding-top: 0.15rem;
  flex-shrink: 0;
}

/* ── Artifact Index ─────────────────────────────────────── */

.artifact-filters {
  display: flex;
  gap: 1.25rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}

.artifact-filters a {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}

.artifact-filters a:hover {
  color: var(--ink);
}

.artifact-filters a.active {
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
}

.artifact-table {
  width: 100%;
  border-collapse: collapse;
}

.artifact-table th {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 0.55rem 0.75rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  font-weight: 400;
}

.artifact-table th:last-child {
  padding-right: 0;
}

.artifact-table td {
  padding: 0.9rem 0.75rem 0.9rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.92rem;
  vertical-align: top;
  line-height: 1.5;
}

.artifact-table td.type-cell {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.artifact-empty {
  text-align: center;
  padding: 3.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 2;
}

.artifact-note {
  display: block;
  font-size: 0.7rem;
  margin-top: 0.25rem;
  opacity: 0.7;
}

/* ── About — prose sections ─────────────────────────────── */

.about-header {
  max-width: 56ch;
}

.about-header h1 {
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 3.5vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

.about-header .lede {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.72;
  text-align: justify;
  hyphens: auto;
}

.prose {
  max-width: 60ch;
}

.prose p {
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 1.1rem;
  text-align: justify;
  hyphens: auto;
}

.prose p:last-child {
  margin-bottom: 0;
}

.four-col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem;
  margin-top: 1.25rem;
}

.four-col-item .item-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 0.5rem;
}

.four-col-item h4 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.four-col-item p {
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--muted);
  text-align: justify;
  hyphens: auto;
}

.behind-prose p {
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 1rem;
  text-align: justify;
  hyphens: auto;
  max-width: 60ch;
}

.behind-prose a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.behind-prose a:hover {
  color: var(--accent);
}

/* ── Placeholder pages ──────────────────────────────────── */

.placeholder-header {
  padding-top: 2rem;
}

.placeholder-header h1 {
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 3.5vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1.5rem;
}

.placeholder-state {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 2;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.placeholder-state span {
  display: block;
  opacity: 0.65;
}

/* ── Footer ─────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--rule);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-brand {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.12s;
}

.footer-links a:hover {
  color: var(--ink);
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-right {
    border-left: none;
    border-top: 1px solid var(--rule);
    padding-left: 0;
    padding-top: 2rem;
  }

  .pillars-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .glance-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  .loop-steps {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  .four-col {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (max-width: 600px) {
  .glance-grid {
    grid-template-columns: 1fr 1fr;
  }

  .loop-steps {
    grid-template-columns: 1fr 1fr;
  }

  .four-col {
    grid-template-columns: 1fr 1fr;
  }

  .nav-links {
    gap: 1rem;
  }

  .nav-links a {
    font-size: 0.78rem;
  }

  .editorial-list li {
    flex-direction: column;
    gap: 0.25rem;
  }

  .rule-label {
    min-width: unset;
  }

  .signal-bar {
    gap: 0.75rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: flex-start;
  }
}
