/* Eastside Riding Academy — camp availability widget v2
   Dressed in the website's own system (new-webpages-design ui.md): cream and
   paper surfaces, ink and forest type, copper accents, Georgia for titles.
   Every pill carries text as well as colour, and nothing here is smaller than
   14px: the readers are parents on phones, often in daylight.

   Three surfaces, in the order the eye meets them:
     bezel  — the frame (the board root); takes a faint wash of the open tab's season
     panel  — one camp, lifted off the bezel; its header band wears the season
     well   — one day row, flat and hairline-divided; identical for every season
   The traffic light (the gauge's bar and word) is the same green / orange /
   red / grey everywhere; no season borrows those hues for its chrome.

   Layout: camps are grouped by school holidays; two or more groups become tabs
   (.era-ca__tabs). data-compact (set by the script at 560px and under) is the
   phone rim; data-narrow (set when the fold mode applies) lets a camp fold to
   its band plus the dot strip.

   Intensity, one class on the board root:
     .era-ca--festive  band + accent + motif + bezel wash   (what the website ships)
     .era-ca--quiet    band + accent only

   Everything is scoped under .era-ca (the board) or .era-ca-doc (the widget
   page's <html>), so the same sheet can sit inside the staff preview page
   without touching the app's own root, body or tokens. No inline styles, no
   images, no data: URIs — the page's CSP forbids them, so every motif is CSS.
   One look only: the host is the cream website, so there is no dark variant
   (a phone in dark mode must not get a dark board inside a cream page). */

.era-ca, .era-ca-doc {
  --era-cream: #f2e8d0;
  --era-paper: #faf3e2;
  --era-line: #e8dbb8;
  --era-line-2: #d9c99a;
  --era-ink: #0a1b36;
  --era-forest: #0f2a52;
  --era-muted: #4b5a73;
  --era-copper: #b8862a;
  --era-copper-bright: #d9a93a;
  --era-gold: #c89a37;
  --era-gold-soft: #e0c97a;
  --era-navy: #082548;
  --era-panel: #ffffff;
  --era-title-font: Georgia, "Times New Roman", serif;

  --era-green-bg: #e6f4ea;  --era-green-fg: #166534;  --era-green-line: #a7d7b4;
  --era-amber-bg: #fdf3cf;  --era-amber-fg: #a16207;  --era-amber-line: #ecd27a;  --era-amber-dot: #e0961c;
  --era-red-bg:   #fde8e8;  --era-red-fg:   #991b1b;  --era-red-line:   #f3b0b0;
  --era-grey-bg:  #f3f4f6;  --era-grey-fg:  #4b5563;  --era-grey-line:  #d1d5db;
  /* brighter fills for marks drawn on a dark band (the folded camp's dot strip) */
  --era-green-bright: #5fd38d; --era-amber-bright: #f3c44c; --era-red-bright: #f28b8b;

  /* Season chrome. Each season sets these three on its panel; the bezel wash
     reads the board's data-next-season (the open tab's season). */
  --era-band: var(--era-forest);
  --era-band-fg: var(--era-paper);
  --era-accent: var(--era-copper);
}

/* The widget page only — never the host document of the preview page */
.era-ca-doc, .era-ca-doc body { margin: 0; padding: 0; background: transparent; }

/* ── Bezel ─────────────────────────────────────────────────────────────────── */
.era-ca {
  box-sizing: border-box;
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--era-ink);
  background: var(--era-paper);
  /* The rim is the widget's own: the host must add no padding around the frame, or its
     page colour would ring the season-tinted wash. 24px wide so the board sits clear of the
     host card's edge, 16px on a phone. */
  padding: 24px;
}
/* data-compact is the width flag alone (frame 560px or narrower), whatever the fold mode */
.era-ca[data-compact] { padding: 16px; }
.era-ca *, .era-ca *::before, .era-ca *::after { box-sizing: inherit; }

/* Festive: the frame takes a faint wash of the open tab's season, mixed from paper */
.era-ca--festive[data-next-season="christmas"] { background: #eceedd; }
.era-ca--festive[data-next-season="summer"]    { background: #ecf1e9; }
.era-ca--festive[data-next-season="autumn"]    { background: #f6e9d6; }
.era-ca--festive[data-next-season="winter"]    { background: #eef0e6; }
.era-ca--festive[data-next-season="spring"]    { background: #eef2dc; }

/* Heading row */
.era-ca__heading {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 2px 2px 10px;
}
/* Colour key: a dot per state in the bar tones; wraps under the title on narrow widths */
.era-ca__legend {
  margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px;
  font-size: 13px; color: var(--era-muted);
}
.era-ca__key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.era-ca__dot {
  flex: 0 0 auto; width: 10px; height: 10px; border-radius: 999px; box-sizing: border-box;
  background: var(--era-grey-line); border: 1px solid var(--era-grey-line);
}
.era-ca__key--available .era-ca__dot { background: var(--era-green-fg); border-color: var(--era-green-fg); }
.era-ca__key--limited   .era-ca__dot { background: var(--era-amber-dot); border-color: var(--era-amber-dot); }
.era-ca__key--full      .era-ca__dot { background: var(--era-red-fg);   border-color: var(--era-red-fg); }
.era-ca__key--closed    .era-ca__dot { background: transparent; border: 1px dashed var(--era-grey-fg); }

/* ── Tabs: one per school holidays ─────────────────────────────────────────── */
.era-ca__tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin: 0 2px 12px; border-bottom: 1px solid var(--era-line-2);
}
.era-ca__tab {
  appearance: none; -webkit-appearance: none;
  margin: 0 0 -1px; padding: 8px 14px 9px;
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; color: var(--era-forest);
  cursor: pointer;
}
.era-ca__tab:hover { color: var(--era-ink); background: rgba(184, 134, 42, 0.08); }
.era-ca__tab[aria-selected="true"] { color: var(--era-ink); border-bottom-color: var(--era-copper); }
.era-ca__tab:focus-visible { outline: 2px solid var(--era-copper); outline-offset: 2px; }
.era-ca__panel[hidden] { display: none; }

/* ── Panel: one camp ───────────────────────────────────────────────────────── */
.era-ca__program {
  margin: 0 0 14px;
  background: var(--era-panel);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(10, 27, 54, 0.08), 0 0 0 1px var(--era-line);
  overflow: hidden;
}

/* The band: the one place a season shows */
.era-ca__band {
  position: relative; overflow: hidden;
  padding: 11px 14px 12px;
  background: var(--era-band);
  color: var(--era-band-fg);
  border-top: 3px solid var(--era-accent);
}
.era-ca__title { position: relative; z-index: 1; margin: 0; font-size: inherit; font-weight: inherit; }
/* The band's heading is a button so a phone can fold the camp; on a wide frame
   it is inert and looks like plain text */
.era-ca__toggle {
  appearance: none; -webkit-appearance: none;
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 0; padding: 0; background: transparent; border: 0;
  color: inherit; font: inherit; text-align: left; cursor: default;
}
.era-ca__toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
.era-ca__titles { flex: 1 1 auto; min-width: 0; }
.era-ca__name {
  display: block; font: 700 20px/1.2 var(--era-title-font); letter-spacing: -0.01em;
}
.era-ca__run { display: block; margin-top: 2px; font-size: 15px; font-weight: 500; opacity: 0.88; }

/* Summary chip, "Show days" hint and chevron: only on a narrow frame */
.era-ca__summary, .era-ca__dots, .era-ca__more, .era-ca__chevron { display: none; }
/* One dot per camp day, in date order, in the bar tones — the legend already explains them */
.era-ca__dots { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.era-ca__dotweek { display: inline-flex; gap: 5px; align-items: center; }
/* Bright fill with a dark rim: readable on the dark season band and on the quiet look alike */
.era-ca__dotday {
  width: 13px; height: 13px; border-radius: 999px; box-sizing: border-box;
  background: var(--era-grey-line); border: 1.5px solid var(--era-grey-fg);
}
.era-ca__dotday--available { background: var(--era-green-bright); border-color: var(--era-green-fg); }
.era-ca__dotday--limited   { background: var(--era-amber-bright); border-color: var(--era-amber-fg); }
.era-ca__dotday--full      { background: var(--era-red-bright);   border-color: var(--era-red-fg); }
.era-ca__dotday--closed    { background: transparent; border: 1.5px dashed var(--era-paper); opacity: 0.8; }
/* Screen-reader text for the dot strip */
.era-ca__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.era-ca__more {
  flex: 0 0 auto; font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; opacity: 0.95;
}
.era-ca__summary {
  flex: 0 0 auto; padding: 3px 9px; border: 1px solid currentColor; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap; opacity: 0.92;
}
.era-ca__chevron {
  flex: 0 0 auto; width: 9px; height: 9px; margin: 0 4px 4px 0;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); opacity: 0.9;
}
.era-ca[data-narrow] .era-ca__summary { display: inline-block; }
.era-ca[data-narrow] .era-ca__dots { display: inline-flex; }
.era-ca[data-narrow] .era-ca__more { display: inline-block; margin-left: auto; }
.era-ca[data-narrow] .era-ca__chevron { display: inline-block; }
/* Narrow: the title keeps the top row (clear of the motif at the band's top
   right), the summary chip and chevron take a row of their own beneath it */
.era-ca[data-narrow] .era-ca__toggle { cursor: pointer; flex-wrap: wrap; row-gap: 8px; }
.era-ca[data-narrow] .era-ca__titles { flex-basis: 100%; padding-right: 60px; }
.era-ca[data-narrow] .era-ca__program[data-collapsed] .era-ca__chevron { transform: rotate(-45deg); margin: 4px 4px 0 0; }
.era-ca[data-narrow] .era-ca__program[data-collapsed] .era-ca__body { display: none; }

/* Folded on a wide frame (data-fold="always"): title left, dots beside it, the hint and
   chevron at the right, all on one row, clear of the motif at the band's top right */
.era-ca[data-narrow][data-wide] .era-ca__toggle { flex-wrap: nowrap; padding-right: 76px; }
.era-ca[data-narrow][data-wide] .era-ca__titles { flex: 0 1 auto; flex-basis: auto; padding-right: 18px; }
.era-ca[data-narrow][data-wide] .era-ca__dots { justify-content: flex-start; }

/* Motif layers: the band's ::before, plus a span with two pseudo-elements.
   Hidden under .era-ca--quiet. */
.era-ca__motif { position: absolute; pointer-events: none; }
.era-ca__motif::before, .era-ca__motif::after { content: ""; position: absolute; }
.era-ca--quiet .era-ca__motif, .era-ca--quiet .era-ca__band::before { display: none; }

/* ── Seasons ───────────────────────────────────────────────────────────────── */

/* Christmas: deep pine, gold type, holly-red edge; gold stars and a candy stripe */
.era-ca__program[data-season="christmas"] {
  --era-band: #0f3d2e; --era-band-fg: var(--era-gold-soft); --era-accent: #b3261e;
}
.era-ca__program[data-season="christmas"] .era-ca__band::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
  background: repeating-linear-gradient(135deg, #b3261e 0 6px, #fbf8f2 6px 12px);
}
/* The span is an unclipped box; its two pseudo-elements are the stars (a
   clip-path on the span itself would clip them away) */
.era-ca__program[data-season="christmas"] .era-ca__motif { right: 14px; top: 6px; width: 64px; height: 44px; }
.era-ca__program[data-season="christmas"] .era-ca__motif::before,
.era-ca__program[data-season="christmas"] .era-ca__motif::after {
  background: var(--era-gold-soft);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.era-ca__program[data-season="christmas"] .era-ca__motif::before { right: 0; top: 0; width: 24px; height: 24px; }
.era-ca__program[data-season="christmas"] .era-ca__motif::after  { right: 34px; top: 20px; width: 13px; height: 13px; opacity: 0.8; }

/* Summer: sky, navy type, sun-gold edge; a half-sun rising from the right */
.era-ca__program[data-season="summer"] {
  --era-band: #dfeefa; --era-band-fg: var(--era-navy); --era-accent: #d4af42;
}
.era-ca__program[data-season="summer"] .era-ca__motif {
  right: -34px; bottom: -58px; width: 116px; height: 116px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(212, 175, 66, 0.55) 0 8deg, transparent 8deg 22.5deg);
}
.era-ca__program[data-season="summer"] .era-ca__motif::before {
  left: 30px; top: 30px; width: 56px; height: 56px; border-radius: 50%;
  background: #f0cf6a; box-shadow: 0 0 0 5px #dfeefa;
}
.era-ca__program[data-season="summer"] .era-ca__motif::after { display: none; }

/* Autumn: rust, parchment type, olive edge; three drifting leaves */
.era-ca__program[data-season="autumn"] {
  --era-band: #8a3b12; --era-band-fg: #fbf8f2; --era-accent: #6b6b2a;
}
.era-ca__program[data-season="autumn"] .era-ca__motif,
.era-ca__program[data-season="autumn"] .era-ca__motif::before,
.era-ca__program[data-season="autumn"] .era-ca__motif::after {
  border-radius: 0 62% 0 62%;
}
.era-ca__program[data-season="autumn"] .era-ca__motif { right: 22px; top: 10px; width: 22px; height: 22px; background: #e0a34a; transform: rotate(18deg); opacity: 0.9; }
.era-ca__program[data-season="autumn"] .era-ca__motif::before { left: -36px; top: 14px; width: 16px; height: 16px; background: #c9d08a; transform: rotate(-24deg); opacity: 0.8; }
.era-ca__program[data-season="autumn"] .era-ca__motif::after  { left: 26px; top: 22px; width: 12px; height: 12px; background: #f0cf6a; transform: rotate(40deg); opacity: 0.75; }

/* Winter: ice, navy type, steel edge; sparse snow */
.era-ca__program[data-season="winter"] {
  --era-band: #e7f0f7; --era-band-fg: var(--era-navy); --era-accent: #4d74ab;
}
.era-ca__program[data-season="winter"] .era-ca__motif {
  inset: 0;
  background:
    radial-gradient(circle, rgba(255,255,255,0.95) 2px, transparent 2.5px) 0 0 / 46px 38px,
    radial-gradient(circle, rgba(77,116,171,0.35) 1.5px, transparent 2px) 23px 19px / 46px 38px;
}
.era-ca__program[data-season="winter"] .era-ca__motif::before,
.era-ca__program[data-season="winter"] .era-ca__motif::after { display: none; }

/* Spring: meadow, pine type, blossom edge; petals along the band's foot */
.era-ca__program[data-season="spring"] {
  --era-band: #e6f2df; --era-band-fg: #0f3d2e; --era-accent: #c9728f;
}
.era-ca__program[data-season="spring"] .era-ca__motif,
.era-ca__program[data-season="spring"] .era-ca__motif::before,
.era-ca__program[data-season="spring"] .era-ca__motif::after {
  border-radius: 50%; background: #e9a3b8;
}
.era-ca__program[data-season="spring"] .era-ca__motif { right: 40px; bottom: 6px; width: 30px; height: 18px; transform: rotate(-22deg); opacity: 0.9; }
.era-ca__program[data-season="spring"] .era-ca__motif::before { left: -40px; top: -10px; width: 24px; height: 14px; transform: rotate(28deg); opacity: 0.8; }
.era-ca__program[data-season="spring"] .era-ca__motif::after  { left: 34px; top: -14px; width: 20px; height: 12px; transform: rotate(-40deg); background: #f3c3d2; }

/* ── Wells: the days ───────────────────────────────────────────────────────── */
/* As many columns as fit, one row each on a phone. A column must hold the
   longest date ("Wed 13 Jan") beside the widest pill ("Bookings closed")
   without either wrapping, hence the 260px floor. */
.era-ca__body { padding: 8px 14px 12px; }
.era-ca__days {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 20px;
}
/* Two or more weeks: a column per week, as many as fit (the portal landing's rule);
   each week's days run top to bottom under a "Week n" label */
.era-ca__body--weeks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 20px; }
.era-ca__body--weeks .era-ca__days { grid-template-columns: 1fr; }
.era-ca__week-label {
  margin: 6px 0 2px; padding-bottom: 4px; border-bottom: 1px solid var(--era-line);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--era-forest);
}
.era-ca__day {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 40px; border-bottom: 1px solid var(--era-line); padding: 4px 0;
}
.era-ca__date { flex: 1 1 auto; min-width: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The gauge — a fill bar (how full the day is, in fifths) beside a word. Text
   first, colour second: the word carries the meaning, the bar the pace. The
   fill comes from data-fill="0".."5" (the page's CSP forbids inline styles),
   and the status sets the tone of both bar and word. Never shrinks or wraps. */
.era-ca__gauge {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 10px;
  padding: 2px 4px; margin: -2px -4px; border-radius: 999px;
  --era-tone-fg: var(--era-grey-fg); --era-tone-line: var(--era-grey-line); --era-tone-bg: var(--era-grey-bg);
  transition: box-shadow 180ms ease-out, transform 180ms ease-out;
}
.era-ca__gauge--available { --era-tone-fg: var(--era-green-fg); --era-tone-line: var(--era-green-line); --era-tone-bg: var(--era-green-bg); }
.era-ca__gauge--limited   { --era-tone-fg: var(--era-amber-fg); --era-tone-line: var(--era-amber-line); --era-tone-bg: var(--era-amber-bg); }
.era-ca__gauge--full      { --era-tone-fg: var(--era-red-fg);   --era-tone-line: var(--era-red-line);   --era-tone-bg: var(--era-red-bg); }
/* The track carries the state's tint; the darker segment is how booked the day is */
.era-ca__meter {
  position: relative; display: inline-block; width: 84px; height: 9px; overflow: hidden;
  border-radius: 999px; border: 1px solid var(--era-tone-line); background: var(--era-tone-bg);
}
.era-ca__meter::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  border-radius: 999px; background: var(--era-tone-fg); opacity: 0.85;
}
.era-ca__meter[data-fill="1"]::before { width: 20%; }
.era-ca__meter[data-fill="2"]::before { width: 40%; }
.era-ca__meter[data-fill="3"]::before { width: 60%; }
.era-ca__meter[data-fill="4"]::before { width: 80%; }
.era-ca__meter[data-fill="5"]::before { width: 100%; opacity: 1; }
/* An open day never draws less than half a bar of green: nothing booked yet, no fill
   published, or one or two fifths all read as half — the board says "Open", never
   "nobody has booked". Three fifths and up draw at their own width. */
.era-ca__gauge--available .era-ca__meter[data-fill="0"]::before,
.era-ca__gauge--available .era-ca__meter[data-fill="1"]::before,
.era-ca__gauge--available .era-ca__meter[data-fill="2"]::before,
.era-ca__gauge--available .era-ca__meter:not([data-fill])::before { width: 50%; }
/* A closed day has no fill to show: an empty, dashed track */
.era-ca__gauge--closed .era-ca__meter { border-style: dashed; background: transparent; }
.era-ca__word {
  min-width: 56px; font-size: 14px; font-weight: 600; line-height: 1.3; white-space: nowrap;
  color: var(--era-tone-fg);
}

/* Value flash (after interior.dev's value-flash): a gauge that changed between
   polls lifts for 900ms, then settles — "that one just moved" */
.era-ca__gauge[data-changed] { box-shadow: 0 0 0 3px rgba(184, 134, 42, 0.45); transform: translateY(-1px); }

/* ── Notes, footer, skeleton ───────────────────────────────────────────────── */
.era-ca__note { margin: 0 0 8px; font-size: 15px; color: var(--era-ink); }
.era-ca__note--muted { color: var(--era-muted); }
.era-ca__footer { margin: 4px 2px 0; font-size: 14px; color: var(--era-muted); }
.era-ca__footer p { margin: 0 0 4px; }

/* Skeleton swap (after interior.dev's skeleton-swap): shown only when the first
   answer takes longer than a blink, kept for a beat once shown, then the board
   fades in — a fast answer never flickers, a slow one never jumps */
.era-ca__skeleton { display: none; padding: 6px 2px; }
.era-ca[data-state="loading"] .era-ca__skeleton { display: block; }
.era-ca__skeleton span {
  display: block; height: 12px; border-radius: 6px; background: var(--era-line); margin: 0 0 12px;
}
.era-ca__skeleton span:nth-child(1) { width: 42%; height: 18px; }
.era-ca__skeleton span:nth-child(2) { width: 94%; }
.era-ca__skeleton span:nth-child(3) { width: 64%; }
.era-ca__board { animation: era-ca-in 240ms ease-out; }
@keyframes era-ca-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .era-ca__gauge { transition: none; }
  .era-ca__gauge[data-changed] { transform: none; }
  .era-ca__board { animation: none; }
}
