/* "Storybook" style: Platypi ExtraBold headings, Nunito text, warm paper, navy ink, one raspberry accent. */
:root {
  --bg: #fbf6ef;          /* page */
  --hero: #f7efe4;
  --card: #ffffff;
  --ink: #2e3d59;         /* navy: headings and body */
  --ink-soft: #4a5672;    /* secondary text */
  --muted: #8a8476;       /* disabled */
  --line: #ebe1d3;        /* card and table borders */
  --line-strong: #d9cdbd; /* inputs and outlined buttons */
  --row-line: #f1e9de;
  --tint: #f4ece1;        /* table header, ad image, soft hovers */
  /* One accent, raspberry, for buttons, links, eyebrow and Register. */
  --accent: #a3324c;
  --accent-hover: #7d2539;
  --accent-ink: #ffffff;
  --accent-tint: #fbecef;
  --focus: #a3324c;
  --radius: 12px;
  --serif: "Platypi", Georgia, serif;
  --sans: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon { flex: 0 0 auto; display: block; }

/* 1248px content column with 96px sides on a 1440px screen. */
.wrap { max-width: 1440px; margin: 0 auto; padding-left: 96px; padding-right: 96px; }
.rule { border: 0; height: 1px; margin: 0; background: var(--line); }

/* Header */
.site-nav { display: flex; align-items: center; justify-content: space-between; height: 104px; }
.brand img { display: block; height: 110px; width: auto; margin-left: 16px; }
.nav-links { display: flex; gap: 36px; font-size: 17px; font-weight: 700; }
.nav-links a { color: var(--ink); text-decoration: none; }
.nav-links a[href]:hover { color: var(--accent); text-decoration: underline; }

/* Hero with the zip search */
.hero { position: relative; overflow: hidden; padding: 56px 16px; min-height: 531px; background: var(--hero); }
.hero-bg { position: absolute; inset: 0; opacity: .18; background: url("/img/hero-bg.jpg") center / cover no-repeat; }
.hero-inner { position: relative; max-width: 1018px; margin: 0 auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0;
  font-size: 14px; font-weight: 800; letter-spacing: .1em; color: var(--accent); text-transform: uppercase;
}
.eyebrow .dash { width: 24px; height: 2px; background: var(--accent); }
.hero h1 {
  margin: 24px 0 18px; font-family: var(--serif); font-weight: 800;
  font-size: 68px; line-height: 1.05; color: var(--ink);
}
.intro { margin: 0; font-size: 20px; line-height: 1.6; color: var(--ink-soft); }

.zip-search { max-width: 900px; margin: 28px auto 0; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.zip-label { font-size: 15px; font-weight: 700; color: var(--ink); }
.zip-row { display: flex; gap: 12px; }
.zip-field {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 18px; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink-soft);
}
.zip-field:focus-within { border-color: var(--accent); }
.zip-field input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none;
  font: inherit; font-size: 18px; color: var(--ink);
}
/* Town suggestions drop down as you type; no arrow button. */
.zip-field input::-webkit-calendar-picker-indicator { display: none !important; }
.zip-field input::placeholder { color: var(--ink-soft); opacity: 1; }
.helper { margin: 0; font-size: 14px; color: var(--ink-soft); }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 32px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 18px; font-weight: 800; cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { height: 48px; padding: 0 20px; font-size: 15px; }

/* Shown while a search runs: three dots in the logo's colors. */
.searching { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 32px 0 0; color: var(--ink-soft); }
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: hop 1s ease-in-out infinite; }
.dots i:nth-child(2) { background: var(--ink); animation-delay: .15s; }
.dots i:nth-child(3) { background: var(--line-strong); animation-delay: .3s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); opacity: .6; } 30% { transform: translateY(-8px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; } }

/* Sections below the hero */
.section { padding-bottom: 48px; }
.section-heading { margin: 24px 0; }
.label { margin: 0 0 10px; font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
h2 { margin: 0; font-family: var(--serif); font-weight: 800; font-size: 32px; line-height: 1.2; color: var(--ink); }

#listings.reveal { animation: fade-in .3s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.select { position: relative; }
.select::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; margin-top: -6px;
  border: solid var(--ink-soft); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none;
}
.select select {
  appearance: none; width: 100%; height: 48px; padding: 0 42px 0 16px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius);
  font: inherit; font-size: 16px; color: var(--ink); cursor: pointer;
}

/* Previous / page numbers / Next under the table. */
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.pager-pages { display: flex; gap: 6px; }
.pager-btn {
  min-width: 40px; height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.pager-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager-btn:disabled { color: var(--muted); cursor: default; }
.pager-num[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager-gap { align-self: center; color: var(--ink-soft); }

.summary { margin: 0 0 16px; font-size: 15px; color: var(--ink-soft); }

.table-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.events { width: 100%; border-collapse: collapse; table-layout: fixed; }
.events th, .events td { text-align: left; padding: 16px 6px; vertical-align: middle; }
.events th:first-child, .events td:first-child { padding-left: 20px; }
.events th:last-child, .events td:last-child { padding-right: 20px; }
.events th { padding-top: 14px; padding-bottom: 14px; background: var(--tint); color: var(--ink); font-size: 14px; font-weight: 800; border-bottom: 1px solid var(--line); }
.events td { font-size: 15px; border-top: 1px solid var(--row-line); }
.c-event .event-title { font-weight: 700; }
.events tbody tr:first-child td { border-top: 0; }
.events td small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-soft); }
/* Fixed widths for every column but Ages, which takes what is left. */
.c-date { width: 110px; white-space: nowrap; }
.c-day { width: 104px; }
.c-time { width: 96px; }
.t-part { display: block; white-space: nowrap; }
.c-event { width: 170px; }
.c-loc { width: 190px; }
/* Event and library names: two lines of about equal length. */
.line { display: block; }
.c-reg { width: 128px; }
.c-contact { width: 168px; }
.event-title { display: block; }

/* Event type: a small colored tag above the title. */
.tag {
  display: inline-block; margin-bottom: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap;
}
.tag { font-weight: 800; }
.tag-story { background: var(--accent-tint); color: var(--accent); }
.tag-sing { background: #f6ead8; color: #7a4a14; }
.tag-play { background: #ebedf2; color: var(--ink); }

/* Map of libraries, above the table. */
.map-card { margin: 0 0 20px; }
.map-toggle { display: none; }
.map { height: 420px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--tint); z-index: 0; }
.map-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); }
.map-pin { background: none; border: 0; }
.map-pin span {
  display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border: 2px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--accent); box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.map-pin b { transform: rotate(45deg); color: #fff; font: 800 13px var(--sans); }
.leaflet-container { font-family: var(--sans); }
.leaflet-popup-content { margin: 14px 16px; font-size: 13px; line-height: 1.4; }
.map-lib + .map-lib { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.map-name { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.map-addr { margin: 2px 0 0 !important; color: var(--ink-soft); }
.map-events { margin: 8px 0 0; padding: 0; list-style: none; }
.map-events li { margin: 0 0 6px; }
.map-when { display: block; font-weight: 600; color: var(--accent); }
.map-events a { color: var(--accent); }
.map-more { margin: 0 !important; color: var(--ink-soft); }
.leaflet-container a.map-dir {
  display: inline-block; margin-top: 8px; padding: 6px 12px; border: 1px solid var(--accent); border-radius: var(--radius);
  color: var(--accent); font-weight: 800; text-decoration: none;
}
.leaflet-container a.map-dir:hover { background: var(--accent-tint); color: var(--accent-hover); }

/* Register and Contact: outlined buttons with an icon on the right. */
.pill {
  display: flex; align-items: center; gap: 6px; width: 100%; height: 36px; padding: 0 10px;
  background: #fff; border: 1px solid; border-radius: var(--radius);
  font-family: inherit; font-size: 14px; font-weight: 800; text-decoration: none; text-align: left; cursor: pointer;
}
.pill span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-register { color: var(--accent); border-color: var(--accent); }
.pill-register:hover { background: var(--accent-tint); color: var(--accent-hover); }
.pill-contact { color: var(--ink); border-color: var(--line-strong); }
.pill-contact:hover { background: var(--tint); color: var(--ink); }

/* Contact window */
.contact-dialog {
  width: min(420px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); box-shadow: 0 12px 40px rgba(46, 61, 89, .2);
}
.contact-dialog::backdrop { background: rgba(46, 61, 89, .45); }
.contact-title { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 800; }
.contact-library { margin: 4px 0 16px; font-size: 14px; color: var(--ink-soft); }
.contact-label { margin: 0 0 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.contact-email {
  margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  font-size: 16px; overflow-wrap: anywhere; user-select: all;
}
.contact-phone { margin: 12px 0 0; font-size: 14px; color: var(--ink-soft); }
.contact-phone a { color: var(--accent); }
.contact-actions { display: flex; gap: 12px; margin-top: 20px; }
.contact-actions button { flex: 1; }
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer;
}
.btn-outline:hover { background: var(--tint); }
.contact-copied { margin: 10px 0 0; min-height: 1em; font-size: 13px; color: var(--ink-soft); }

/* About */
.about { display: flex; gap: 104px; padding: 40px 0 0; }
.about-heading { flex: 0 0 400px; margin: 0; }
.about-copy { flex: 1; }
.about-label { margin: 2px 0 12px; font-size: 16px; font-weight: 800; color: var(--ink); }
.about-copy p:last-child { margin: 0; font-size: 16px; line-height: 1.8; color: var(--ink-soft); }

/* Ads */
.ads-title { margin: 40px 0 24px; }
.ads { display: grid; grid-template-columns: repeat(3, minmax(0, 400px)); gap: 24px; }
.ad { padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-soft); }
.ad-img { height: 160px; border-radius: 8px; background: var(--tint); margin-bottom: 16px; }
.ad p { margin: 0; font-size: 15px; line-height: 1.8; }
.ad .ad-label { margin-bottom: 8px; font-size: 16px; font-weight: 800; line-height: normal; color: var(--ink); }

/* Footer */
.footer-brand { display: flex; align-items: center; justify-content: space-between; height: 124px; }
.footer-brand img { display: block; height: 110px; width: auto; margin-left: 16px; }
.footer-brand .nav-links { gap: 32px; }
.fine-print { margin: 0; padding: 8px 0 4px; font-size: 14px; color: var(--ink-soft); }
.copyright { margin: 0; padding: 0 0 40px; font-size: 14px; color: var(--ink-soft); }

/* Contact page */
.nav-links a[aria-current="page"] { color: var(--accent); }
.contact-hero { min-height: 0; padding-bottom: 72px; }

/* 404 page */
.not-found { min-height: 0; padding-top: 88px; padding-bottom: 96px; }
.not-found h1 { max-width: 760px; margin-left: auto; margin-right: auto; }
.nf-btn { margin-top: 32px; text-decoration: none; }
.nf-btn:hover { color: var(--accent-ink); }
.nf-help { margin: 20px 0 0; font-size: 16px; color: var(--ink-soft); }
.contact-inner { max-width: 720px; }
.contact-form, .contact-thanks {
  margin: 32px auto 0; padding: 32px; text-align: left; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(46, 61, 89, .08);
}
.contact-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field-row { display: flex; gap: 18px; }
.field label { font-size: 15px; font-weight: 700; color: var(--ink); }
.field .optional { font-weight: 600; color: var(--ink-soft); }
.field input, .field textarea {
  width: 100%; padding: 14px 16px; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius);
  font: inherit; font-size: 17px; color: var(--ink);
}
.field textarea { resize: vertical; min-height: 140px; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.turnstile:empty { display: none; }
.contact-form .btn-primary { align-self: flex-start; }
.form-status { margin: 0; min-height: 1.2em; font-size: 15px; color: var(--ink-soft); }
.form-status.is-error { color: var(--accent); font-weight: 700; }
.contact-thanks { text-align: center; }
.contact-thanks h2:focus { outline: none; }
.contact-thanks p { margin: 12px 0 24px; font-size: 17px; color: var(--ink-soft); }
.btn-back { height: 48px; padding: 0 24px; text-decoration: none; }

/* Tablets */
@media (max-width: 1100px) {
  .wrap { padding-left: 32px; padding-right: 32px; }
  .hero h1 { font-size: 56px; }
  .about { gap: 48px; }
  .about-heading { flex-basis: 300px; }
  .ads { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .c-date { width: 108px; }
  .c-day { display: none; }
  .c-time { width: 92px; }
  .c-event { width: 160px; }
  .c-loc { width: 180px; }
  .c-reg { width: 108px; }
}

/* Phones: stacked layout, each event becomes a card. */
@media (max-width: 720px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .site-nav { height: 72px; }
  .brand img, .footer-brand img { height: 48px; margin-left: 0; }
  .nav-links { gap: 16px; font-size: 14px; }
  .hero { min-height: 0; padding: 40px 16px; }
  .hero h1 { font-size: 40px; margin: 18px 0 12px; }
  .intro { font-size: 17px; }
  .zip-row { flex-direction: column; }
  .zip-field { flex: none; }
  .btn-primary { width: 100%; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .select select { padding: 0 32px 0 12px; font-size: 15px; }
  .select::after { right: 13px; }
  h2 { font-size: 28px; }
  .about { flex-direction: column; gap: 16px; padding-top: 24px; }
  .about-heading { flex-basis: auto; }
  .footer-brand { height: auto; padding: 16px 0; flex-wrap: wrap; gap: 12px; }
  .field-row { flex-direction: column; }
  .contact-form, .contact-thanks { padding: 20px; }
  .contact-form .btn-primary { align-self: stretch; }

  /* The map folds away behind a button so the list comes first. */
  .map-toggle {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 44px;
    border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff;
    color: var(--ink); font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
  }
  .map-card.collapsed .map-body { display: none; }
  .map-body { margin-top: 12px; }
  .map { height: 320px; }
}

/* Phones and narrow tablets: each event becomes a card. */
@media (max-width: 900px) {
  .table-card { background: none; border: 0; border-radius: 0; }
  .events, .events tbody, .events tr, .events td { display: block; width: 100%; }
  .events thead { display: none; }
  .events tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; padding: 12px 0; }
  .events td, .events td:first-child, .events td:last-child { border: 0; padding: 4px 16px; }
  /* Date, day and time share one line at the top of the card. */
  .events td.c-date, .events td.c-day, .events td.c-time { display: inline-block; width: auto; padding-right: 0; font-weight: 800; color: var(--accent); }
  /* The date already says the weekday. */
  .events td.c-day { display: none; }
  .events td.c-date::after { content: " ·"; }
  .events .t-part, .events .line { display: inline; }
  .events td.c-btn { display: inline-block; width: auto; padding-top: 8px; padding-right: 0; }
  .pill { width: auto; min-width: 140px; }
  /* Ages read as one line under the title: "Ages: Babies, Toddlers · Ages 0 to 2". */
  .events td.c-ages { font-size: 14px; color: var(--ink-soft); }
  .events td.c-ages::before { content: "Ages: "; font-weight: 800; }
  .events td.c-ages small { display: inline; font-size: 14px; }
  .events td.c-ages small::before { content: " · "; }
}

/* Privacy page */
.legal { padding-top: 56px; padding-bottom: 72px; }
.legal-inner { max-width: 760px; margin: 0 auto; font-size: 17px; line-height: 1.7; color: var(--ink-soft); }
.legal h1 { margin: 20px 0 8px; font-family: var(--serif); font-weight: 800; font-size: 52px; line-height: 1.1; color: var(--ink); }
.legal h2 { margin: 40px 0 8px; font-family: var(--serif); font-weight: 800; font-size: 26px; line-height: 1.2; color: var(--ink); }
.legal p { margin: 0 0 16px; }
.legal ul { margin: 0 0 16px; padding-left: 24px; }
.legal li { margin: 0 0 6px; }
.legal-date { font-size: 15px; font-weight: 700; }
.legal-table { overflow-x: auto; margin: 8px 0 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.legal-table table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.legal-table th { padding: 12px 16px; text-align: left; background: var(--tint); color: var(--ink); font-weight: 800; }
.legal-table td { padding: 12px 16px; border-top: 1px solid var(--row-line); vertical-align: top; }
.legal-table a { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .legal { padding-top: 32px; padding-bottom: 48px; }
  .legal h1 { font-size: 38px; }
  .legal h2 { font-size: 22px; }
  .legal-inner { font-size: 16px; }
}
