/* ---- Base reset ---------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; height: auto; display: block; }

/* ---- Theme tokens (Light default) --------------------------------------- */
:root{
  /* Higher-contrast light palette */
  --bg: #ffffff;              /* page background */
  --bg-muted: #f6f8fb;        /* section bands */
  --surface: #ffffff;         /* cards */
  --text: #0b1220;            /* near-black */
  --muted: #5b6472;           /* readable on white (≥4.5:1) */
  --border: #e5eaf0;
  --brand: #0b5fff;           /* deep blue */
  --brand-700: #0947c9;
  --accent: #22c55e;
  --chip-bg: #eef2ff;
  --chip-text: #0b2b6b;
  --chip-border: #cdd7ff;
  --placeholder: #7a8494;     /* darker so it’s visible */
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04);
  --shadow-md: 0 8px 24px rgba(16,24,40,.08);
}

/* ---- Dark mode ---------------------------------------------------------- */
@media (prefers-color-scheme: dark){
  :root{
    --bg: #0b1220;
    --bg-muted: #0e162a;
    --surface: #0f172a;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #1f2937;
    --brand: #60a5fa;
    --brand-700: #3b82f6;
    --chip-bg: rgba(96,165,250,.12);
    --chip-text: #dbeafe;
    --chip-border: rgba(96,165,250,.35);
    --placeholder: #a3adc2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.30);
    --shadow-md: 0 8px 24px rgba(0,0,0,.35);
  }
}

/* ---- Typography ---------------------------------------------------------- */
body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3{
  line-height: 1.15;
  margin: 0 0 .5rem 0;
  letter-spacing: -0.01em;
}
h1{ font-size: clamp(1.8rem, 2vw + 1.2rem, 2.4rem); }
h2{ font-size: clamp(1.3rem, 1.2vw + 1rem, 1.6rem); margin-top: 1.25rem; }
h3{ font-size: 1.1rem; margin-top: .25rem; }

p{ margin: .25rem 0 .75rem; }
a{
  color: var(--brand);
  text-decoration: underline;              /* make links obvious */
  text-underline-offset: 2px;
}
a:hover{ color: var(--brand-700); }

/* ---- Layout -------------------------------------------------------------- */
.container{
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px clamp(16px, 3vw, 28px);
}

header{
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
header .container{ padding-top: 18px; padding-bottom: 14px; }
nav a{ margin-right: 12px; color: var(--muted); }
nav a:hover{ color: var(--brand); }

.section{
  background: var(--bg-muted);
  border-radius: var(--radius);
  padding: 16px;
}

footer{
  border-top: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
}
footer .container{ padding-top: 24px; padding-bottom: 28px; }

/* ---- Utilities ----------------------------------------------------------- */
.muted{ color: var(--muted); }
.max-w-readable{ max-width: 72ch; }
.centered{ margin-left: auto; margin-right: auto; }

.ad{
  border: 1px dashed var(--border);
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  margin: 18px 0 22px;
}

/* Responsive grid for cards/links */
.grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 12px 0 10px;
}

/* ---- Inputs -------------------------------------------------------------- */
input, textarea, select, .input, .search-input{
  background: #fff;
  color: var(--text);
  border: 1px solid #cfd6e4;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
::placeholder{ color: var(--placeholder); }

/* ---- Buttons ------------------------------------------------------------- */
.btn, .button, button.primary{
  display: inline-block;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff !important;
  font-weight: 700;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: transform .08s ease, box-shadow .08s ease, background .08s ease;
  line-height: 1.1;
  cursor: pointer;
}
.btn:hover, .button:hover, button.primary:hover{
  background: var(--brand-700);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ---- Chips / Pills ------------------------------------------------------- */
.chips{ display: flex; flex-wrap: wrap; gap: 10px; }
.chip, .pill{
  background: var(--chip-bg);
  color: var(--chip-text);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}
.chip:hover, .pill:hover{ box-shadow: var(--shadow-sm); }
.chip[aria-disabled="true"], .pill[aria-disabled="true"],
.chip.disabled, .pill.disabled{ opacity: .55; cursor: not-allowed; }

/* ---- Cards & lists ------------------------------------------------------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(11,95,255,.35);
}
.card h3{ margin-bottom: .35rem; }

a.card{
  display: block;
  font-weight: 700;
  color: var(--text);
}
a.card small{ color: var(--muted); font-weight: 500; }

/* Simple list styling used by sections */
.list{ list-style: none; padding: 0; margin: 0; }
.list li{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 10px 0;
}
.badge{
  display: inline-block;
  font-size: .75rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(11,95,255,.10);
  color: var(--brand-700);
  border: 1px solid rgba(11,95,255,.25);
}

/* ---- Tables -------------------------------------------------------------- */
.table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.table th, .table td{ padding: 10px 12px; vertical-align: top; }
.table thead th{
  text-align: left;
  background: #eef2f7;      /* clearer header band on light */
  color: var(--text);
  font-weight: 700;
}
.table tr + tr td{ border-top: 1px solid var(--border); }
.table-wrapper{ overflow-x: auto; }

/* ---- Cookie banner tweaks ----------------------------------------------- */
#cookie-banner{
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

/* ---- Small screens ------------------------------------------------------- */
@media (max-width: 640px){
  .ad{ padding: 18px; }
}

/* === Town page helpers (grid + buttons) ================================== */
.grid-2{
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 780px){
  .grid-2{ grid-template-columns: 1fr 1fr; }
}
.card .actions{ margin-top: 10px; }

/* Make long tables scroll on small screens (wrapper is in section.html) */
.table-wrapper{ overflow-x: auto; }

/* ---- Share (high-contrast) ---------------------------------------------- */
.sharebar .shr,
.sharebar .share-item {
  color: #111 !important;
  font-weight: 700;
  text-decoration: none;
  background: #fff;
  border: 1px solid #cfcfcf;
}
.sharebar .share-item:visited { color: #111 !important; }
.sharebar .shr:hover,
.sharebar .share-item:hover { background: #f3f3f3; }
.sharebar .shr:focus,
.sharebar .share-item:focus {
  outline: 2px solid #111; outline-offset: 2px;
}
.share-menu {
  background: #fff;
  color: #111;
  border: 1px solid #cfcfcf;
}

/* Force readability within share area */
.sharebar, .sharebar * {
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
}

/* Dropdown trigger */
.share-dropdown summary.shr {
  color: #111 !important;
  font-weight: 700 !important;
  background: #fff !important;
  border: 1px solid #cfcfcf !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
}

/* Dropdown panel */
.share-menu {
  background: #fff !important;
  color: #111 !important;
  border: 1px solid #cfcfcf !important;
  box-shadow: 0 6px 20px rgba(0,0,0,.12) !important;
  border-radius: 10px !important;
}

/* Dropdown items */
.share-menu .share-item {
  color: #111 !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 8px !important;
}
.share-menu .share-item:hover,
.share-menu .share-item:focus {
  background: #f3f3f3 !important;
}

/* Kill purple visited link color in dark themes */
.sharebar a:link,
.sharebar a:visited,
.sharebar a:active,
.sharebar a:hover {
  color: #111 !important;
}
/* ===== Light-mode HOT FIXES (place at very end of styles.css) ============ */
@media (prefers-color-scheme: light) {
  /* 1) Search bar: make it readable on light backgrounds */
  .searchbar input,
  .search input,
  input[type="search"],
  .search-input {
    background: #ffffff !important;
    color: var(--text) !important;
    border: 1px solid #cfd6e4 !important;
    border-radius: 14px !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 14px 16px !important;
  }
  .searchbar input::placeholder,
  .search input::placeholder,
  input[type="search"]::placeholder,
  .search-input::placeholder {
    color: var(--placeholder) !important;
  }

  /* 2) Category chips row under the search box */
  /* Works whether you used .chips/.chip or plain links */
  .chips a,
  .chips .chip,
  .chip,
  .pill,
  .category-pills a,
  .quick-actions a,
  .hero-actions a {
    background: var(--chip-bg) !important;
    color: var(--chip-text) !important;
    border: 1px solid var(--chip-border) !important;
    border-radius: 999px !important;
    padding: 8px 12px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    text-decoration: none !important;
    box-shadow: var(--shadow-sm) !important;
    opacity: 1 !important;                 /* kill “disabled” look */
    mix-blend-mode: normal !important;
    -webkit-text-fill-color: var(--chip-text) !important;
  }
  .chips a:hover,
  .chip:hover,
  .pill:hover,
  .category-pills a:hover,
  .quick-actions a:hover,
  .hero-actions a:hover {
    box-shadow: var(--shadow-sm) !important;
    filter: none !important;
  }

  /* Only dim if truly disabled */
  .chip[aria-disabled="true"],
  .pill[aria-disabled="true"] {
    opacity: .55 !important;
    cursor: not-allowed !important;
  }

  /* 3) Make sure links are visibly links */
  a { text-decoration: underline; text-underline-offset: 2px; }
  a:hover { color: var(--brand-700); }
}

/* 4) Last resort: if any parent set low opacity on the whole row, null it */
.category-pills, .quick-actions, .hero-actions, .chips {
  opacity: 1 !important;
  filter: none !important;
}

