/* ==========================================================================
   Victorian Hot Water Database — Design System
   Signature element: the "rating plate" card — styled after the physical
   nameplate riveted to every hot water unit, listing model/serial/specs.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@600;700;800&family=Public+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* ---- Light theme (default) ---- */
  --bg: #EEF1F0;
  --bg-raised: #F6F8F7;
  --surface: #FFFFFF;
  --surface-alt: #E4E9E8;
  --plate: #E9EDEC;
  --ink: #16232B;
  --ink-muted: #5B6A70;
  --ink-faint: #8B9A9F;
  --primary: #1B4B66;
  --primary-ink: #FFFFFF;
  --accent: #C1712F;
  --accent-ink: #FFFFFF;
  --success: #3F7D5C;
  --success-bg: #E1EFE7;
  --danger: #A8412F;
  --danger-bg: #F5E4E0;
  --border: #D3D8D6;
  --border-strong: #B7BFBD;
  --shadow: 0 1px 2px rgba(20, 30, 35, 0.06), 0 4px 12px rgba(20, 30, 35, 0.06);
  --shadow-lg: 0 8px 24px rgba(20, 30, 35, 0.12), 0 2px 6px rgba(20, 30, 35, 0.08);
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;

  --font-display: 'Big Shoulders Display', sans-serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;
}

[data-theme="dark"] {
  --bg: #10161A;
  --bg-raised: #161E23;
  --surface: #1B2328;
  --surface-alt: #222B30;
  --plate: #1F2A2E;
  --ink: #E7ECEE;
  --ink-muted: #93A3AA;
  --ink-faint: #647177;
  --primary: #5FA3C7;
  --primary-ink: #0C1418;
  --accent: #E0985A;
  --accent-ink: #1A1006;
  --success: #6BB894;
  --success-bg: #16261F;
  --danger: #D97F6B;
  --danger-bg: #2B1A16;
  --border: #2C363B;
  --border-strong: #3B474D;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  transition: background-color .2s ease, color .2s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.05;
  margin: 0 0 .4em;
  text-transform: uppercase;
}
h1 { font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; color: var(--ink-muted); }

.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------- Header / Nav ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header__bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  max-width: 1320px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: .01em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand__mark {
  width: 34px; height: 34px;
  border-radius: 7px;
  background: var(--primary);
  color: var(--primary-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: .95rem;
}
.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}
.main-nav a {
  text-decoration: none;
  color: var(--ink-muted);
  font-size: .92rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.main-nav a:hover { color: var(--ink); background: var(--surface-alt); }
.main-nav a.is-active { color: var(--primary); background: var(--surface-alt); }

.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--border-strong); }

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  cursor: pointer;
}

@media (max-width: 880px) {
  .main-nav { display: none; width: 100%; order: 3; }
  .main-nav.is-open { display: flex; flex-direction: column; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 10px; }
  .site-header__bar { flex-wrap: wrap; }
  .nav-toggle { display: flex; }
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700;
  font-size: .88rem;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { box-shadow: var(--shadow); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { box-shadow: var(--shadow); }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn-outline:hover { background: var(--surface-alt); }
.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------------- Hero ---------------- */
.hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(180deg, var(--bg-raised), var(--bg));
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 40px;
  align-items: center;
}
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; } }
.hero__title { max-width: 620px; }
.hero__title .accent-underline {
  background: linear-gradient(transparent 62%, var(--accent) 62%);
}
.hero__sub { max-width: 520px; font-size: 1.05rem; }
.hero__stats {
  display: flex; gap: 28px; margin-top: 22px; flex-wrap: wrap;
}
.hero__stat .n {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--primary);
  display: block;
}
.hero__stat .l {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
}

/* Signature: the rating plate, used decoratively in the hero */
.rating-plate {
  background: var(--plate);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  position: relative;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-mono);
}
.rating-plate::before, .rating-plate::after,
.rating-plate .rivet-tl, .rating-plate .rivet-tr, .rating-plate .rivet-bl, .rating-plate .rivet-br {
  content: "";
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.25), 0 1px 0 rgba(255,255,255,.15);
}
.rating-plate .rivet-tl { top: 10px; left: 10px; }
.rating-plate .rivet-tr { top: 10px; right: 10px; }
.rating-plate .rivet-bl { bottom: 10px; left: 10px; }
.rating-plate .rivet-br { bottom: 10px; right: 10px; }
.rating-plate__head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 10px; margin-bottom: 10px;
}
.rating-plate__head .model {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.15rem; text-transform: uppercase; color: var(--ink);
}
.rating-plate__head .tag {
  font-size: .68rem; color: var(--accent); text-transform: uppercase; letter-spacing: .08em;
}
.rating-plate__rows { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: .78rem; }
.rating-plate__rows div { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--border); padding-bottom: 3px; color: var(--ink-muted); }
.rating-plate__rows div b { color: var(--ink); font-weight: 600; }

/* ---------------- Sections ---------------- */
.section { padding: 48px 0; }
.section--tight { padding: 28px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head h2 { margin-bottom: 0; }

/* ---------------- Search bar ---------------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow);
}
.search-bar svg { flex-shrink: 0; color: var(--ink-faint); }
.search-bar input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--font-body); font-size: 1rem; color: var(--ink); padding: 10px 0;
}
.search-bar input::placeholder { color: var(--ink-faint); }

/* ---------------- Filter chips / quick filters ---------------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--ink); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* ---------------- Grid layout for browse/search pages ---------------- */
.browse-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 880px) { .browse-layout { grid-template-columns: 1fr; } }

.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: 84px;
}
.filter-group { margin-bottom: 20px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group h4 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .08em;
  color: var(--ink-faint);
  margin: 0 0 10px;
  font-weight: 600;
}
.filter-option {
  display: flex; align-items: center; gap: 8px;
  font-size: .88rem; color: var(--ink-muted);
  padding: 5px 0; cursor: pointer;
}
.filter-option input { accent-color: var(--primary); }
.filter-option:hover { color: var(--ink); }
.filter-count { margin-left: auto; font-family: var(--font-mono); font-size: .74rem; color: var(--ink-faint); }
.range-row { display: flex; gap: 8px; align-items: center; }
.range-row input[type=number] {
  width: 100%; padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font-family: var(--font-mono); font-size: .82rem;
}

/* ---------------- Product Card ---------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
  text-decoration: none;
  color: inherit;
}
.product-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-strong); }
.product-card__media {
  aspect-ratio: 4/3;
  background: var(--surface-alt);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
  position: relative;
}
.product-card__badge {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--font-mono);
  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
  background: var(--primary); color: var(--primary-ink);
  padding: 4px 8px; border-radius: 4px;
}
.product-card__badge.tech-heat_pump { background: #3F7D5C; }
.product-card__badge.tech-electric_storage { background: #1B4B66; }
.product-card__badge.tech-gas_storage { background: #A8412F; }
.product-card__badge.tech-continuous_flow { background: #7A4FB0; }
.product-card__badge.tech-solar { background: #C1712F; }
.product-card__verified {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--font-mono); font-size: .64rem;
  background: var(--success-bg); color: var(--success);
  padding: 4px 7px; border-radius: 4px; letter-spacing: .04em;
}
.product-card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card__mfr { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); font-weight: 600; }
.product-card__model { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; text-transform: uppercase; }
.product-card__specs {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px;
  font-family: var(--font-mono); font-size: .76rem; color: var(--ink-muted);
}
.product-card__specs b { color: var(--ink); font-weight: 600; }
.product-card__footer {
  margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border);
}
.icon-badges { display: flex; gap: 6px; }
.icon-badge {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-alt); color: var(--ink-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700;
}
.icon-badge.on { background: var(--success-bg); color: var(--success); }

/* ---------------- Section dividers/labels ---------------- */
.hairline { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---------------- Badges / Pills ---------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.pill--yes { background: var(--success-bg); color: var(--success); }
.pill--no { background: var(--surface-alt); color: var(--ink-faint); }
.pill--discontinued { background: var(--danger-bg); color: var(--danger); }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 32px;
  margin-top: 40px;
  background: var(--bg-raised);
}
.site-footer .container { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .site-footer .container { grid-template-columns: 1fr 1fr; } }
.site-footer h5 { font-family: var(--font-mono); text-transform: uppercase; font-size: .72rem; letter-spacing: .08em; color: var(--ink-faint); margin: 0 0 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { text-decoration: none; color: var(--ink-muted); font-size: .86rem; }
.site-footer a:hover { color: var(--primary); }
.footer-note { grid-column: 1/-1; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--ink-faint); }

/* ---------------- Utility ---------------- */
.text-center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-muted); }
.empty-state svg { color: var(--ink-faint); margin-bottom: 12px; }
.skeleton { background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 37%, var(--surface-alt) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: var(--surface-alt); color: var(--ink-muted); font-size: .78rem; padding: 5px 10px; border-radius: var(--radius-sm); }

table.spec-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.spec-table th, table.spec-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.spec-table th { width: 40%; color: var(--ink-faint); font-weight: 600; font-family: var(--font-mono); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
table.spec-table td { font-family: var(--font-mono); }

.badge-note {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .74rem; color: var(--ink-faint);
  background: var(--surface-alt); padding: 4px 10px; border-radius: 999px;
}

/* Toast for compare add/remove */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: var(--radius);
  font-size: .86rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* Compare bar */
.compare-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border-strong);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  padding: 12px 24px; z-index: 45;
  transform: translateY(100%); transition: transform .2s ease;
}
.compare-bar.is-visible { transform: translateY(0); }
.compare-bar__inner { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.compare-bar__slots { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.compare-slot { display: flex; align-items: center; gap: 6px; background: var(--surface-alt); padding: 6px 10px; border-radius: var(--radius-sm); font-size: .8rem; }
.compare-slot button { border: none; background: none; color: var(--ink-faint); cursor: pointer; font-size: 1rem; line-height: 1; }
