/* ============================================================================
   KnoxWhat : "The Almanac" (ported from franklinwhat)
   components.css : header, chips, cards, buttons, badges, listings, footer
   ============================================================================ */

/* ============================================================================
   Buttons
   ============================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-family: var(--font-sans); font-weight: 600; font-size: var(--t-base);
  padding: 0.6rem 1.05rem; border-radius: var(--r-md);
  border: 1.5px solid transparent; line-height: 1.2;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn svg { width: 1.05em; height: 1.05em; }
/* btn--primary uses the darker emerald (4.5:1 vs white) for WCAG AA. */
.btn--primary { background: var(--color-primary-hover); color: #fff; box-shadow: var(--sh-sm); }
.btn--primary:hover { background: var(--color-primary-text); transform: translateY(-1px); box-shadow: var(--sh-md); }
.btn--ghost { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-2); }
.btn--ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn--quiet { padding: 0.4rem 0.6rem; color: var(--color-text-2); }
.btn--quiet:hover { color: var(--color-primary); }
.btn--block { width: 100%; }
.btn--lg { font-size: var(--t-md); padding: 0.8rem 1.4rem; }

/* ============================================================================
   Masthead
   ============================================================================ */
.masthead {
  position: sticky; top: 0; z-index: 600;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1.5px solid var(--color-border);
}
.masthead__bar { display: flex; align-items: center; gap: var(--s-4); padding-block: var(--s-3); }
.brand { display: flex; flex-direction: column; line-height: 1; }
.brand__name {
  font-family: var(--font-display); font-weight: 600; font-size: 1.5rem;
  letter-spacing: -0.02em; color: var(--color-text);
}
.brand__name b { font-weight: 600; color: var(--color-primary); font-style: italic; }
.brand__tag {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em;
  color: var(--color-text-3); margin-top: 4px;
}
.masthead__spacer { flex: 1; }
.masthead__nav { display: flex; gap: var(--s-2); }
.masthead__nav a {
  font-size: var(--t-sm); font-weight: 600; color: var(--color-text-2);
  padding: 0.4rem 0.7rem; border-radius: var(--r-sm);
}
.masthead__nav a:hover { color: var(--color-primary); background: var(--paper-sunk); }
@media (max-width: 820px){ .masthead__nav { display: none; } }

/* icon button (theme toggle) */
.icon-btn {
  width: 42px; height: 42px; border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--color-text-2);
  border: 1.5px solid var(--color-border); background: var(--color-surface);
  transition: all var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--color-primary); border-color: var(--color-primary); }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.theme-icon--dark { display: none; }
html[data-theme="dark"] .theme-icon--light { display: none; }
html[data-theme="dark"] .theme-icon--dark { display: block; }

/* ============================================================================
   Freshness chip, "Updated 3h ago", states: fresh / aging / stale
   Reads as a quiet, intentional status stamp, not a bolted-on pill.
   ============================================================================ */
.freshness {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.02em; color: var(--color-text-2);
  padding: 0.3rem 0.6rem 0.3rem 0.55rem; border-radius: var(--r-pill);
  background: var(--color-surface); border: 1.5px solid var(--color-border);
}
.freshness__dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--color-primary);
  position: relative; flex-shrink: 0;
}
.freshness__dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  background: var(--color-primary); opacity: 0.35; animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse { 0%{transform:scale(0.6);opacity:0.5;} 70%{transform:scale(1.8);opacity:0;} 100%{opacity:0;} }
@media (prefers-reduced-motion: reduce){ .freshness__dot::after { display: none; } }

.freshness[data-state="aging"] { border-color: color-mix(in srgb, var(--gold-500) 45%, var(--line)); }
.freshness[data-state="aging"] .freshness__dot,
.freshness[data-state="aging"] .freshness__dot::after { background: var(--gold-600); }
.freshness[data-state="stale"] {
  color: var(--clay-700); background: var(--clay-50);
  border-color: color-mix(in srgb, var(--clay-500) 45%, var(--line));
}
.freshness[data-state="stale"] .freshness__dot,
.freshness[data-state="stale"] .freshness__dot::after { background: var(--clay-600); animation: none; }
html[data-theme="dark"] .freshness[data-state="stale"] { color: var(--clay-500); background: color-mix(in srgb, var(--clay-500) 14%, var(--surface)); }

/* ============================================================================
   Stale / offline banner, slim toast, warm voice
   ============================================================================ */
.banner {
  display: flex; align-items: center; gap: var(--s-3); justify-content: center;
  padding: var(--s-3) var(--s-4); font-size: var(--t-sm); font-weight: 500;
  text-align: center;
}
.banner--offline { background: var(--pine-800); color: var(--ondark); }
.banner--offline b { color: #fff; }
.banner--stale { background: var(--clay-50); color: var(--clay-700); border-bottom: 1.5px solid color-mix(in srgb, var(--clay-500) 35%, transparent); }
html[data-theme="dark"] .banner--stale { background: color-mix(in srgb, var(--clay-500) 16%, var(--surface)); color: var(--clay-500); }
.banner svg { width: 1.05em; height: 1.05em; flex-shrink: 0; }

/* ============================================================================
   Markers, Free / Kid-friendly / Dog-friendly / Childcare
   Small iconographic chips. Childcare gets a highlighted clay treatment.
   ============================================================================ */
.markers { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.marker {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.01em;
  padding: 0.2rem 0.5rem 0.2rem 0.4rem; border-radius: var(--r-pill);
  background: var(--paper-sunk); color: var(--color-text-2);
  border: 1px solid var(--color-border); white-space: nowrap;
}
.marker svg { width: 13px; height: 13px; }
.marker--free { background: var(--gold-100); color: var(--gold-700); border-color: color-mix(in srgb, var(--gold-500) 35%, transparent); }
.marker--kid  { background: var(--river-100); color: var(--river-600); border-color: color-mix(in srgb, var(--river-500) 30%, transparent); }
.marker--dog  { background: var(--emerald-50); color: var(--emerald-600); border-color: color-mix(in srgb, var(--emerald-500) 28%, transparent); }
.marker--childcare {
  /* clay-600 gives #fff a 5.58:1 ratio (AA) in both themes; clay-500 was 3.08:1
     and failed Lighthouse color-contrast. Keeps the solid prominent badge. */
  background: var(--clay-600); color: #fff; border-color: var(--clay-700);
  box-shadow: 0 1px 6px -1px color-mix(in srgb, var(--clay-600) 60%, transparent);
}
html[data-theme="dark"] .marker--free { background: color-mix(in srgb, var(--gold-500) 16%, var(--surface)); color: var(--gold-500); }
html[data-theme="dark"] .marker--kid  { background: color-mix(in srgb, var(--river-500) 16%, var(--surface)); color: var(--river-500); }
html[data-theme="dark"] .marker--dog  { background: color-mix(in srgb, var(--emerald-500) 16%, var(--surface)); color: var(--emerald-500); }

/* ============================================================================
   Drive-time chip, the "should I drive?" signal
   ============================================================================ */
.drive {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  color: var(--color-text-2);
}
.drive svg { width: 13px; height: 13px; opacity: 0.8; }
.drive--home { color: var(--color-primary); }
.drive b { font-weight: 600; color: var(--color-text); }

/* category dot */
.cat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--cat, var(--color-primary)); }

/* ============================================================================
   Event card
   ============================================================================ */
.ecard {
  display: grid; grid-template-columns: 96px 1fr; gap: var(--s-4);
  padding: var(--s-4); background: var(--color-surface);
  border: 1.5px solid var(--color-border); border-radius: var(--r-lg);
  box-shadow: var(--sh-xs); cursor: pointer; text-align: left; width: 100%;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ecard:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--color-border-2); }

/* date block, the calendar tab */
.ecard__date {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 2px; text-align: center;
}
.ecard__date-dow { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--clay-600); font-weight: 600; }
.ecard__date-day { font-family: var(--font-display); font-size: 2.1rem; font-weight: 600; line-height: 1; color: var(--color-text); }
.ecard__date-mon { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-3); margin-top: 2px; }
.ecard__date-time { font-family: var(--font-mono); font-size: 0.68rem; color: var(--color-text-2); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--color-border); }

.ecard__body { min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.ecard__top { display: flex; align-items: center; gap: 0.5rem; }
.ecard__cat { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-3); font-weight: 500; }
.ecard__title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; line-height: 1.15; color: var(--color-text); letter-spacing: -0.01em; }
.ecard:hover .ecard__title { color: var(--color-primary); }
.ecard__where { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; color: var(--color-text-2); font-size: var(--t-sm); }
.ecard__where-venue { font-weight: 600; color: var(--color-text); }
.ecard__sep { color: var(--color-border-2); }
.ecard__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: 0.2rem; flex-wrap: wrap; }

/* local-tip variant, a friend told me */
.ecard--tip { border-color: color-mix(in srgb, var(--clay-500) 40%, var(--line)); background: linear-gradient(0deg, var(--clay-50), var(--color-surface) 60%); }
html[data-theme="dark"] .ecard--tip { background: linear-gradient(0deg, color-mix(in srgb, var(--clay-500) 10%, var(--surface)), var(--surface) 70%); }
.tip-flag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--clay-700); 
}
html[data-theme="dark"] .tip-flag { color: var(--clay-500); }
.tip-flag svg { width: 12px; height: 12px; }

@media (max-width: 520px){
  .ecard { grid-template-columns: 64px 1fr; gap: var(--s-3); padding: var(--s-3); }
  .ecard__date-day { font-size: 1.6rem; }
}

/* ============================================================================
   Feature card (hero picks, Pickin', SMCPA, festivals)
   ============================================================================ */
.feature {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 280px; padding: var(--s-5); border-radius: var(--r-lg); overflow: hidden;
  color: #fff; background: var(--pine-800); cursor: pointer; isolation: isolate;
  box-shadow: var(--sh-sm); transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }
.feature__img { position: absolute; inset: 0; z-index: -2; object-fit: cover; width: 100%; height: 100%; }
.feature::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(11,46,34,0.05) 0%, rgba(11,46,34,0.55) 55%, rgba(11,46,34,0.92) 100%);
}
.feature__eyebrow { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ondark-bright); margin-bottom: 0.4rem; }
.feature__title { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; line-height: 1.1; color: #fff;
  /* Clamp to 2 lines so every card is a uniform 280px (its min-height floor).
     Long titles used to wrap to 3-4 lines, making cards ~420px tall and the
     grid's filled height impossible to reserve, the root of the featured CLS.
     Full title is on the event page the card links to. */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feature__meta { margin-top: 0.5rem; font-family: var(--font-mono); font-size: var(--t-sm); color: rgba(255,255,255,0.85); display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* placeholder fill for missing imagery */
.imgph {
  position: absolute; inset: 0; z-index: -2;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 11px),
    linear-gradient(160deg, var(--ph, var(--pine-700)), color-mix(in srgb, var(--ph, var(--pine-900)) 60%, #000));
  display: grid; place-items: center;
}
.imgph__label { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em; color: rgba(255,255,255,0.6); text-transform: uppercase; }

/* ============================================================================
   Inline newsletter capture (signup_cta), high-intent pages
   ============================================================================
   The footer form was the ONLY signup surface; this puts the ask on the pages
   that actually get organic traffic. The lazy beehiiv iframe is height-pinned
   and its slot reserved (min-height) so it never causes layout shift. */
.signup-cta {
  max-width: 42rem; margin: var(--s-7) auto; padding: var(--s-5) var(--s-5) var(--s-4);
  border: 1.5px solid var(--color-border); border-radius: var(--r-lg);
  background: var(--surface-2, var(--color-surface)); text-align: center;
}
.signup-cta__h { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.15; margin: 0 0 0.35rem; color: var(--color-text); }
.signup-cta__p { color: var(--color-text-2); font-size: 0.9rem; margin: 0 0 var(--s-3); }
.signup-cta__form { min-height: 66px; }
.bh-signup iframe { width: 100% !important; height: 66px !important; border: 0; display: block; }

/* ============================================================================
   Day group (listing)
   ============================================================================ */
.daygroup { margin-bottom: var(--s-6); }
.daygroup__head {
  display: flex; align-items: baseline; gap: var(--s-3);
  position: sticky; top: 70px; z-index: 5;
  padding: var(--s-2) 0; margin-bottom: var(--s-3);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(6px);
}
.daygroup__dow { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; color: var(--color-text); }
.daygroup__date { font-family: var(--font-mono); font-size: var(--t-sm); color: var(--color-text-3); }
.daygroup__count { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--color-text-3); margin-left: auto; }
.daygroup__list { display: grid; gap: var(--s-3); }

/* "today" emphasis */
.daygroup--today .daygroup__dow { color: var(--color-primary); }

/* ============================================================================
   Footer
   ============================================================================ */
.footer { background: var(--pine-900); color: var(--ondark); margin-top: var(--s-9); padding-block: var(--s-7) var(--s-6); }
.footer a { color: var(--ondark); opacity: 0.85; }
.footer a:hover { opacity: 1; color: #fff; }
.footer__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--s-6); }
@media (max-width: 720px){ .footer__grid { grid-template-columns: 1fr 1fr; gap: var(--s-5); } .footer__brand { grid-column: 1 / -1; } .footer__signup { max-width: 28rem; } }
.footer__brand .brand__name { color: #fff; }
.footer__brand .brand__name b { color: var(--ondark-bright); }
.footer__blurb { color: var(--ondark-dim); opacity: 0.9; font-size: var(--t-sm); margin-top: var(--s-3); max-width: 30ch; }
.footer__h { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ondark-dim); opacity: 0.85; margin-bottom: var(--s-3); }
.footer__list { list-style: none; padding: 0; display: grid; gap: 0.5rem; font-size: var(--t-sm); }
.footer__bottom { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid rgba(255,255,255,0.12); display: flex; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; font-size: var(--t-xs); color: var(--ondark-dim); opacity: 0.85; font-family: var(--font-mono); }
/* Underline footer-bottom links so they're distinguishable by more than colour
   (Lighthouse link-in-text-block, the colophon link inherits the text colour). */
.footer__bottom a { text-decoration: underline; text-underline-offset: 2px; }

/* Primary green (#059669) is only 3.8:1 as small text on the warm cards, so the
   inline color:var(--color-primary) labels (sports class-schedule/"when", movies
   "showtimes →", guides "open guide →") failed Lighthouse contrast. Swap them for
   a theme-aware contrast-safe ink (no generator change needed). */
[style*="color:var(--color-primary)"] { color: var(--color-primary-text) !important; }

/* Sports sign-up calendar: bigger touch target for the league links
   (Lighthouse target-size, they were ~18px tall). */
.signup-month__leagues a { padding-block: 8px; }

/* ── Scroll-reveal entrance (progressive enhancement; site.js adds .js-reveal +
   [data-reveal] only when JS runs. No-JS or reduced-motion → simply visible). ── */
.js-reveal [data-reveal]{opacity:0;transform:translateY(14px);transition:opacity .55s ease-out,transform .55s ease-out}
.js-reveal [data-reveal].is-revealed{opacity:1;transform:none}
@media (prefers-reduced-motion: reduce){.js-reveal [data-reveal]{opacity:1!important;transform:none!important;transition:none!important}}

/* ── Print: strip interactive chrome + force content visible for a clean printout
   of any event, guide, or list. Print-only, zero effect on the on-screen view. ── */
@media print {
  .js-reveal [data-reveal]{opacity:1!important;transform:none!important}
  .masthead,.footer,.skip-link,[data-theme-toggle],.masthead__lang,#offlineBanner,
  .footer__signup,#map,.leaflet-container,.banner,.btn,button,.back-to-top{display:none!important}
  *{box-shadow:none!important;text-shadow:none!important}
  body{background:#fff!important;color:#000!important}
  main,.wrap,.read{max-width:100%!important;width:auto!important;margin:0!important;padding:0!important}
  a{color:#000!important}
  .page-head,.page-head *{background:none!important;color:#000!important}
  .ecard,.rest-card,section,.daygroup,.rest-cat,.signup-month{break-inside:avoid;page-break-inside:avoid}
}

/* Brand-tinted text selection, a small on-brand touch (decorative; can't hide content). */
::selection { background: color-mix(in srgb, var(--color-primary) 30%, transparent); }
::-moz-selection { background: color-mix(in srgb, var(--color-primary) 30%, transparent); }
