/* CivicPorch — one stylesheet for the site, the clerk app and public portals.
   Palette: haint blue (porch ceilings), town-green ink, clapboard white, notice-pin yellow. */

:root {
  --ink: #16302a;
  --ink-2: #3f5751;
  --ink-3: #6b807a;
  --paper: #f8faf9;
  --surface: #ffffff;
  --sunk: #edf3f1;
  --line: #d6e0dc;
  --line-strong: #b8c8c2;
  --porch: #c4e1dd;
  --porch-deep: #9fcdc7;
  --porch-line: rgba(22, 48, 42, 0.07);
  --green: #1e5b45;
  --green-ink: #174a38;
  --green-soft: #dcefe7;
  --pin: #f2c230;
  --pin-ink: #6b5200;
  --pin-soft: #fff4cc;
  --alarm: #b3261e;
  --alarm-soft: #fbe7e5;
  --shadow: 0 1px 2px rgba(22, 48, 42, 0.08), 0 8px 24px rgba(22, 48, 42, 0.08);

  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 68ch;
  --r: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e4eeea;
    --ink-2: #b3c4be;
    --ink-3: #85988f;
    --paper: #0f1a17;
    --surface: #15231f;
    --sunk: #1a2c27;
    --line: #263b35;
    --line-strong: #37524a;
    --porch: #1c3834;
    --porch-deep: #25504a;
    --porch-line: rgba(228, 238, 234, 0.05);
    --green: #5cc29b;
    --green-ink: #7fd6b3;
    --green-soft: #173a2e;
    --pin-soft: #3a3111;
    --pin-ink: #f2c230;
    --alarm: #ff8a80;
    --alarm-soft: #3d1b18;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.6 var(--sans); font-variant-numeric: tabular-nums;
}
a { color: var(--green-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--pin); outline-offset: 2px; border-radius: 3px; }
img, svg, iframe { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 0.5em; font-weight: 800; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 1.2rem + 3vw, 3.25rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.005em; }
p { margin: 0 0 1em; }
small, .small { font-size: 0.86rem; }
.muted { color: var(--ink-3); }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 58ch; }
code, pre { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code { background: var(--sunk); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--sunk); padding: 1rem; border-radius: var(--r); overflow-x: auto; white-space: pre-wrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--surface); padding: 0.5rem 1rem; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.grid2 { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid3 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

/* ---------- brand + nav ---------- */
.logo { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.logo svg { width: 30px; height: 26px; color: var(--green); }
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar .wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; flex-wrap: wrap; }
.topbar nav { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.topbar nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.topbar nav a.btn { color: #fff; text-decoration: none; }
@media (prefers-color-scheme: dark) { .topbar nav a.btn { color: #0f1a17; } }
.topbar nav a:not(.btn):hover, .topbar nav a:not(.btn)[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--pin); text-decoration-thickness: 3px; }
footer.site { border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; color: var(--ink-3); font-size: 0.9rem; margin-top: 3rem; }
footer.site .cols { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
footer.site h4 { font-size: 0.9rem; color: var(--ink-2); margin-bottom: 0.4rem; }
footer.site ul { list-style: none; padding: 0; margin: 0; }
footer.site li { margin: 0.25rem 0; }
footer.site a { color: var(--ink-3); }

/* ---------- buttons + forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: 700 0.98rem/1 var(--sans); padding: 0.8rem 1.15rem; border-radius: 999px; border: 2px solid var(--green);
  background: var(--green); color: #fff; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--green-ink); border-color: var(--green-ink); }
@media (prefers-color-scheme: dark) { .btn { color: #0f1a17; } }
.btn.ghost { background: transparent; color: var(--green-ink); }
.btn.ghost:hover { background: var(--green-soft); }
.btn.small { padding: 0.5rem 0.85rem; font-size: 0.88rem; }
.btn.danger { background: transparent; border-color: var(--alarm); color: var(--alarm); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--green-ink); text-decoration: underline; cursor: pointer; }
.linkbtn.danger { color: var(--alarm); }

label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 0.3rem; }
.hint { font-weight: 400; color: var(--ink-3); font-size: 0.86rem; }
input:not([type]), input[type=search], input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=url], input[type=number], select, textarea {
  width: 100%; font: 400 1rem/1.4 var(--sans); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: 6px; padding: 0.6rem 0.7rem;
}
textarea { min-height: 7rem; resize: vertical; }
textarea.minutes { min-height: 34rem; font: 400 0.95rem/1.55 var(--mono); }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-soft); }
.field { margin-bottom: 1rem; }
.fields { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.check { display: flex; gap: 0.5rem; align-items: baseline; font-weight: 400; }
.error { background: var(--alarm-soft); color: var(--alarm); padding: 0.7rem 0.9rem; border-radius: 6px; font-weight: 600; }
.flash { background: var(--green-soft); color: var(--green-ink); padding: 0.75rem 1rem; border-radius: 6px; font-weight: 600; margin: 1rem 0; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem 1.35rem; }
.panel + .panel { margin-top: 1.25rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel h2 { font-size: 1.3rem; }
.band { background: var(--sunk); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; color: var(--ink-2); font-size: 0.86rem; }
tr.us td { background: var(--green-soft); font-weight: 600; }
.table-scroll { overflow-x: auto; }

.tag { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--sunk); color: var(--ink-2); }
.tag.ok { background: var(--green-soft); color: var(--green-ink); }
.tag.due { background: var(--pin-soft); color: var(--pin-ink); }
.tag.late { background: var(--alarm-soft); color: var(--alarm); }

/* The posted stamp: yellow pushpin + time. The product's signature mark. */
.posted { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700; font-size: 0.85rem; color: var(--ink); }
.posted::before { content: ""; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6c9 0 18%, var(--pin) 22%, #c89a10 100%); box-shadow: 0 1px 1px rgba(0,0,0,.25); flex: none; }

/* ---------- hero (porch ceiling) ---------- */
.porch {
  background-color: var(--porch);
  background-image: repeating-linear-gradient(180deg, transparent 0 46px, var(--porch-line) 46px 48px);
  border-bottom: 1px solid var(--porch-deep);
}
.hero { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: 1.05fr 1fr; align-items: center; padding-block: clamp(3rem, 7vw, 5.5rem); }
.hero h1 { max-width: 13ch; }
.hero .lede { color: var(--ink-2); }
.hero .ctas { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.5rem 0 0.75rem; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }

.notice-board { position: relative; min-height: 500px; }
.notice {
  position: relative; background: var(--surface); border-radius: 3px; box-shadow: var(--shadow);
  padding: 1.6rem 1.5rem 1.25rem; font-size: 0.92rem; line-height: 1.5; max-width: 420px;
}
.notice::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6c9 0 18%, var(--pin) 22%, #c89a10 100%); box-shadow: 0 2px 3px rgba(0,0,0,.3);
}
.notice h3 { font-size: 1rem; margin-bottom: 0.15rem; }
.notice ol { padding-left: 1.2rem; margin: 0.75rem 0; }
.notice li { margin: 0.2rem 0; }
.notice.agenda { transform: rotate(-1.5deg); }
.notice.minutes { position: absolute; right: 0; top: 330px; width: min(360px, 88%); transform: rotate(1.2deg); background: var(--surface); border-left: 4px solid var(--green); }
.notice.minutes::before { display: none; }
.checkmark { background: var(--pin-soft); color: var(--pin-ink); font-weight: 700; padding: 0 0.25rem; border-radius: 3px; white-space: nowrap; }
@media (max-width: 520px) { .notice-board { min-height: 0; } .notice.minutes { position: relative; top: auto; margin-top: 1.25rem; width: 100%; } }
@media (prefers-reduced-motion: no-preference) {
  .notice.minutes { animation: settle 700ms 300ms both cubic-bezier(.2,.8,.2,1); }
  @keyframes settle { from { opacity: 0; transform: translateY(14px) rotate(3deg); } to { opacity: 1; transform: rotate(1.2deg); } }
}

/* ---------- marketing sections ---------- */
.memory { margin: 0; display: grid; gap: 0.9rem; }
.memory .notice { max-width: none; }
.memory .notice::before { display: none; }
.memory .notice:first-child { transform: rotate(-0.6deg); }
.memory .notice:last-child { transform: rotate(0.5deg); border-left: 4px solid var(--green); }
.memory-step { margin: 0; padding-left: 1.4rem; position: relative; color: var(--ink-2); }
.memory-step::before { content: ""; position: absolute; left: 0.35rem; top: -0.5rem; bottom: -0.5rem; border-left: 2px dashed var(--line-strong); }
.feature h3 { margin-bottom: 0.35rem; }
.feature p { color: var(--ink-2); margin: 0; }
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--green); color: var(--paper); font-weight: 800; margin-bottom: 0.6rem; }
.price-big { font-size: clamp(3rem, 2rem + 4vw, 5rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.price-card { background: var(--surface); border: 2px solid var(--green); border-radius: 14px; padding: 1.75rem; }
.price-card ul, .ticks { list-style: none; padding: 0; margin: 1rem 0; }
.price-card li, .ticks li { padding-left: 1.6rem; position: relative; margin: 0.45rem 0; }
.price-card li::before, .ticks li::before { content: ""; position: absolute; left: 0.2rem; top: 0.45em; width: 0.6rem; height: 0.35rem; border-left: 2.5px solid var(--green); border-bottom: 2.5px solid var(--green); transform: rotate(-45deg); }
details { border-bottom: 1px solid var(--line); padding: 0.9rem 0; }
details summary { font-weight: 700; cursor: pointer; }
details p { margin: 0.6rem 0 0; color: var(--ink-2); }
.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.2rem; font-size: 1.5rem; }
.prose h3 { margin-top: 1.6rem; }
.prose li { margin: 0.3rem 0; }
.prose blockquote { margin: 1rem 0; padding: 0.6rem 1rem; border-left: 4px solid var(--pin); background: var(--pin-soft); color: var(--ink); }
.prose table { margin: 1rem 0; }
.cta-band { background: var(--green); color: #fff; border-radius: 14px; padding: 2rem; }
.cta-band a.btn { background: var(--pin); border-color: var(--pin); color: #16302a; }
.cta-band p { color: #e5f2ed; }
@media (prefers-color-scheme: dark) { .cta-band { color: #0f1a17; } .cta-band p { color: #173a2e; } }
.crumbs { font-size: 0.9rem; color: var(--ink-3); margin-bottom: 0.75rem; }
.crumbs a { color: var(--ink-3); }

/* ---------- app shell ---------- */
.app main { padding-block: 1.75rem 4rem; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); margin-bottom: 0.2rem; }
.demo-banner { background: var(--pin-soft); color: var(--pin-ink); text-align: center; font-size: 0.88rem; font-weight: 600; padding: 0.4rem; }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.meeting-row { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 1rem; align-items: start; }
.datebox { text-align: center; border: 1.5px solid var(--line-strong); border-radius: 6px; padding: 0.3rem 0.2rem; line-height: 1.15; background: var(--surface); }
.datebox b { display: block; font-size: 1.4rem; }
.datebox span { font-size: 0.78rem; color: var(--ink-3); }
.obligations { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.35rem; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.35rem 0; }
.checklist .box { width: 1.05rem; height: 1.05rem; border: 2px solid var(--line-strong); border-radius: 4px; flex: none; transform: translateY(2px); }
.checklist .done .box { background: var(--green); border-color: var(--green); }
.checklist .done a { color: var(--ink-3); text-decoration: line-through; }
.two-col { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.agenda-item { display: grid; grid-template-columns: 2rem 1fr auto; gap: 0.75rem; align-items: start; }
.agenda-item .num { font-weight: 800; color: var(--ink-3); padding-top: 0.1rem; }
.agenda-item details { border: 0; padding: 0; }
.agenda-item details summary { font-weight: 400; color: var(--green-ink); font-size: 0.88rem; }
.movers { display: flex; gap: 0.2rem; }
.movers button { background: var(--sunk); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; padding: 0.15rem 0.45rem; color: var(--ink-2); }
.progress { height: 10px; background: var(--sunk); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); width: 0; transition: width 200ms; }
.drop { border: 2px dashed var(--line-strong); border-radius: var(--r); padding: 1.5rem; text-align: center; background: var(--sunk); }
.drop.over { border-color: var(--green); background: var(--green-soft); }
.minutes-view { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.5rem 1.75rem; }
.minutes-view h1 { font-size: 1.6rem; }
.minutes-view h2 { font-size: 1.15rem; margin-top: 1.5rem; }
.minutes-view blockquote { margin: 0 0 1rem; padding: 0.5rem 0.8rem; background: var(--pin-soft); border-left: 4px solid var(--pin); font-weight: 600; }
.hash { font-family: var(--mono); font-size: 0.82rem; word-break: break-all; }
.meter { display: grid; gap: 0.3rem; }
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpis div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; }
.kpis b { display: block; font-size: 1.6rem; }

/* ---------- public portal ---------- */
.portal-head { background: var(--porch); border-bottom: 1px solid var(--porch-deep); padding: 1.5rem 0; }
.portal-head h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.3rem); margin: 0; }
.portal-head p { margin: 0.2rem 0 0; color: var(--ink-2); }
.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--r); overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.transcript { max-height: 32rem; overflow-y: auto; font-size: 0.93rem; }
.transcript p { margin: 0 0 0.6rem; }
.transcript .translation { display: block; margin-top: 0.2rem; padding-left: 0.75rem; border-left: 3px solid var(--pin); color: var(--ink-2); font-size: 0.9em; }
.transcript .t { color: var(--ink-3); font-size: 0.8rem; margin-right: 0.4rem; }
.powered { text-align: center; font-size: 0.85rem; color: var(--ink-3); padding: 2rem 0; }
.embed-body { background: transparent; font-size: 15px; }
.embed-body .list > li { padding: 0.55rem 0; }

/* ---------- print (agenda, certificate) ---------- */
.paper { background: #fff; color: #111; max-width: 8.5in; margin: 1.5rem auto; padding: 0.9in 0.9in; box-shadow: var(--shadow); font-size: 12pt; line-height: 1.5; }
.paper h1 { font-size: 20pt; letter-spacing: 0; }
.paper .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 3rem; }
.paper .sig div { border-top: 1px solid #111; padding-top: 0.3rem; font-size: 10pt; }
.noprint { text-align: center; margin: 1rem; }
@media print {
  body { background: #fff; }
  .noprint, .topbar, footer.site { display: none !important; }
  .paper { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}

/* Town branding on the public page */
.portal-brand { display: flex; gap: 1rem; align-items: center; }
.portal-seal { width: 64px; height: 64px; object-fit: contain; flex: none; border-radius: 8px; background: #fff; padding: 4px; }
.portal-head.accented { background: var(--accent-header); border-bottom-color: transparent; color: #fff; }
.portal-head.accented h1, .portal-head.accented p, .portal-head.accented a { color: #fff; }
.portal-welcome p { max-width: 70ch; margin: 1.25rem 0 0; font-size: 1.05rem; }
.portal-contact { border-top: 1px solid var(--line); margin-top: 1rem; padding: 1.5rem 0 0.5rem; }
.portal-contact h2 { font-size: 1.15rem; }
.portal-contact h3 { font-size: 1rem; margin: 0 0 0.3rem; }
.portal-contact address { font-style: normal; }
.portal-contact p { margin: 0 0 0.3rem; }
.agenda-text .pre { white-space: pre-wrap; font-size: 0.93rem; max-height: 36rem; overflow-y: auto; padding-top: 0.5rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.swatch { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 400; }
.swatch span { width: 1.4rem; height: 1.4rem; border-radius: 50%; display: inline-block; }
.agenda-doc { margin-bottom: 1rem; }
