/* =========================================================================
   City of Clyde Information Portal - info.clydeohio.org
   Hand-written, dependency-free, accessible by construction.

   Palette grounded in the city seal navy + government-standard neutrals.
   All text/background pairs verified for WCAG 2.1 AA contrast.
   Re-skinning is a variable swap below; nothing else hardcodes a color.
   ========================================================================= */

:root {
  /* Brand (from the city seal) */
  --navy:        #14406e;  /* primary brand; white text on it = 8.6:1 (AA/AAA) */
  --navy-dark:   #0e2f52;  /* top utility bar, footer */
  --navy-deep:   #0a2440;  /* footer base */
  --link:        #155293;  /* links on white = 5.6:1 (AA) */
  --link-hover:  #0e3a6b;

  /* Neutrals */
  --ink:         #1b2733;  /* body text on white = 13.5:1 */
  --muted:       #515c69;  /* secondary text on white = 7.0:1 */
  --line:        #d4dae1;  /* borders/dividers */
  --bg:          #ffffff;
  --bg-alt:      #f3f6f9;  /* alternating section background */
  --bg-card:     #ffffff;
  --focus:       #b8841a;  /* focus ring; high contrast on navy and white */

  --maxw: 1140px;
  --radius: 6px;           /* restrained; no bubbly corners */
  --shadow: 0 1px 3px rgba(16, 36, 60, .10);
  --shadow-lift: 0 4px 14px rgba(16, 36, 60, .16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; max-width: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}
/* Nothing should be able to push past the viewport width */
img, audio, video, iframe, table { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; color: var(--ink); font-weight: 700; }
h1 { font-size: 2rem; margin: 0 0 .5rem; }
h2 { font-size: 1.5rem; margin: 0 0 .75rem; }
h3 { font-size: 1.2rem; margin: 0 0 .4rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
img { max-width: 100%; height: auto; }

/* Visible, consistent focus for keyboard users - never removed without replacement */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* Screen-reader-only utility */
.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;
}

/* Skip link - visible on focus */
.skip-link {
  position: absolute; left: .5rem; top: -3rem;
  background: var(--navy); color: #fff; padding: .6rem 1rem;
  border-radius: var(--radius); z-index: 100; transition: top .15s ease;
}
.skip-link:focus { top: .5rem; color: #fff; }

/* ---------- Header ---------- */
.top-bar {
  background: var(--navy-dark); color: #eaf1f8; font-size: .85rem;
}
.top-bar .container { display: flex; align-items: center; justify-content: center; min-height: 34px; text-align: center; }
.top-bar .official { display: inline-flex; align-items: center; gap: .4rem; }

.site-header { background: var(--navy); color: #fff; }
.site-header .container {
  display: flex; align-items: center; gap: 1rem;
  min-height: 84px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: .8rem; color: #fff; text-decoration: none; }
.brand img { width: 56px; height: 56px; display: block; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand .brand-title { font-weight: 700; font-size: 1.15rem; }
.brand .brand-sub   { font-size: .82rem; color: #cfe0f1; }

/* Primary nav */
.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; display: flex; gap: .25rem; margin: 0; padding: 0; flex-wrap: wrap; }
.main-nav a {
  display: block; color: #fff; text-decoration: none;
  padding: .55rem .85rem; border-radius: var(--radius); font-weight: 600; font-size: .95rem;
}
.main-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.main-nav a[aria-current="page"] { background: #fff; color: var(--navy); }

/* Mobile nav toggle (hidden on desktop) */
.nav-toggle {
  display: none; margin-left: auto;
  background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.5);
  border-radius: var(--radius); padding: .45rem .7rem; font: inherit; font-weight: 600; cursor: pointer;
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  .main-nav { flex-basis: 100%; margin-left: 0; display: none; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; padding-bottom: .75rem; }
  .main-nav a { padding: .7rem .5rem; border-radius: 0; border-top: 1px solid rgba(255,255,255,.14); }
}

/* ---------- Hero / search ---------- */
.hero { background: var(--bg-alt); border-bottom: 1px solid var(--line); }
.hero .container { padding-top: 2.25rem; padding-bottom: 2.25rem; }
.hero h1 { margin-bottom: .35rem; }
.hero .lead { color: var(--muted); font-size: 1.1rem; margin-bottom: 1.25rem; }

.search-form { display: flex; gap: .5rem; max-width: 620px; width: 100%; }
.search-form label { flex: 0 0 auto; }
.search-form input[type="search"] {
  flex: 1 1 auto; min-width: 0; font: inherit; padding: .7rem .9rem;
  border: 1px solid #aab4bf; border-radius: var(--radius); color: var(--ink); background: #fff;
}
.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--navy); color: #fff; border: 1px solid var(--navy);
  padding: .7rem 1.1rem; border-radius: var(--radius); text-decoration: none;
}
.btn:hover { background: var(--navy-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--bg-alt); color: var(--navy); }

/* ---------- Main / sections ---------- */
main { display: block; }
.section-pad { padding: 2.25rem 0; }
.section-pad.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Card grid */
.card-grid {
  display: grid; gap: 1.1rem;
  /* min(260px, 100%) prevents overflow when the viewport is narrower than 260px */
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}
.card {
  position: relative;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
/* Whole card is a link target via a stretched anchor; keeps a single semantic link */
.card h3 a { text-decoration: none; color: var(--ink); }
.card h3 a::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.card:hover { cursor: pointer; }
.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); border-color: #b9c4d0; }
.card:focus-within { border-color: var(--navy); }
.card p { color: var(--muted); margin-bottom: .9rem; }
.card .card-more { margin-top: auto; color: var(--link); font-weight: 600; }

/* Most-requested inline list */
.requested { font-size: .95rem; }
.requested ul { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: .5rem 0 0; padding: 0; }
.requested .label { color: var(--muted); font-weight: 600; }

/* Filter bar (meetings, and future list pages) */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 1.5rem;
}
.filter-field { display: flex; flex-direction: column; gap: .25rem; flex: 1 1 12rem; min-width: 0; }
.filter-field label { font-weight: 600; font-size: .9rem; }
.filter-field select {
  font: inherit; padding: .55rem .6rem; width: 100%; min-width: 0; max-width: 100%;
  border: 1px solid #aab4bf; border-radius: var(--radius); background: #fff; color: var(--ink);
}
.filter-bar .btn { flex: 0 0 auto; }

.result-count { color: var(--muted); font-size: .95rem; }

/* Instant "find in results" search (revealed by JS) */
.js-search { margin-bottom: .75rem; display: flex; flex-direction: column; gap: .25rem; }
.js-search label { font-weight: 600; font-size: .9rem; }
.js-search input[type="search"] {
  font: inherit; padding: .6rem .7rem; width: 100%; max-width: 28rem; min-width: 0;
  border: 1px solid #aab4bf; border-radius: var(--radius); background: #fff; color: var(--ink);
}
.no-matches { color: var(--muted); }
.linklike {
  background: none; border: none; padding: 0; font: inherit; color: var(--link);
  text-decoration: underline; cursor: pointer;
}
.linklike:hover { color: var(--link-hover); }

/* Meeting / record lists (shared styling) */
.meeting-list, .record-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.meeting, .record {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; background: #fff;
}
.meeting-head, .record-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; margin: 0 0 .6rem; font-size: 1.1rem; }
.meeting-date, .record-date { font-weight: 700; }
.meeting-type, .record-meta { color: var(--muted); font-weight: 600; font-size: .95rem; }
.meeting-audio { margin: .25rem 0 .6rem; max-width: 480px; }
.meeting-audio audio { width: 100%; min-width: 0; }
.meeting-links, .record-links { margin: 0; }
.leg-desc { margin: .1rem 0 .6rem; }
.muted { color: var(--muted); }

/* Segmented tabs (e.g. Public Safety report type) */
.seg-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem; }
.seg-tab {
  padding: .55rem 1rem; text-decoration: none; color: var(--link); background: #fff;
  font-weight: 600; border-right: 1px solid var(--line);
}
.seg-tab:last-child { border-right: none; }
.seg-tab.active { background: var(--navy); color: #fff; }

/* Calendar (daily calls for service) */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cal-title { margin: 0; font-size: 1.3rem; text-align: center; flex: 1 1 auto; }
.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendar th { padding: .4rem 0; font-size: .8rem; color: var(--muted); text-align: center; border-bottom: 2px solid var(--line); }
.calendar td { border: 1px solid var(--line); height: 60px; padding: 0; vertical-align: top; text-align: center; }
.calendar td.cal-empty { background: var(--bg-alt); }
.cal-day { display: block; padding: .35rem .4rem; font-weight: 600; font-size: .95rem; }
.cal-muted { color: var(--muted); font-weight: 400; }
.calendar td.has-log a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  height: 100%; text-decoration: none; color: var(--navy); background: #e9f1fa;
}
.calendar td.has-log a:hover { background: #d7e6f6; }
.calendar td.has-log .cal-day { padding: 0; }
.cal-tag { font-size: .6rem; font-weight: 700; letter-spacing: .04em; color: var(--link); }

/* New-tab hint */
.ext::after { content: " (opens in a new tab)"; }
.ext .sr-note { /* allow visually-hidden variant if needed */ }

/* Simple data tables */
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
table.data { border-collapse: collapse; width: 100%; }
table.data th, table.data td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-deep); color: #d6e2ee; margin-top: 2.5rem; }
.site-footer a { color: #fff; }
.site-footer .container { padding-top: 2rem; padding-bottom: 2rem; }
.footer-cols { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.site-footer h2 { color: #fff; font-size: 1.05rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: .3rem 0; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15); margin-top: 1.5rem; padding-top: 1rem;
  font-size: .85rem; color: #aebfd0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center;
}
.footer-bottom .seal { width: 40px; height: 40px; }

/* ---------- Small screens: stack filters, full-width controls ---------- */
@media (max-width: 640px) {
  .filter-bar { flex-direction: column; align-items: stretch; gap: .75rem; }
  .filter-field { flex: 1 1 auto; width: 100%; }
  .filter-bar .btn { width: 100%; }
  .js-search input[type="search"] { max-width: 100%; }
  /* Stack the hero search so the button can never push past the viewport */
  .search-form { flex-direction: column; }
  .search-form input[type="search"], .search-form .btn { width: 100%; }
  .hero .container { padding-top: 1.75rem; padding-bottom: 1.75rem; }
  h1 { font-size: 1.6rem; }
  .container { padding: 0 1rem; }
  /* Segmented tabs + calendar on small screens */
  .seg-tabs { display: flex; width: 100%; }
  .seg-tab { flex: 1 1 0; text-align: center; padding: .55rem .4rem; }
  .cal-title { flex-basis: 100%; order: -1; margin-bottom: .25rem; }
  .cal-nav .btn { flex: 1 1 0; text-align: center; padding: .55rem .4rem; }
  .calendar td { height: 46px; }
  .cal-day { padding: .2rem; font-size: .8rem; }
  .cal-tag { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover { transform: none; }
}
