/* Template 1 base stylesheet — SUDOKU-BY look (light, blue/amber, soft cards),
   IMGNOW content rhythm. The builder overrides --brand-* per site theme by
   injecting a small :root block; everything else keys off these tokens so a
   theme swap is one edit. Magazine-style informational pages, consistent
   content width so blocks never jump wide/narrow/wide. */
:root {
  --brand:        #3b82f6;
  --brand-dark:   #1d4ed8;
  --brand-light:  #eff6ff;
  --brand-border: #bfdbfe;
  --accent:       #f59e0b;
  --accent-light: #fffbeb;

  --text:        #1e293b;
  --text-muted:  #64748b;
  --text-light:  #94a3b8;
  --surface:     #ffffff;
  --bg:          #f8fafc;
  --bg-alt:      #f1f5f9;
  --border:      #e2e8f0;

  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   18px;
  --shadow-sm:   0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow:      0 4px 16px rgba(15,23,42,.08);

  --content-w:   760px;   /* the ONE reading width — every text block obeys it */
  --wide-w:      1080px;  /* page frame */
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--text);
  background: var(--bg); line-height: 1.7; font-size: 17px;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--wide-w); margin: 0 auto; padding: 0 20px; }
.reading { max-width: var(--content-w); margin-left: auto; margin-right: auto; }

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── header / footer ─────────────────────────────────────────────────────── */
header.site {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
header.site .bar { display: flex; align-items: center; gap: 18px; height: 62px; }
header.site .logo { font-weight: 800; font-size: 19px; color: var(--text); display: flex; align-items: center; gap: 9px; }
header.site nav { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }
header.site nav a { color: var(--text-muted); font-weight: 600; font-size: 15px; }
header.site nav a:hover { color: var(--brand-dark); text-decoration: none; }

footer.site { background: var(--surface); border-top: 1px solid var(--border); margin-top: 60px; padding: 34px 0; }
footer.site .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 26px; }
footer.site h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-light); margin: 0 0 10px; }
footer.site a { color: var(--text-muted); display: block; padding: 3px 0; font-size: 15px; }
footer.site .fine { color: var(--text-light); font-size: 13px; margin-top: 24px; text-align: center; }

/* ── hero ────────────────────────────────────────────────────────────────── */
.hero { background: linear-gradient(180deg, var(--brand-light), var(--surface)); padding: 56px 0 44px; border-bottom: 1px solid var(--border); }
.hero h1 { font-size: 40px; line-height: 1.15; margin: 0 0 14px; letter-spacing: -.02em; }
.hero p.lede { font-size: 20px; color: var(--text-muted); margin: 0 auto; max-width: var(--content-w); }

/* ── section headings ────────────────────────────────────────────────────── */
h1, h2, h3, h4 { color: var(--text); line-height: 1.25; }
h2 { font-size: 28px; margin: 40px 0 14px; letter-spacing: -.01em; }
h3 { font-size: 21px; margin: 28px 0 10px; }
h4 { font-size: 17px; margin: 20px 0 8px; }
p { margin: 0 0 16px; }
em { font-style: italic; color: var(--text); }
strong { font-weight: 700; }

/* ── cards / grids ───────────────────────────────────────────────────────── */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); transition: box-shadow .18s, transform .18s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin-top: 0; }
.card .ico { width: 44px; height: 44px; color: var(--brand); margin-bottom: 12px; }
.card p { color: var(--text-muted); font-size: 15px; margin-bottom: 0; }

/* ── magazine article body: one column, one width, rich blocks ───────────── */
article.magazine { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 40px; }
article.magazine > * { max-width: var(--content-w); margin-left: auto; margin-right: auto; }
article.magazine .full { max-width: none; }         /* opt-out for a wide table/chart */
.summary { background: var(--brand-light); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); padding: 16px 20px; margin: 0 auto 26px; }
.summary strong { color: var(--brand-dark); }
.tip { background: var(--accent-light); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 14px 18px; margin: 22px auto; }
.tip::before { content: "💡 "; }

ul, ol { padding-left: 24px; margin: 0 auto 18px; }
li { margin: 6px 0; }
ul.checks { list-style: none; padding-left: 0; }
ul.checks li { padding-left: 28px; position: relative; }
ul.checks li::before { content: "✓"; color: var(--brand); font-weight: 800; position: absolute; left: 0; }

table { border-collapse: collapse; width: 100%; margin: 22px auto; font-size: 15px; }
table.full { max-width: none; }
th, td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
th { background: var(--bg-alt); font-weight: 700; }
tr:nth-child(even) td { background: var(--bg); }

figure.chart { margin: 26px auto; text-align: center; }
figure.chart svg { max-width: 100%; height: auto; }
figure.chart figcaption { color: var(--text-light); font-size: 13px; margin-top: 8px; }

blockquote { border-left: 4px solid var(--brand-border); margin: 22px auto; padding: 6px 20px; color: var(--text-muted); font-style: italic; }

/* ── FAQ ─────────────────────────────────────────────────────────────────── */
.faq { max-width: var(--content-w); margin: 30px auto; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 18px; margin-bottom: 10px; background: var(--surface); }
.faq summary { font-weight: 700; cursor: pointer; padding: 12px 0; }
.faq details[open] summary { color: var(--brand-dark); }

/* ── internal-link chips + inline contextual links ───────────────────────── */
.magazine a { color: var(--brand-dark); text-decoration: underline; text-decoration-color: var(--brand-border); text-underline-offset: 2px; }
.related { max-width: var(--content-w); margin: 34px auto 0; }
.related h3 { border-top: 1px solid var(--border); padding-top: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--brand-light); color: var(--brand-dark); border: 1px solid var(--brand-border); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; }
.chip:hover { background: var(--brand); color: #fff; text-decoration: none; }

/* ── buttons / breadcrumb ────────────────────────────────────────────────── */
.btn { display: inline-block; background: var(--brand); color: #fff; border-radius: var(--radius-sm); padding: 11px 20px; font-weight: 700; border: 0; cursor: pointer; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand-dark); border: 1px solid var(--brand-border); }
.crumb { color: var(--text-light); font-size: 14px; margin: 20px 0 4px; }
.crumb a { color: var(--text-muted); }

.section { padding: 44px 0; }
.section.alt { background: var(--bg-alt); }
.center { text-align: center; }
.mt0 { margin-top: 0; }

@media (max-width: 640px) {
  .hero h1 { font-size: 30px; }
  article.magazine { padding: 24px; }
  body { font-size: 16px; }
}
