/*
 * Steppa blog stylesheet — hand-written, standalone, brand-matched.
 *
 * WHY NOT TAILWIND: blog pages are generated by scripts/build-blog.mjs AFTER
 * `vite build` runs, so Tailwind's source scan has already finished and would
 * never see these class names. Plain CSS also means an article renders
 * correctly for crawlers with nothing but this one stylesheet.
 *
 * Tokens mirror src/index.css (@theme). Keep them in sync by hand.
 */

:root {
  --cream: #ffffff;
  --cream-deep: #f4f2ec;
  --ink: #16140f;
  --ink-soft: #534e44;
  --ink-faint: #6a6557;
  --brand: #ee9b14;
  --brand-deep: #b06f05;
  --brand-glow: #ff8a1c;
  --brand-tint: #fff4e0;
  --line: rgba(22, 20, 15, 0.1);
  --line-soft: rgba(22, 20, 15, 0.06);
  --shadow-card: 0 1px 2px rgba(20, 19, 15, 0.04), 0 12px 32px rgba(20, 19, 15, 0.08);
  --shadow-float: 0 18px 48px rgba(20, 19, 15, 0.16);
  --radius: 20px;
  --measure: 42rem;
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', ui-serif, Georgia, 'Times New Roman', serif;
}

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

html {
  scroll-behavior: smooth;
  /* Keep #anchor jumps clear of the fixed nav pill. */
  scroll-padding-top: 6.5rem;
  -webkit-text-size-adjust: 100%;
}

body.blog {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

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

/* Mascot art is not uniformly square (cash.webp is 760×1133, the rest 760×760).
   Anywhere we pin both dimensions, letterbox instead of squashing. The
   generator emits aspect-correct width/height attrs; this is the backstop. */
.cta-mascot,
.post-hero,
.card img,
.rel-card img,
.author-box img {
  object-fit: contain;
}

::selection {
  background: var(--brand-glow);
  color: #1a1208;
}

a {
  color: var(--brand-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--ink);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
  line-height: 1.14;
  color: var(--ink);
  text-wrap: balance;
  margin: 0;
}

/* ---------------------------------------------------------------- nav ---- */

.site-nav {
  position: fixed;
  inset: 1rem 1rem auto;
  z-index: 50;
}
@media (min-width: 640px) {
  .site-nav {
    inset: 2rem 2rem auto;
  }
}

.nav-pill {
  position: relative;
  margin: 0 auto;
  max-width: 1600px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(20, 19, 15, 0.12);
  box-shadow: 0 8px 30px rgba(20, 19, 15, 0.12), inset 0 0 0 1px var(--line-soft);
  padding: 0.5rem 0.75rem;
}
@media (min-width: 640px) {
  .nav-pill {
    padding: 0.625rem 1.5rem;
  }
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.nav-brand img {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 9px;
}

.nav-links {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  gap: 2.25rem;
}
@media (min-width: 860px) {
  .nav-links {
    display: flex;
  }
}
.nav-links a {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(22, 20, 15, 0.75);
  text-decoration: none;
}
.nav-links a:hover {
  color: var(--ink);
}

.btn-nav {
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  text-decoration: none;
  white-space: nowrap;
}
.btn-nav:hover {
  background: #322d22;
  color: #fff;
}

/* --------------------------------------------------------------- post ---- */

.post,
.index {
  max-width: 68rem;
  margin: 0 auto;
  padding: 8rem 1.25rem 0;
}
@media (min-width: 640px) {
  .post,
  .index {
    padding: 10rem 2rem 0;
  }
}

.crumb {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-decoration: none;
  margin-bottom: 1.25rem;
}
.crumb:hover {
  color: var(--ink);
}

.kicker {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-deep);
  background: var(--brand-tint);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

.post-head {
  display: grid;
  gap: 2rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2.5rem;
}
@media (min-width: 900px) {
  .post-head {
    grid-template-columns: 1fr auto;
    gap: 3rem;
  }
}

.post-head h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 600;
  margin-top: 1rem;
}

.post-hero {
  width: 200px;
  height: 200px;
  justify-self: center;
  filter: drop-shadow(0 18px 32px rgba(20, 19, 15, 0.16));
}
@media (min-width: 900px) {
  .post-hero {
    width: 260px;
    height: 260px;
  }
}

.standfirst {
  font-size: clamp(1.0625rem, 2vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 38rem;
  margin: 1rem 0 0;
}

.byline {
  margin: 1.5rem 0 0;
  font-size: 0.875rem;
  color: var(--ink-faint);
}
.meta-updated {
  font-weight: 600;
  color: var(--brand-deep);
}

/* Key takeaways — the answer box. Deliberately the first thing after the head:
   AI answer engines and skim readers both take the first ~150 words. */
.takeaways {
  margin: 2.5rem auto 0;
  max-width: var(--measure);
  background: var(--brand-tint);
  border: 1px solid rgba(238, 155, 20, 0.28);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
}
.takeaways-title {
  margin: 0 0 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-deep);
}
.takeaways ul {
  margin: 0;
  padding-left: 1.1rem;
}
.takeaways li {
  margin-bottom: 0.5rem;
  color: #4a3a1c;
}
.takeaways li:last-child {
  margin-bottom: 0;
}

.toc {
  margin: 2rem auto 0;
  max-width: var(--measure);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  background: var(--cream-deep);
}
.toc-title {
  margin: 0 0 0.6rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.toc ol {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.toc li {
  margin-bottom: 0.35rem;
}
.toc a {
  color: var(--ink-soft);
  text-decoration: none;
}
.toc a:hover {
  color: var(--brand-deep);
  text-decoration: underline;
}

/* -------------------------------------------------------------- prose ---- */

.prose {
  max-width: var(--measure);
  margin: 0 auto;
  padding-top: 2.5rem;
}

.prose h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 600;
  margin: 3rem 0 0.9rem;
}
.prose h3 {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.25rem 0 0.6rem;
}
.prose p {
  margin: 0 0 1.25rem;
  color: var(--ink-soft);
}
.prose strong {
  color: var(--ink);
  font-weight: 650;
}
.prose ul,
.prose ol {
  margin: 0 0 1.25rem;
  padding-left: 1.3rem;
  color: var(--ink-soft);
}
.prose li {
  margin-bottom: 0.6rem;
}
.prose blockquote {
  margin: 1.75rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--brand);
  color: var(--ink);
  font-size: 1.125rem;
}
.prose blockquote p:last-child {
  margin-bottom: 0;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 3rem 0;
}
/* Article images only — markdown wraps a standalone image in a <p>, so this
   selector deliberately excludes the CTA card's mascot, which is an <img>
   inside an <aside> that also lives in .prose. box-shadow follows the element
   BOX, not the silhouette, so applying it to transparent mascot art paints a
   rounded rectangle halo behind the character. */
.prose p > img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin: 2rem 0;
}
.prose code {
  font-size: 0.9em;
  background: var(--cream-deep);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.1em 0.4em;
}

/* Wide comparison tables scroll inside their own box — the page body never
   scrolls sideways on a phone. On desktop they break out of the 42rem reading
   measure (a 6-column spec table is unreadable squeezed into prose width) and
   stay centred on it. */
.table-scroll {
  overflow-x: auto;
  margin: 2rem 0;
  max-width: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}
.table-scroll table {
  border-collapse: collapse;
  width: 100%;
  min-width: 40rem;
  font-size: 0.9375rem;
  background: #fff;
}
.table-scroll th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--cream-deep);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table-scroll td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
  vertical-align: top;
}
.table-scroll tr:last-child td {
  border-bottom: none;
}
@media (min-width: 1180px) {
  .prose .table-scroll {
    width: 60rem;
    /* centre the wider box on the 42rem measure it sits inside */
    margin-left: calc((var(--measure) - 60rem) / 2);
  }
  .table-scroll table {
    min-width: 0;
  }
}

/* ---------------------------------------------------------------- cta ---- */

.btn-primary {
  display: inline-block;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 650;
  font-size: 0.9375rem;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn-primary:hover {
  background: #322d22;
  color: #fff;
  transform: translateY(-1px);
}
.btn-lg {
  font-size: 1.0625rem;
  padding: 0.95rem 2rem;
}

.cta-card {
  max-width: var(--measure);
  margin: 3rem auto;
  display: grid;
  gap: 1.25rem;
  align-items: center;
  background: linear-gradient(150deg, var(--brand-tint), #fffaf1);
  border: 1px solid rgba(238, 155, 20, 0.3);
  border-radius: 24px;
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}
@media (min-width: 640px) {
  .cta-card {
    grid-template-columns: auto 1fr;
    gap: 1.75rem;
    padding: 2rem 2.25rem;
  }
}
.cta-mascot {
  width: auto;
  height: 120px;
  justify-self: center;
  filter: drop-shadow(0 10px 20px rgba(20, 19, 15, 0.14));
}
.cta-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-deep);
}
.cta-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.cta-text {
  margin: 0 0 1.1rem;
  font-size: 0.9375rem;
  color: #4a3a1c;
  line-height: 1.6;
}
.cta-fine {
  margin: 0.85rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-faint);
}

.final-cta {
  max-width: 52rem;
  margin: 5rem auto 0;
  text-align: center;
  background: var(--cream-deep);
  border-radius: 28px;
  padding: 3rem 1.5rem;
}
.final-cta h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  font-weight: 600;
}
.final-cta p {
  max-width: 34rem;
  margin: 1rem auto 1.75rem;
  color: var(--ink-soft);
}
.final-cta .cta-fine {
  margin-top: 1.1rem;
}

/* ---------------------------------------------------- sources / author ---- */

.sources {
  max-width: var(--measure);
  margin: 3.5rem auto 0;
  border-top: 1px solid var(--line);
  padding-top: 2rem;
}
.sources h2 {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.sources ol {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.sources li {
  margin-bottom: 0.6rem;
}

.author-box {
  max-width: var(--measure);
  margin: 2.5rem auto 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.1rem;
  align-items: center;
  background: var(--cream-deep);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
}
.author-box img {
  width: 56px;
  height: 56px;
}
.author-box p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.author-name {
  font-weight: 700;
  color: var(--ink) !important;
  margin-bottom: 0.15rem !important;
}

/* ------------------------------------------------------------ related ---- */

.related {
  max-width: 68rem;
  margin: 5rem auto 0;
}
.related h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.rel-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 720px) {
  .rel-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.rel-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.rel-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
}
.rel-card img {
  width: 64px;
  height: 64px;
}
.rel-kicker {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-deep);
}
.rel-card h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0.3rem 0 0.35rem;
}
.rel-card p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -------------------------------------------------------------- index ---- */

.index-head {
  max-width: 44rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--line);
}
.index-head h1 {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 600;
  margin-top: 1rem;
}

.card-grid {
  display: grid;
  gap: 1.25rem;
  padding-top: 3rem;
}
@media (min-width: 780px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.75rem;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-float);
}
.card img {
  width: 110px;
  height: 110px;
  filter: drop-shadow(0 10px 20px rgba(20, 19, 15, 0.12));
}
.card h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0.6rem 0 0.6rem;
}
.card-body p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--ink-soft);
  line-height: 1.6;
}
.card-meta {
  margin-top: 1rem !important;
  font-size: 0.8125rem !important;
  color: var(--ink-faint) !important;
}

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

.site-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--line);
  background: var(--cream-deep);
}
.footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3.5rem 1.25rem;
}
@media (min-width: 640px) {
  .footer-inner {
    padding: 3.5rem 2rem;
  }
}
.footer-grid {
  display: grid;
  gap: 2.5rem;
}
@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
  }
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}
.footer-brand img {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}
.footer-blurb {
  margin: 0.75rem 0 0;
  max-width: 20rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.site-footer h3 {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.site-footer ul {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}
.site-footer li {
  margin-bottom: 0.75rem;
}
.site-footer li a {
  font-size: 0.875rem;
  color: var(--ink-soft);
  text-decoration: none;
}
.site-footer li a:hover {
  color: var(--ink);
}
.footer-legal {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding-top: 1.75rem;
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--ink-faint);
}
.footer-legal p {
  margin: 0 0 0.75rem;
}
.footer-legal p:last-child {
  margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
