/* Twin Township Ambulance — site styles.
   Brand palette derived from the TTA logo & patch.
   Color pairings re-checked at WCAG AA (see DEVELOPMENT_PLAN.md, Phase 6). */

:root {
  --tta-primary: #0e5a68;      /* deep petrol teal (wordmark) */
  --tta-primary-dark: #0a454f;
  --tta-secondary: #1f7a8c;    /* banner teal */
  --tta-accent: #1e6fb8;       /* ECG blue — focus rings, small accents */
  --tta-ink: #1a1f23;          /* charcoal body text */
  --tta-muted: #5b6670;
  --tta-line: #d7dbde;
  --tta-bg: #ffffff;
  --tta-bg-alt: #f3f6f7;
  --tta-urgent: #b3261e;       /* urgent notice */

  --bs-primary: var(--tta-primary);
  --bs-link-color: var(--tta-primary);
  --bs-link-hover-color: var(--tta-primary-dark);
}

body {
  color: var(--tta-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

h1, h2, h3, h4 { font-weight: 700; color: var(--tta-ink); }
a { color: var(--tta-primary); }
a:hover { color: var(--tta-primary-dark); }

/* ---- Accessibility helpers ---- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1080;
  background: var(--tta-primary); color: #fff; padding: .6rem 1rem;
  border-radius: 0 0 .5rem 0; text-decoration: none;
}
.skip-link:focus { left: 0; }

a:focus-visible, button:focus-visible, .btn:focus-visible,
.form-control:focus-visible, .form-select:focus-visible, .nav-link:focus-visible,
.accordion-button:focus-visible {
  outline: 3px solid var(--tta-accent);
  outline-offset: 2px;
}

/* ---- Top utility bar ---- */
.topbar { background: var(--tta-primary-dark); color: #e0eff1; font-size: .9rem; }
.topbar .container { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; justify-content: space-between; padding: .45rem 0; }
.topbar a { color: #fff; text-decoration: none; font-weight: 600; }
.topbar a:hover { text-decoration: underline; }

/* ---- Header / nav ---- */
.site-header { background: #fff; border-bottom: 3px solid var(--tta-primary); }
.navbar-brand .brand-mark {
  display: inline-flex; width: 2rem; height: 2rem; align-items: center; justify-content: center;
  background: var(--tta-primary); color: #fff; border-radius: .4rem; font-weight: 700;
}
.navbar-brand .brand-text { font-weight: 700; color: var(--tta-primary); }
.nav-link { color: var(--tta-ink); font-weight: 600; }
.nav-link:hover, .nav-link.active { color: var(--tta-primary); }
.site-header .nav-link.active { box-shadow: inset 0 -3px 0 var(--tta-primary); }

/* ---- Buttons ---- */
.btn-primary { background: var(--tta-primary); border-color: var(--tta-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--tta-primary-dark); border-color: var(--tta-primary-dark); }
.btn-outline-primary { color: var(--tta-primary); border-color: var(--tta-primary); }
.btn-outline-primary:hover { background: var(--tta-primary); border-color: var(--tta-primary); }
.btn-paybill { background: var(--tta-secondary); color: #fff; font-weight: 600; }
.btn-paybill:hover, .btn-paybill:focus { background: var(--tta-primary); color: #fff; }

/* ---- Hero (home) ---- */
.hero {
  position: relative; overflow: hidden; color: #fff; padding: 4.5rem 0 5.5rem;
  background:
    radial-gradient(900px 420px at 82% -20%, rgba(46, 140, 158, .55), transparent 60%),
    linear-gradient(135deg, var(--tta-primary), var(--tta-primary-dark));
}
.hero > .container { position: relative; z-index: 1; }
.hero::after { /* faint Star-of-Life watermark */
  content: ""; position: absolute; right: -60px; top: 50%; transform: translateY(-50%);
  width: 420px; height: 420px; opacity: .07; pointer-events: none; z-index: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='%23fff'%3E%3Crect x='27' y='11' width='10' height='42' rx='3'/%3E%3Crect x='11' y='27' width='42' height='10' rx='3' transform='rotate(60 32 32)'/%3E%3Crect x='11' y='27' width='42' height='10' rx='3' transform='rotate(120 32 32)'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.hero-eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; font-weight: 700; color: rgba(255, 255, 255, .85); margin-bottom: .75rem; }
.hero-title { color: #fff; font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; line-height: 1.08; letter-spacing: -.015em; margin-bottom: 1rem; max-width: 20ch; }
.hero-lead { font-size: 1.2rem; max-width: 40rem; color: rgba(255, 255, 255, .92); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.75rem 0 1rem; }
.hero .btn-light { color: var(--tta-primary); font-weight: 700; }
.hero .btn-outline-light { border-width: 2px; font-weight: 600; }
.hero-emergency { display: inline-block; margin-top: .75rem; padding: .4rem .9rem; border-radius: 2rem; background: rgba(255, 255, 255, .12); font-size: .9rem; }
/* Hero split layout — the photo column renders only when a hero photo is configured */
.hero-grid { display: grid; gap: 2rem; align-items: center; }
.hero-photo { display: none; }
.hero-photo img { width: 100%; max-height: 22rem; object-fit: cover; border-radius: 1rem; box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .25); }
@media (min-width: 992px) {
  .hero--with-photo .hero-grid { grid-template-columns: 1.15fr .85fr; }
  .hero--with-photo .hero-photo { display: block; }
  .hero--with-photo::after { display: none; } /* hide the watermark behind the real photo */
  .hero--with-photo .hero-title, .hero--with-photo .hero-lead { max-width: none; }
}
/* Center the hero copy (eyebrow, headline, lead, buttons, 911 pill) within its column */
.hero-copy { text-align: center; }
.hero-copy .hero-title,
.hero-copy .hero-lead { margin-left: auto; margin-right: auto; }
.hero-copy .hero-actions { justify-content: center; }

/* ---- Interior page header ---- */
.page-header { background: var(--tta-bg-alt); border-bottom: 1px solid var(--tta-line); padding: 2rem 0; }
.page-header h1 { margin: 0; }
.page-subtitle { color: var(--tta-muted); margin: .5rem 0 0; font-size: 1.1rem; max-width: 52rem; }

/* ---- Sections ---- */
.section { padding: 3rem 0; }
.section-tight { padding: 2rem 0; }
.section-alt { background: var(--tta-bg-alt); }
.section-lead { font-size: 1.15rem; color: var(--tta-muted); max-width: 52rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 700; color: var(--tta-secondary); }

/* ---- Quick links (home) ---- */
.quicklink {
  display: block; height: 100%; text-align: center; text-decoration: none; color: var(--tta-ink);
  background: var(--tta-bg-alt); border: 1px solid var(--tta-line); border-radius: .75rem; padding: 1.5rem 1rem;
  transition: transform .12s ease, border-color .12s ease, color .12s ease;
}
.quicklink:hover { transform: translateY(-2px); border-color: var(--tta-secondary); color: var(--tta-primary); box-shadow: 0 .5rem 1rem rgba(14, 90, 104, .08); }
.quicklink-icon { display: block; font-size: 1.7rem; line-height: 1; margin-bottom: .5rem; }
.quicklink-title { font-weight: 700; }
/* Quick-link cards sit just below the hero with a slight layered overlap */
.quicklinks-section { position: relative; z-index: 2; margin-top: -1.5rem; }
@media (max-width: 575.98px) { .quicklinks-section { margin-top: -1rem; } }

/* ---- Generic cards ---- */
.card-tta { background: #fff; border: 1px solid var(--tta-line); border-radius: .85rem; padding: 1.5rem; height: 100%; }
.card-tta h3 { font-size: 1.2rem; margin-bottom: .5rem; color: var(--tta-primary); }
.card-icon {
  width: 3rem; height: 3rem; border-radius: .6rem; background: var(--tta-bg-alt); color: var(--tta-primary);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: .85rem;
}
.value-card { border-left: 4px solid var(--tta-secondary); }
.value-card h3 { color: var(--tta-ink); }

/* ---- Checklist ---- */
.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li { padding-left: 1.75rem; position: relative; margin-bottom: .5rem; }
.feature-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--tta-secondary); font-weight: 700; }

/* ---- Article cards ---- */
.article-card { display: flex; flex-direction: column; height: 100%; background: #fff; border: 1px solid var(--tta-line); border-radius: .85rem; overflow: hidden; }
.article-card .thumb { aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--tta-secondary), var(--tta-primary)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2rem; }
.article-card .body { padding: 1.25rem; display: flex; flex-direction: column; flex: 1; }
.article-card .cat { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tta-secondary); font-weight: 700; }
.article-card h3 { font-size: 1.15rem; margin: .35rem 0; }
.article-card h3 a { color: var(--tta-ink); text-decoration: none; }
.article-card h3 a:hover { color: var(--tta-primary); }
.article-card .meta { color: var(--tta-muted); font-size: .85rem; margin-top: auto; }

/* ---- Job cards ---- */
.job-card { background: #fff; border: 1px solid var(--tta-line); border-radius: .85rem; padding: 1.5rem; }
.job-card .badges { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.badge-tta { background: var(--tta-bg-alt); color: var(--tta-primary); border: 1px solid var(--tta-line); border-radius: 2rem; padding: .25rem .75rem; font-size: .85rem; font-weight: 600; }
.badge-tta.active { background: var(--tta-primary); color: #fff; border-color: var(--tta-primary); }

/* ---- Stats ---- */
.stat { text-align: center; }
.stat .num { font-size: 2.25rem; font-weight: 800; color: var(--tta-primary); line-height: 1; }
.stat .label { color: var(--tta-muted); font-size: .95rem; }

/* ---- CTA band ---- */
.cta-band { background: linear-gradient(135deg, var(--tta-primary), var(--tta-primary-dark)); color: #fff; border-radius: 1rem; padding: 2.5rem; }
.cta-band h2 { color: #fff; }
.cta-band .btn-outline-light { border-width: 2px; }

/* ---- Notice banner (sitewide, Phase 3) ---- */
.notice-banner { padding: .85rem 0; }
.notice-banner.is-urgent { background: var(--tta-urgent); color: #fff; }
.notice-banner.is-urgent a { color: #fff; text-decoration: underline; }
.notice-banner.is-routine { background: #eaf3f5; color: var(--tta-ink); border-bottom: 1px solid var(--tta-line); }
.notice-banner.is-pinned { background: var(--tta-primary); color: #fff; }
.notice-banner.is-pinned a { color: #fff; text-decoration: underline; }
.notice-banner .container { display: flex; align-items: center; gap: 1rem; }
.notice-banner .btn-close-notice { margin-left: auto; background: transparent; border: 0; color: inherit; font-size: 1.4rem; line-height: 1; opacity: .85; cursor: pointer; }
.notice-banner .btn-close-notice:hover { opacity: 1; }

/* ---- Notice list items (notices page) ---- */
.notice-item { border: 1px solid var(--tta-line); border-left-width: 5px; border-radius: .6rem; padding: 1.1rem 1.25rem; background: #fff; margin-bottom: 1rem; }
.notice-item.is-urgent { border-left-color: var(--tta-urgent); }
.notice-item.is-routine { border-left-color: var(--tta-secondary); }
.notice-tag { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .15rem .55rem; border-radius: 2rem; }
.notice-item.is-urgent .notice-tag { background: var(--tta-urgent); color: #fff; }
.notice-item.is-routine .notice-tag { background: var(--tta-bg-alt); color: var(--tta-primary); }
.notice-date { color: var(--tta-muted); font-size: .85rem; }

/* ---- Forms ---- */
.form-required { color: var(--tta-urgent); }
.form-note { color: var(--tta-muted); font-size: .9rem; }

/* ---- Gallery placeholder ---- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.gallery-grid .ph { aspect-ratio: 4 / 3; border-radius: .6rem; background: linear-gradient(135deg, var(--tta-secondary), var(--tta-primary)); opacity: .85; }
.gallery-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .6rem; display: block; }

/* ---- Photo gallery ---- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.photo-item { position: relative; display: block; overflow: hidden; border-radius: .6rem; aspect-ratio: 1 / 1; background: var(--tta-bg-alt); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.photo-item:hover img, .photo-item:focus-visible img { transform: scale(1.06); }
.photo-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: .85rem .55rem .4rem; color: #fff; font-size: .8rem; line-height: 1.25; pointer-events: none; background: linear-gradient(to top, rgba(0,0,0,.8), rgba(0,0,0,.45) 55%, rgba(0,0,0,0)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); display: flex; align-items: center; justify-content: center; z-index: 1090; padding: 2rem; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 95%; max-height: 85vh; border-radius: .4rem; display: block; margin: 0 auto; }
.lightbox-figure { margin: 0; max-width: 95%; }
.lightbox-figure figcaption { color: #fff; text-align: center; margin-top: .6rem; font-size: .95rem; }
.lightbox-close { position: absolute; top: 1rem; right: 1.25rem; background: transparent; border: 0; color: #fff; font-size: 2.5rem; line-height: 1; cursor: pointer; }

/* ---- Team ---- */
.team-card { display: flex; flex-direction: column; }
.team-photo { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: .75rem; }
.avatar-initials { display: flex; align-items: center; justify-content: center; background: var(--tta-secondary); color: #fff; font-weight: 800; font-size: 2.25rem; }
.team-role { color: var(--tta-secondary); font-weight: 600; margin: .15rem 0 .5rem; }
.team-bio { color: var(--tta-muted); font-size: .95rem; }

/* ---- Map ---- */
.map-embed { width: 100%; border: 0; border-radius: .85rem; aspect-ratio: 16 / 9; }

/* ---- Prose (article body) ---- */
.prose { max-width: 46rem; }
.prose p, .prose li { font-size: 1.075rem; }
.prose h2 { margin-top: 2rem; font-size: 1.4rem; }
.prose img { max-width: 100%; height: auto; border-radius: .6rem; }

/* ---- Accordion brand tweak ---- */
.accordion-button:not(.collapsed) { background: var(--tta-bg-alt); color: var(--tta-primary); }
.accordion-button:focus { box-shadow: 0 0 0 .25rem rgba(30, 111, 184, .3); }

/* ---- Breadcrumb ---- */
.breadcrumb-wrap { color: var(--tta-muted); font-size: .95rem; margin-bottom: .5rem; }
.breadcrumb-wrap a { color: var(--tta-primary); text-decoration: none; }
.breadcrumb-wrap a:hover { text-decoration: underline; }

/* ---- Footer ---- */
.site-footer { background: var(--tta-ink); color: #cfd6db; padding: 3rem 0 1.5rem; margin-top: 3rem; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-brand { font-weight: 800; color: #fff; font-size: 1.15rem; }
.footer-tag { color: #9fb6bd; }
.footer-h { font-size: .95rem; text-transform: uppercase; letter-spacing: .08em; color: #9fb6bd; margin-bottom: .75rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .4rem; }
.footer-contact { font-style: normal; line-height: 1.7; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .15); margin-top: 2rem; padding-top: 1rem; color: #9fb6bd; }

/* ---- Admin backend ---- */
.admin-body { background: var(--tta-bg-alt); }
.admin-navbar { background: var(--tta-primary-dark); }
.admin-navbar .navbar-brand { color: #fff; font-weight: 700; }
.navbar-text-link { color: #fff; text-decoration: none; }
.navbar-text-link:hover { text-decoration: underline; }
.login-card { max-width: 420px; margin: 3rem auto; }
.admin-stat { display: block; padding: 1.25rem; background: #fff; border: 1px solid var(--tta-line); border-radius: .85rem; text-decoration: none; color: var(--tta-ink); height: 100%; }
.admin-stat:hover { border-color: var(--tta-secondary); color: var(--tta-primary); }
.admin-stat .num { font-size: 2rem; font-weight: 800; color: var(--tta-primary); line-height: 1; }
.admin-stat .label { color: var(--tta-muted); }
.admin-table th { white-space: nowrap; }
.drag-handle { cursor: grab; user-select: none; color: var(--tta-muted); font-size: .8rem; font-weight: 600; margin-bottom: .4rem; }
.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: .4; }
.sortable-chosen .card-tta { border-color: var(--tta-secondary); }

/* ---- Motion ---- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
