/* ==========================================================================
   Chisel & Stone — design system
   20 sections. Stone-grey ground, marble-white ink, patina-green accent.
   Hard right angles, chiselled header, cards that are clickable as a whole.
   No external font or asset requests: every family below resolves locally.
   ========================================================================== */

/* ---------------------------------------------- 1. Design tokens ---------- */
:root {
  /* stone grey */
  --stone-950: #0E0E11;
  --stone-900: #16161A;
  --stone-850: #202024;
  --stone-800: #2A2A2E;
  --stone-700: #3A3A40;
  --stone-600: #4A4A52;
  --stone-500: #5E5E68;
  --stone-400: #7A7A84;
  --stone-300: #9A9AA4;

  /* marble white */
  --marble-50: #F5F2EC;
  --marble-100: #E8E4DC;
  --marble-200: #D8D4CC;
  --marble-300: #C4C0B8;
  --marble-400: #A8A49C;
  --marble-500: #8A867E;
  --marble-600: #6E6A62;

  /* patina green */
  --patina-900: #1E3A32;
  --patina-800: #2E5A4C;
  --patina-500: #4A7A6A;
  --patina-400: #6A9A88;
  --patina-300: #8AB8A8;
  --patina-200: #B0D4C8;
  --patina-100: #D8E8E0;

  /* granite */
  --granite-800: #3A3028;
  --granite-600: #5A4A3C;
  --granite-400: #7A6A58;
  --granite-300: #9A8A78;
  --granite-200: #B8A898;
  --granite-100: #D8C8B8;

  /* terracotta */
  --terra-800: #7A3A2A;
  --terra-600: #A85A48;
  --terra-400: #C87A68;
  --terra-300: #E0A898;
  --terra-200: #F0C8B8;

  /* semantic */
  --danger: #C44A3A;
  --ok: #5A9A7A;
  --warn: #D4A040;
  --info: #5A7A98;

  /* text */
  --text: #E8E4DC;
  --text-2: #C4C0B8;
  --text-3: #8A867E;
  --text-inv: #2A2A2E;
  --link: #D8D4CC;
  --link-hover: #8AB8A8;
  --link-underline: #1E3A32;

  /* surfaces */
  --bg: #2A2A2E;
  --bg-deep: #16161A;
  --bg-card: #3A3A40;
  --bg-card-2: #43434A;
  --bg-inset: #202024;
  --bg-marble: #F5F2EC;

  /* borders */
  --border: #3A3A40;
  --border-2: #4A4A52;

  /* texture */
  --grain: rgba(232, 228, 220, .04);
  --chisel-mark: rgba(74, 122, 106, .06);

  /* radii */
  --r-0: 0px;
  --r-sm: 2px;
  --r-card: 12px;
  --r-pill: 999px;

  /* shadows */
  --sh-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-sm: 0 2px 8px rgba(0, 0, 0, .45);
  --sh-md: 0 8px 22px rgba(0, 0, 0, .5);
  --sh-lg: 0 18px 48px rgba(0, 0, 0, .6);
  --glow-patina: 0 0 16px rgba(74, 122, 106, .3);
  --glow-marble: 0 0 12px rgba(232, 228, 220, .2);

  /* transitions */
  --t-colour: .14s ease;
  --t-move: .28s ease;
  --t-chisel: .4s cubic-bezier(.34, 1.2, .64, 1);

  /* type */
  --font-display: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, Menlo, "Courier New", monospace;

  /* layout */
  --wrap: 1200px;
  --wrap-narrow: 820px;
  --wrap-wide: 1360px;
  --gutter: 22px;
  --header-h: 88px;   /* 36 brand + 52 chisel slot */
}

/* ------------------------------------------------------ 2. Reset / base --- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* §2 stone grain over the whole page, extremely faint */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  background-attachment: fixed;
  background-blend-mode: overlay;
}

img, svg, video, canvas { max-width: 100%; display: block; }
img { height: auto; }

a { color: var(--link); text-decoration: none; transition: color var(--t-colour); }
a:hover { color: var(--link-hover); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

hr { border: 0; border-top: 1px solid var(--border); margin: 34px 0; }

::selection { background: var(--patina-500); color: var(--marble-50); }

/* focus ring — §3 */
:focus-visible {
  outline: 2px solid var(--patina-500);
  outline-offset: 2px;
  box-shadow: 0 0 12px rgba(74, 122, 106, .35);
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 500;
  background: var(--patina-500); color: var(--marble-50);
  padding: 10px 18px; font-weight: 700;
}
.skip-link:focus { left: 12px; top: 12px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------ 3. Typography ----- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .02em;
  color: var(--text);
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
h3 { font-size: clamp(1.18rem, 2vw, 1.4rem); }
h4 { font-size: 1.08rem; }
h5 { font-size: .98rem; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

strong { color: var(--marble-50); font-weight: 700; }
em { color: var(--text-2); }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: .88em; }
code {
  background: var(--stone-850);
  border: 1px solid var(--border);
  padding: 1px 6px;
  color: var(--patina-300);
}
pre {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.6;
}
pre code { background: none; border: 0; padding: 0; }

.mono { font-family: var(--font-mono); }

/* eyebrow — §3 */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .72rem; font-weight: 800; letter-spacing: .18em;
  text-transform: uppercase; color: var(--patina-500);
  margin-bottom: 12px;
}
.eyebrow::before { content: "⛏"; font-size: .9em; letter-spacing: 0; }

.lede { font-size: 1.08rem; color: var(--text-2); max-width: 68ch; }
.section-head { margin-bottom: 30px; }
.section-head p { color: var(--text-2); max-width: 68ch; margin: 0; }
.section-head.center { text-align: center; }
.section-head.center p { margin-inline: auto; }

/* in-body links get a patina underline — §3 */
.prose a, .post-body a { color: var(--marble-200); text-decoration: underline; text-decoration-color: var(--patina-800); text-underline-offset: 3px; }
.prose a:hover, .post-body a:hover { color: var(--patina-300); text-decoration-color: var(--patina-500); }

/* ------------------------------------------------------ 4. Layout --------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: var(--wrap-narrow); }
.wrap-wide { max-width: var(--wrap-wide); }

main { padding-top: 100px; }        /* §4 clear the fixed header */
main.no-pad { padding-top: 0; }

.section { padding-block: 60px; }
.section-sm { padding-block: 38px; }
.section-tight { padding: 42px 0 60px; }
.section-deep { background: var(--bg-deep); }

.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--gutter); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { display: grid; gap: var(--gutter); grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.cluster { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cluster.center { justify-content: center; }
.stack > * + * { margin-top: 14px; }
.split-wide { display: grid; grid-template-columns: 380px 1fr; gap: 40px; align-items: start; }
.split-side { display: grid; grid-template-columns: 1fr 310px; gap: 44px; align-items: start; }
.split-even { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; align-items: start; }

/* ------------------------------------------------------ 5. Header --------- */
/* §5 the chiselled header: a brand strip, then a row of nav items cut into the
   stone as trapezoid slots with irregular chisel lines between them. */

.site-header { position: fixed; inset: 0 0 auto 0; z-index: 200; }

.brandbar {
  height: 36px; background: var(--stone-900);
  border-bottom: 1px solid var(--patina-900);
  display: flex; align-items: center; gap: 14px;
  padding-inline: var(--gutter); position: relative; z-index: 2;
  transition: transform var(--t-move), opacity var(--t-move);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 26px; height: 26px; border-radius: var(--r-pill);
  background: var(--patina-500); flex: 0 0 auto;
  display: grid; place-items: center;
}
.brand-mark svg { width: 15px; height: 15px; fill: none; stroke: var(--marble-50); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name { font-family: var(--font-display); font-size: 1.02rem; font-weight: 700; color: var(--marble-50); white-space: nowrap; letter-spacing: .01em; }
.brand-sub { font-size: .52rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--patina-500); white-space: nowrap; }
.brandbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--text-2);
  transition: background var(--t-colour), color var(--t-colour), border-color var(--t-colour);
}
.icon-btn:hover { background: var(--stone-800); color: var(--marble-50); border-color: var(--border-2); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.pill-link {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--patina-500); border-radius: var(--r-pill);
  padding: 5px 14px; font-size: .72rem; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--patina-300);
  transition: background var(--t-colour), color var(--t-colour);
  white-space: nowrap;
}
.pill-link:hover { background: var(--patina-500); color: var(--marble-50); }
.pill-link svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.9; }

.burger { display: none; }

/* --- the chisel slot row --- */
.chisel-nav {
  height: 52px; background: var(--stone-800);
  border-bottom: 1px solid var(--patina-900);
  display: flex; align-items: stretch; justify-content: center;
  position: relative; z-index: 1;
  transition: height var(--t-move);
  overflow: visible;
}
/* faint diagonal chisel marks across the whole slot row */
.chisel-nav::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(115deg, var(--chisel-mark) 0 1px, transparent 1px 26px);
}
.nav-item {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 0 26px; flex: 0 1 auto;
  font-size: .8rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-2);
  background: transparent;
  /* §5.2 the trapezoid slot: narrower at the top, wider at the base */
  clip-path: polygon(9% 0, 91% 0, 100% 100%, 0 100%);
  transition: background var(--t-colour), color var(--t-colour), transform var(--t-chisel);
  white-space: nowrap;
}
.nav-item:hover { background: var(--stone-600); color: var(--marble-50); }
/* the irregular chisel line separating two slots */
.nav-item::after {
  content: ""; position: absolute; right: -1px; top: 18%; bottom: 12%;
  width: 1px; background: var(--border);
  transform: skewX(-7deg);
  transition: background var(--t-colour), box-shadow var(--t-colour);
}
.nav-item:last-child::after { display: none; }
.nav-item:hover::after { background: var(--stone-500); }
/* active slot is driven deeper into the stone */
.nav-item.is-active {
  background: var(--patina-500); color: var(--marble-50);
  transform: translateY(2px);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, .5), var(--glow-patina);
}
.nav-item.is-active::after { background: var(--patina-500); box-shadow: var(--glow-patina); }

/* dropdown */
.nav-drop { position: relative; display: flex; }
.dd {
  position: absolute; top: calc(100% + 1px); left: 0; min-width: 268px;
  background: var(--stone-700); border-radius: var(--r-card);
  border: 1px solid var(--border-2); border-top: 2px solid var(--patina-500);
  box-shadow: var(--sh-lg); padding: 8px; z-index: 30;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--t-colour), transform var(--t-colour), visibility var(--t-colour);
}
.nav-drop:hover .dd, .nav-drop:focus-within .dd, .dd.is-open { opacity: 1; visibility: visible; transform: none; }
.dd a {
  display: block; padding: 9px 12px; border-radius: var(--r-sm);
  font-size: .84rem; color: var(--text-2); transition: background var(--t-colour), color var(--t-colour);
}
.dd a:hover { background: var(--stone-600); color: var(--marble-50); }
.dd a strong { display: block; font-weight: 600; color: inherit; font-size: .86rem; }
.dd-desc { display: block; font-size: .74rem; color: var(--text-3); font-weight: 400; }
.dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dd-all { color: var(--patina-300) !important; font-weight: 700; }

/* scrolled state: brand strip retracts, slot row pins to the top and tightens */
body.is-scrolled .brandbar { transform: translateY(-100%); opacity: 0; pointer-events: none; }
body.is-scrolled .chisel-nav { height: 46px; }
.site-header.is-condensed .chisel-nav { position: fixed; top: 0; left: 0; right: 0; }

/* mobile drawer */
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(340px, 88vw);
  background: var(--stone-850); border-left: 1px solid var(--border-2);
  z-index: 300; transform: translateX(102%);
  transition: transform var(--t-move);
  display: flex; flex-direction: column; overflow-y: auto;
  padding: 18px 0 30px;
}
.drawer.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 18px 16px; border-bottom: 1px solid var(--border); }
.drawer-nav { display: flex; flex-direction: column; gap: 6px; padding: 16px 12px; }
/* vertical chisel slots keep the trapezoid idea in the drawer */
.drawer-nav > a, .drawer-group > summary {
  display: block; padding: 13px 18px; color: var(--text-2);
  font-size: .84rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, 97% 100%, 3% 100%);
  background: var(--stone-800); transition: background var(--t-colour), color var(--t-colour);
}
.drawer-nav > a:hover, .drawer-group > summary:hover { background: var(--stone-600); color: var(--marble-50); }
.drawer-nav > a.is-active { background: var(--patina-500); color: var(--marble-50); }
.drawer-group > summary { cursor: pointer; list-style: none; }
.drawer-group > summary::-webkit-details-marker { display: none; }
.drawer-sub { display: flex; flex-direction: column; padding: 4px 0 4px 14px; }
.drawer-sub a { padding: 9px 14px; font-size: .82rem; color: var(--text-2); border-left: 2px solid var(--border); }
.drawer-sub a:hover { color: var(--marble-50); border-left-color: var(--patina-500); }
.scrim {
  position: fixed; inset: 0; background: rgba(14, 14, 17, .72);
  z-index: 250; opacity: 0; visibility: hidden; transition: opacity var(--t-move), visibility var(--t-move);
}
.scrim.is-open { opacity: 1; visibility: visible; }

/* ------------------------------------------------------ 6. Hero ----------- */
.hero {
  position: relative; height: 460px; overflow: hidden;
  background: var(--stone-900);
}
.hero-slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity .7s ease;
}
.hero-slide.is-active { opacity: 1; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, #16161A 0%, rgba(42, 42, 46, .9) 46%, rgba(74, 122, 106, .12) 100%);
}
.hero-inner {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center;
}
.hero-copy { max-width: 640px; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(74, 122, 106, .18); border: 1px solid var(--patina-800);
  border-radius: var(--r-pill); padding: 5px 14px; margin-bottom: 18px;
  font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--patina-200);
}
.hero h1 { font-size: clamp(1.95rem, 4.2vw, 2.9rem); margin-bottom: 14px; }
.hero p { color: var(--text-2); font-size: 1.04rem; max-width: 54ch; margin-bottom: 24px; }
.hero-dots { position: absolute; left: var(--gutter); bottom: 22px; z-index: 3; display: flex; gap: 8px; }
.hero-dot {
  width: 28px; height: 4px; border: 0; padding: 0; background: var(--stone-500);
  transition: width var(--t-move), background var(--t-colour), box-shadow var(--t-colour);
}
.hero-dot.is-active { width: 44px; background: var(--patina-500); box-shadow: var(--glow-patina); }
.hero-arrows { position: absolute; right: var(--gutter); bottom: 18px; z-index: 3; display: flex; gap: 8px; }
.hero-arrow {
  width: 36px; height: 36px; border-radius: var(--r-pill);
  border: 1px solid var(--border-2); background: rgba(22, 22, 26, .7); color: var(--text-2);
  display: grid; place-items: center; transition: background var(--t-colour), color var(--t-colour), border-color var(--t-colour);
}
.hero-arrow:hover { background: var(--patina-500); color: var(--marble-50); border-color: var(--patina-500); }
.hero-arrow svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ------------------------------------------------- 6b. Search panel ------ */
.search-panel {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 180;
  background: var(--stone-850); border-bottom: 2px solid var(--patina-500);
  box-shadow: var(--sh-lg); padding: 18px 0 22px;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity var(--t-colour), transform var(--t-colour), visibility var(--t-colour);
}
.search-panel.is-open { opacity: 1; visibility: visible; transform: none; }
.search-panel input[type="search"] {
  width: 100%; background: var(--bg-deep); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: 12px 14px; color: var(--text);
  font-family: var(--font-mono); font-size: .9rem;
}
.search-panel input[type="search"]:focus { border-color: var(--patina-500); outline: none; box-shadow: var(--glow-patina); }
.search-panel .search-results { margin-top: 14px; max-height: 60vh; overflow-y: auto; }
.search-panel .search-hit { background: var(--bg-card); }
.search-panel .search-hit h3 { font-size: .94rem; margin: 4px 0 3px; }
.search-panel .search-hit p { font-size: .82rem; }
.search-panel .mono-sm { padding: 6px 2px; }

/* ------------------------------------------------- 6c. Trust strip ------- */
.trust-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gutter);
  background: var(--bg-deep); border: 1px solid var(--border-2);
  border-radius: var(--r-card); padding: 22px;
}
.trust-item { display: flex; flex-direction: column; gap: 6px; }
.trust-icon { width: 34px; height: 34px; border-radius: var(--r-pill); background: var(--patina-900); border: 1px solid var(--patina-800); display: grid; place-items: center; margin-bottom: 4px; }
.trust-icon svg { width: 17px; height: 17px; fill: none; stroke: var(--patina-300); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.trust-item h3 { font-size: .98rem; margin: 0; }
.trust-item p { font-size: .84rem; color: var(--text-2); margin: 0; }

/* ------------------------------------------------- 6d. Process steps ----- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gutter); }
.steps .step { margin: 0; }
.step-link {
  display: flex; flex-direction: column; height: 100%; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border-2);
  border-radius: var(--r-card); padding: 14px; color: var(--text);
  transition: transform var(--t-move), box-shadow var(--t-move), border-color var(--t-colour);
}
.step-link:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); border-color: var(--patina-500); color: var(--text); }
.step-media { position: relative; background: var(--stone-850); border-radius: var(--r-sm); overflow: hidden; aspect-ratio: 16 / 10; }
.step-media img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.step-num {
  position: absolute; top: 8px; left: 8px; width: 32px; height: 32px;
  border-radius: var(--r-pill); background: var(--patina-500); color: var(--marble-50);
  display: grid; place-items: center; font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  box-shadow: var(--sh-sm);
}
.step-tag { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; color: var(--patina-300); text-transform: uppercase; }
.step-link h3 { font-size: 1rem; margin: 0; }
.step-link p { font-size: .84rem; color: var(--text-2); margin: 0; }

/* blog step list reuses the numbered circle */
.steps-list { margin: 24px 0; }

/* ------------------------------------------------------ 7. Page hero ------ */
.page-hero {
  background: var(--stone-900); border-bottom: 3px solid var(--patina-500);
  padding: 44px 0 40px; position: relative;
}
.page-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(115deg, var(--chisel-mark) 0 1px, transparent 1px 22px);
}
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 16px;
}
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--patina-300); }
.crumbs span[aria-hidden] { color: var(--stone-500); }
.page-hero h1 { margin-bottom: 12px; }
.page-hero .lede { margin: 0; }

/* ------------------------------------------------------ 8. Cards ---------- */
/* §0.1 every card is an <a> wrapping the whole thing. The hit area is the whole
   card including padding, hover lifts the whole card, and nothing inside is
   independently focusable. */

.card {
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--r-card);
  box-shadow: var(--sh-sm);
  overflow: hidden; position: relative;
  color: var(--text);
  cursor: pointer;
  transition: transform var(--t-move), box-shadow var(--t-move), border-color var(--t-colour);
}
.card::before {
  /* chisel-mark edge along the top of the card */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: repeating-linear-gradient(90deg, var(--patina-500) 0 14px, transparent 14px 26px);
  opacity: .5;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-lg);
  border-color: var(--patina-500);
  color: var(--text);
}
.card:focus-visible { outline: 2px solid var(--patina-500); outline-offset: 2px; box-shadow: var(--sh-lg), var(--glow-patina); }
.card:active { transform: translateY(-1px); }

/* §0.1 overlay shape: used where a card must also contain a genuine outbound
   citation link. The overlay covers the whole card, so the entire surface is
   still one click target, and the citation sits above it on the z-axis. */
.card-overlay { position: absolute; inset: 0; z-index: 1; }
.card-overlay:focus-visible { outline: 2px solid var(--patina-500); outline-offset: 2px; }
.card-ext { position: relative; z-index: 2; }
.card:focus-within { outline: 2px solid var(--patina-500); outline-offset: 2px; box-shadow: var(--sh-lg), var(--glow-patina); }
.card-media { position: relative; aspect-ratio: 16 / 10; background: var(--stone-850); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: 10px; transition: transform var(--t-move); }
.card:hover .card-media img { transform: scale(1.04); }
.card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-title { font-family: var(--font-display); font-size: 1.06rem; font-weight: 700; margin: 0; line-height: 1.25; }
.card-desc { font-size: .88rem; color: var(--text-2); margin: 0; }
.card-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: .72rem; color: var(--text-3);
}
.card-arrow { color: var(--patina-500); font-size: 1rem; transition: transform var(--t-colour); }
.card:hover .card-arrow { transform: translateX(4px); }

/* variants */
.cat-card .cat-icon {
  width: 48px; height: 48px; border-radius: var(--r-pill);
  background: var(--patina-900); border: 1px solid var(--patina-800);
  display: grid; place-items: center; margin-bottom: 4px;
  background-image: repeating-linear-gradient(115deg, var(--chisel-mark) 0 1px, transparent 1px 7px);
}
.cat-card .cat-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--patina-300); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cat-count { font-family: var(--font-mono); font-size: .72rem; color: var(--patina-300); }

.tool-card .card-media { background: var(--stone-850); }

.blog-card .card-media { aspect-ratio: 16 / 9; }
.blog-meta { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--font-mono); font-size: .68rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }

.calc-card .card-media { aspect-ratio: 16 / 10; }

.studio-card { background: var(--stone-900); }
.studio-card::before { background: repeating-linear-gradient(90deg, var(--patina-400) 0 20px, transparent 20px 34px); opacity: .8; }
.studio-card:hover { box-shadow: var(--sh-lg), var(--glow-patina); }

.qa-card, .quote-card {
  border-left: 3px solid var(--patina-500);
}
.qa-card .card-body, .quote-card .card-body { gap: 12px; }
.qa-tag {
  align-self: flex-start; font-family: var(--font-mono); font-size: .64rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--patina-300);
  background: var(--patina-900); border: 1px solid var(--patina-800);
  border-radius: var(--r-pill); padding: 3px 10px;
}
.qa-q { font-style: italic; color: var(--marble-100); margin: 0; font-size: .94rem; line-height: 1.55; }
.qa-src { font-family: var(--font-mono); font-size: .68rem; color: var(--text-3); }
.qa-a { font-size: .88rem; color: var(--text-2); margin: 0; padding-left: 22px; position: relative; }
.qa-a::before { content: "✅"; position: absolute; left: 0; font-size: .8rem; }

.quote-mark { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; color: var(--patina-800); margin: 0; }
.quote-text { font-size: .96rem; color: var(--marble-100); font-style: italic; margin: 0; line-height: 1.6; }

.stone-card .card-media { aspect-ratio: 4 / 3; }

/* whole-row link used inside tables */
.row-link { color: inherit; text-decoration: none; }
.row-link:hover { color: inherit; }

/* ------------------------------------------------------ 9. Badges / tags -- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--patina-900); color: var(--patina-200); border: 1px solid var(--patina-800);
  white-space: nowrap;
}
.tag-marble { background: var(--stone-850); color: var(--marble-200); border-color: var(--border-2); }
.tag-granite { background: var(--granite-800); color: var(--granite-200); border-color: var(--granite-600); }
.tag-terra { background: var(--terra-800); color: var(--terra-200); border-color: var(--terra-600); }
.tag-outline { background: transparent; color: var(--text-2); border-color: var(--border-2); }
.tag-warn { background: #2E2410; color: #F5D870; border-color: #8A6A10; }
.tag-danger { background: #2E1414; color: #E8A098; border-color: #7A3A2A; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--border-2); background: var(--stone-850);
  font-size: .78rem; font-weight: 600; color: var(--text-2);
  transition: background var(--t-colour), color var(--t-colour), border-color var(--t-colour);
}
.chip:hover { border-color: var(--patina-500); color: var(--marble-50); }
.chip.is-active { background: var(--patina-500); color: var(--marble-50); border-color: var(--patina-500); }

.param-badge {
  display: inline-block; font-family: var(--font-mono); font-size: .78rem;
  background: var(--stone-850); border: 1px solid var(--patina-800);
  color: var(--patina-200); padding: 2px 9px; border-radius: var(--r-sm);
}
.badge-3d {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--patina-500); color: var(--marble-50);
  border-radius: var(--r-pill); padding: 3px 11px;
  font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.badge-3d svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; }

.stone-badge { font-size: .68rem; font-weight: 700; padding: 2px 9px; border-radius: var(--r-pill); border: 1px solid; }
.sb-marble { color: #E8E4DC; border-color: #7A7A84; background: #2A2A2E; }
.sb-granite { color: var(--granite-200); border-color: var(--granite-600); background: var(--granite-800); }
.sb-limestone { color: #E8DCC4; border-color: #8A7A58; background: #2E2A1E; }
.sb-sandstone { color: #E0C0A0; border-color: #8A5A38; background: #2E1E14; }
.sb-alabaster { color: var(--patina-100); border-color: var(--patina-800); background: var(--patina-900); }
.sb-soapstone { color: var(--stone-300); border-color: var(--stone-600); background: var(--stone-850); }

.mohs-badge { font-family: var(--font-mono); font-size: .7rem; padding: 2px 8px; border-radius: var(--r-sm); font-weight: 700; color: var(--stone-950); }

/* ------------------------------------------------------ 10. Indicators ---- */
.hardness-indicator, .dust-indicator, .stability-indicator, .webgl-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em;
  padding: 4px 11px; border-radius: var(--r-sm); border: 1px solid var(--border-2);
  background: var(--stone-850); color: var(--text-2);
}
.hardness-indicator::before, .dust-indicator::before, .stability-indicator::before {
  content: ""; width: 9px; height: 9px; border-radius: var(--r-pill); background: currentColor;
}
.hardness-indicator[data-level="1"] { color: #8AB8A8; }
.hardness-indicator[data-level="2"] { color: #A8C4A0; }
.hardness-indicator[data-level="3"] { color: #D4C878; }
.hardness-indicator[data-level="4"] { color: #D4A040; }
.hardness-indicator[data-level="5"] { color: #C44A3A; }
.dust-indicator[data-level="LOW"] { color: var(--ok); }
.dust-indicator[data-level="MEDIUM"] { color: var(--warn); }
.dust-indicator[data-level="HIGH"] { color: var(--danger); }
.stability-indicator[data-level="STABLE"] { color: var(--ok); }
.stability-indicator[data-level="GRAIN RISK"] { color: var(--warn); }
.stability-indicator[data-level="CRACK RISK"] { color: var(--danger); }

.webgl-status { gap: 9px; }
.webgl-status::before { content: ""; width: 9px; height: 9px; border-radius: var(--r-pill); background: currentColor; box-shadow: 0 0 8px currentColor; }
.webgl-status[data-state="loading"] { color: var(--text-3); }
.webgl-status[data-state="ready"] { color: var(--ok); }
.webgl-status[data-state="fallback"] { color: var(--warn); }
.webgl-status[data-state="error"] { color: var(--danger); }

/* ------------------------------------------------------ 11. Notices ------- */
.notice { border-radius: var(--r-sm); padding: 14px 18px; border: 1px solid; margin-block: 18px; font-size: .9rem; }
.notice strong { display: block; margin-bottom: 4px; }
.notice-safety { background: #2E1E18; border-color: var(--terra-800); color: var(--terra-300); }
.notice-safety strong { color: var(--terra-200); }
.notice-info { background: #152030; border-color: #3A5A78; color: #A8C4D9; }
.notice-info strong { color: #C8DCEC; }
.notice-warn { background: #2E2410; border-color: #8A6A10; color: #F5D870; }
.notice-warn strong { color: #FBE8A0; }
.notice-neutral { background: var(--bg-card); border-color: var(--border-2); color: var(--text-2); }

.tip-box { border-left: 4px solid var(--patina-500); background: var(--stone-850); padding: 14px 18px; margin-block: 20px; font-size: .92rem; color: var(--text-2); }
.tip-box strong { display: block; color: var(--patina-300); margin-bottom: 3px; font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; }
.tip-box.warn { border-left-color: var(--terra-600); }
.tip-box.warn strong { color: var(--terra-300); }
.tip-box.note { border-left-color: var(--info); }
.tip-box.note strong { color: #A8C4D9; }
.tip-box.ok { border-left-color: var(--ok); }
.tip-box.ok strong { color: #8AB8A8; }

.legal-note {
  background: var(--stone-850); border-left: 4px solid var(--patina-500);
  padding: 14px 18px; margin-top: 28px;
  font-family: var(--font-mono); font-size: .84rem; line-height: 1.7; color: var(--text-2);
}

.safety-strip {
  background: #2E1E18; border-bottom: 1px solid var(--terra-800);
  padding: 9px 0; font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .1em; color: var(--terra-300); text-transform: uppercase;
}
.safety-strip .wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.safety-strip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: 0 0 auto; }
.safety-strip strong { color: var(--terra-200); }

.empty-state { border: 1px dashed var(--border-2); padding: 44px 24px; text-align: center; color: var(--text-3); border-radius: var(--r-card); }

/* ------------------------------------------------------ 12. Buttons ------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-pill);
  font-size: .9rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid transparent; cursor: pointer; text-align: center;
  transition: background var(--t-colour), color var(--t-colour), border-color var(--t-colour), box-shadow var(--t-colour), transform var(--t-colour);
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--patina-500); color: var(--marble-50); }
.btn-primary:hover { background: var(--patina-400); color: var(--marble-50); box-shadow: var(--glow-patina); }
.btn-marble { background: var(--marble-100); color: var(--stone-800); }
.btn-marble:hover { background: var(--marble-50); color: var(--stone-900); }
.btn-outline { background: var(--stone-800); color: var(--patina-300); border-color: var(--patina-500); }
.btn-outline:hover { background: var(--patina-900); color: var(--patina-100); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--stone-700); color: var(--marble-50); }
.btn-danger { background: var(--terra-800); color: #FBEAE4; }
.btn-danger:hover { background: var(--terra-600); }
.btn-sm { padding: 7px 14px; font-size: .76rem; }
.btn-lg { padding: 14px 28px; font-size: .96rem; }
.btn-block { width: 100%; }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.btn-chisel svg { transition: transform var(--t-chisel); }
.btn-chisel:hover svg { transform: rotate(-14deg) translateY(-1px); }

/* ------------------------------------------------------ 13. Forms --------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .f-label {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
}
.field input, .field select, .field textarea {
  background: var(--bg-deep); border: 1px solid var(--border-2); border-radius: var(--r-sm);
  padding: 10px 12px; color: var(--text); width: 100%;
  transition: border-color var(--t-colour), box-shadow var(--t-colour);
  font-family: var(--font-mono); font-size: .88rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--patina-500); outline: none; box-shadow: var(--glow-patina);
}
.field textarea { min-height: 120px; resize: vertical; font-family: var(--font-body); }
.field-hint { font-size: .76rem; color: var(--text-3); }
.field-error { font-size: .78rem; color: var(--terra-300); min-height: 1.2em; }
.field.is-invalid input, .field.is-invalid select, .field.is-invalid textarea { border-color: var(--terra-600); }

.form-card { background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--r-card); padding: 26px; }

/* range slider */
.range-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.range-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.range-head label { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.range-val { font-family: var(--font-mono); font-size: .84rem; color: var(--patina-300); font-weight: 700; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  background: var(--stone-600); border-radius: var(--r-pill); outline: none; margin: 8px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
  border-radius: var(--r-pill); background: var(--patina-500); cursor: pointer;
  border: 2px solid var(--marble-100); box-shadow: var(--sh-sm);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: var(--r-pill); background: var(--patina-500);
  cursor: pointer; border: 2px solid var(--marble-100);
}
input[type="range"]:focus-visible { box-shadow: var(--glow-patina); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--bg-deep); border: 1px solid var(--border-2); border-radius: var(--r-pill); padding: 4px; }
.seg button {
  border: 0; background: transparent; color: var(--text-2);
  padding: 6px 14px; border-radius: var(--r-pill); font-size: .76rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; transition: background var(--t-colour), color var(--t-colour);
}
.seg button:hover { color: var(--marble-50); }
.seg button.is-active { background: var(--patina-500); color: var(--marble-50); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.switch-row span { font-size: .86rem; color: var(--text-2); }
.switch { position: relative; width: 44px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; background: var(--stone-600); border-radius: var(--r-pill); transition: background var(--t-colour); pointer-events: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: var(--r-pill); background: var(--marble-200); transition: transform var(--t-move); }
.switch input:checked + .switch-track { background: var(--patina-500); }
.switch input:checked + .switch-track::after { transform: translateX(20px); background: var(--marble-50); }
.switch input:focus-visible + .switch-track { box-shadow: var(--glow-patina); }

/* ------------------------------------------------------ 14. Tables -------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-2); border-radius: var(--r-card); background: var(--bg-card); }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 640px; }
table.data thead th {
  background: var(--patina-900); color: var(--patina-200);
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--patina-800); white-space: nowrap;
}
table.data tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background var(--t-colour); }
table.data tbody tr:hover { background: var(--stone-850); }
table.data td strong { color: var(--marble-100); }
table.data .src { font-family: var(--font-mono); font-size: .74rem; }
table.data .src a { color: var(--text-3); text-decoration: underline; text-underline-offset: 2px; }
table.data .src a:hover { color: var(--patina-300); }

.spec-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.spec-table th, .spec-table td { padding: 9px 0; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.spec-table th { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; color: var(--text-3); text-transform: uppercase; font-weight: 600; width: 44%; padding-right: 14px; }
.spec-table td { color: var(--marble-100); font-family: var(--font-mono); font-size: .8rem; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------ 15. Filters ------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--r-card);
  padding: 14px 16px; margin-bottom: 26px;
}
.filter-bar input[type="search"], .filter-bar input[type="text"] {
  flex: 1 1 220px; background: var(--bg-deep); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: 9px 12px; font-family: var(--font-mono); font-size: .84rem; color: var(--text);
}
.filter-bar select {
  background: var(--bg-deep); border: 1px solid var(--border-2); border-radius: var(--r-sm);
  padding: 9px 12px; font-family: var(--font-mono); font-size: .8rem; color: var(--text-2);
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--patina-500); outline: none; }
.filter-count { font-family: var(--font-mono); font-size: .76rem; color: var(--text-3); white-space: nowrap; margin-left: auto; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }

.pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 34px; }
.pagination button, .pagination a {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); background: var(--bg-card); color: var(--text-2);
  font-family: var(--font-mono); font-size: .84rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t-colour), color var(--t-colour), border-color var(--t-colour);
}
.pagination button:hover, .pagination a:hover { border-color: var(--patina-500); color: var(--marble-50); }
.pagination .is-active { background: var(--patina-500); color: var(--marble-50); border-color: var(--patina-500); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ------------------------------------------------------ 16. Calculator ---- */
.calc-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; align-items: start; }
.calc-panel { background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--r-card); padding: 24px; }
.calc-result {
  background: var(--stone-900); border: 1px solid var(--border-2); border-radius: var(--r-card);
  padding: 26px; position: relative; overflow: hidden;
}
.calc-result::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(115deg, var(--chisel-mark) 0 1px, transparent 1px 18px);
}
.calc-hero-value {
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.2rem); line-height: 1;
  color: var(--patina-300); text-shadow: 0 0 22px rgba(74, 122, 106, .4);
  position: relative;
}
.calc-hero-unit { font-family: var(--font-mono); font-size: .82rem; color: var(--text-3); letter-spacing: .1em; text-transform: uppercase; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; position: relative; }
.calc-cell { background: var(--stone-850); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; }
.calc-cell .cc-label { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.calc-cell .cc-value { font-family: var(--font-mono); font-size: 1.06rem; color: var(--marble-100); font-weight: 700; }
.calc-formula { font-family: var(--font-mono); font-size: .76rem; color: var(--text-3); margin-top: 18px; line-height: 1.7; position: relative; }
.gauge { height: 8px; background: var(--stone-700); border-radius: var(--r-pill); overflow: hidden; margin-top: 8px; }
.gauge-fill { height: 100%; width: 0; background: var(--patina-500); transition: width var(--t-move), background var(--t-colour); }
.gauge-fill.is-over { background: var(--danger); }
.gauge-fill.is-good { background: var(--ok); }

/* ------------------------------------------------------ 17. Studio -------- */
.studio-shell { background: var(--bg-deep); border: 1px solid var(--border-2); border-radius: var(--r-card); overflow: hidden; }
.studio-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--stone-850);
}
.studio-toolbar .spacer { flex: 1; }
.studio-body { display: grid; grid-template-columns: 1fr 330px; min-height: 520px; }
.studio-stage { position: relative; background: #101013; min-height: 520px; }
.studio-stage canvas { width: 100%; height: 100%; display: block; }
.studio-panel { border-left: 1px solid var(--border); padding: 18px; overflow-y: auto; max-height: 720px; background: var(--stone-850); }
.studio-panel h4 { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--patina-300); font-family: var(--font-mono); margin: 20px 0 10px; }
.studio-panel h4:first-child { margin-top: 0; }
.studio-hint {
  padding: 10px 16px; border-top: 1px solid var(--border); background: var(--stone-900);
  font-family: var(--font-mono); font-size: .72rem; color: var(--text-3); letter-spacing: .05em;
}

.studio-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(16, 16, 19, .9); z-index: 5; padding: 24px; text-align: center;
  transition: opacity var(--t-move), visibility var(--t-move);
}
.studio-overlay.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.so-inner { max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.so-inner .ico { width: 34px; height: 34px; fill: none; stroke: var(--patina-400); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.so-inner h3 { margin: 0; font-size: 1.1rem; }
.so-inner p { color: var(--text-2); font-size: .88rem; margin: 0; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--stone-600); border-top-color: var(--patina-500); border-radius: var(--r-pill); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.studio-fallback { display: none; padding: 20px; }
.studio-fallback.is-on { display: block; }
.fb-inner { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.fb-inner h3 { margin: 0; font-size: 1rem; }
.fb-inner p { font-size: .86rem; color: var(--text-2); margin: 0; }
.fb-inner svg { width: 100%; height: auto; background: var(--stone-850); border: 1px solid var(--border); border-radius: var(--r-sm); }

.readout { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.readout-cell { background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; }
.readout-cell.wide { grid-column: 1 / -1; }
.ro-label { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.ro-value { font-family: var(--font-mono); font-size: 1rem; color: var(--patina-300); font-weight: 700; }

.step-track { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.step-chip {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 11px; border-radius: var(--r-pill); border: 1px solid var(--border-2);
  background: var(--bg-deep); color: var(--text-3);
}
.step-chip.is-done { border-color: var(--patina-800); color: var(--patina-400); }
.step-chip.is-active { background: var(--patina-500); color: var(--marble-50); border-color: var(--patina-500); }

.studio-grid { display: grid; gap: var(--gutter); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ------------------------------------------------------ 18. Blog ---------- */
.featured-post {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0;
  background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--r-card);
  overflow: hidden; margin-bottom: 34px; color: var(--text);
  transition: border-color var(--t-colour), box-shadow var(--t-move), transform var(--t-move);
}
.featured-post:hover { border-color: var(--patina-500); box-shadow: var(--sh-lg); transform: translateY(-3px); color: var(--text); }
.featured-post .fp-media { background: var(--stone-850); min-height: 280px; }
.featured-post .fp-media img { width: 100%; height: 100%; object-fit: contain; padding: 22px; }
.featured-post .fp-body { padding: 30px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }

.post-hero { background: var(--stone-900); border-bottom: 3px solid var(--patina-500); padding: 40px 0 34px; }
.post-hero .wrap { position: relative; }
.post-hero h1 { max-width: 22ch; }
.post-meta { display: flex; flex-wrap: wrap; gap: 14px; font-family: var(--font-mono); font-size: .72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; margin-top: 14px; }

.post-body h2 { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--border); }
.post-body h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.post-body h3 { margin-top: 30px; }
.post-body ul, .post-body ol { color: var(--text-2); padding-left: 22px; margin: 0 0 1.2em; }
.post-body li { margin-bottom: 8px; }
.post-body li::marker { color: var(--patina-500); }
.post-body blockquote {
  margin: 26px 0; padding: 18px 22px; background: var(--stone-850);
  border-left: 4px solid var(--patina-500); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.post-body blockquote p { font-style: italic; color: var(--marble-100); margin-bottom: 8px; }
.post-body blockquote footer { font-family: var(--font-mono); font-size: .74rem; color: var(--text-3); }
.post-body blockquote cite { font-style: normal; }
.post-body blockquote cite a { color: var(--text-3); text-decoration: underline; text-underline-offset: 2px; }
.post-body blockquote cite a:hover { color: var(--patina-300); }

.step-block { display: flex; gap: 16px; margin-bottom: 20px; align-items: flex-start; }
.step-num {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: var(--r-pill);
  background: var(--patina-900); border: 1px solid var(--patina-800); color: var(--patina-200);
  display: grid; place-items: center; font-family: var(--font-display); font-size: 1.16rem; font-weight: 700;
}
.step-block h4 { margin: 0 0 4px; }
.step-block p { margin: 0; color: var(--text-2); font-size: .92rem; }

.toc {
  background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--r-card);
  padding: 18px 20px; position: sticky; top: calc(var(--header-h) + 18px);
}
.toc h4 { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--patina-300); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: 9px; }
.toc a { font-size: .84rem; color: var(--text-2); display: block; padding-left: 24px; position: relative; }
.toc a::before { content: counter(toc, decimal-leading-zero); position: absolute; left: 0; font-family: var(--font-mono); font-size: .7rem; color: var(--text-3); }
.toc a:hover, .toc a.is-current { color: var(--patina-300); }

.author-box { background: var(--stone-850); border: 1px solid var(--border); border-radius: var(--r-card); padding: 18px 20px; margin-top: 34px; }
.author-box p { font-size: .88rem; color: var(--text-2); margin: 0; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 34px; }
.post-nav a { background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--r-card); padding: 16px 18px; color: var(--text); transition: border-color var(--t-colour), transform var(--t-move); }
.post-nav a:hover { border-color: var(--patina-500); transform: translateY(-3px); color: var(--text); }
.post-nav .pn-label { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); display: block; margin-bottom: 5px; }
.post-nav .pn-title { font-family: var(--font-display); font-weight: 700; font-size: .98rem; }
.post-nav .pn-next { text-align: right; }

.read-progress { position: fixed; top: 0; left: 0; height: 2px; background: var(--patina-500); width: 0; z-index: 400; box-shadow: var(--glow-patina); }
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 150;
  width: 44px; height: 44px; border-radius: var(--r-pill);
  background: var(--patina-500); color: var(--marble-50); border: 0;
  display: grid; place-items: center; box-shadow: var(--sh-md);
  opacity: 0; visibility: hidden; transition: opacity var(--t-move), visibility var(--t-move), background var(--t-colour);
}
.to-top.is-on { opacity: 1; visibility: visible; }
.to-top:hover { background: var(--patina-400); }
.to-top svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }

/* ------------------------------------------------------ 19. Footer -------- */
.site-footer { background: var(--stone-900); border-top: 1px solid var(--border); margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 34px; padding: 48px 0 34px; }
.footer-col h4 { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--patina-300); margin: 0 0 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 9px; }
.footer-col a { font-size: .86rem; color: var(--text-2); }
.footer-col a:hover { color: var(--patina-300); }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.footer-brand .brand-mark { width: 30px; height: 30px; }
.footer-brand .brand-name { font-size: 1.1rem; }
.footer-note { font-size: .84rem; color: var(--text-3); max-width: 40ch; }
.footer-icons { display: flex; gap: 10px; margin-top: 16px; }
.footer-icons a {
  width: 34px; height: 34px; border-radius: var(--r-pill); border: 1px solid var(--border-2);
  display: grid; place-items: center; color: var(--text-3);
  transition: border-color var(--t-colour), color var(--t-colour);
}
.footer-icons a:hover { border-color: var(--patina-500); color: var(--patina-300); }
.footer-icons svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.footer-ver { font-family: var(--font-mono); font-size: .7rem; color: var(--text-3); margin-top: 14px; }

.subscribe { display: flex; gap: 8px; margin-top: 12px; }
.subscribe input { flex: 1; background: var(--bg-deep); border: 1px solid var(--border-2); border-radius: var(--r-sm); padding: 9px 12px; color: var(--text); font-size: .84rem; font-family: var(--font-mono); }
.subscribe input:focus { border-color: var(--patina-500); outline: none; }

.footer-safety {
  border: 1px solid var(--patina-800); border-left: 4px solid var(--patina-500);
  background: rgba(30, 58, 50, .28); border-radius: var(--r-sm);
  padding: 16px 20px; display: flex; gap: 14px; align-items: flex-start; margin-bottom: 26px;
}
.footer-safety svg { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: var(--patina-300); stroke-width: 1.7; margin-top: 2px; }
.footer-safety h4 { margin: 0 0 5px; font-size: .92rem; color: var(--patina-200); }
.footer-safety p { margin: 0; font-size: .82rem; color: var(--text-2); }

.footer-bottom {
  border-top: 1px solid var(--border); padding: 18px 0 26px;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  font-size: .78rem; color: var(--text-3);
}
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-bottom a { color: var(--text-3); }
.footer-bottom a:hover { color: var(--patina-300); }
.silica-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--patina-800); border-radius: var(--r-pill);
  padding: 4px 12px; font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .1em; color: var(--patina-300); text-transform: uppercase;
}

/* ------------------------------------------------------ 20. Utilities ----- */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; } .mt-3 { margin-top: 34px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 20px; } .mb-3 { margin-bottom: 34px; }
.text-2 { color: var(--text-2); } .text-3 { color: var(--text-3); } .text-patina { color: var(--patina-300); }
.center { text-align: center; }
.mono-sm { font-family: var(--font-mono); font-size: .76rem; color: var(--text-3); }
.divider { height: 1px; background: var(--border); margin: 34px 0; }
.cta-band {
  background: var(--patina-800); border-radius: var(--r-card); padding: 40px;
  position: relative; overflow: hidden; text-align: center;
}
.cta-band::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(115deg, rgba(232, 228, 220, .05) 0 1px, transparent 1px 20px);
}
.cta-band h2 { position: relative; color: var(--marble-50); }
.cta-band p { position: relative; color: var(--patina-100); max-width: 56ch; margin-inline: auto; }
.cta-band .cluster { position: relative; justify-content: center; margin-top: 22px; }

/* gallery for tool detail pages */
.gallery-main { background: var(--stone-850); border: 1px solid var(--border-2); border-radius: var(--r-card); aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; position: relative; }
.gallery-main::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: repeating-linear-gradient(90deg, var(--patina-500) 0 12px, transparent 12px 22px); opacity: .6; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; padding: 24px; }
.gallery-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.gallery-thumb { background: var(--stone-850); border: 1px solid var(--border); border-radius: var(--r-sm); aspect-ratio: 1; display: grid; place-items: center; cursor: pointer; padding: 0; transition: border-color var(--t-colour); }
.gallery-thumb:hover, .gallery-thumb.is-active { border-color: var(--patina-500); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }

.panel { background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--r-card); padding: 22px; }
.panel h3 { margin-top: 0; }

.stage-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--stone-850); border: 1px solid var(--border-2); border-radius: var(--r-pill);
  padding: 4px 12px; font-family: var(--font-mono); font-size: .7rem; color: var(--text-2);
  letter-spacing: .06em; text-transform: uppercase;
}
.stage-pill::before { content: ""; width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--patina-500); }

/* search page */
.search-results { display: flex; flex-direction: column; gap: 12px; }
.search-hit { display: block; background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--r-card); padding: 16px 18px; color: var(--text); transition: border-color var(--t-colour), transform var(--t-move); }
.search-hit:hover { border-color: var(--patina-500); transform: translateX(4px); color: var(--text); }
.search-hit .sh-kind { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--patina-300); }
.search-hit h3 { margin: 5px 0 5px; font-size: 1rem; }
.search-hit p { margin: 0; font-size: .86rem; color: var(--text-2); }

/* compare tray on the database page */
.compare-tray {
  position: sticky; bottom: 0; z-index: 60;
  background: var(--stone-900); border: 1px solid var(--border-2); border-radius: var(--r-card);
  padding: 12px 16px; margin-top: 20px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; box-shadow: var(--sh-md);
}
.compare-tray .ct-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ct-item { display: inline-flex; align-items: center; gap: 8px; background: var(--stone-850); border: 1px solid var(--border-2); border-radius: var(--r-pill); padding: 4px 12px; font-size: .78rem; }
.ct-item button { border: 0; background: transparent; color: var(--text-3); font-size: 1rem; line-height: 1; padding: 0; }
.ct-item button:hover { color: var(--terra-300); }

/* --------------------------------------------- 21. Responsive ------------ */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .split-wide { grid-template-columns: 320px 1fr; gap: 28px; }
  .studio-body { grid-template-columns: 1fr 290px; }
  .trust-strip { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1000px) {
  .nav-item { padding: 0 18px; font-size: .76rem; }
  .split-side { grid-template-columns: 1fr; }
  .toc { position: static; margin-bottom: 26px; }
}
@media (max-width: 900px) {
  :root { --header-h: 36px; }
  .chisel-nav { display: none; }
  .burger { display: grid; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .split-wide { grid-template-columns: 1fr; }
  .split-even { grid-template-columns: 1fr; }
  .calc-layout { grid-template-columns: 1fr; }
  .featured-post { grid-template-columns: 1fr; }
  .featured-post .fp-media { min-height: 200px; }
  .studio-body { grid-template-columns: 1fr; }
  .studio-panel { border-left: 0; border-top: 1px solid var(--border); max-height: none; }
  .studio-stage { min-height: 380px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .pn-next { text-align: left; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 15px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .trust-strip, .steps { grid-template-columns: 1fr; }
  /* On a narrow screen the stacked hero copy is taller than 460px, so a fixed
     height either clips the second CTA or lets it collide with the dots and
     arrows. Let the hero grow to fit the copy and reserve a bottom strip for
     the controls; 460px stays as the minimum. */
  .hero { height: auto; min-height: 460px; }
  .hero-inner { position: relative; inset: auto; align-items: flex-start; padding: 26px 0 108px; }
  .hero-copy { max-width: none; }
  .hero-kicker { margin-bottom: 14px; }
  .hero h1 { font-size: clamp(1.7rem, 7.8vw, 2.1rem); margin-bottom: 12px; }
  .hero p { font-size: .96rem; margin-bottom: 16px; }
  .hero-dots { bottom: 34px; }
  .hero-arrows { bottom: 28px; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .calc-grid, .readout { grid-template-columns: 1fr; }
  .gallery-thumbs { grid-template-columns: repeat(2, 1fr); }
  .section { padding-block: 42px; }
  .cta-band { padding: 28px 20px; }
  .filter-count { margin-left: 0; width: 100%; }
  .to-top { right: 14px; bottom: 14px; }
}

/* --------------------------------------------- 22. Motion / print -------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .card:hover { transform: none; }
  .card:hover .card-media img { transform: none; }
  .hero-slide { transition: none; }
  .spinner { animation: none; border-top-color: var(--patina-500); }
}

@media print {
  .site-header, .drawer, .scrim, .to-top, .read-progress, .hero-arrows, .hero-dots, .site-footer { display: none !important; }
  body { background: #fff; color: #111; }
  main { padding-top: 0; }
  a { color: #111; text-decoration: underline; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}
