/* GrindMinded — "Late-night workshop" theme
   Dark, warm, focused. The site should feel like a notebook lit by a desk lamp. */

/* --- Tokens --- */
:root {
  --bg: #0f0d0a;             /* espresso in a dim room */
  --bg-elev: #161310;        /* one shade lighter for cards/inlays */
  --fg: #ece4d3;             /* cream */
  --fg-soft: #c5bca8;        /* slightly muted for long reads */
  --muted: #8a7e6b;          /* faded label */
  --rule: #2a241d;           /* hairline */
  --rule-strong: #3d352a;
  --accent: #c8956c;         /* the brief's warm tone, used as ink not wash */
  --accent-soft: #8a6a4a;    /* accent at low intensity */

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "Source Serif 4", "Source Serif Pro", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --max-width: 1080px;       /* wider — masthead needs room */
  --measure: 64ch;
  --gutter: 1.5rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--fg); text-decoration-thickness: 1px; }

/* --- Masthead (signature element) --- */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.masthead__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem var(--gutter) 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  column-gap: 1.5rem;
  row-gap: 0.25rem;
}
.masthead__brand {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
  text-decoration: none;
  color: var(--fg);
  font-variation-settings: "SOFT" 100, "WONK" 0, "opsz" 144;
}
.masthead__brand:hover { color: var(--accent); }

.masthead__meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-align: right;
  line-height: 1.4;
}

/* --- Nav --- */
.site-nav {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.site-nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.6rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  min-width: 0;
}
.site-nav__link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.site-nav__link:hover { color: var(--fg); border-bottom-color: var(--accent); }

/* --- Main --- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem var(--gutter) 4rem;
  min-width: 0;
}

/* --- Single article --- */
.single__header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin: 0 0 1rem;
  display: inline-block;
}
.eyebrow::before {
  content: "§ ";
  color: var(--accent-soft);
}
.single__title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  font-weight: 500;
  color: var(--fg);
  font-variation-settings: "SOFT" 50, "opsz" 144;
  max-width: 22ch;
}
.single__lede {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--fg-soft);
  margin: 0 0 1.25rem;
  line-height: 1.45;
  max-width: 50ch;
}
.single__meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* --- Prose --- */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-top: 3rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
  font-variation-settings: "SOFT" 30, "opsz" 60;
  line-height: 1.15;
}
.prose h2::before {
  content: "—  ";
  color: var(--accent-soft);
  font-style: normal;
  font-weight: 400;
}
.prose h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  font-style: italic;
  margin-top: 2rem;
  margin-bottom: 0.25rem;
  color: var(--fg);
}
.prose strong { font-weight: 600; color: var(--fg); }
.prose em { color: var(--fg-soft); }
.prose a { color: var(--accent); }
.prose a:hover { color: var(--fg); }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elev);
  padding: 0.15em 0.4em;
  border-radius: 2px;
  color: var(--accent);
}
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: 0.45rem; }
.prose li::marker { color: var(--accent-soft); }
.prose hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3rem auto;
  width: 4rem;
}

/* --- Tables --- */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0 2.25rem;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
  font-variant-numeric: tabular-nums;
}
.prose th, .prose td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  color: var(--fg-soft);
}
.prose th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--rule-strong);
}
.prose tr:hover td { color: var(--fg); background: rgba(200, 149, 108, 0.04); }

/* --- Affiliate disclosure --- */
.affiliate-disclosure {
  max-width: var(--measure);
  margin-top: 4rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  font-size: 0.88rem;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.affiliate-disclosure strong { color: var(--fg-soft); font-weight: 500; }
.affiliate-disclosure a { color: var(--accent); }

/* --- Home --- */
.home__header { margin-bottom: 4rem; padding-bottom: 2rem; border-bottom: 1px solid var(--rule); }
.home__title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5.5rem);
  margin: 0 0 1rem;
  letter-spacing: -0.035em;
  line-height: 0.95;
  font-weight: 500;
  font-variation-settings: "SOFT" 100, "opsz" 144;
  max-width: 14ch;
}
.home__title em {
  font-style: italic;
  color: var(--accent);
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.home__lede {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--fg-soft);
  max-width: 50ch;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.home__section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin: 3rem 0 1.5rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.home__section-label::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--rule);
}

/* --- Card grid --- */
.card-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--rule);
}
@media (min-width: 720px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
  .card-grid > .card:nth-child(odd) { border-right: 1px solid var(--rule); padding-right: 1.5rem; }
  .card-grid > .card:nth-child(even) { padding-left: 1.5rem; }
}
.card {
  border-bottom: 1px solid var(--rule);
  padding: 1.5rem 0;
}
@media (min-width: 720px) {
  .card { border-bottom: none; }
}
.card__link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.card__link:hover .card__title { color: var(--accent); }
.card__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent-soft);
  margin: 0 0 0.5rem;
}
.card__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--fg);
  transition: color 120ms ease;
}
.card__excerpt {
  color: var(--fg-soft);
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.5;
}

/* --- Section list --- */
.section-list__title {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 500;
  font-style: italic;
  margin: 0 0 2rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variation-settings: "SOFT" 50, "opsz" 144;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 5rem;
  background: var(--bg);
}
.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem var(--gutter);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  justify-content: space-between;
  align-items: center;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* --- Mobile --- */
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  main { padding: 2rem 1.1rem 3rem; }
  .masthead__inner {
    grid-template-columns: 1fr;
    padding: 1.5rem 1.1rem 1rem;
  }
  .masthead__meta { text-align: left; }
  .site-nav__inner { padding: 0.5rem 1.1rem; gap: 0.4rem 1.25rem; }
  .site-footer__inner { padding: 1.75rem 1.1rem; }
  .card-grid > .card { padding: 1.25rem 0; }
  .home__title { font-size: 2.75rem; }
}

/* --- Respect reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
