/**
 * POSTCODE PRICES — Design System
 * Clean, data-forward, trust-building
 * No AI slop, no generic stock feel
 */

/* ============================================
   FONTS
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --f-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --f-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* ============================================
     COLOURS — Professional, trustworthy
     ============================================ */
  
  /* Neutrals */
  --ink: #0f172a;
  --ink-soft: #1e293b;
  --slate: #475569;
  --stone: #64748b;
  --mist: #94a3b8;
  --ice: #e2e8f0;
  --snow: #f1f5f9;
  --paper: #f8fafc;
  --white: #ffffff;

  /* Primary — Trust blue */
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #3b82f6;
  --blue-wash: #eff6ff;

  /* Accent — Success/savings green */
  --green: #16a34a;
  --green-dark: #15803d;
  --green-wash: #f0fdf4;

  /* Warning */
  --amber: #d97706;
  --amber-wash: #fffbeb;

  /* Error */
  --red: #dc2626;
  --red-wash: #fef2f2;

  /* ============================================
     SPACING
     ============================================ */
  --sp-xs: 4px;
  --sp-s: 8px;
  --sp-m: 16px;
  --sp-l: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;
  --sp-3xl: 64px;
  --sp-4xl: 96px;

  /* ============================================
     SHADOWS
     ============================================ */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);

  /* ============================================
     RADII
     ============================================ */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
}

/* ============================================
   RESET
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--f-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p { margin-bottom: var(--sp-m); }

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-l);
}

.container--narrow {
  max-width: 800px;
}

.container--wide {
  max-width: 1400px;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--ice);
  padding: var(--sp-m) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-l);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue);
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--sp-l);
}

.nav a {
  color: var(--slate);
  font-weight: 500;
  font-size: 0.9375rem;
}

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

.nav a.active {
  color: var(--blue);
}

/* Header search */
.header-search {
  display: flex;
  align-items: center;
  gap: var(--sp-s);
  background: var(--snow);
  border: 1px solid var(--ice);
  border-radius: var(--radius-full);
  padding: var(--sp-xs) var(--sp-s) var(--sp-xs) var(--sp-m);
}

.header-search input {
  border: none;
  background: transparent;
  font-size: 0.875rem;
  width: 120px;
  outline: none;
}

.header-search button {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   HERO / SEARCH
   ============================================ */
.hero {
  padding: var(--sp-4xl) 0;
  text-align: center;
  background: linear-gradient(180deg, var(--white) 0%, var(--paper) 100%);
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: var(--sp-m);
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--slate);
  max-width: 600px;
  margin: 0 auto var(--sp-2xl);
}

.search-form {
  display: flex;
  gap: var(--sp-s);
  max-width: 500px;
  margin: 0 auto;
}

.search-form input {
  flex: 1;
  padding: var(--sp-m) var(--sp-l);
  font-size: 1.125rem;
  border: 2px solid var(--ice);
  border-radius: var(--radius-lg);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-wash);
}

.search-form button {
  padding: var(--sp-m) var(--sp-xl);
  font-size: 1.125rem;
  font-weight: 600;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 0.2s;
}

.search-form button:hover {
  background: var(--blue-dark);
}

/* Autocomplete dropdown */
.search-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--ice);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  margin-top: var(--sp-xs);
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.search-autocomplete.active {
  display: block;
}

.search-autocomplete-item {
  padding: var(--sp-m);
  cursor: pointer;
  border-bottom: 1px solid var(--ice);
}

.search-autocomplete-item:last-child {
  border-bottom: none;
}

.search-autocomplete-item:hover {
  background: var(--snow);
}

.search-autocomplete-item .postcode {
  font-weight: 600;
  font-family: var(--f-mono);
}

.search-autocomplete-item .area {
  color: var(--slate);
  font-size: 0.875rem;
}

/* ============================================
   DEAL CARDS
   ============================================ */
.deal-card {
  background: var(--white);
  border: 1px solid var(--ice);
  border-radius: var(--radius-lg);
  padding: var(--sp-l);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.deal-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-md);
}

.deal-card--featured {
  border-color: var(--blue);
  border-width: 2px;
}

.deal-card__badge {
  display: inline-block;
  background: var(--blue);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--sp-xs) var(--sp-s);
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-m);
}

.deal-card__badge--value {
  background: var(--green);
}

.deal-card__badge--fast {
  background: var(--blue-light);
}

.deal-card__badge--cheap {
  background: var(--amber);
}

.deal-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-m);
}

.deal-card__provider {
  font-size: 0.875rem;
  color: var(--slate);
  margin-bottom: var(--sp-xs);
}

.deal-card__name {
  font-size: 1.125rem;
  font-weight: 600;
}

.deal-card__price {
  text-align: right;
}

.deal-card__price-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--f-mono);
}

.deal-card__price-period {
  font-size: 0.875rem;
  color: var(--slate);
}

.deal-card__specs {
  display: flex;
  gap: var(--sp-l);
  margin-bottom: var(--sp-m);
  padding: var(--sp-m) 0;
  border-top: 1px solid var(--ice);
  border-bottom: 1px solid var(--ice);
}

.deal-card__spec {
  text-align: center;
}

.deal-card__spec-value {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: var(--f-mono);
}

.deal-card__spec-label {
  font-size: 0.75rem;
  color: var(--slate);
  text-transform: uppercase;
}

.deal-card__pros-cons {
  margin-bottom: var(--sp-m);
}

.deal-card__pro, .deal-card__con {
  font-size: 0.875rem;
  padding: var(--sp-xs) 0;
}

.deal-card__pro::before {
  content: "✓ ";
  color: var(--green);
  font-weight: 600;
}

.deal-card__con::before {
  content: "✗ ";
  color: var(--red);
  font-weight: 600;
}

.deal-card__cta {
  display: block;
  width: 100%;
  padding: var(--sp-m);
  background: var(--blue);
  color: white;
  text-align: center;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: background 0.2s;
}

.deal-card__cta:hover {
  background: var(--blue-dark);
  text-decoration: none;
}

/* ============================================
   COMPARISON TABLE
   ============================================ */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.comparison-table th,
.comparison-table td {
  padding: var(--sp-m);
  text-align: left;
  border-bottom: 1px solid var(--ice);
}

.comparison-table th {
  background: var(--snow);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--slate);
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

.comparison-table tr:hover td {
  background: var(--snow);
}

.comparison-table .provider {
  font-weight: 600;
}

.comparison-table .price {
  font-family: var(--f-mono);
  font-weight: 600;
}

.comparison-table .speed {
  font-family: var(--f-mono);
}

.comparison-table .unavailable {
  color: var(--mist);
  font-style: italic;
}

/* Sortable headers */
.comparison-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.comparison-table th.sortable:hover {
  background: var(--ice);
}

.comparison-table th.sortable::after {
  content: " ↕";
  color: var(--mist);
}

.comparison-table th.sorted-asc::after {
  content: " ↑";
  color: var(--blue);
}

.comparison-table th.sorted-desc::after {
  content: " ↓";
  color: var(--blue);
}

/* ============================================
   FILTERS
   ============================================ */
.filters {
  display: flex;
  gap: var(--sp-m);
  flex-wrap: wrap;
  margin-bottom: var(--sp-l);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--sp-s);
}

.filter-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate);
}

.filter-group select {
  padding: var(--sp-s) var(--sp-m);
  font-size: 0.875rem;
  border: 1px solid var(--ice);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
}

/* ============================================
   INFO CARDS
   ============================================ */
.info-card {
  background: var(--white);
  border: 1px solid var(--ice);
  border-radius: var(--radius-lg);
  padding: var(--sp-l);
}

.info-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--sp-m);
  display: flex;
  align-items: center;
  gap: var(--sp-s);
}

.info-card__content {
  color: var(--slate);
  font-size: 0.9375rem;
}

.info-card--highlight {
  background: var(--blue-wash);
  border-color: var(--blue);
}

.info-card--warning {
  background: var(--amber-wash);
  border-color: var(--amber);
}

.info-card--success {
  background: var(--green-wash);
  border-color: var(--green);
}

/* ============================================
   PAGE SECTIONS
   ============================================ */
.section {
  padding: var(--sp-2xl) 0;
}

.section__header {
  margin-bottom: var(--sp-xl);
}

.section__title {
  font-size: 1.5rem;
  margin-bottom: var(--sp-s);
}

.section__subtitle {
  color: var(--slate);
}

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--sp-s);
  font-size: 0.875rem;
  color: var(--slate);
  margin-bottom: var(--sp-l);
}

.breadcrumbs a {
  color: var(--slate);
}

.breadcrumbs a:hover {
  color: var(--blue);
}

.breadcrumbs span {
  color: var(--mist);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: var(--ink);
  color: var(--mist);
  padding: var(--sp-2xl) 0;
  margin-top: var(--sp-3xl);
}

.site-footer a {
  color: var(--mist);
}

.site-footer a:hover {
  color: var(--white);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-xl);
}

.footer-col h4 {
  color: var(--white);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--sp-m);
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: var(--sp-s);
}

.footer-bottom {
  margin-top: var(--sp-xl);
  padding-top: var(--sp-xl);
  border-top: 1px solid var(--ink-soft);
  font-size: 0.875rem;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--slate); }
.text-small { font-size: 0.875rem; }
.text-mono { font-family: var(--f-mono); }

.mt-0 { margin-top: 0; }
.mt-s { margin-top: var(--sp-s); }
.mt-m { margin-top: var(--sp-m); }
.mt-l { margin-top: var(--sp-l); }
.mt-xl { margin-top: var(--sp-xl); }

.mb-0 { margin-bottom: 0; }
.mb-s { margin-bottom: var(--sp-s); }
.mb-m { margin-bottom: var(--sp-m); }
.mb-l { margin-bottom: var(--sp-l); }
.mb-xl { margin-bottom: var(--sp-xl); }

.grid {
  display: grid;
  gap: var(--sp-l);
}

.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: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  
  h1 { font-size: 2rem; }
  .hero h1 { font-size: 2rem; }
  .hero { padding: var(--sp-2xl) 0; }
  
  .search-form {
    flex-direction: column;
  }
  
  .nav {
    display: none;
  }
  
  .deal-card__specs {
    flex-wrap: wrap;
  }
}

/* ============================================
   PRICE HISTORY CHART (placeholder styles)
   ============================================ */
.price-chart {
  background: var(--white);
  border: 1px solid var(--ice);
  border-radius: var(--radius-lg);
  padding: var(--sp-l);
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mist);
}

/* ============================================
   LAST UPDATED BADGE
   ============================================ */
.last-updated {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 0.75rem;
  color: var(--slate);
  background: var(--snow);
  padding: var(--sp-xs) var(--sp-s);
  border-radius: var(--radius-full);
}

.last-updated::before {
  content: "●";
  color: var(--green);
  font-size: 0.5rem;
}

/* ============================================
   TECHNOLOGY BADGES
   ============================================ */
.tech-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--ice);
  color: var(--slate);
  margin-right: 4px;
}

.tech-badge--fttp {
  background: var(--green-wash);
  color: var(--green-dark);
}

.tech-badge--cable {
  background: var(--blue-wash);
  color: var(--blue-dark);
}

/* ============================================
   COVERAGE STATS
   ============================================ */
.coverage-stat {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 0.85rem;
  color: var(--slate);
}

.coverage-stat__pct {
  font-weight: 600;
  font-family: var(--f-mono);
  color: var(--ink);
}

.coverage-stat--verified {
  background: var(--green-wash);
  color: var(--green-dark);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

/* ============================================
   GUIDE CONTENT (AI-generated)
   ============================================ */
.guide-content {
  background: var(--white);
  border: 1px solid var(--ice);
  border-radius: var(--radius-lg);
  padding: var(--sp-xl);
}

.guide-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--sp-l);
  color: var(--ink);
}

.guide-content__body {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-soft);
  white-space: pre-line;
}

.guide-content__body p,
.guide-content__body br + br {
  margin-top: var(--sp-m);
}

/* Sector cards for outcode pages */
.sector-card {
  display: block;
  padding: var(--sp-m);
  background: var(--white);
  border: 1px solid var(--silver);
  border-radius: var(--r-m);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sector-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.sector-card__postcode {
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: var(--sp-xs);
}
.sector-card__stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--slate);
  margin-bottom: var(--sp-s);
}
.sector-card__price {
  font-weight: 600;
  color: var(--ink);
}
.sector-card__coverage {
  font-size: 0.75rem;
}
.sector-card__bar {
  height: 4px;
  background: var(--silver);
  border-radius: 2px;
  margin-bottom: 4px;
  position: relative;
  overflow: hidden;
}
.sector-card__bar::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--gigabit);
  background: var(--blue);
}

/* Provider cards */
.provider-card {
  padding: var(--sp-m);
  background: var(--white);
  border: 1px solid var(--silver);
  border-radius: var(--r-m);
}
.provider-card__name {
  font-weight: 600;
  margin-bottom: var(--sp-xs);
}
.provider-card__deals {
  font-size: 0.85rem;
  color: var(--slate);
}
.provider-card__price {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue);
  margin-top: var(--sp-xs);
}

/* Grid variants */
.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-m);
}
.grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-m);
}
@media (max-width: 768px) {
  .grid-5, .grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Internal link sections */
.related-links {
  margin-top: var(--sp-xl);
  padding-top: var(--sp-l);
  border-top: 1px solid var(--silver);
}
.related-links h3 {
  font-size: 1rem;
  margin-bottom: var(--sp-m);
  color: var(--slate);
}
.related-links__grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-s);
}
.related-links__grid a {
  padding: var(--sp-xs) var(--sp-s);
  background: var(--snow);
  border-radius: var(--r-s);
  font-size: 0.85rem;
  color: var(--ink);
  text-decoration: none;
}
.related-links__grid a:hover {
  background: var(--blue);
  color: var(--white);
}

/* Provider logos */
.provider-logo {
  width: 100px;
  height: 32px;
  object-fit: contain;
}
.provider-logo--square {
  width: 40px;
  height: 40px;
  border-radius: var(--r-s);
}

/* Trust badges */
.trust-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-m);
  padding: var(--sp-m);
  background: var(--snow);
  border-radius: var(--r-m);
  margin-bottom: var(--sp-xl);
  align-items: center;
  justify-content: center;
}
.trust-badge {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 0.85rem;
  color: var(--slate);
}
.trust-badge svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  max-width: 20px;
  flex-shrink: 0;
  color: var(--blue);
}
.trust-badge--verified {
  color: var(--ink);
  font-weight: 500;
}
.trust-badge--verified svg {
  color: #00A67E;
}

/* Data source attribution */
.data-source {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: var(--sp-xs) var(--sp-s);
  background: #f0f7ff;
  border: 1px solid #cce5ff;
  border-radius: var(--r-s);
  font-size: 0.75rem;
  color: #004085;
}
.data-source img {
  height: 14px;
}

/* Affiliate disclosure */
.affiliate-notice {
  font-size: 0.75rem;
  color: var(--slate);
  padding: var(--sp-s);
  background: var(--snow);
  border-radius: var(--r-s);
  margin-top: var(--sp-m);
}

/* Updated deal card with logo */
.deal-card__logo {
  margin-bottom: var(--sp-s);
}
