/* Abe Unlimited
   Layout: a long single column of chapters, each with a narrow label rail on the left and content on the right; collapses to one column on phones.
   Motif: the strip of amorphous silicon cells on a pocket calculator, used as a divider and brand mark.
   Type: Archivo (condensed) for display, IBM Plex Sans for reading, IBM Plex Mono for figures. Shared with the Mars-PVGIS tool so the site and tool read as one family. */

:root {
  --paper: #f1f3f5;
  --surface: #ffffff;
  --ink: #131922;
  --ink-2: #485365;
  --muted: #7a8494;
  --rule: #d8dde5;
  --band: #e6eaef;
  --cell: #4b2b33;        /* amorphous silicon, reddish brown */
  --cell-line: #6e4550;
  --sun: #e09a12;         /* sunlight gold, for marks and fills */
  --sun-ink: #8f5a00;     /* gold dark enough to read as text on paper */
  --mars: #b9471f;
  --mars-ink: #9a3713;
  --accent: var(--sun);
  --accent-ink: var(--sun-ink);
  --deep: #121a26;        /* dark band background, same in both themes */
  --deep-ink: #eef1f5;
  --deep-ink-2: #a8b3c3;
  --deep-rule: #2a3546;
  --focus: #2a78d6;
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1180px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e131b; --surface: #161d28; --ink: #eef1f5; --ink-2: #b0bac8; --muted: #808a9a;
    --rule: #263042; --band: #131a24; --cell: #6a3c47; --cell-line: #8a5864;
    --sun: #f2ab2a; --sun-ink: #f4bb52; --mars: #e2693c; --mars-ink: #ef8a62;
    --deep: #0a0f16; --deep-rule: #222c3b; --focus: #6da7ec;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e131b; --surface: #161d28; --ink: #eef1f5; --ink-2: #b0bac8; --muted: #808a9a;
  --rule: #263042; --band: #131a24; --cell: #6a3c47; --cell-line: #8a5864;
  --sun: #f2ab2a; --sun-ink: #f4bb52; --mars: #e2693c; --mars-ink: #ef8a62;
  --deep: #0a0f16; --deep-rule: #222c3b; --focus: #6da7ec;
  color-scheme: dark;
}
body.mars { --accent: var(--mars); --accent-ink: var(--mars-ink); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg, iframe { max-width: 100%; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-stretch: 75%; text-wrap: balance; margin: 0; line-height: 1.02; }
h1 { font-weight: 800; font-size: clamp(2.8rem, 8vw, 6rem); letter-spacing: -0.015em; }
h2 { font-weight: 800; font-size: clamp(2rem, 4.6vw, 3.3rem); letter-spacing: -0.01em; }
h3 { font-weight: 600; font-size: 1.4rem; letter-spacing: 0.005em; line-height: 1.15; }
.mono { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--font-data); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); display: block;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
.prose { max-width: 64ch; display: grid; gap: 1.05em; color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.lede { font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.55; color: var(--ink-2); max-width: 58ch; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 28px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-name { font-family: var(--font-display); font-stretch: 75%; font-weight: 800; font-size: 1.45rem; letter-spacing: 0.01em; line-height: 1; }
.brand-name span { color: var(--accent-ink); }
.nav { display: flex; gap: 4px 20px; flex-wrap: wrap; font-size: 0.95rem; }
.nav a { color: var(--ink-2); text-decoration: none; padding-block: 4px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.nav a.nav-cta { color: var(--ink); font-weight: 600; }

/* ---------- the calculator cell strip, the brand motif ---------- */
.cells { display: inline-flex; gap: 2px; padding: 2px; background: #2a2a2e; border-radius: 2px; flex: none; }
.cells i {
  display: block; width: 9px; height: 14px; background: var(--cell);
  background-image: repeating-linear-gradient(90deg, transparent 0 2px, var(--cell-line) 2px 2.6px);
}
.cells.lg i { width: 30px; height: 44px; background-image: repeating-linear-gradient(90deg, transparent 0 5px, var(--cell-line) 5px 6px); }
.strip-rule { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.strip-rule::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* ---------- chapters ---------- */
.chapter { padding-block: clamp(64px, 10vw, 120px); border-top: 1px solid var(--rule); }
.chapter-grid { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 28px clamp(24px, 5vw, 72px); }
.chapter-grid > * { min-width: 0; }
.rail { display: grid; align-content: start; gap: 10px; }
.rail .eyebrow { color: var(--accent-ink); }
@media (max-width: 760px) { .chapter-grid { grid-template-columns: minmax(0, 1fr); } }

.btns { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 10px 20px;
  font-family: var(--font-body); font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--ink); color: var(--paper); background: var(--ink); border-radius: 0;
}
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent-ink); color: var(--accent-ink); background: transparent; }
.btn .arr { font-family: var(--font-data); }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--rule); padding-block: 40px 56px; color: var(--muted); font-size: 0.9rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 40px; align-items: center; }
.site-foot a { color: var(--ink-2); }
