/* ===================================================================
   Base / Theme tokens
   =================================================================== */
:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-alt: #f4f7fb;
  --text: #1a2330;
  --text-muted: #5b6572;
  --border: #dfe6ee;
  --accent: #2f6feb;
  --accent-contrast: #ffffff;
  --danger-bg: #fdecec;
  --danger-text: #a3231f;
  --success-bg: #e9f7ef;
  --success-text: #1e7a3d;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(20, 30, 50, 0.08);
  --sky-day: linear-gradient(180deg, #6fa8ff 0%, #bcd9ff 100%);
  --sky-night: linear-gradient(180deg, #101b33 0%, #2c3a5e 100%);
  --sky-rain: linear-gradient(180deg, #5c6b7a 0%, #94a3b3 100%);
  --sky-snow: linear-gradient(180deg, #b9c6d6 0%, #e7edf4 100%);
  --sky-cloud: linear-gradient(180deg, #8b9bb0 0%, #c3cedb 100%);
}

[data-theme="dark"] {
  --bg: #0f1420;
  --surface: #171d2b;
  --surface-alt: #1e2536;
  --text: #eaeef5;
  --text-muted: #99a3b5;
  --border: #2a3247;
  --accent: #5b8dfd;
  --accent-contrast: #0f1420;
  --danger-bg: #3a1c1c;
  --danger-text: #ff9d97;
  --success-bg: #16301f;
  --success-text: #7fe0a1;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background-color .3s ease, color .3s ease;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-contrast);
  padding: 10px 16px; z-index: 1000; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===================================================================
   Header
   =================================================================== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 960px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none;
}
.brand i { color: var(--accent); font-size: 1.4rem; }
.main-nav { display: flex; gap: 18px; margin-left: auto; flex-wrap: wrap; }
.main-nav a { color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--accent); }
.icon-btn {
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--accent); }

/* ===================================================================
   Hero / weather widget
   =================================================================== */
.hero {
  padding: 36px 0 20px;
  background: var(--sky-day);
  color: #fff;
  transition: background .6s ease;
}
[data-sky="night"] .hero { background: var(--sky-night); }
[data-sky="rain"] .hero { background: var(--sky-rain); }
[data-sky="snow"] .hero { background: var(--sky-snow); color: #22303f; }
[data-sky="cloud"] .hero { background: var(--sky-cloud); }

.search-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.search-row input[type="text"] {
  flex: 1 1 220px; padding: 12px 14px; border-radius: 10px; border: none;
  font-size: 1rem; background: rgba(255,255,255,.92); color: #1a2330;
}
.btn {
  padding: 12px 18px; border-radius: 10px; border: none; cursor: pointer;
  font-weight: 600; font-size: .95rem; white-space: nowrap;
}
.btn-primary { background: #ffffff; color: var(--accent); }
.btn-primary:hover { background: #eef3f8; }
.btn-secondary { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.5); }
.btn-secondary:hover { background: rgba(255,255,255,.28); }

.recent-searches { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.recent-searches button {
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4); color: #fff;
  padding: 6px 12px; border-radius: 999px; font-size: .85rem; cursor: pointer;
}

.detected-note { font-size: .9rem; opacity: .9; margin-bottom: 16px; }

.unit-toggle { display: inline-flex; border-radius: 999px; overflow: hidden; margin-bottom: 20px; border: 1px solid rgba(255,255,255,.5); }
.unit-btn { background: transparent; border: none; color: #fff; padding: 6px 16px; cursor: pointer; font-weight: 600; }
.unit-btn.active { background: rgba(255,255,255,.25); }

.weather-app { min-height: 120px; }

.current-card {
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  animation: fadeIn .4s ease;
}
[data-sky="snow"] .current-card { background: rgba(255,255,255,.55); }

.current-card .icon { font-size: 4rem; line-height: 1; }
.current-temp { font-size: 3.2rem; font-weight: 700; }
.current-meta { flex: 1 1 220px; }
.current-desc { font-size: 1.1rem; margin-bottom: 6px; text-transform: capitalize; }
.current-details {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px 16px;
  margin-top: 14px; font-size: .88rem;
}
.current-details span { display: block; opacity: .85; font-size: .78rem; }

.hourly-strip {
  display: flex; gap: 14px; overflow-x: auto; padding: 16px 2px 6px; margin-top: 16px;
  scrollbar-width: thin;
}
.hourly-item {
  flex: 0 0 auto; text-align: center; background: rgba(255,255,255,.14);
  border-radius: 12px; padding: 10px 14px; min-width: 68px;
}
[data-sky="snow"] .hourly-item { background: rgba(255,255,255,.5); }
.hourly-item .time { font-size: .78rem; opacity: .85; }
.hourly-item i { font-size: 1.4rem; display: block; margin: 6px 0; }

.daily-forecast {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px;
  margin-top: 20px;
}
.daily-card {
  background: rgba(255,255,255,.14); border-radius: 12px; padding: 14px; text-align: center;
}
[data-sky="snow"] .daily-card { background: rgba(255,255,255,.5); }
.daily-card .day-name { font-weight: 600; font-size: .9rem; }
.daily-card i { font-size: 1.8rem; margin: 8px 0; display: block; }
.daily-card .hi { font-weight: 700; }
.daily-card .lo { opacity: .8; margin-left: 6px; }

/* Loading + error states */
.loading-skeleton { animation: pulse 1.3s infinite ease-in-out; }
.skeleton-card { height: 140px; border-radius: var(--radius); background: rgba(255,255,255,.2); margin-bottom: 10px; }
.skeleton-row { height: 60px; border-radius: 12px; background: rgba(255,255,255,.15); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.error-box {
  background: var(--danger-bg); color: var(--danger-text);
  border-radius: 10px; padding: 14px 16px; margin: 10px 0; font-size: .92rem;
}
.form-success { background: var(--success-bg); color: var(--success-text); border-radius: 10px; padding: 14px 16px; }

/* ===================================================================
   Ad slots
   =================================================================== */
.ad-slot {
  max-width: 960px; margin: 28px auto; padding: 0 20px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.ad-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.ad-placeholder {
  width: 100%; min-height: 90px; border: 1px dashed var(--border); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: .85rem;
  background: var(--surface-alt);
}

/* ===================================================================
   Content sections (About / Privacy / Terms / FAQ)
   =================================================================== */
.content-section { padding: 40px 20px 60px; }
.content-section h1 { font-size: 1.8rem; margin-bottom: .3em; }
.content-section h2 { font-size: 1.25rem; margin-top: 1.6em; }
.content-section h3 { font-size: 1.05rem; margin-top: 1.4em; }
.content-section p, .content-section li { color: var(--text-muted); }
.content-section a { color: var(--accent); }
.content-section details {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; margin: 10px 0;
}
.content-section summary { cursor: pointer; font-weight: 600; color: var(--text); }

/* ===================================================================
   Contact form
   =================================================================== */
.contact-form { max-width: 480px; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.form-field input, .form-field textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: inherit; font-size: .95rem;
}

/* ===================================================================
   Footer
   =================================================================== */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 28px 20px; margin-top: 20px; }
.footer-inner { max-width: 960px; margin: 0 auto; text-align: center; color: var(--text-muted); font-size: .85rem; }
.footer-nav { display: flex; gap: 16px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.footer-nav a { color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--accent); }
.footer-note { max-width: 640px; margin: 8px auto 0; }

/* ===================================================================
   Cookie banner
   =================================================================== */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 20px rgba(0,0,0,.08);
  padding: 16px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: center;
}
.cookie-banner p { margin: 0; max-width: 640px; font-size: .85rem; color: var(--text-muted); }
.cookie-actions { display: flex; gap: 10px; }
.cookie-banner .btn { padding: 8px 16px; font-size: .85rem; }
.cookie-banner .btn-primary { background: var(--accent); color: #fff; }
.cookie-banner .btn-secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }

/* ===================================================================
   Responsive
   =================================================================== */
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; }
  .main-nav { order: 3; width: 100%; justify-content: space-between; margin-left: 0; }
  .current-card { flex-direction: column; text-align: center; }
  .current-details { grid-template-columns: repeat(2, 1fr); }
}
