/* UV Index Today - design system
   Lightweight, dependency-free, theme-aware. Built for fast Core Web Vitals. */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #14202e;
  --text-soft: #4a5a6a;
  --border: #e2e8f0;
  --brand: #ff7a1a;
  --brand-2: #ffb703;
  --link: #0a66c2;
  --shadow: 0 1px 2px rgba(16, 32, 48, .05), 0 8px 24px rgba(16, 32, 48, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1080px;

  /* UV risk bands (WHO colors) */
  --uv-low: #2e9e57;
  --uv-moderate: #e5b800;
  --uv-high: #f07d19;
  --uv-very-high: #e5484d;
  --uv-extreme: #8b5cf6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141b;
    --surface: #161f2a;
    --surface-2: #1e2a37;
    --text: #eaf1f8;
    --text-soft: #9fb0c0;
    --border: #263341;
    --link: #6bb3ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #0e141b; --surface: #161f2a; --surface-2: #1e2a37; --text: #eaf1f8;
  --text-soft: #9fb0c0; --border: #263341; --link: #6bb3ff;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}
:root[data-theme="light"] {
  --bg: #f6f8fb; --surface: #ffffff; --surface-2: #eef2f7; --text: #14202e;
  --text-soft: #4a5a6a; --border: #e2e8f0; --link: #0a66c2;
  --shadow: 0 1px 2px rgba(16,32,48,.05), 0 8px 24px rgba(16,32,48,.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip; /* guard: never scroll the page horizontally */
}
h1, h2, h3, h4 { font-family: "Poppins", var(--font, sans-serif); line-height: 1.25; color: var(--text); font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 2rem 0 .75rem; }
h3 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 2.5rem 0; }
.muted { color: var(--text-soft); }
.center { text-align: center; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: 1rem; height: 62px; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: "Poppins"; font-weight: 700; font-size: 1.12rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; object-fit: contain; flex: none; display: block; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
.nav a { color: var(--text-soft); font-size: .95rem; font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }
.theme-toggle { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 1.05rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.nav-toggle { display: none; }

@media (max-width: 720px) {
  .nav a.nav-link-text { display: none; }
}

/* Hero */
.hero { position: relative; overflow: hidden; padding: 3rem 0 2.5rem; text-align: center;
  background:
    radial-gradient(1200px 400px at 50% -120px, color-mix(in srgb, var(--brand-2) 32%, transparent), transparent 70%),
    radial-gradient(800px 300px at 80% 0, color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%);
}
.hero p.lead { font-size: 1.15rem; color: var(--text-soft); max-width: 640px; margin: 0 auto 1.5rem; }
.eyebrow { display: inline-block; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .78rem; color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); padding: .3rem .7rem; border-radius: 999px; margin-bottom: 1rem; }

/* Search box */
.search { max-width: 560px; margin: 0 auto; position: relative; }
.search form { display: flex; gap: .5rem; }
.search input[type="text"] {
  flex: 1; min-width: 0; padding: .95rem 1.1rem; font-size: 1.05rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.search input[type="text"]:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .95rem 1.3rem; font-size: 1rem; font-weight: 600; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap; font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #241400; }
.btn-primary:hover { filter: brightness(1.05); text-decoration: none; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-block { width: 100%; }
.locate { margin-top: .7rem; display: inline-flex; align-items: center; gap: .4rem; background: none; border: none; color: var(--link); cursor: pointer; font-size: .95rem; font-family: inherit; }

.autocomplete-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); overflow: hidden; text-align: left; display: none;
}
.autocomplete-list.open { display: block; }
.autocomplete-list button { display: block; width: 100%; text-align: left; padding: .7rem 1rem; background: none; border: none; color: var(--text); cursor: pointer; font-size: .95rem; font-family: inherit; }
.autocomplete-list button:hover, .autocomplete-list button.active { background: var(--surface-2); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.link-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; color: var(--text); transition: border-color .15s, transform .15s; }
.link-card:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-1px); }
.link-card .lc-title { font-weight: 600; }
.link-card .lc-sub { color: var(--text-soft); font-size: .85rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-block; padding: .45rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .92rem; }
.chip:hover { border-color: var(--brand); text-decoration: none; }

/* UV hero dial */
.uv-hero { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: center; }
@media (max-width: 620px) { .uv-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; } }
.uv-dial {
  width: 168px; height: 168px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #fff; flex: none;
  box-shadow: inset 0 0 0 8px rgba(255,255,255,.18), var(--shadow);
}
.uv-dial .num { font-family: "Poppins"; font-weight: 700; font-size: 3.4rem; line-height: 1; }
.uv-dial .cap { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.uv-meta .level { font-family: "Poppins"; font-weight: 700; font-size: 1.5rem; margin-bottom: .25rem; }

/* risk band backgrounds */
.band-low { background: var(--uv-low); }
.band-moderate { background: var(--uv-moderate); }
.band-high { background: var(--uv-high); }
.band-very-high { background: var(--uv-very-high); }
.band-extreme { background: var(--uv-extreme); }
.text-band-low { color: var(--uv-low); }
.text-band-moderate { color: var(--uv-moderate); }
.text-band-high { color: var(--uv-high); }
.text-band-very-high { color: var(--uv-very-high); }
.text-band-extreme { color: var(--uv-extreme); }

.badge { display: inline-block; padding: .25rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; color: #fff; }

/* Forecast bars */
.forecast { display: flex; align-items: flex-end; gap: 6px; height: 160px; overflow-x: auto; padding-top: .5rem; }
.fcol { flex: 1 0 34px; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.fbar { width: 22px; border-radius: 6px 6px 0 0; min-height: 4px; }
.fval { font-size: .8rem; font-weight: 600; }
.ftime { font-size: .72rem; color: var(--text-soft); }

/* Scale table */
.scale-row { display: grid; grid-template-columns: 90px 110px 1fr; gap: .75rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.scale-row:last-child { border-bottom: none; }
.scale-swatch { height: 28px; border-radius: 6px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; }
@media (max-width: 520px) { .scale-row { grid-template-columns: 70px 1fr; } .scale-row .scale-range { display: none; } }

/* Breadcrumbs */
.breadcrumbs { font-size: .88rem; color: var(--text-soft); padding: 1rem 0 0; }
.breadcrumbs a { color: var(--text-soft); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs span { margin: 0 .4rem; opacity: .6; }

/* Prose (guides/content) */
.prose { max-width: 760px; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.prose li { margin-bottom: .4rem; }
.prose h2 { border-top: 1px solid var(--border); padding-top: 1.5rem; }
.prose .lead { font-size: 1.15rem; color: var(--text-soft); }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: .7rem; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: .6rem; }

/* Footer */
.site-footer { margin-top: auto; background: var(--surface); border-top: 1px solid var(--border); padding: 2.5rem 0 1.5rem; color: var(--text-soft); font-size: .92rem; }
.site-footer h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); margin: 0 0 .8rem; }
.site-footer a { color: var(--text-soft); display: block; padding: .18rem 0; }
.site-footer a:hover { color: var(--brand); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 1.5rem; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 1.5rem; padding-top: 1.2rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

.stack > * + * { margin-top: 1rem; }
.pill-note { background: var(--surface-2); border-radius: var(--radius-sm); padding: .8rem 1rem; font-size: .92rem; color: var(--text-soft); }
