:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #090f1d;
  --ink-2: #1e293b;
  --muted: #475569;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: #ecfdf5;
  --accent-ring: rgba(16, 185, 129, 0.2);
  --p1: #0b1528;
  --p2: #0f233d;
  --p3: #082f2a;
  --hi: #10b981;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px 0 rgba(9, 15, 29, 0.06), 0 1px 2px -1px rgba(9, 15, 29, 0.06);
  --shadow-md: 0 10px 30px -8px rgba(9, 15, 29, 0.08), 0 4px 12px -4px rgba(9, 15, 29, 0.04);
  --shadow-lg: 0 20px 40px -15px rgba(9, 15, 29, 0.14);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060d1a;
    --surface: #0c182b;
    --surface-2: #13233d;
    --ink: #f8fafc;
    --ink-2: #cbd5e1;
    --muted: #94a3b8;
    --line: #1e293b;
    --line-strong: #263859;
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-soft: rgba(16, 185, 129, 0.12);
    --accent-ring: rgba(16, 185, 129, 0.25);
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

h1, h2, h3, h4 {
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "tnum";
  margin-top: 0;
}

h1 {
  font-size: clamp(1.85rem, 3.2vw, 2.65rem);
  font-weight: 800;
  margin-bottom: 0.65rem;
}

h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.12rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 150ms ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Site Header, Unique Hex-Shield Logo & Navigation */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 1.18rem;
  color: var(--ink);
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: var(--ink);
}

.brand svg {
  flex-shrink: 0;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.brand:hover svg {
  transform: scale(1.05);
}

.brand-tld {
  color: var(--accent);
  font-weight: 700;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-2);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.main-nav a svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.85;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Hero Section */
.hero {
  padding: 36px 0 24px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.lead {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 780px;
  margin: 0 0 16px;
}

/* Two-Column Calculator Split Card */
.calc-shell {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 36px;
}

.calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-2);
}

.field input,
.field select,
.hub-search-input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--ink);
  background: #ffffff;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.field input:hover,
.field select:hover,
.hub-search-input:hover {
  background: #f8fafc;
  border-color: var(--muted);
}

.field input:focus,
.field select:focus,
.hub-search-input:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .field input,
  .field select,
  .hub-search-input {
    background: #0c182b;
    border-color: #263859;
    color: #f8fafc;
  }
  .field input:hover,
  .field select:hover,
  .hub-search-input:hover {
    background: #102038;
    border-color: #3b537e;
  }
  .field input:focus,
  .field select:focus,
  .hub-search-input:focus {
    background: #0c182b;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  }
}

.fieldset-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 0;
  background: var(--surface);
}

.fieldset-box legend {
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0 8px;
  color: var(--ink);
}

/* Output Results Panel */
#results {
  background: linear-gradient(155deg, var(--p1) 0%, var(--p2) 55%, var(--p3) 100%);
  color: #f8fafc;
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#results dl {
  margin: 0;
}

#results dl.first {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

#results dl.first dt {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 6px;
}

#results dl.first dd:first-of-type {
  margin: 0;
  font-size: clamp(2.1rem, 3.6vw, 2.85rem);
  font-weight: 800;
  color: #34d399;
  text-shadow: none;
  letter-spacing: -0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "tnum" 1, "zero" 1;
  display: inline-block;
  transform-origin: left center;
  transition: transform 150ms cubic-bezier(0.22, 1, 0.36, 1), color 150ms ease;
}

#results dl.first dd:first-of-type.pulse {
  transform: scale(1.02);
}

#results dl.rest {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  align-items: baseline;
}

#results dl.rest dt {
  font-size: 0.9rem;
  color: #cbd5e1;
}

#results dl.rest dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

.calc-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.calc-actions button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 150ms ease;
}

button#copy {
  background: var(--accent);
  color: #ffffff;
  border: none;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

button#copy:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

button#copy.copied,
button#copy[data-copied="1"] {
  background: #10b981;
  color: #ffffff;
  transform: scale(1.03);
}

button#reset {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

button#reset:hover {
  background: rgba(255, 255, 255, 0.14);
}

#calc-note {
  margin-top: 16px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #cbd5e1;
}

#calc-error {
  display: none;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Explainer Diagnostic Breakdown */
#explainer-details {
  margin: 28px 0;
}

.explainer-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.explainer-table,
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.explainer-table th,
.explainer-table td,
table th,
table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

.explainer-table th,
table th {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--ink);
}

.explainer-table tr.total-row td {
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--ink);
}

.reason-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.reason-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.reason-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.badge-fact {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-estimate {
  background: var(--surface-2);
  color: var(--ink-2);
}

/* Interactive Hub Directory Search & Filter Bar */
.hub-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.hub-search-wrap {
  flex: 1 1 280px;
  max-width: 420px;
}

.hub-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hub-filter-btn {
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 150ms ease;
}

.hub-filter-btn:hover,
.hub-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Cards, Bespoke Duotone SVG Icon Containers & Grids */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin: 20px 0 36px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14) 0%, rgba(11, 21, 40, 0.06) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

.card h3 {
  margin: 0;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.content-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
  content-visibility: auto;
  contain-intrinsic-size: 1px 420px;
}

/* On-Page SEO FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 14px 18px;
}

.faq-item summary {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

/* Off-Page SEO Citation & Embed Widget Box */
.embed-cite-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 16px;
}

.embed-code {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px;
  resize: vertical;
}

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 16px 0 0;
}

/* Global 4-Column Footer & YMYL Disclaimer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 48px 0 32px;
  margin-top: 56px;
  font-size: 0.88rem;
  color: var(--muted);
  content-visibility: auto;
  contain-intrinsic-size: 1px 340px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  margin-bottom: 28px;
}

.footer-col h4 {
  font-size: 0.92rem;
  margin-bottom: 12px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-col h4 svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ymyl-disclaimer {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-weight: 500;
  margin-bottom: 16px;
}

.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

@media (max-width: 860px) {
  .calc-shell {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: 0 16px;
  }
  .calc-shell,
  .content-section,
  #results {
    padding: 16px;
  }
  .calc-actions {
    flex-direction: column;
  }
  .calc-actions button {
    width: 100%;
    min-height: 44px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
