/* Thinkorithm — single shared stylesheet. No external resources. */

:root {
  --paper: #f7f6f3;
  --surface: #ffffff;
  --ink: #18202b;
  --ink-soft: #3a4452;
  --muted: #5d6675;
  --line: #dcdfe4;
  --accent: #2c4b70;
  --accent-ink: #ffffff;
  --copper: #a8541f;
  --fact-bg: #eef3f8;
  --outlook-bg: #f8f1ea;
  --code-bg: #f0f1f3;
  --serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --wrap: 72rem;
  --text: 42rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11161d;
    --surface: #171d26;
    --ink: #e6e9ed;
    --ink-soft: #c5cbd3;
    --muted: #9aa3af;
    --line: #2a323d;
    --accent: #8fb3db;
    --accent-ink: #0f1620;
    --copper: #e39a62;
    --fact-bg: #182330;
    --outlook-bg: #251d17;
    --code-bg: #1b222c;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--copper); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-text { max-width: calc(var(--text) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; border-radius: 4px;
}
.skip:focus { top: 1rem; }

/* ---------- masthead */

.masthead { border-bottom: 1px solid var(--line); background: var(--paper); }
.masthead-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 2rem; padding-block: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--ink); text-decoration: none; font: 500 1.15rem/1 var(--serif); letter-spacing: .01em;
}
.brand b { font-weight: 700; }
.mark { width: 1.9rem; height: 1.9rem; fill: currentColor; color: var(--accent); flex: none; }
.mark-core { fill: var(--copper); }

.primary ul { display: flex; flex-wrap: wrap; gap: .25rem 1.4rem; margin: 0; padding: 0; list-style: none; }
.primary a {
  display: inline-block; padding: .35rem 0; color: var(--ink-soft); text-decoration: none;
  font-size: .95rem; border-bottom: 2px solid transparent;
}
.primary a:hover { color: var(--ink); border-bottom-color: var(--line); }
.primary a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--copper); }

/* ---------- shared text bits */

.kicker {
  margin: 0 0 .5rem; color: var(--copper);
  font: 600 .75rem/1.3 var(--sans); letter-spacing: .12em; text-transform: uppercase;
}
.meta { margin: .4rem 0 0; color: var(--muted); font-size: .875rem; }
.dek { color: var(--ink-soft); font: 400 1.2rem/1.5 var(--serif); margin: .75rem 0 0; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -.005em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); margin: 0; }

/* ---------- hero */

.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: center;
  padding-block: clamp(2.5rem, 6vw, 5rem);
}
.hero h1 { font-size: clamp(2.5rem, 1.6rem + 4vw, 4.3rem); }
.hero-lead { font: 400 clamp(1.15rem, 1rem + .6vw, 1.4rem)/1.55 var(--serif); color: var(--ink-soft); margin: 1.2rem 0 0; max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 2rem 0 0; }
.hero-art { margin: 0; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }

.button {
  display: inline-block; padding: .7rem 1.2rem; border-radius: 4px; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: .95rem;
  border: 1px solid var(--accent);
}
.button:hover { filter: brightness(1.08); }
.button-quiet { background: transparent; color: var(--accent); }

/* ---------- blocks and grids */

.block { padding-block: clamp(2rem, 5vw, 3.5rem); border-top: 1px solid var(--line); }
.block-title {
  margin: 0 0 1.6rem; font: 600 .8rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.grid { display: grid; gap: clamp(1.25rem, 3vw, 2rem); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-bottom: 4rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 4rem; }

.topic-link {
  display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  transition: border-color .15s ease;
}
.topic-link:hover { border-color: var(--accent); }
.topic-link img { aspect-ratio: 2 / 1; object-fit: cover; border-bottom: 1px solid var(--line); }
.topic-num { margin: 1rem 1.1rem 0; color: var(--copper); font: 600 .8rem/1 var(--mono); }
.topic h3 { margin: .4rem 1.1rem 0; font-size: 1.3rem; }
.topic p { margin: .5rem 1.1rem 0; color: var(--ink-soft); font-size: .95rem; }
.topic-count { margin: auto 1.1rem 1rem; padding-top: .9rem; color: var(--muted); font-size: .85rem; }

.card { display: flex; flex-direction: column; }
.card-media { display: block; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: .9rem; }
.card-media img { aspect-ratio: 2 / 1; object-fit: cover; }
.card .kicker { margin-bottom: .3rem; }
.card-title { margin: 0; font-size: 1.2rem; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--accent); text-decoration: underline; }
.card-text { margin: .5rem 0 0; color: var(--ink-soft); font-size: .95rem; }

.about-strip { display: grid; grid-template-columns: 1fr 2fr; gap: 2rem; }
.about-strip .block-title { margin: 0; }
.about-strip-text p { margin: 0 0 .8rem; font: 400 1.15rem/1.6 var(--serif); color: var(--ink-soft); }
.about-strip-text p:last-child { font: 400 1rem/1.5 var(--sans); }

/* ---------- section pages */

.section-head {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center;
  padding-block: clamp(2rem, 5vw, 4rem);
}
.section-head-art { border: 1px solid var(--line); border-radius: 6px; }

/* ---------- articles */

.article-head { padding-top: clamp(1.5rem, 4vw, 3rem); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.4rem; padding: 0; list-style: none; font-size: .85rem; }
.crumbs li + li::before { content: "/"; margin-right: .4rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.article-head .meta { margin-top: 1rem; }

.article-art { margin-block: clamp(1.5rem, 4vw, 2.5rem); }
.article-art img { border-radius: 6px; border: 1px solid var(--line); width: 100%; }

.prose { font: 400 1.1875rem/1.72 var(--serif); color: var(--ink); }
.prose > * { margin: 0 0 1.15em; }
.prose h2 { font-size: 1.55rem; margin: 2em 0 .6em; }
.prose h3 { font-size: 1.25rem; margin: 1.6em 0 .5em; }
.prose .lead { font-size: 1.32rem; line-height: 1.6; color: var(--ink-soft); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--copper); }
.prose cite { font-style: italic; }

.note {
  margin: 2em 0; padding: 1.1rem 1.3rem; border-left: 3px solid var(--accent);
  background: var(--fact-bg); border-radius: 0 6px 6px 0; font-size: 1.05rem;
}
.note p { margin: 0; }
.note .note-label { margin-bottom: .4rem; font: 600 .75rem/1.3 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.note-outlook { border-left-color: var(--copper); background: var(--outlook-bg); }
.note-outlook .note-label { color: var(--copper); }

.prompt { margin: 1.2em 0 1.6em; }
.prompt figcaption { font: 600 .85rem/1.3 var(--sans); color: var(--muted); margin-bottom: .45rem; }
.prompt pre {
  margin: 0; padding: 1rem 1.1rem; overflow-x: auto; background: var(--code-bg);
  border: 1px solid var(--line); border-radius: 6px;
  font: 400 .9rem/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.caption-note { font-size: 1rem; color: var(--muted); }
.checklist { list-style: none; padding-left: 0 !important; }
.checklist li { padding-left: 1.7em; position: relative; }
.checklist li::before { content: "☐"; position: absolute; left: 0; color: var(--accent); }

.sources { margin-top: 3em; padding-top: 1.4em; border-top: 1px solid var(--line); font: 400 .9rem/1.55 var(--sans); color: var(--ink-soft); }
.sources h2 { font: 600 .8rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 1rem; }
.sources li { margin-bottom: .6em; overflow-wrap: anywhere; }

.article-foot { padding-bottom: 4rem; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.5rem; }
.pager a {
  display: block; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); text-decoration: none; font: 600 1rem/1.35 var(--serif); background: var(--surface);
}
.pager a:hover { border-color: var(--accent); }
.pager span { display: block; margin-bottom: .3rem; font: 600 .72rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pager-next { grid-column: 2; text-align: right; }

/* ---------- 404 */

.notfound { padding-block: clamp(3rem, 10vw, 7rem); }
.notfound-code { margin: 0 0 .5rem; font: 600 clamp(4rem, 12vw, 7rem)/1 var(--serif); color: var(--line); }
.notfound-links { margin: 1.6rem 0 0; padding-left: 1.2em; }
.notfound-links li { margin-bottom: .4rem; }

/* ---------- footer */

.colophon { border-top: 1px solid var(--line); background: var(--surface); }
.colophon-inner {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; padding-block: 2.5rem 3rem;
}
.foot-title { margin: 0 0 .7rem; font: 600 .75rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.colophon ul { margin: 0; padding: 0; list-style: none; }
.colophon li { margin-bottom: .45rem; }
.colophon a:not(.brand) { color: var(--ink-soft); text-decoration: none; font-size: .95rem; }
.colophon a:not(.brand):hover { color: var(--ink); text-decoration: underline; }
.brand-small { align-self: start; font-size: 1rem; }

/* ---------- responsive */

@media (max-width: 64rem) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 44rem) {
  body { font-size: 1rem; }
  .hero, .section-head, .about-strip { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .prose { font-size: 1.0625rem; }
  .prose .lead { font-size: 1.18rem; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: auto; }
  .colophon-inner { grid-template-columns: 1fr 1fr; }
  .brand-small { grid-column: 1 / -1; }
  .masthead-inner { padding-block: .8rem; }
  .primary ul { gap: .1rem 1.1rem; }
}

@media print {
  .masthead nav, .colophon, .skip, .pager, .article-art { display: none; }
  body { background: #fff; color: #000; }
}

/* ---------- Thinkorithm additions */
.hero-sub { margin: 1rem 0 0; font: 600 clamp(1.25rem, 1.05rem + .9vw, 1.65rem)/1.35 var(--serif); color: var(--ink); max-width: 34rem; }
.hero-lead { margin-top: .9rem; }
.topic-num { display: flex; align-items: center; gap: .6rem; }
.topic-flag {
  font: 600 .65rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--copper); padding: .3rem .45rem; border-radius: 3px;
}
.topic-central .topic-link { border-color: var(--copper); box-shadow: 0 0 0 1px var(--copper); }
