/* =============================================================
   Reiderstad Invest — Blog redesign prototype
   Design system generated from references/design.md (light theme
   = signature). Dark tokens applied via [data-theme="dark"] for the
   footer, to demonstrate the dual-theme system.
   Single source of truth: design.md. Do not hand-tune hex here —
   these values are transcribed verbatim from the token contract.
   ============================================================= */

:root {
  /* Light palette */
  --bg: #F4F4F4;            /* Soft Stone canvas */
  --surface-1: #FFFFFF;     /* cards, panels */
  --surface-2: #EBEBEB;     /* recessed wells, inputs */
  --fg: #2D2D2D;            /* body text */
  --muted-strong: #4A4A4A;  /* secondary text */
  --muted: #7A7A7A;         /* tertiary text */
  --hairline: rgba(45, 45, 45, 0.10);
  --accent: #7A7A7A;        /* large / metric / UI accent */
  --accent-deep: #5A5A5A;   /* body-size links/text on light (≥4.5:1) */
  --danger: #B84A2C;

  /* CTA pair (light) */
  --btn-primary-bg: #707070;
  --btn-primary-bg-hover: #5E5E5E;
  --btn-primary-fg: #F4F4F4;
  --btn-secondary-bg: #EBEBEB;
  --btn-secondary-bg-hover: #E2E2E2;
  --btn-secondary-fg: #2D2D2D;
  --btn-secondary-border: rgba(45, 45, 45, 0.10);
  --btn-secondary-blur: 10px;

  /* Type */
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Spacing (4 → 140) */
  --s-xs: 4px;  --s-sm: 8px;  --s-md: 16px; --s-lg: 24px;
  --s-xl: 32px; --s-2xl: 48px; --s-3xl: 64px; --s-4xl: 80px;
  --s-5xl: 96px; --s-6xl: 112px; --s-7xl: 128px; --s-8xl: 140px;

  --container: 1280px;
  --reading: 720px;        /* article column */
}

/* Dark theme tokens (footer / hero surfaces) */
[data-theme="dark"] {
  --bg: #1A1A1A;
  --surface-1: #252525;
  --surface-2: #141414;
  --fg: #F4F4F4;
  --muted-strong: #C8C8C8;
  --muted: #8A8A8A;
  --hairline: rgba(244, 244, 244, 0.10);
  --accent: #C8C8C8;
  --accent-deep: #A0A0A0;
  --btn-primary-bg: #F4F4F4;
  --btn-primary-bg-hover: #FFFFFF;
  --btn-primary-fg: #1A1A1A;
  --btn-secondary-bg: rgba(244, 244, 244, 0.10);
  --btn-secondary-bg-hover: rgba(244, 244, 244, 0.18);
  --btn-secondary-fg: #F4F4F4;
  --btn-secondary-border: rgba(244, 244, 244, 0.22);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.0625rem;          /* 17px min */
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; margin: 0; }
h1 { font-size: 2.125rem; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.625rem; line-height: 1.25; }
h3 { font-size: 1.125rem; line-height: 1.3; font-weight: 500; }
p { margin: 0 0 1.1em; }

/* ---------- Layout ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--s-5xl); }
.section { padding-block: var(--s-6xl); }
.section--tight { padding-block: var(--s-4xl); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--s-md);
}
.lede { font-size: 1.1875rem; color: var(--muted-strong); max-width: 46ch; }
.divider { height: 1px; background: var(--hairline); border: 0; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-sm);
  font-family: var(--font-body); font-weight: 500; font-size: 0.875rem;
  letter-spacing: 0.02em; line-height: 1.4;
  padding: 12px 20px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: background-color .18s ease, color .18s ease, transform .08s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); }
.btn--primary:hover { background: var(--btn-primary-bg-hover); }
.btn--secondary {
  background: var(--btn-secondary-bg); color: var(--btn-secondary-fg);
  border-color: var(--btn-secondary-border);
  -webkit-backdrop-filter: blur(var(--btn-secondary-blur)) saturate(1.1);
  backdrop-filter: blur(var(--btn-secondary-blur)) saturate(1.1);
}
.btn--secondary:hover { background: var(--btn-secondary-bg-hover); }
.btn--ghost { background: transparent; color: var(--muted-strong); padding: 12px 16px; }
.btn--ghost:hover { color: var(--fg); }

/* ---------- Tags / chips ---------- */
.tag {
  display: inline-block; font-family: var(--font-mono);
  font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--muted-strong); background: var(--surface-1);
  border: 1px solid var(--hairline);
  padding: 4px 10px; border-radius: var(--r-sm); white-space: nowrap;
}
.tag--accent { background: var(--accent); color: var(--bg); border-color: transparent; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.brand { display: flex; align-items: center; gap: var(--s-md); }
.brand__mark { width: 34px; height: 34px; flex: 0 0 auto; }
.brand__word { font-family: var(--font-display); font-size: 1.35rem; letter-spacing: .01em; color: var(--fg); }
.nav__links { display: flex; align-items: center; gap: var(--s-xl); list-style: none; margin: 0; padding: 0; }
.nav__links a {
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 500;
  letter-spacing: 0.02em; color: var(--muted-strong);
}
.nav__links a:hover, .nav__links a[aria-current] { color: var(--fg); text-decoration: none; }
.nav__lang { display: flex; gap: var(--s-sm); font-family: var(--font-mono); font-size: 0.75rem; }
.nav__lang a { color: var(--muted); }
.nav__lang a[aria-current] { color: var(--fg); }
.nav__burger { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--fg); cursor: pointer; }

/* ---------- Hub hero ---------- */
.hub-hero { padding-block: var(--s-6xl) var(--s-3xl); }
.hub-hero h1 { font-size: 2.75rem; line-height: 1.1; letter-spacing: -0.02em; max-width: 16ch; }
.hub-hero .lede { margin-top: var(--s-lg); }
.hub-hero em { font-style: italic; color: var(--accent); }
.searchbar {
  margin-top: var(--s-2xl); display: flex; align-items: center; gap: var(--s-sm);
  max-width: 520px; background: var(--surface-2);
  border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 4px 4px 4px 16px;
}
.searchbar input {
  flex: 1; border: 0; background: transparent; font-family: var(--font-body);
  font-size: 1rem; color: var(--fg); padding: 12px 0;
}
.searchbar input::placeholder { color: var(--muted); }
.searchbar input:focus { outline: none; }
.searchbar .btn { padding: 10px 16px; }

/* ---------- Featured ---------- */
.featured-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--s-lg); }
.featured-side { display: grid; grid-template-rows: 1fr 1fr; gap: var(--s-lg); }
.feature-card {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface-1); border: 1px solid var(--hairline);
  display: flex; flex-direction: column; min-height: 240px;
}
.feature-card--lg { min-height: 420px; }
.feature-card__media { position: relative; flex: 1; overflow: hidden; background: var(--surface-2); }
.feature-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.feature-card:hover .feature-card__media img { transform: scale(1.02); }
.feature-card__overlay {
  position: absolute; inset: auto 0 0 0; padding: var(--s-xl);
  background: linear-gradient(to top, rgba(26,26,26,.78), rgba(26,26,26,.12) 70%, transparent);
  color: #F4F4F4;
}
.feature-card--lg .feature-card__overlay h3 { font-size: 1.9rem; line-height: 1.15; font-weight: 400; max-width: 18ch; }
.feature-card__overlay h3 { font-size: 1.3rem; color: #F4F4F4; }
.feature-card__overlay .meta { color: rgba(244,244,244,.78); }
.feature-card .tag { position: absolute; top: var(--s-md); left: var(--s-md); background: rgba(26,26,26,.55); color: #F4F4F4; border-color: transparent; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.meta { font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: 0.04em; color: var(--muted); }

/* ---------- Cluster nav ---------- */
.cluster-row { display: flex; flex-wrap: wrap; gap: var(--s-sm); }
.cluster-chip {
  font-family: var(--font-body); font-weight: 500; font-size: 0.875rem; letter-spacing: 0.01em;
  padding: 10px 18px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); color: var(--muted-strong); background: var(--surface-1);
  transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}
.cluster-chip:hover { color: var(--fg); border-color: var(--muted); text-decoration: none; }
.cluster-chip[aria-current] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-md); margin-bottom: var(--s-xl); }
.section-head h2 { font-size: 1.625rem; }

/* ---------- Post grid ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-lg); }
.post-card {
  display: flex; flex-direction: column; background: var(--surface-1);
  border: 1px solid var(--hairline); border-radius: var(--r-md); overflow: hidden;
  transition: border-color .18s ease;
}
.post-card:hover { border-color: var(--muted); }
.post-card:hover .post-card__title { color: var(--accent-deep); }
.post-card__media { aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.post-card:hover .post-card__media img { transform: scale(1.03); }
/* tonal placeholder for cards without photography */
.post-card__media--tonal {
  display: grid; place-items: center;
  background: linear-gradient(135deg, #EDEDED, #E2E2E2);
}
.post-card__media--tonal span { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.post-card__body { padding: var(--s-lg); display: flex; flex-direction: column; gap: var(--s-sm); flex: 1; }
.post-card__title { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.25; color: var(--fg); transition: color .18s ease; }
.post-card__excerpt { font-size: 0.95rem; color: var(--muted-strong); line-height: 1.5; margin: 0; }
.post-card__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--s-sm); padding-top: var(--s-sm); }

.loadmore { display: flex; justify-content: center; margin-top: var(--s-3xl); }

/* ---------- Newsletter band ---------- */
.news-band { background: var(--surface-2); border-block: 1px solid var(--hairline); }
.news-band__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2xl); flex-wrap: wrap; }
.news-band h2 { max-width: 18ch; }
.news-band p { color: var(--muted-strong); max-width: 42ch; margin: var(--s-sm) 0 0; }
.news-form { display: flex; gap: var(--s-sm); flex: 0 1 460px; }
.news-form input {
  flex: 1; background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 12px 16px; font-family: var(--font-body); font-size: 1rem; color: var(--fg);
}
.news-form input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Footer (dark) ---------- */
.site-footer { background: var(--bg); color: var(--fg); padding-block: var(--s-4xl) var(--s-2xl); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--s-2xl); }
.footer-brand__mark { width: 40px; height: 40px; margin-bottom: var(--s-md); }
.footer-brand p { color: var(--muted-strong); max-width: 30ch; font-size: 0.95rem; }
.site-footer h4 { font-family: var(--font-mono); font-weight: 400; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s-md); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-sm); }
.site-footer a { color: var(--muted-strong); font-size: 0.95rem; }
.site-footer a:hover { color: var(--fg); }
.footer-base { display: flex; justify-content: space-between; gap: var(--s-md); flex-wrap: wrap; margin-top: var(--s-3xl); padding-top: var(--s-lg); border-top: 1px solid var(--hairline); color: var(--muted); font-size: 0.85rem; font-family: var(--font-mono); }

/* =============================================================
   ARTICLE TEMPLATE
   ============================================================= */
.breadcrumb { font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: 0.04em; color: var(--muted); padding-top: var(--s-2xl); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--fg); }

.article-head { padding-bottom: var(--s-xl); }
.article-head h1 { font-size: 2.75rem; line-height: 1.1; letter-spacing: -0.02em; max-width: 20ch; margin-top: var(--s-md); }
.article-head .article-meta { margin-top: var(--s-lg); display: flex; align-items: center; gap: var(--s-md); flex-wrap: wrap; }
.article-meta__author { display: flex; align-items: center; gap: var(--s-sm); }
.article-meta__author img { width: 32px; height: 32px; border-radius: var(--r-pill); object-fit: cover; }
.dot { width: 3px; height: 3px; border-radius: var(--r-pill); background: var(--muted); display: inline-block; }

.article-hero { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--hairline); aspect-ratio: 21 / 9; background: var(--surface-2); }
.article-hero img { width: 100%; height: 100%; object-fit: cover; }
.article-hero__cap { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); margin-top: var(--s-sm); }

.article-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--s-4xl); padding-top: var(--s-3xl); align-items: start; }

/* Table of contents (sticky on lg) */
.toc { position: sticky; top: 110px; }
.toc h4 { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s-md); }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-sm); border-left: 1px solid var(--hairline); }
.toc a { display: block; padding-left: var(--s-md); margin-left: -1px; font-size: 0.9rem; color: var(--muted-strong); border-left: 2px solid transparent; }
.toc a:hover { color: var(--fg); text-decoration: none; }
.toc a[aria-current] { color: var(--fg); border-left-color: var(--accent); }

.prose { max-width: var(--reading); }
.prose > p, .prose > ul, .prose > ol { font-size: 1.0625rem; line-height: 1.65; }
.prose h2 { margin: var(--s-3xl) 0 var(--s-md); }
.prose h3 { margin: var(--s-xl) 0 var(--s-sm); }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose figure { margin: var(--s-xl) 0; }
.prose figure img { border-radius: var(--r-md); border: 1px solid var(--hairline); }
.prose figcaption { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); margin-top: var(--s-sm); }

/* Key takeaways card */
.takeaways {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent); border-radius: var(--r-md);
  padding: var(--s-lg) var(--s-xl); margin: var(--s-xl) 0;
}
.takeaways h4 { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s-md); }
.takeaways ul { margin: 0; padding-left: 1.1em; display: grid; gap: var(--s-sm); }
.takeaways li { font-size: 1rem; color: var(--fg); }

/* Data callout */
.data-callout { margin: var(--s-2xl) 0; }
.data-callout__label { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-md); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-md); }
.stat {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: var(--s-lg);
}
.stat__num { font-family: var(--font-display); font-size: 2.5rem; line-height: 1; color: var(--accent-deep); letter-spacing: -0.02em; }
.stat__cap { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-strong); margin-top: var(--s-sm); }
.data-callout__src { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); margin-top: var(--s-md); }

/* Tables */
.prose table { width: 100%; border-collapse: collapse; margin: var(--s-xl) 0; font-size: 0.95rem; }
.prose th, .prose td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.prose thead th { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.prose tbody tr:hover { background: var(--surface-2); }

/* Inline mid-article CTA */
.inline-cta {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-lg);
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: var(--s-lg) var(--s-xl); margin: var(--s-2xl) 0; flex-wrap: wrap;
}
.inline-cta p { margin: 0; font-family: var(--font-display); font-size: 1.25rem; color: var(--fg); max-width: 34ch; }

/* FAQ accordion */
.faq { margin-top: var(--s-2xl); }
.faq details { border-bottom: 1px solid var(--hairline); }
.faq summary { cursor: pointer; list-style: none; padding: var(--s-md) 0; font-family: var(--font-display); font-size: 1.2rem; color: var(--fg); display: flex; justify-content: space-between; align-items: center; gap: var(--s-md); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-body); color: var(--muted); font-size: 1.4rem; line-height: 1; transition: transform .18s ease; }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding-bottom: var(--s-md); color: var(--muted-strong); }

/* Author + lifecycle + related (article footer zone) */
.article-foot { padding-top: var(--s-3xl); }
.author-card {
  display: flex; gap: var(--s-md); align-items: center;
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: var(--s-lg); max-width: var(--reading);
}
.author-card img { width: 56px; height: 56px; border-radius: var(--r-pill); object-fit: cover; flex: 0 0 auto; background: var(--surface-2); }
.author-card .role { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.author-card p { margin: var(--s-xs) 0 0; font-size: 0.95rem; color: var(--muted-strong); }

.lifecycle {
  margin: var(--s-2xl) 0; border-radius: var(--r-lg); padding: var(--s-3xl);
  text-align: center;
}
.lifecycle h2 { font-size: 2rem; max-width: 22ch; margin: 0 auto var(--s-md); }
.lifecycle p { color: var(--muted-strong); max-width: 48ch; margin: 0 auto var(--s-lg); }

.related h2 { margin-bottom: var(--s-xl); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .container { padding: 0 var(--s-xl); }
  .article-layout { grid-template-columns: 1fr; gap: var(--s-xl); }
  .toc { position: static; border-left: 0; }
  .toc ol { display: flex; flex-wrap: wrap; gap: var(--s-sm); border-left: 0; }
  .toc a { border-left: 0; border: 1px solid var(--hairline); border-radius: var(--r-pill); padding: 6px 12px; margin: 0; }
  .toc a[aria-current] { border-color: var(--accent); }
}
@media (max-width: 860px) {
  .section { padding-block: var(--s-4xl); }
  .hub-hero { padding-block: var(--s-4xl) var(--s-2xl); }
  .hub-hero h1, .article-head h1 { font-size: 2.15rem; }
  .featured-grid { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav__links, .nav__lang { display: none; }
  .nav__burger { display: block; }
  .news-band__inner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 540px) {
  .container { padding: 0 var(--s-md); }
  .post-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--s-xl); }
  .inline-cta, .lifecycle { padding: var(--s-xl); }
}

/* ---------- Motion / a11y ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
