/* Flood Protection Finder — base + components. Tokens live in tokens.css.
   Pages keep the prototype's inline layout styles; the classes below provide
   components (buttons, badges, inputs, cards) and mobile overrides. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--navy-900); font-family: var(--font-body); color: var(--text-primary); -webkit-font-smoothing: antialiased; font: var(--text-body-md); }
a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--text-link-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--white); color: var(--navy-900); padding: 10px 16px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 12px; }

/* ── Page frame ─────────────────────────────────── */
.frame { background: var(--navy-900); padding: 12px; min-height: 100vh; display: flex; flex-direction: column; }
.site-header { background: var(--navy-800); border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: 24px clamp(20px, 4vw, 48px) 48px; color: var(--white); }
.site-main { background: var(--white); border-radius: 0 0 var(--radius-xl) var(--radius-xl); padding: 64px clamp(20px, 4vw, 48px) 96px; }
.site-main.rounded { border-radius: var(--radius-xl); }

/* ── Nav ─────────────────────────────────────────── */
.nav { display: flex; justify-content: space-between; align-items: center; gap: 24px; font-family: var(--font-body); }
.nav-brand { font: var(--text-display-sm); color: var(--white); white-space: nowrap; text-decoration: none; }
.nav-brand:hover { color: var(--white); text-decoration: none; }
.nav-left { display: flex; flex-direction: column; gap: 14px; }
.nav-links { display: flex; gap: 28px; flex-wrap: wrap; font: var(--text-label-lg); letter-spacing: var(--tracking-nav); }
.nav-links a { color: var(--white); text-underline-offset: 6px; }
.nav-links a.active { color: var(--blue-300); text-decoration: underline; }
.nav-right { display: flex; justify-content: flex-end; align-items: center; gap: 20px; font: var(--text-label-lg); }
.nav-right a.signin { color: var(--blue-200); }
.nav-toggle { display: none; background: transparent; border: 1px solid var(--border-on-inverse); color: var(--white); border-radius: var(--radius-sm); padding: 8px 12px; font: var(--text-label-md); cursor: pointer; }

/* ── Footer ─────────────────────────────────────── */
.site-footer { padding: 40px clamp(20px, 4vw, 48px) 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 32px; color: var(--blue-200); font: var(--text-body-sm); }
.site-footer a { color: var(--blue-200); }
.site-footer a:hover { color: var(--white); }
.site-footer .col { display: flex; flex-direction: column; gap: 10px; }
.site-footer .col-title { font: var(--text-label-md); color: var(--white); }
.site-footer .brand { font: var(--text-display-sm); color: var(--white); }
.site-footer .legal { grid-column: 1 / -1; border-top: 1px solid var(--border-on-inverse); padding-top: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* ── Typography helpers ─────────────────────────── */
.eyebrow { font: var(--text-eyebrow); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--text-brand); }
.muted { color: var(--text-secondary); }
.display-xl { font: var(--text-display-xl); }
.display-lg { font: var(--text-display-lg); }
.display-md { font: var(--text-display-md); }
.display-sm { font: var(--text-display-sm); }
.prose { font: var(--text-body-md); color: var(--ink-700); max-width: 720px; }
.prose h2 { font: var(--text-display-md); color: var(--text-primary); margin: 40px 0 12px; }
.prose h3 { font: var(--text-display-sm); color: var(--text-primary); margin: 32px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin-bottom: 6px; }
.prose img { border-radius: var(--radius-lg); }
.prose blockquote { margin: 24px 0; padding: 16px 24px; background: var(--ice-100); border-radius: var(--radius-md); }
.prose table { border-collapse: collapse; width: 100%; font: var(--text-body-sm); }
.prose th, .prose td { border-bottom: 1px solid var(--border-subtle); padding: 10px; text-align: left; }

/* ── Buttons (DS Button: primary | secondary | ghost | inverse; sm | md | lg) ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: var(--text-label-lg); font-family: var(--font-body); padding: 12px 22px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; background: var(--blue-600); color: var(--text-on-inverse); text-decoration: none; transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard); white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--navy-700); color: var(--white); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { font: var(--text-label-md); padding: 9px 16px; }
.btn-lg { padding: 15px 28px; }
.btn-secondary { background: var(--white); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--ice-100); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-primary); }
.btn-ghost:hover { background: var(--ice-100); color: var(--text-primary); }
.btn-inverse { background: var(--white); color: var(--navy-900); }
.btn-inverse:hover { background: var(--ice-200); color: var(--navy-900); }
.btn-danger { background: #b4414c; color: var(--white); }
.btn-danger:hover { background: #8e2f39; color: var(--white); }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; padding: 0; font: inherit; color: var(--text-link); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ── Badges (DS Badge tones) ────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-full); font: var(--text-label-sm); letter-spacing: .02em; background: var(--ice-100); color: var(--text-primary); white-space: nowrap; }
.badge-brand { background: var(--blue-200); color: var(--navy-900); }
.badge-positive { background: var(--green-100); color: #1c5f50; }
.badge-attention { background: var(--coral-100); color: #7a2e35; }
.badge-inverse { background: rgba(255,255,255,.14); color: var(--white); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Tags / chips (DS Tag) ──────────────────────── */
.tag { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-md); background: var(--ice-100); color: var(--text-primary); font: var(--text-label-md); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Cards (DS Card tones) ──────────────────────── */
.card { border-radius: var(--radius-lg); padding: var(--space-5); background: var(--white); border: 1px solid var(--ice-200); }
.card-tinted { background: var(--ice-100); border-color: transparent; }
.card-sunken { background: var(--ice-050); border-color: transparent; }
.card-brand { background: var(--blue-500); color: var(--white); border-color: transparent; }
.card-inverse { background: var(--navy-800); color: var(--white); border-color: transparent; }

/* ── Forms (DS Input / Select / Checkbox) ───────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field > .label { font: var(--text-label-md); color: var(--text-primary); }
.field .hint { font: var(--text-body-sm); color: var(--text-secondary); }
.field .error, .field-error { font: var(--text-body-sm); color: #b4414c; }
.input, input[type=text].input, select.input, textarea.input,
.field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  font: var(--text-body-md); font-family: var(--font-body); padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle); outline: none; background: var(--white); color: var(--text-primary); width: 100%;
  transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}
.field textarea, textarea.input { min-height: 120px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { box-shadow: var(--shadow-focus); border-color: var(--blue-500); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--coral-500); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font: var(--text-body-md); }
.check input { width: 20px; height: 20px; accent-color: var(--blue-600); margin: 0; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ── Tabs (DS Tabs) ─────────────────────────────── */
.tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--border-subtle); overflow-x: auto; }
.tabs a, .tabs button { background: transparent; border: none; cursor: pointer; padding: 12px 2px; font: var(--text-label-lg); color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a.active, .tabs button.active, .tabs [aria-selected=true] { color: var(--text-primary); border-bottom-color: var(--blue-600); }

/* ── Alerts / flash ─────────────────────────────── */
.alert { padding: 14px 18px; border-radius: var(--radius-md); font: var(--text-body-sm); margin-bottom: 16px; background: var(--ice-100); color: var(--text-primary); }
.alert-success { background: var(--green-100); color: #1c5f50; }
.alert-error { background: var(--coral-100); color: #7a2e35; }
.alert-info { background: var(--ice-100); color: var(--navy-900); }
.alert-warning { background: #fdf1d8; color: #6b4b0c; }
.flash-stack { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.flash-stack .alert { box-shadow: var(--shadow-lg); margin: 0; }

/* ── Image placeholder (replaces prototype image slots) ── */
.img-slot { background: var(--ice-200); border: 1px dashed var(--slate-400); border-radius: var(--radius-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--slate-600); font: var(--text-body-sm); text-align: center; overflow: hidden; }
.img-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-cover { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

/* ── Tables ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font: var(--text-body-sm); }
.table th { text-align: left; font: var(--text-label-md); color: var(--text-secondary); padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--ice-200); vertical-align: top; }
.table tr:hover td { background: var(--ice-050); }

/* ── Pagination ─────────────────────────────────── */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 24px; font: var(--text-label-md); }
.pagination a, .pagination span { padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); }
.pagination .current { background: var(--blue-600); color: var(--white); border-color: var(--blue-600); }
.pagination .muted { border: none; }

/* ── Specialist card (search results) ───────────── */
.result-card { display: grid; grid-template-columns: 120px minmax(0, 1fr) 150px; gap: 20px; align-items: center; padding: 16px; border-radius: var(--radius-lg); border: 1px solid var(--ice-200); background: var(--white); }
.result-card.featured { background: var(--ice-100); border-color: var(--ice-200); }

/* ── Utility ────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Responsive overrides for prototype inline grids ──
   Add class="g-stack" to any inline grid that should become one column on small screens,
   "g-2" to become two columns, "f-stack" for flex rows that should stack. */
@media (max-width: 960px) {
  .g-stack { grid-template-columns: minmax(0, 1fr) !important; }
  .g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .f-stack { flex-direction: column !important; align-items: stretch !important; }
  .hide-md { display: none !important; }
  .pad-md { padding: 32px 24px !important; }
  .span-reset { grid-column: auto !important; }
  .site-main { padding-top: 40px; padding-bottom: 64px; }
  .result-card { grid-template-columns: 80px minmax(0, 1fr); }
  .result-card > :last-child { grid-column: 1 / -1; }
  .nav { flex-wrap: wrap; }
  .nav-toggle { display: inline-block; }
  .nav-links, .nav-right { display: none; }
  .nav.open .nav-links, .nav.open .nav-right { display: flex; }
  .nav.open .nav-left { width: 100%; }
  .nav.open .nav-links { flex-direction: column; gap: 14px; padding-top: 8px; }
  .nav.open .nav-right { width: 100%; justify-content: flex-start; }
  .nav-left { flex: 1; }
}
@media (max-width: 640px) {
  .g-2, .g-stack-sm { grid-template-columns: minmax(0, 1fr) !important; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none !important; }
  .frame { padding: 6px; }
  .site-header { border-radius: 20px 20px 0 0; padding-bottom: 32px; }
  .site-main { border-radius: 0 0 20px 20px; }
  h1 { font-size: clamp(34px, 9vw, 48px) !important; }
  .display-xl, .display-lg { font-size: clamp(32px, 8.5vw, 44px) !important; }
  .pad-sm { padding: 28px 20px !important; }
  .site-footer .legal { flex-direction: column; }
}

/* ── Dashboard shell (business account + admin) ── */
.dash-frame { background: var(--navy-900); padding: 12px; min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 12px; }
.dash-side { background: var(--navy-800); border-radius: var(--radius-xl); padding: 28px 24px; display: flex; flex-direction: column; gap: 28px; align-self: start; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.dash-nav { display: flex; flex-direction: column; gap: 4px; }
.dash-nav a { color: var(--blue-200); font: var(--text-label-lg); padding: 11px 14px; border-radius: var(--radius-sm); display: flex; justify-content: space-between; align-items: center; text-decoration: none; }
.dash-nav a:hover { background: rgba(255,255,255,.06); color: var(--white); text-decoration: none; }
.dash-nav a.active { background: var(--blue-600); color: var(--white); }
.dash-nav .count { background: var(--coral-500); color: var(--white); border-radius: var(--radius-full); font: var(--text-label-sm); padding: 3px 8px; }
.dash-group { font: var(--text-eyebrow); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--blue-400); padding: 14px 14px 4px; }
.dash-plan { margin-top: auto; background: var(--navy-900); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.dash-main { background: var(--white); border-radius: var(--radius-xl); padding: 40px 48px 64px; display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.page-title { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.page-title h1 { margin: 4px 0 0; font: var(--text-display-lg); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { border-radius: var(--radius-lg); padding: 24px; background: var(--ice-050); display: flex; flex-direction: column; gap: 6px; }
.stat .label { font: var(--text-body-sm); color: var(--text-secondary); }
.stat .value { font: var(--text-display-lg); color: var(--navy-900); }
.stat.brand { background: var(--blue-600); } .stat.brand .label, .stat.brand .value { color: var(--white); }
.stat.tinted { background: var(--ice-100); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0; border-top: 1px solid var(--border-subtle); }
@media (max-width: 960px) {
  .dash-frame { grid-template-columns: minmax(0, 1fr); padding: 6px; gap: 6px; }
  .dash-side { position: static; max-height: none; padding: 18px 20px; border-radius: 20px; gap: 16px; }
  .dash-side .dash-nav, .dash-side .dash-plan { display: none; }
  .dash-side.open .dash-nav, .dash-side.open .dash-plan { display: flex; }
  .dash-toggle { display: inline-block; }
  .dash-main { padding: 28px 20px 48px; border-radius: 20px; }
}

@media (max-width: 420px) { .nav-brand { font-size: 21px; } }
