/* ============================================================
   Stud — Construction Calculators
   Design tokens, base styles, components
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-subtle: #fafafa;
  --bg-muted: #f5f5f5;
  --fg: #0a0a0a;
  --fg-muted: #525252;
  --fg-subtle: #737373;
  --fg-faint: #a3a3a3;
  --border: #e7e7e7;
  --border-strong: #d4d4d4;
  --accent: #15803d;
  --accent-hover: #166534;
  --accent-fg: #ffffff;
  --accent-subtle: #f0fdf4;
  --accent-ring: rgba(21, 128, 61, 0.18);
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.04), 0 8px 24px -8px rgba(0,0,0,0.08);
  --grid-line: rgba(10, 10, 10, 0.04);
}

html[data-theme='dark'] {
  --bg: #0a0a0a;
  --bg-elev: #111111;
  --bg-subtle: #0f0f0f;
  --bg-muted: #161616;
  --fg: #fafafa;
  --fg-muted: #a3a3a3;
  --fg-subtle: #8a8a8a;
  --fg-faint: #525252;
  --border: #1f1f1f;
  --border-strong: #2a2a2a;
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --accent-fg: #052e16;
  --accent-subtle: #052e16;
  --accent-ring: rgba(34, 197, 94, 0.22);
  --danger: #f87171;
  --danger-bg: #1a0a0a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.3), 0 8px 24px -8px rgba(0,0,0,0.5);
  --grid-line: rgba(255, 255, 255, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
  transition: background-color 240ms ease, color 240ms ease;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: var(--accent-fg);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

input, textarea, select {
  font-family: inherit;
  color: inherit;
}

.mono {
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-feature-settings: 'tnum', 'zero';
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (min-width: 768px) {
  .container { padding: 0 40px; }
}

/* ============================================================
   Header
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 60px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  justify-self: start;
}

.brand-mark {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.brand-mark svg { display: block; }

.nav {
  display: none;
  align-items: center;
  gap: 4px;
  justify-self: center;
}
@media (min-width: 900px) {
  .nav { display: flex; }
}

.nav-link {
  font-size: 13.5px;
  color: var(--fg-muted);
  padding: 7px 12px;
  border-radius: 6px;
  font-weight: 450;
  transition: color 150ms ease, background-color 150ms ease;
}
.nav-link:hover { color: var(--fg); background: var(--bg-muted); }
.nav-link.active { color: var(--fg); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--fg-muted);
  transition: color 150ms ease, background-color 150ms ease;
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover { color: var(--fg); background: var(--bg-muted); }
.theme-toggle svg { transition: transform 320ms cubic-bezier(0.4, 0, 0.2, 1); }
.theme-toggle:hover svg { transform: rotate(20deg); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 7px;
  border: 1px solid transparent;
  transition: all 150ms ease;
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-ring);
}

.btn-primary {
  background: var(--fg);
  color: var(--bg);
}
.btn-primary:hover { background: color-mix(in srgb, var(--fg) 85%, var(--accent)); }

.btn-accent {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-accent:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elev);
  color: var(--fg);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-muted); }

.btn-ghost {
  color: var(--fg-muted);
}
.btn-ghost:hover { color: var(--fg); background: var(--bg-muted); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 14.5px; border-radius: 8px; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 96px 0 80px;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, black 30%, transparent 75%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 6px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-bottom: 28px;
  font-weight: 450;
  white-space: nowrap;
  max-width: 100%;
  box-shadow: var(--shadow-sm);
}
.hero-eyebrow .tag {
  background: var(--bg-muted);
  color: var(--fg);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.hero-title {
  font-size: clamp(40px, 7vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 0 0 22px;
  text-wrap: balance;
}
.hero-title em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--fg-muted);
  line-height: 1.55;
  max-width: 560px;
  margin: 0 auto 36px;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-runners {
  margin-top: 72px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px 48px;
  color: var(--fg-subtle);
  font-size: 13px;
}
.hero-runner {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.hero-runner-value {
  color: var(--fg);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

/* ============================================================
   Sections
   ============================================================ */
.section {
  padding: 80px 0;
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.section-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.section-title {
  font-size: clamp(28px, 3.5vw, 40px);
  letter-spacing: -0.028em;
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
  max-width: 640px;
  text-wrap: balance;
}

.section-desc {
  color: var(--fg-muted);
  max-width: 440px;
  font-size: 15px;
}

/* ============================================================
   Featured calculator grid
   ============================================================ */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

.calc-card {
  background: var(--bg-elev);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  text-align: left;
  width: 100%;
  overflow: hidden;
  --cat-accent: #8a96a3;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition:
    transform 220ms cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 220ms cubic-bezier(0.34, 1.2, 0.64, 1),
    border-color 180ms ease,
    background-color 180ms ease;
  will-change: transform;
}
.calc-card[data-cat="paint"]     { --cat-accent: #d18a6c; }
.calc-card[data-cat="concrete"]  { --cat-accent: #8a96a3; }
.calc-card[data-cat="drywall"]   { --cat-accent: #c3bdaf; }
.calc-card[data-cat="tile"]      { --cat-accent: #6f8aa3; }
.calc-card[data-cat="lumber"]    { --cat-accent: #b8855a; }
.calc-card[data-cat="roofing"]   { --cat-accent: #b06547; }
.calc-card[data-cat="landscape"] { --cat-accent: #7a9968; }

.calc-card-viz {
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  color: var(--fg);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--cat-accent) 6%, transparent),
    transparent 70%),
    var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  transition: background 220ms ease;
}
.calc-card-viz svg {
  width: 86%;
  height: 80%;
  display: block;
}
.calc-card-viz::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cat-accent);
  opacity: 0.55;
}

.calc-card-body {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.calc-card-cat {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cat-accent);
  margin: 0 0 2px;
}
.calc-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.calc-card:hover {
  background: var(--bg-elev);
  transform: translateY(-3px);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 12px 28px -10px color-mix(in srgb, var(--cat-accent) 35%, rgba(0,0,0,0.18));
  border-color: color-mix(in srgb, var(--cat-accent) 50%, var(--border));
}
.calc-card:active { transform: translateY(-1px); }
.calc-card:hover .calc-card-viz {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--cat-accent) 18%, transparent),
    transparent 70%),
    var(--bg-subtle);
}
.calc-card:hover .calc-card-arrow { opacity: 1; transform: translateX(0); }

.calc-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calc-card-icon-base {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-muted);
  display: grid;
  place-items: center;
  color: var(--fg);
}
.calc-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-muted);
  display: grid;
  place-items: center;
  color: var(--fg);
}

.calc-card-arrow {
  color: var(--fg-faint);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 180ms ease;
}

.calc-card-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}

.calc-card-desc {
  font-size: 13.5px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.55;
}

/* "Request" filler card so trailing empty grid cells become intentional */
.calc-card-cta {
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 24px 26px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  position: relative;
  transition: background 180ms ease;
  gap: 18px;
  min-height: 240px;
}
.calc-card-cta:hover { background: var(--bg-subtle); }
.calc-card-cta-mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--fg-muted);
  border: 1px dashed var(--border-strong, var(--fg-faint));
}
.calc-card-cta-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  line-height: 1.2;
}
.calc-card-cta-desc {
  font-size: 13.5px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.55;
}
.calc-card-cta-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.calc-card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--fg-subtle);
  margin-top: auto;
  padding-top: 6px;
}
.calc-card-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ============================================================
   Why-this section (feature cards)
   ============================================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 24px;
}
@media (min-width: 768px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }

.feature-card {
  padding: 28px 4px 0;
  border-top: 1px solid var(--fg);
  position: relative;
}
.feature-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  height: 1px;
  width: 24px;
  background: var(--accent);
}

.feature-card h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}

.feature-card p {
  color: var(--fg-muted);
  font-size: 14.5px;
  margin: 0;
  line-height: 1.6;
}

/* ============================================================
   Categories list
   ============================================================ */
.cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 12px;
}

.cat {
  background: var(--bg-elev);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition:
    transform 200ms cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 200ms cubic-bezier(0.34, 1.2, 0.64, 1),
    border-color 160ms ease,
    background-color 160ms ease;
  position: relative;
}
.cat:hover {
  background: var(--bg-elev);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px -10px rgba(0, 0, 0, 0.18);
  border-color: color-mix(in srgb, var(--fg) 30%, var(--border));
}
.cat:active { transform: translateY(0); }
.cat:hover .cat-count { color: var(--fg); }
.cat:hover .cat-title-icon { background: var(--fg); color: var(--bg); }
.cat-title-icon { transition: background-color 160ms ease, color 160ms ease; }
.cat-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cat-title-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--bg-muted);
  display: grid; place-items: center;
}
.cat-title-icon-dashed {
  background: transparent !important;
  border: 1px dashed var(--fg-faint);
  color: var(--fg-muted);
}
.cat-cta:hover .cat-title-icon-dashed { color: var(--fg); border-color: var(--fg-muted); }
.cat-count {
  font-size: 12.5px;
  color: var(--fg-subtle);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   Calculator page
   ============================================================ */
.calc-page {
  padding: 48px 0 96px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-subtle);
  margin-bottom: 32px;
  flex-wrap: wrap;
  row-gap: 2px;
}
.breadcrumb a, .breadcrumb-current { white-space: nowrap; }
.breadcrumb a { color: var(--fg-subtle); transition: color 150ms; }
.breadcrumb a:hover { color: var(--fg); }
.breadcrumb-sep { color: var(--fg-faint); }
.breadcrumb-current { color: var(--fg); font-weight: 500; }

.calc-hero {
  max-width: 720px;
  margin-bottom: 44px;
}
.calc-hero h1 {
  font-size: clamp(32px, 4.6vw, 48px);
  letter-spacing: -0.03em;
  font-weight: 600;
  line-height: 1.05;
  margin: 0 0 16px;
  text-wrap: balance;
}
.calc-hero p {
  font-size: 17px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.55;
}

/* The shell — main split layout */
.calc-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}
@media (min-width: 980px) {
  .calc-shell { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 32px; }
}

.calc-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elev);
  overflow: hidden;
}

.calc-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  gap: 12px;
  flex-wrap: wrap;
  row-gap: 10px;
}
.calc-panel-head h2 {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
}
.calc-panel-head h2 .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.calc-panel-body {
  padding: 28px 24px;
}

/* Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field + .field { margin-top: 20px; }

.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.005em;
}
.field-hint {
  font-size: 12px;
  color: var(--fg-subtle);
  font-weight: 400;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
  min-width: 0;
}
.input-wrap:hover { border-color: var(--border-strong); }
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input-wrap.error {
  border-color: var(--danger);
}

.input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  padding: 0 12px;
  width: 100%;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  min-width: 0;
  letter-spacing: -0.005em;
}
.input-wrap input::placeholder { color: var(--fg-faint); }

.input-suffix {
  display: flex;
  align-items: center;
  padding: 0 10px 0 6px;
  font-size: 12px;
  color: var(--fg-subtle);
  font-family: 'Geist Mono', ui-monospace, monospace;
  border-left: 1px solid var(--border);
  pointer-events: none;
  user-select: none;
}

.steppers {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  width: 22px;
  flex-shrink: 0;
}
.stepper {
  width: 100%;
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--fg-subtle);
  transition: background-color 100ms ease, color 100ms ease;
  font-size: 10px;
  border-radius: 0;
}
.stepper:first-child { border-top-right-radius: 7px; }
.stepper:last-child { border-bottom-right-radius: 7px; }
.stepper:hover { background: var(--bg-muted); color: var(--fg); }
.stepper + .stepper { border-top: 1px solid var(--border); }

.field-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 2px;
}

/* Pill / unit toggle */
.pill-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-muted);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  position: relative;
}
.pill-toggle button {
  position: relative;
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--fg-muted);
  transition: color 200ms ease;
  z-index: 1;
}
.pill-toggle button.active { color: var(--fg); }
.pill-thumb {
  position: absolute;
  background: var(--bg-elev);
  border-radius: 6px;
  top: 3px;
  bottom: 3px;
  box-shadow: var(--shadow-sm);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
  z-index: 0;
}

/* Slider */
.slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--fg);
  cursor: grab;
  transition: transform 120ms ease, box-shadow 120ms ease;
  border: 3px solid var(--bg-elev);
  box-shadow: 0 0 0 1px var(--border-strong);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.12); }
.slider::-webkit-slider-thumb:active { cursor: grabbing; }
.slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--fg);
  border: 3px solid var(--bg-elev);
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: grab;
}
.slider-value {
  width: 56px;
  text-align: right;
  font-size: 13px;
  font-family: 'Geist Mono', monospace;
  color: var(--fg);
}

/* Subsections inside calc */
.subsection {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px dashed var(--border);
}
.subsection-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin: 0 0 16px;
}

/* Result panel */
.result-panel {
  position: sticky;
  top: 80px;
}

.result-hero {
  padding: 32px 28px 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.result-hero-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  opacity: 0.5;
}

.result-label {
  position: relative;
  font-size: 12px;
  color: var(--fg-subtle);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.result-number-row {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.result-number {
  font-family: 'Geist Mono', monospace;
  font-size: clamp(48px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 500;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  display: inline-block;
}
@keyframes pulse-num {
  0%, 100% { color: var(--fg); }
  40% { color: var(--accent); }
}
.result-number.pulse { animation: pulse-num 480ms ease; }
.result-unit {
  font-family: 'Geist Mono', monospace;
  font-size: 18px;
  color: var(--fg-subtle);
  font-weight: 400;
}

.result-sub {
  position: relative;
  margin-top: 12px;
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 1.5;
}

.result-breakdown {
  padding: 18px 28px 24px;
}
.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 13.5px;
}
.breakdown-row + .breakdown-row {
  border-top: 1px solid var(--border);
}

.breakdown-value {
  font-family: 'Geist Mono', monospace;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
  text-align: right;
}
.breakdown-label {
  color: var(--fg-muted);
  flex: 1;
  padding-right: 12px;
}

.result-actions {
  display: flex;
  gap: 8px;
  padding: 14px 24px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}
.result-actions .btn { flex: 1; }

/* ============================================================
   How it works
   ============================================================ */
.calc-aside {
  margin-top: 64px;
  display: block;
}

.aside-block {
  max-width: 760px;
}
.aside-block h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 16px;
}
.aside-block > p {
  color: var(--fg-muted);
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 16px;
}

.formula-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  font-family: 'Geist Mono', monospace;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--fg);
  margin: 20px 0;
}
.formula-box .var { color: var(--accent); }
.formula-box .op { color: var(--fg-subtle); }
.formula-box .comment { color: var(--fg-subtle); font-style: italic; }

/* Related calcs */
.related {
  margin-top: 64px;
  padding-top: 48px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Category page
   ============================================================ */
.cat-page-hero {
  padding: 56px 0 32px;
  max-width: 760px;
}
.cat-page-hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: -0.03em;
  font-weight: 600;
  margin: 0 0 16px;
}
.cat-page-hero p {
  font-size: 17px;
  color: var(--fg-muted);
  line-height: 1.55;
  margin: 0;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 56px 0 32px;
  margin-top: 96px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (min-width: 768px) {
  .footer-inner { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px; }
}
.footer-brand { color: var(--fg-muted); font-size: 13.5px; max-width: 280px; line-height: 1.55; }
.footer-brand .brand { margin-bottom: 12px; color: var(--fg); }
.footer-col-title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin-bottom: 14px;
}
.footer-link {
  display: block;
  padding: 5px 0;
  font-size: 13.5px;
  color: var(--fg-muted);
  transition: color 150ms ease;
}
.footer-link:hover { color: var(--fg); }
.footer-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--fg-subtle);
}
.footer-bottom .mono { font-size: 11.5px; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up {
  /* Animation as a progressive enhancement — final state is the baseline */
  opacity: 1;
  transform: translateY(0);
  animation: fade-up 360ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Visual: paint swatch picker */
.swatch-row {
  display: flex;
  gap: 8px;
}
.swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 160ms ease;
  position: relative;
}
.swatch:hover { transform: scale(1.08); }
.swatch.active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg);
}

/* Visual: concrete shape selector */
.shape-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.shape-option {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-muted);
  transition: all 150ms ease;
}
.shape-option:hover { border-color: var(--border-strong); color: var(--fg); }
.shape-option.active {
  border-color: var(--fg);
  color: var(--fg);
  background: var(--bg-subtle);
}
.shape-option svg { color: var(--fg-muted); }
.shape-option.active svg { color: var(--fg); }

/* Drywall sheet selector */
.sheet-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sheet-option {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 150ms ease;
  text-align: left;
}
.sheet-option:hover { border-color: var(--border-strong); }
.sheet-option.active { border-color: var(--fg); background: var(--bg-subtle); }
.sheet-option-rect {
  width: 32px;
  height: 22px;
  border: 1.5px solid var(--fg-muted);
  border-radius: 2px;
  flex-shrink: 0;
}
.sheet-option.active .sheet-option-rect { border-color: var(--fg); }
.sheet-option-info { display: flex; flex-direction: column; gap: 2px; }
.sheet-option-title { font-size: 13px; font-weight: 500; }
.sheet-option-sub { font-size: 11.5px; color: var(--fg-subtle); }

/* Visual room preview */
.room-preview {
  position: relative;
  height: 140px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.room-preview-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 16px 16px;
}
.room-rect {
  position: relative;
  border: 1.5px solid var(--fg);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  transition: width 240ms cubic-bezier(0.4, 0, 0.2, 1), height 240ms cubic-bezier(0.4, 0, 0.2, 1);
}
.room-dim {
  position: absolute;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--bg-elev);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.room-dim.bottom { bottom: -10px; left: 50%; transform: translateX(-50%); }
.room-dim.right { right: -10px; top: 50%; transform: translateY(-50%) translateX(100%); }

/* Print */
@media print {
  .header, .footer, .result-actions, .calc-aside, .related, .breadcrumb { display: none !important; }
  .result-panel { position: static; }
  body { background: white; color: black; }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-md);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ----- Print -------------------------------------------------------------- */
@media print {
  html, body { background: #fff !important; color: #000 !important; }
  .header, .footer, .related, .calc-aside, .breadcrumb,
  .result-actions, .hero-cta, .toast, .calc-card-cta { display: none !important; }
  .calc-shell { display: block !important; }
  .calc-panel, .result-panel { break-inside: avoid; box-shadow: none !important; border: 1px solid #999 !important; }
  .calc-hero { margin-bottom: 12px; }
  .result-hero-bg, .room-preview-grid, .hero-grid { display: none !important; }
  .result-number { font-size: 36px !important; }
  a { color: #000 !important; text-decoration: none !important; }
  .formula-box { background: #f4f4f4 !important; }
}
