/* Inspired by municipal sites — clean header, strong contrast, accessible focus */

:root {
  --fern-green: #1a5f4a;
  --fern-green-dark: #134538;
  --fern-accent: #2d8a6e;
  --text: #1c1c1c;
  --muted: #4a4a4a;
  --bg: #f6f7f8;
  --white: #ffffff;
  --border: #d9dde2;
  --link: #0b5cab;
  --danger: #b00020;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a {
  color: var(--link);
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--fern-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--fern-green);
  color: var(--white);
}

.skip-link:focus {
  left: 0;
}

.site-header {
  background: var(--fern-green);
  color: var(--white);
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
  color: inherit;
}

.brand-with-logo {
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
}

.brand-mark {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
  opacity: 0.95;
}

.brand-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.9;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}

.main-nav a {
  color: var(--white);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
}

.main-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.main-nav a.is-active {
  background: rgba(255, 255, 255, 0.2);
}

.main-nav .nav-sep {
  opacity: 0.45;
  user-select: none;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--white);
  color: var(--fern-green);
}

.btn-primary:hover {
  filter: brightness(0.97);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.hero {
  background: linear-gradient(135deg, var(--fern-green-dark) 0%, var(--fern-green) 55%, var(--fern-accent) 100%);
  color: var(--white);
  padding: 2.5rem 1.25rem 2.75rem;
}

.hero--home {
  padding: 1.25rem 1.25rem 1.4rem;
}

.hero-inner {
  max-width: 1120px;
  margin: 0 auto;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.15;
}

.hero--home .hero-home-headline {
  margin: 0;
  max-width: 52rem;
  font-size: clamp(1.2rem, 2.5vw, 1.65rem);
  font-weight: 700;
  line-height: 1.4;
  opacity: 0.98;
}

.hero--home .hero-home-headline--fallback {
  font-size: clamp(1.5rem, 3.25vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
}

.hero-lead {
  margin: 0;
  max-width: 52rem;
  font-size: 1.05rem;
  opacity: 0.95;
}

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.home-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.home-sections .home-block-intro {
  max-width: 52rem;
  align-self: stretch;
}

.home-sections .home-block-calendar,
.home-sections .home-block-quick,
.home-sections .poll-sidebar {
  align-self: stretch;
  max-width: 100%;
}

/* Stack intro / calendar / quick when the poll uses a sibling column (see home.ejs). */
.home-main-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
  align-self: stretch;
}

@media (max-width: 959px) {
  .home-sections--poll-first .poll-sidebar {
    order: -1;
  }
}

/* Large screens: one grid row = main stack | poll (no row-spanning, so sections stack tightly). */
@media (min-width: 960px) {
  .home-sections--with-poll {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 1.5rem 2rem;
    align-items: start;
  }

  .home-sections--with-poll > .home-main-column {
    grid-column: 1;
    align-self: start;
    width: 100%;
  }

  .home-sections--with-poll > .poll-sidebar {
    grid-column: 2;
    align-self: start;
    width: 100%;
    max-width: none;
    position: sticky;
    top: 1rem;
  }
}

.poll-widget.card {
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(26, 95, 74, 0.14);
  box-shadow:
    0 12px 40px rgba(19, 69, 56, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  background: linear-gradient(180deg, #fff 0%, #fafcfb 100%);
}

.poll-widget-header {
  padding: 1.35rem 1.4rem 1.45rem;
  background: linear-gradient(135deg, var(--fern-green-dark) 0%, var(--fern-green) 42%, var(--fern-accent) 100%);
  color: #fff;
}

.poll-widget-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  margin-bottom: 0.5rem;
}

.poll-widget-title {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.poll-widget-question {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.45;
  opacity: 0.95;
  font-weight: 500;
}

.poll-alert {
  margin: 1rem 1.35rem 0;
  padding: 0.7rem 0.95rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.poll-alert-success {
  background: rgba(232, 245, 241, 0.95);
  color: var(--fern-green-dark);
  border: 1px solid #b8e0d2;
}

.poll-alert-error {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6cb;
}

.poll-panel {
  padding: 1.25rem 1.4rem;
  border-top: 1px solid var(--border);
}

.poll-panel-results {
  background: linear-gradient(180deg, transparent 0%, rgba(232, 245, 241, 0.4) 100%);
}

.poll-panel-title {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fern-green-dark);
}

.poll-chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  padding: 0.25rem 0 0.5rem;
}

.poll-chart-block {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(0, 1.2fr);
  gap: 1.25rem 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

@media (max-width: 420px) {
  .poll-chart-block {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .poll-chart-legend {
    width: 100%;
    max-width: 16rem;
  }
}

.poll-donut-wrap {
  position: relative;
  width: 168px;
  height: 168px;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 16px rgba(19, 69, 56, 0.18));
}

.poll-donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.poll-donut--empty {
  background: conic-gradient(from 0deg, #e8eef0 0%, #dce6e2 40%, #e8eef0 100%);
}

.poll-donut-center {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.poll-donut-total {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--fern-green-dark);
  line-height: 1;
}

.poll-donut-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0.15rem;
}

.poll-chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.poll-chart-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.88rem;
}

.poll-chart-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 0.2rem;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.poll-chart-legend-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.poll-chart-legend-label {
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.poll-chart-legend-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.poll-details {
  margin-top: 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem 0.65rem;
}

.poll-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--fern-green);
  padding: 0.35rem 0;
  list-style-position: outside;
}

.poll-details summary:hover {
  text-decoration: underline;
}

.poll-details + .poll-details {
  margin-top: 0.5rem;
}

.poll-form .poll-field {
  margin-bottom: 0.85rem;
}

.poll-form label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.poll-form input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.poll-form input[type="text"]:focus {
  border-color: var(--fern-accent);
  box-shadow: 0 0 0 3px rgba(45, 138, 110, 0.18);
  outline: none;
}

.poll-options-fieldset {
  border: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.poll-legend {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.poll-choice-card {
  display: block;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.poll-choice-card:last-of-type {
  margin-bottom: 0;
}

.poll-choice-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.poll-choice-card-body {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.poll-choice-card:hover .poll-choice-card-body {
  border-color: rgba(45, 138, 110, 0.45);
  background: rgba(232, 245, 241, 0.35);
}

.poll-choice-card input:focus-visible + .poll-choice-card-body {
  outline: 3px solid var(--fern-accent);
  outline-offset: 2px;
}

.poll-choice-card input:checked + .poll-choice-card-body {
  border-color: var(--fern-green);
  background: rgba(232, 245, 241, 0.65);
  box-shadow: 0 0 0 1px rgba(26, 95, 74, 0.12);
}

.poll-choice-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.poll-choice-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.poll-submit {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--fern-accent) 0%, var(--fern-green) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(26, 95, 74, 0.35);
}

.poll-submit:hover {
  filter: brightness(1.06);
}

.poll-submit-secondary {
  background: linear-gradient(180deg, #3d8f75 0%, var(--fern-green-dark) 100%);
  box-shadow: 0 2px 8px rgba(19, 69, 56, 0.3);
}

.poll-form-inline {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.poll-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.65rem;
  line-height: 1.45;
}

.poll-muted {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.45;
}

.poll-by-option {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.poll-option-block {
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
}

.poll-option-title {
  color: var(--text);
}

.poll-count {
  color: var(--muted);
  font-weight: 600;
}

.poll-voter-names {
  margin: 0.35rem 0 0 0.75rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.poll-log {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.82rem;
  color: var(--text);
  max-height: 12rem;
  overflow-y: auto;
}

.poll-log li {
  margin-bottom: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: baseline;
}

.poll-log-name {
  font-weight: 600;
}

.poll-log-sep {
  color: var(--muted);
}

.poll-log-choice {
  color: var(--fern-green);
  font-weight: 600;
}

.poll-log-time {
  color: var(--muted);
  font-size: 0.76rem;
  width: 100%;
}

.poll-panel-add {
  background: rgba(246, 247, 248, 0.8);
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.35rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin-top: 0;
  font-size: 1.35rem;
  color: var(--fern-green-dark);
}

.prose {
  max-width: 52rem;
}

.prose p:first-child {
  margin-top: 0;
}

.quick-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 0;
}

.quick-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.quick-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

.quick-card strong {
  display: block;
  color: var(--fern-green);
  margin-bottom: 0.25rem;
}

.calendar-widget {
  margin-top: 0;
  margin-bottom: 0;
  border-left: 4px solid var(--fern-accent);
}

.calendar-widget-head {
  margin-bottom: 1rem;
}

.calendar-widget h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  color: var(--fern-green-dark);
}

.calendar-widget-sub {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.calendar-widget-error {
  margin: 0;
  font-size: 0.9rem;
  color: var(--danger);
}

.calendar-widget-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.calendar-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.calendar-event {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.calendar-event:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.calendar-event-title {
  font-weight: 700;
  color: var(--fern-green);
  text-decoration: none;
}

.calendar-event-title:hover {
  text-decoration: underline;
}

span.calendar-event-title {
  color: var(--text);
}

.calendar-event-when {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.calendar-event-detail {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Standalone site gate (no main chrome) */
.site-gate-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(160deg, var(--fern-green-dark) 0%, var(--fern-green) 45%, var(--bg) 45%);
}

.site-gate-brand {
  text-align: center;
  color: #fff;
  margin-bottom: 1.5rem;
}

.site-gate-brand-with-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.site-gate-logo {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.site-gate-brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.site-gate-brand .brand-kicker {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 0.35rem;
}

.site-gate-brand .brand-title {
  font-size: 1.5rem;
  font-weight: 800;
}

.site-gate-main {
  width: 100%;
  max-width: 28rem;
  padding: 1.75rem 1.5rem;
}

.site-gate-heading {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  color: var(--fern-green-dark);
}

.site-gate-lead {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.site-gate-submit {
  background: var(--fern-green) !important;
  color: #fff !important;
  width: 100%;
  padding: 0.55rem 1rem;
}

.site-footer {
  margin-top: auto;
  background: #2b2f33;
  color: #e8eaed;
  padding: 2rem 1.25rem;
  font-size: 0.9rem;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}

.footer-meta {
  opacity: 0.85;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.footer-links a {
  color: #fff;
}

.footer-links button.footer-btn-link {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
}

.footer-links button.footer-btn-link:hover {
  opacity: 0.9;
}

.form-stack label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.form-stack input[type="password"],
.form-stack input[type="text"],
.form-stack textarea {
  width: 100%;
  max-width: 28rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}

.form-stack textarea.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  max-width: 100%;
  min-height: 120px;
}

.form-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.alert-error {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6cb;
}

.alert-success {
  background: #e8f5f1;
  color: var(--fern-green-dark);
  border: 1px solid #b8e0d2;
}

.admin-grid {
  display: grid;
  gap: 1.25rem;
}

.admin-grid textarea.code.large {
  min-height: 220px;
}

@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-nav {
    width: 100%;
  }
}
