:root {
  --paper: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef0eb;
  --ink: #17201d;
  --muted: #65706b;
  --line: #dce1dc;
  --brand: #e6532f;
  --brand-dark: #b73317;
  --brand-soft: #fff0eb;
  --green: #1c6b4a;
  --navy: #173f46;
  --shadow: 0 16px 46px rgba(23, 32, 29, 0.08);
  --radius: 14px;
  --shell: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 3px solid #188bdb;
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.narrow-shell { max-width: 780px; }

.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid rgba(23, 32, 29, 0.1);
  background: rgba(246, 247, 244, 0.95);
  backdrop-filter: blur(12px);
}

.header-inner {
  min-height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px 8px 8px 2px;
  background: var(--brand);
  color: white;
  font-size: 14px;
  letter-spacing: 0;
}

.nav-list { display: flex; gap: 30px; margin: 0; padding: 0; list-style: none; }
.nav-list a {
  color: #4f5a55;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.nav-list a:hover, .nav-list a[aria-current="page"] { color: var(--ink); }
.header-inner > .button { justify-self: end; }

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 11px 17px;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.button-small { min-height: 40px; padding: 9px 13px; }
.button-primary { background: var(--brand); color: white; box-shadow: 0 8px 20px rgba(230, 83, 47, 0.2); }
.button-primary:hover { background: var(--brand-dark); }
.button-secondary { border-color: #cfd5cf; background: var(--surface); color: var(--ink); }
.button-secondary:hover { border-color: #9fa9a3; background: #fbfcfa; }
.button-soft { background: #e9ece7; color: var(--ink); }
.button-light { background: white; color: var(--ink); }
.button-muted { width: 100%; background: #edf0ec; color: #738079; cursor: not-allowed; }
.button-note { color: inherit; font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; opacity: 0.62; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.eyebrow > span { width: 18px; height: 2px; background: currentColor; }
.eyebrow-light { color: #f9b19e; }

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  padding: 94px 0 92px;
  background:
    radial-gradient(circle at 85% 18%, rgba(230, 83, 47, 0.1), transparent 24%),
    linear-gradient(180deg, #fbfcf9, var(--paper));
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image: linear-gradient(rgba(23, 32, 29, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 32, 29, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to right, black, transparent 60%);
}

.hero-grid { position: relative; display: grid; grid-template-columns: 1.08fr 0.78fr; gap: 90px; align-items: center; }
.hero h1, .page-hero h1, .thread-header h1, .state-page h1 {
  margin: 0;
  font-size: clamp(48px, 6vw, 78px);
  line-height: 0.98;
  letter-spacing: -0.065em;
}
.hero h1 em { display: block; color: var(--brand); font-family: Georgia, serif; font-weight: 500; }
.hero-lede { max-width: 670px; margin: 28px 0 0; color: #4f5c57; font-size: clamp(18px, 2vw, 21px); line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.hero-footnote { margin: 20px 0 0; color: #7a837e; font-size: 13px; }

.hero-panel {
  border: 1px solid #ccd3ce;
  border-radius: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  transform: rotate(1deg);
}
.panel-label { display: flex; align-items: center; gap: 8px; padding: 3px 5px 15px; color: #69736e; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #2aa56e; box-shadow: 0 0 0 4px #e0f4e9; }
.loop-list { margin: 0; padding: 0; list-style: none; }
.loop-list li { display: grid; grid-template-columns: 38px 1fr; gap: 1px 10px; border-top: 1px solid #e3e6e2; padding: 17px 10px; }
.loop-list li.active { margin-bottom: 6px; border: 0; border-radius: 10px; background: var(--brand-soft); }
.loop-number { grid-row: span 2; color: var(--brand); font: 700 12px/1.5 ui-monospace, monospace; }
.loop-list strong { font-size: 14px; }
.loop-list small { color: var(--muted); font-size: 12px; }

.how-section, .latest-section { padding: 92px 0; }
.how-section { background: var(--surface); }
.section-heading { margin-bottom: 40px; }
.section-heading h2, .builder-callout h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}
.split-heading { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 60px; align-items: end; }
.split-heading > p { margin: 0; color: var(--muted); font-size: 17px; }
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.steps-grid li { padding: 29px 28px 10px 0; }
.steps-grid li + li { border-left: 1px solid var(--line); padding-left: 28px; }
.steps-grid span { color: var(--brand); font: 700 12px ui-monospace, monospace; }
.steps-grid h3 { min-height: 54px; margin: 44px 0 10px; font-size: 19px; line-height: 1.35; }
.steps-grid p { margin: 0; color: var(--muted); font-size: 14px; }

.section-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.text-link { color: var(--brand-dark); font-weight: 750; text-decoration: none; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.text-link-large { padding-bottom: 8px; font-size: 14px; }
.problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.problem-list { display: grid; gap: 14px; }
.problem-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.problem-card:hover { border-color: #b9c1bb; transform: translateY(-2px); box-shadow: 0 12px 34px rgba(23, 32, 29, 0.06); }
.problem-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.category-tag, .status-badge, .sample-label, .coming-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.055em;
  line-height: 1;
  text-transform: uppercase;
}
.category-tag { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.status-badge { background: #e9f3ed; color: var(--green); }
.status-in_progress { background: #e8f0f5; color: #245d77; }
.status-solved { background: #e1f4e8; color: #16663f; }
.status-archived { background: #eceeec; color: #606a65; }
.sample-label { border: 1px solid #d6dad6; color: #747d78; }
.problem-card h2 { margin: 18px 0 10px; font-size: 20px; line-height: 1.3; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.problem-card h2 a { text-decoration: none; }
.problem-card h2 a:hover { color: var(--brand-dark); }
.problem-card > p { flex: 1; margin: 0; color: var(--muted); font-size: 14px; }
.problem-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 24px; border-top: 1px solid #eaedea; padding-top: 16px; }
.problem-card-footer time { color: #838c87; font-size: 12px; }
.problem-card-footer .text-link { font-size: 12px; }

.builder-callout { padding: 80px 0; background: var(--navy); color: white; }
.callout-inner { display: grid; grid-template-columns: 1fr 0.8fr auto; gap: 54px; align-items: end; }
.callout-inner > p { margin: 0; color: #bdced0; }

.site-footer { border-top: 1px solid var(--line); padding: 54px 0 24px; background: #eceeea; }
.footer-inner { display: flex; justify-content: space-between; gap: 40px; }
.brand-footer { margin-bottom: 13px; }
.footer-tagline { margin: 0; color: var(--muted); font-size: 14px; }
.footer-inner nav { display: flex; gap: 28px; align-items: center; }
.footer-inner nav a { color: #515c57; font-size: 14px; font-weight: 650; text-decoration: none; }
.footer-inner nav a:hover { color: var(--brand-dark); }
.footer-base { display: flex; justify-content: space-between; margin-top: 42px; border-top: 1px solid #d4d9d4; padding-top: 20px; color: #7a837f; font-size: 11px; }

.page-hero { padding: 82px 0 76px; border-bottom: 1px solid var(--line); background: #fbfcfa; }
.page-hero-compact { padding-block: 66px 58px; }
.page-hero h1 { max-width: 930px; font-size: clamp(42px, 5vw, 64px); }
.page-hero p:last-child { max-width: 720px; margin: 24px 0 0; color: var(--muted); font-size: 19px; }

.directory-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 50px; padding-block: 48px 90px; }
.category-filter { display: flex; flex-direction: column; align-items: stretch; gap: 4px; position: sticky; top: 20px; height: fit-content; }
.category-filter a { border-radius: 8px; padding: 9px 12px; color: #59645f; font-size: 14px; font-weight: 650; text-decoration: none; }
.category-filter a:hover { background: #ecefeb; }
.category-filter a[aria-current="page"] { background: var(--ink); color: white; }
.directory-toolbar { display: flex; justify-content: space-between; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.directory-toolbar p { margin: 0; color: var(--ink); font-weight: 750; }
.problem-list .problem-card { padding: 25px 28px; }
.problem-list .problem-card h2 { font-size: 22px; }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 30px; border-top: 1px solid var(--line); padding-top: 22px; font-size: 14px; }
.pagination a { color: var(--brand-dark); font-weight: 750; text-decoration: none; }
.pagination a:last-child { justify-self: end; }
.pagination > span:nth-child(2) { color: var(--muted); }

.empty-state { border: 1px dashed #bdc5bf; border-radius: var(--radius); padding: 60px 28px; background: rgba(255,255,255,0.5); text-align: center; }
.empty-icon { color: var(--brand); font-size: 36px; }
.empty-state h2 { margin: 8px 0 6px; font-size: 24px; }
.empty-state p { max-width: 570px; margin: 0 auto 24px; color: var(--muted); }
.notice { display: flex; flex-direction: column; border: 1px solid #e0c1b8; border-radius: var(--radius); padding: 24px; background: #fff4f0; }
.notice span { color: var(--muted); }

.thread-page { padding: 38px 0 100px; }
.thread-shell { max-width: 1080px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 48px; color: var(--muted); font-size: 13px; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand-dark); }
.thread-header { max-width: 900px; }
.thread-header h1 { margin-top: 24px; font-size: clamp(40px, 5.5vw, 64px); line-height: 1.05; overflow-wrap: anywhere; }
.thread-byline { display: flex; gap: 10px; margin-top: 24px; color: var(--muted); font-size: 14px; }
.thread-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; margin-top: 52px; align-items: start; }
.thread-content { display: grid; gap: 22px; }
.content-card, .action-card, .share-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.content-card { padding: 34px; }
.section-kicker { margin: 0 0 8px; color: var(--brand-dark); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.content-card h2, .action-card h2, .share-card h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.thread-body { margin-top: 28px; white-space: pre-line; color: #35413c; font-size: 18px; line-height: 1.82; }
.solutions-card > p { margin: 20px 0 0; color: var(--muted); }
.section-title-row { display: flex; justify-content: space-between; gap: 24px; align-items: start; }
.coming-pill { flex: none; background: #eff1ee; color: #67726c; }
.thread-sidebar { display: grid; gap: 16px; position: sticky; top: 24px; }
.action-card, .share-card { padding: 24px; }
.action-card > p:not(.section-kicker), .share-card p { color: var(--muted); font-size: 14px; }
.share-card .button { width: 100%; }
.share-feedback { display: block; min-height: 22px; margin-top: 8px; color: var(--green); font-size: 12px; }
.back-link { padding: 10px 2px; color: var(--brand-dark); font-size: 13px; font-weight: 750; text-decoration: none; }

.prose-page { padding-block: 64px 100px; }
.prose-page section { padding-block: 30px; border-bottom: 1px solid var(--line); scroll-margin-top: 30px; }
.prose-page h2 { margin: 0 0 14px; font-size: 28px; letter-spacing: -.035em; }
.prose-page p { margin: 0; color: #4e5b55; font-size: 17px; }
.plain-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plain-grid > div { border: 1px solid var(--line); border-radius: 12px; padding: 22px; background: white; }
.plain-grid p { margin-top: 8px; font-size: 14px; }
.coming-section { margin-top: 28px; border: 0 !important; border-radius: var(--radius); padding: 34px !important; background: var(--navy); color: white; }
.coming-section p { color: #bfd0d1; }
.coming-section .button { margin-top: 24px; }
.legal-copy section:first-child { padding-top: 0; }

.state-page { min-height: 62vh; padding-block: 100px; text-align: center; }
.state-page .error-code { margin: 0 0 12px; color: var(--brand); font: 800 14px ui-monospace, monospace; letter-spacing: .18em; }
.state-page h1 { font-size: clamp(42px, 6vw, 68px); }
.state-page > p:not(.error-code) { margin: 22px auto 28px; color: var(--muted); font-size: 18px; }

@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero-copy { max-width: 720px; }
  .hero-panel { max-width: 620px; transform: none; }
  .problem-grid { grid-template-columns: 1fr 1fr; }
  .steps-grid { grid-template-columns: 1fr 1fr; }
  .steps-grid li:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .steps-grid li:nth-child(4) { border-top: 1px solid var(--line); }
  .callout-inner { grid-template-columns: 1fr 1fr; }
  .callout-inner .button { width: fit-content; }
  .directory-layout { grid-template-columns: 1fr; gap: 26px; }
  .category-filter { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
  .category-filter a { flex: none; }
  .thread-layout { grid-template-columns: 1fr; }
  .thread-sidebar { position: static; grid-template-columns: 1fr 1fr; }
  .back-link { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .shell { width: min(calc(100% - 28px), var(--shell)); }
  .header-inner { min-height: 66px; grid-template-columns: 1fr auto; gap: 12px; }
  .header-inner nav { display: none; }
  .header-inner > .button { font-size: 0; }
  .header-inner > .button .button-note { font-size: 10px; }
  .brand { font-size: 15px; }
  .hero { padding: 66px 0 62px; }
  .hero h1 { font-size: clamp(44px, 14vw, 62px); }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .hero-panel { padding: 12px; }
  .loop-list li { padding: 15px 8px; }
  .how-section, .latest-section { padding: 65px 0; }
  .split-heading { grid-template-columns: 1fr; gap: 20px; }
  .steps-grid, .problem-grid { grid-template-columns: 1fr; }
  .steps-grid li, .steps-grid li + li, .steps-grid li:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; padding: 24px 0; }
  .steps-grid h3 { min-height: 0; margin-top: 18px; }
  .section-heading-row { align-items: start; flex-direction: column; }
  .problem-card, .problem-list .problem-card { padding: 20px; }
  .builder-callout { padding: 58px 0; }
  .callout-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-inner, .footer-base { flex-direction: column; }
  .footer-inner nav { flex-wrap: wrap; gap: 18px; }
  .footer-base { gap: 6px; margin-top: 28px; }
  .page-hero { padding: 60px 0 54px; }
  .directory-layout { padding-block: 28px 70px; }
  .directory-toolbar { gap: 12px; }
  .pagination { grid-template-columns: 1fr 1fr; gap: 12px; }
  .pagination > span:nth-child(2) { grid-row: 1; grid-column: 1 / -1; text-align: center; }
  .thread-page { padding-top: 24px; }
  .breadcrumbs { margin-bottom: 34px; }
  .thread-header h1 { font-size: 40px; }
  .thread-byline { align-items: start; flex-direction: column; gap: 3px; }
  .thread-byline span[aria-hidden] { display: none; }
  .thread-layout { margin-top: 38px; }
  .content-card { padding: 24px 20px; }
  .section-title-row { flex-direction: column; }
  .thread-sidebar { grid-template-columns: 1fr; }
  .plain-grid { grid-template-columns: 1fr; }
  .prose-page { padding-block: 42px 70px; }
  .coming-section { padding: 26px 22px !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
