/* ============================================================
   myhomeio.com — Theme POC (PROP-MYHOMEIO-RED-001)
   Zero-JS native CSS. Four verified variants:
   warm (default brand) / dark / paper / hybrid (system-aware)
   All pairs WCAG-verified 2026-10-09 (see scratch/wcag_pairs.json).
   ============================================================ */

:root {
  /* Golden-ratio spacing scale (1.618 steps from 4px base) */
  --sp-1: 4px;  --sp-2: 6px;  --sp-3: 10px; --sp-4: 16px;
  --sp-5: 26px; --sp-6: 42px; --sp-7: 68px; --sp-8: 110px;
  --radius: 10px;
  --font: "Inter var", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --maxw: 1120px;
}

/* ---- WARM NEUTRAL — brand default (Nora 2026-10-09) ---- */
:root, [data-theme="warm"], :root:has(#t-warm:checked) {
  --bg: #F2EDE4;            /* cream */
  --bg-elev: #FBF8F1;       /* lifted card surface */
  --surface: #E9E1D2;       /* recessed band */
  --ink: #1C1814;           /* charcoal text — 15.13:1 on bg (AAA) */
  --ink-soft: #4A4036;
  --accent: #8B5A3C;        /* clay — 4.97:1 on bg (AA) */
  --accent-ink: #F2EDE4;    /* on clay — 4.97:1 (AA) */
  --accent-hi: #A9714C;
  --line: #D8CDBB;
  --focus: #5E3A24;
  --shadow: 0 2px 6px rgb(28 24 20 / .08), 0 12px 32px rgb(28 24 20 / .10);
}

/* ---- DARK ENGINEERING — credibility variant (energy dashboards) ---- */
[data-theme="dark"], :root:has(#t-dark:checked) {
  --bg: #121212;            /* OLED */
  --bg-elev: #1E1C19;
  --surface: #242220;
  --ink: #ECEAE6;           /* 15.59:1 on bg (AAA) */
  --ink-soft: #B8B2A8;
  --accent: #C9A227;        /* amber — 7.74:1 on bg (AAA) */
  --accent-ink: #121212;    /* on amber — 7.74:1 (AAA) */
  --accent-hi: #E3BC44;
  --line: #35322E;
  --focus: #E3BC44;
  --shadow: 0 2px 6px rgb(0 0 0 / .5), 0 12px 32px rgb(0 0 0 / .45);
}

/* ---- LIGHT PAPER — daytime editorial ---- */
[data-theme="paper"], :root:has(#t-paper:checked) {
  --bg: #F5F2EB;
  --bg-elev: #FCFAF4;
  --surface: #EBE6DA;
  --ink: #0A0A0A;           /* 17.71:1 on bg (AAA) */
  --ink-soft: #44403A;
  --accent: #6B4E12;        /* deep amber (WCAG fix: raw #C9A227 fails 2.16:1 on paper) */
  --accent-ink: #F5F2EB;
  --accent-hi: #8B5A3C;
  --line: #D9D2C2;
  --focus: #6B4E12;
  --shadow: 0 2px 6px rgb(10 10 10 / .07), 0 12px 32px rgb(10 10 10 / .09);
}

/* ---- HYBRID SYSTEM-AWARE — native default until sign-off ----
   Pure CSS: follows the user's OS preference, zero JS.
   Interactive live-preview toggle enabled via :root:has(#t-hybrid:checked). */
:root[data-theme="hybrid"], [data-theme="hybrid"], :root:has(#t-hybrid:checked) {
  color-scheme: light;
  --bg: #F2EDE4; --bg-elev: #FBF8F1; --surface: #E9E1D2;
  --ink: #1C1814; --ink-soft: #4A4036;
  --accent: #8B5A3C; --accent-ink: #F2EDE4; --accent-hi: #A9714C;
  --line: #D8CDBB; --focus: #5E3A24;
  --shadow: 0 2px 6px rgb(28 24 20 / .08), 0 12px 32px rgb(28 24 20 / .10);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="hybrid"], [data-theme="hybrid"], :root:has(#t-hybrid:checked) {
    color-scheme: dark;
    --bg: #121212; --bg-elev: #1E1C19; --surface: #242220;
    --ink: #ECEAE6; --ink-soft: #B8B2A8;
    --accent: #C9A227; --accent-ink: #121212; --accent-hi: #E3BC44;
    --line: #35322E; --focus: #E3BC44;
    --shadow: 0 2px 6px rgb(0 0 0 / .5), 0 12px 32px rgb(0 0 0 / .45);
  }
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem; line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  transition: background-color .25s ease, color .25s ease;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 var(--sp-3); letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 800; }
h2 { font-size: clamp(1.15rem, 2vw, 1.45rem); font-weight: 700; }
p  { margin: 0 0 var(--sp-3); }
a  { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--accent-hi); }
code { font-family: var(--mono); font-size: .85em; background: var(--surface); padding: 1px 6px; border-radius: 5px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--accent-ink); color: var(--accent); padding: 8px 14px; border-radius: 0 0 8px 0; font-weight: 700;
}
.skip:focus { left: 0; }

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

/* ---- Header ---- */
.site {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-4);
  min-height: 60px;
}
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand__tld { color: var(--ink-soft); font-weight: 600; }
.brand__mark {
  width: 14px; height: 14px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent) 0 55%, var(--accent-hi) 55% 100%);
}
.nav ul { display: flex; flex-wrap: wrap; gap: 2px 14px; list-style: none; margin: 0; padding: 0; justify-content: flex-end; }
.nav a {
  color: var(--ink); text-decoration: none; font-size: .875rem; font-weight: 600;
  padding: 6px 4px; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Theme switch: native radio inputs, zero JS ---- */
.theme-switch { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; margin: 0; }
.theme-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-switch label {
  padding: 4px 10px; border: 1.5px solid var(--line); border-radius: 999px;
  color: var(--ink-soft); cursor: pointer; user-select: none; background: transparent;
}
.theme-switch label:hover { border-color: var(--accent); color: var(--accent); }
.theme-switch input:checked + label {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.theme-switch input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- Hero ---- */
.hero {
  display: grid;
  grid-template-columns: 1.618fr 1fr;  /* golden ratio split */
  gap: var(--sp-6);
  align-items: center;
  padding-block: var(--sp-7) var(--sp-6);
}
.hero h1 a { color: inherit; text-decoration: none; }
.hero h1 a:hover { color: var(--accent); }
.hero__thumb img {
  width: 100%; height: 220px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--line);
}
.kicker {
  font-family: var(--mono); font-size: .75rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--sp-3);
}
.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--ink-soft); max-width: 52ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-5); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 8px;
  font-weight: 700; font-size: .95rem; text-decoration: none;
  border: 1.5px solid transparent;
  transition: transform .12s ease, background-color .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hi); }
.btn--ghost { border-color: var(--accent); color: var(--accent); }
.btn--ghost:hover { background: var(--accent); color: var(--accent-ink); }
.hero__panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--sp-4);
  container-type: inline-size;  /* Container Queries demo */
}
.hero__panel svg { width: 100%; height: auto; }
.mesh line { stroke: var(--line); stroke-width: 1.5; }
.hero__readout {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: .8rem; color: var(--ink-soft);
}
.hero__readout b { color: var(--accent); font-weight: 700; }

/* ---- Category grid — CSS Grid + Subgrid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-4);
  padding-block: var(--sp-6) var(--sp-6);
}
.card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--sp-2);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.card h2 { margin: 0; font-size: clamp(1.15rem, 2vw, 1.45rem); }
.card h2 a { color: inherit; text-decoration: none; }
.card h2 a:hover { color: var(--accent); }
.card p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.card__tag {
  font-family: var(--mono); font-size: .72rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
}
/* Subgrid: align nested card internals across rows when container supports it */
@supports (grid-template-rows: subgrid) {
  .grid { grid-auto-flow: row; }
  .card {
    grid-template-rows: subgrid;
    grid-row: span 3;
  }
}

/* ---- Professional Publication Footer ---- */
.site-foot {
  margin-top: var(--sp-8);
  padding-block: var(--sp-7) var(--sp-5);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.site-foot__inner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}
.footer-top {
  display: grid;
  grid-template-columns: 1.4fr 2fr;
  gap: var(--sp-6);
  align-items: start;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  max-width: 40ch;
}
.footer-mission {
  font-size: .92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}
.footer-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-5);
}
.footer-col h4 {
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp-3);
}
.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-col a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .88rem;
  transition: color .15s ease;
}
.footer-col a:hover {
  color: var(--accent);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  font-size: .82rem;
  color: var(--ink-soft);
}
.footer-bottom p {
  margin: 0;
}
@media (max-width: 768px) {
  .footer-top {
    grid-template-columns: 1fr;
    gap: var(--sp-5);
  }
}

/* ---- Article & Post Views (Single / Page) ---- */
.article { max-width: 760px; margin-inline: auto; padding-block: var(--sp-6); }
.article-head { margin-bottom: var(--sp-6); }
.article-head h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin-bottom: var(--sp-3); }
.article-meta {
  font-family: var(--mono); font-size: .8rem; color: var(--ink-soft);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3);
}
.article-meta .dot { color: var(--line); }
.article-hero { margin-bottom: var(--sp-6); }
.article-hero img { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); width: 100%; height: auto; }

.article-body { font-size: 1.05rem; line-height: 1.75; color: var(--ink); }
.article-body p { margin-bottom: var(--sp-4); }
.article-body h2 { font-size: 1.5rem; margin-top: var(--sp-6); margin-bottom: var(--sp-3); }
.article-body h3 { font-size: 1.25rem; margin-top: var(--sp-5); margin-bottom: var(--sp-2); }
.article-body ul, .article-body ol { margin-bottom: var(--sp-4); padding-left: var(--sp-5); }
.article-body li { margin-bottom: var(--sp-2); }
.article-body blockquote {
  margin: var(--sp-5) 0; padding: var(--sp-4) var(--sp-5);
  border-left: 3px solid var(--accent); background: var(--bg-elev);
  border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink-soft);
}
.article-body pre {
  background: var(--surface); padding: var(--sp-4); border-radius: var(--radius);
  overflow-x: auto; font-family: var(--mono); font-size: .9rem;
}
.article-body figure { margin: var(--sp-5) 0; }
.article-body figure img { border-radius: var(--radius); border: 1px solid var(--line); }
.article-body figcaption { font-size: .85rem; color: var(--ink-soft); text-align: center; margin-top: var(--sp-2); }

.pagination, .post-navigation {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-4); padding-block: var(--sp-5); margin-top: var(--sp-5);
  border-top: 1px solid var(--line); font-weight: 600; font-size: .9rem;
}
.pagination a, .post-navigation a { text-decoration: none; color: var(--accent); }
.pagination a:hover, .post-navigation a:hover { color: var(--accent-hi); }

/* ---- Responsive ---- */
@media (max-width: 820px) {
  .site__inner { grid-template-columns: 1fr auto; }
  .nav { grid-column: 1 / -1; order: 3; }
  .nav ul { justify-content: flex-start; }
  .hero { grid-template-columns: 1fr; gap: var(--sp-5); }
  .hero__panel { order: -1; }
}
@media (max-width: 480px) {
  .theme-switch { font-size: .68rem; }
  .theme-switch label { padding: 3px 8px; }
  .hero__cta .btn { flex: 1 1 100%; justify-content: center; }
}
/* Container-query demo: denser readout when panel is narrow */
@container (max-width: 300px) {
  .hero__readout { flex-direction: column; gap: 6px; }
}
