/* ============================================================================
 * Smart-Tariffs.co.uk — Base Layout, Header, Mobile Sticky Nav, Typography
 * ============================================================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--st-font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--st-ink);
  background: var(--st-canvas);
  overflow-x: clip;
}

.tabular { font-variant-numeric: tabular-nums; }
.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;
}

/* GOV.UK High-Visibility Keyboard Focus */
:focus-visible {
  outline: 3px solid var(--st-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--st-focus-ink);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 2000;
  background: var(--st-focus);
  color: var(--st-focus-ink);
  font-weight: 700;
  padding: 12px 18px;
  border-radius: var(--st-radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

a { color: var(--st-primary); text-underline-offset: 3px; }
a:hover { color: var(--st-primary-hover); }

.wrap {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}
.wrap-narrow {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
}

/* Global Notice Banner (Admin Configurable) */
.site-banner {
  background: var(--st-mint-soft);
  border-bottom: 1px solid var(--st-border);
  color: var(--st-ink);
  font-size: 0.9rem;
  padding: 8px 0;
}
.site-banner .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.site-banner strong { color: var(--st-primary); }

/* Deep Navy Top Header (Hosts Uploaded Green-House Logo Cleanly) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--st-navy-deep);
  color: #FFFFFF;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  flex-shrink: 0;
}
.brand-link:hover { color: #FFFFFF; }
.brand-link svg { width: 34px; height: 34px; flex-shrink: 0; }
.brand-wordmark .b-green { color: var(--st-brand-green); }
.brand-wordmark .b-tld { color: #DCE8F0; font-size: 0.86rem; font-weight: 600; }

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.primary-nav a {
  color: #E2EEF6;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 11px;
  border-radius: var(--st-radius-sm);
  white-space: nowrap;
}
.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}
.primary-nav a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--st-brand-green);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.dno-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 11px;
  border-radius: var(--st-radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.dno-pill-btn:hover { background: rgba(255, 255, 255, 0.16); }
.dno-pill-btn .dno-code {
  color: var(--st-brand-green);
  font-weight: 800;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--st-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.18); }

.mobile-menu-btn { display: none; }

/* Mobile Slide Drawer Menu */
.mobile-drawer-scrim {
  position: fixed; inset: 0; background: rgba(7, 22, 37, 0.56);
  z-index: 1400; display: none;
}
.mobile-drawer-scrim.open { display: block; }
.mobile-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 88vw);
  background: var(--st-surface); color: var(--st-ink);
  z-index: 1410; padding: 18px; overflow-y: auto;
  transform: translateX(100%); transition: transform 0.2s ease;
  box-shadow: var(--st-shadow-md);
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--st-border);
}
.mobile-drawer-links { display: flex; flex-direction: column; gap: 4px; }
.mobile-drawer-links a {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 44px; padding: 10px 12px; border-radius: var(--st-radius-sm);
  color: var(--st-ink); text-decoration: none; font-weight: 600;
}
.mobile-drawer-links a:hover, .mobile-drawer-links a[aria-current="page"] {
  background: var(--st-primary-soft); color: var(--st-primary);
}
.mobile-drawer-group {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--st-ink-muted); margin: 14px 0 6px 12px;
}

/* Sticky Mobile Bottom Navigation Bar (One-Handed Use) */
.mobile-bottom-nav {
  display: none;
}

/* Buttons & Form Primitives */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--st-radius-sm);
  border: 2px solid transparent;
  font: inherit; font-weight: 700; font-size: 0.95rem;
  text-decoration: none; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-primary {
  background: var(--st-primary); color: #FFFFFF; border-color: var(--st-primary);
}
[data-theme="dark"] .btn-primary { color: #05131E; }
.btn-primary:hover { background: var(--st-primary-hover); border-color: var(--st-primary-hover); color: #FFFFFF; }
[data-theme="dark"] .btn-primary:hover { color: #05131E; }

.btn-secondary {
  background: var(--st-surface); color: var(--st-ink); border-color: var(--st-border);
}
.btn-secondary:hover { background: var(--st-surface-alt); border-color: var(--st-ink-muted); }

.btn-ghost {
  background: transparent; color: var(--st-primary); border-color: transparent;
  padding: 0 12px;
}
.btn-ghost:hover { background: var(--st-primary-soft); }

.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.85rem; }

input[type="text"],
input[type="number"],
input[type="url"],
input[type="password"],
select,
textarea {
  font: inherit;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--st-radius-sm);
  border: 2px solid var(--st-border-strong);
  background: var(--st-surface);
  color: var(--st-ink);
  width: 100%;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--st-primary);
  min-height: 32px;
  cursor: pointer;
}

.field-error {
  display: flex; align-items: flex-start; gap: 6px;
  color: var(--st-error); font-size: 0.86rem; font-weight: 600;
  margin-top: 6px;
}
.field-hint {
  color: var(--st-ink-muted); font-size: 0.83rem; margin-top: 4px;
}

/* Cards & Badges */
.card {
  background: var(--st-surface);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-lg);
  padding: 20px;
  box-shadow: var(--st-shadow-sm);
}

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--st-radius-pill);
  font-size: 0.78rem; font-weight: 700; line-height: 1.3;
  white-space: nowrap;
}
.badge-savings { background: var(--st-savings-bg); color: var(--st-savings); }
.badge-primary { background: var(--st-primary-soft); color: var(--st-primary); }
.badge-amber { background: var(--st-amber-bg); color: var(--st-amber-ink); }
.badge-peak { background: var(--st-peak-bg); color: var(--st-peak); }
.badge-muted { background: var(--st-surface-alt); color: var(--st-ink-muted); border: 1px solid var(--st-border); }

/* Footer */
.site-footer {
  background: var(--st-navy-deep);
  color: #DDE9F2;
  padding: 44px 0 36px;
  margin-top: 56px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 28px;
}
.footer-col h3 {
  color: #FFFFFF; font-size: 0.92rem; margin: 0 0 12px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.footer-col a { color: #C5DBE8; text-decoration: none; font-size: 0.9rem; }
.footer-col a:hover { color: var(--st-brand-green); text-decoration: underline; }
.footer-disclaimer {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.83rem; color: #B4C8D6; line-height: 1.6;
}

/* Breadcrumbs & Content Pages */
.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 0.86rem; color: var(--st-ink-muted); margin: 16px 0 12px;
}
.breadcrumbs a { color: var(--st-ink-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--st-primary); text-decoration: underline; }

.prose h1 { font-size: clamp(1.85rem, 3.6vw, 2.5rem); line-height: 1.15; letter-spacing: -0.025em; margin: 0 0 14px; }
.prose h2 { font-size: 1.45rem; line-height: 1.25; margin: 28px 0 10px; }
.prose h3 { font-size: 1.12rem; margin: 20px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }

details.faq-item {
  background: var(--st-surface);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-md);
  padding: 14px 18px;
  margin-bottom: 10px;
}
details.faq-item summary {
  cursor: pointer; font-weight: 700; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item[open] summary { margin-bottom: 10px; color: var(--st-primary); }

/* Responsive Rules — Guaranteed Zero Overflow on 360px Phones */
@media (max-width: 1023px) {
  .primary-nav { display: none; }
  .mobile-menu-btn { display: inline-flex; }
  .header-inner { min-height: 54px; gap: 8px; }
  .brand-link { font-size: 1.08rem; gap: 7px; }
  .brand-link svg { width: 28px; height: 28px; }
  .dno-pill-btn { min-height: 34px; padding: 4px 8px; font-size: 0.78rem; }
  .icon-btn { width: 34px; height: 34px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }

  body { padding-bottom: 68px; }
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1100;
    background: var(--st-surface);
    border-top: 1px solid var(--st-border);
    box-shadow: 0 -4px 16px rgba(20, 43, 59, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-height: 56px; padding: 6px 4px;
    color: var(--st-ink-muted); text-decoration: none;
    font-size: 0.73rem; font-weight: 700;
  }
  .mobile-bottom-nav a[aria-current="page"],
  .mobile-bottom-nav a:hover {
    color: var(--st-primary);
  }
}

@media (max-width: 480px) {
  .wrap { width: calc(100% - 20px); }
  .brand-wordmark .b-tld { display: none; }
  .dno-pill-btn .dno-label { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-actions { gap: 5px; }
  .icon-btn { width: 32px; height: 32px; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 340px) {
  .dno-pill-btn .dno-label { display: none; }
}
