/* Boston Music Calendar. An academic, editorial look: white page, crimson accents,
   Libre Franklin for text and headings, Roboto Slab for times and dates, square corners. */

:root {
  --crimson: #a51c30;
  --crimson-dark: #8c1526;
  --ink: #1e1e1e;
  --body: #333333;
  --muted: #666666;
  --faint: #939393;
  --rule: #e0e0e0;
  --rule-strong: #cccccc;
  --tan: #f3f3f1;
  --wash: #f7f7f7;
  --paper: #ffffff;
  --on-dark: #ffffff;
  --on-dark-muted: #c2c2c2;
  --sans: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --slab: "Roboto Slab", Georgia, serif;
  --page: 1120px;
  --gutter: 32px;
  --bar-h: 0px; /* set from JS so day headers stick just below the filter bar */
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--crimson); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--crimson-dark); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
input { font: inherit; }
:focus-visible { outline: 3px solid var(--crimson); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 8px; top: -48px; z-index: 50;
  background: var(--ink); color: var(--on-dark); padding: 8px 12px; text-decoration: none;
}
.skip:focus { top: 8px; color: var(--on-dark); }

/* ── Masthead ───────────────────────────────────────────── */

.masthead { border-top: 6px solid var(--crimson); border-bottom: 1px solid var(--rule); }
.masthead-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 84px; }
.wordmark {
  display: grid; gap: 2px;
  padding-left: 16px; border-left: 4px solid var(--crimson);
  color: var(--ink); text-decoration: none;
}
.wordmark:hover { color: var(--ink); }
.wordmark-name { font-weight: 700; font-size: 1.375rem; line-height: 1.1; letter-spacing: -0.01em; }
.wordmark-sub { font-family: var(--slab); font-weight: 300; font-size: 0.875rem; color: var(--muted); }
.masthead-nav { display: flex; gap: 28px; }
.masthead-nav a {
  color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 0.875rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 0; border-bottom: 2px solid transparent;
}
.masthead-nav a:hover { color: var(--crimson); border-bottom-color: var(--crimson); }

/* ── Hero ───────────────────────────────────────────────── */

.hero { background: var(--tan); padding: 44px 0 36px; }
.eyebrow {
  color: var(--crimson);
  font-weight: 600; font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.hero h1 {
  margin-top: 10px; max-width: 24em; text-wrap: balance;
  color: var(--ink);
  font-weight: 700; font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.1; letter-spacing: -0.015em;
}
.lede {
  margin-top: 16px; max-width: 44em;
  font-family: var(--slab); font-weight: 300; font-size: 1.125rem; line-height: 1.6; color: var(--body);
}
.status { margin-top: 18px; font-size: 0.875rem; color: var(--muted); }
.status a { color: var(--crimson); }
.status .old { color: var(--crimson); font-weight: 600; }

/* ── Filter bar ─────────────────────────────────────────── */

.bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule-strong);
  box-shadow: 0 1px 0 rgba(30, 30, 30, 0.04);
}
.bar-inner { display: grid; gap: 12px; padding-top: 16px; padding-bottom: 16px; }
.bar-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }

.search { flex: 1 1 280px; min-width: 0; display: flex; }
#q {
  width: 100%; height: 46px; padding: 0 14px;
  border: 2px solid var(--ink); border-radius: 0; background: var(--paper);
  color: var(--ink); font-size: 1rem;
  -webkit-appearance: none; appearance: none;
}
#q::placeholder { color: var(--muted); opacity: 1; }
#q:focus { outline: none; border-color: var(--crimson); box-shadow: inset 0 0 0 1px var(--crimson); }

/* Segmented "when" control: square, joined, crimson when chosen */
.when-wrap { position: relative; display: flex; }
.seg { display: flex; }
.seg-opt {
  height: 46px; padding: 0 16px; white-space: nowrap;
  border: 2px solid var(--ink); border-radius: 0; background: var(--paper);
  color: var(--ink); font-weight: 600; font-size: 0.9375rem;
}
.seg-opt + .seg-opt { margin-left: -2px; }
.seg-opt:hover:not(.on) { background: var(--tan); }
.seg-opt.on { position: relative; z-index: 1; background: var(--crimson); border-color: var(--crimson); color: var(--on-dark); }
.when .short { display: none; }

/* a chevron drawn in CSS, for buttons that open a panel */
.has-caret::after, .pick-btn::after {
  content: ""; display: inline-block; vertical-align: 0.2em;
  width: 7px; height: 7px; margin-left: 10px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
[aria-expanded="true"].has-caret::after, .pick-btn[aria-expanded="true"]::after { transform: rotate(-135deg); vertical-align: -0.1em; }

/* City, kind and venue pickers get their own row, so a longer label never
   reflows the bar under an open dropdown. */
.pickers { display: flex; flex-wrap: wrap; gap: 12px; flex: 1 1 100%; }
.drop-wrap { position: relative; display: flex; }
.pick-btn {
  height: 42px; padding: 0 16px; white-space: nowrap;
  border: 2px solid var(--ink); border-radius: 0; background: var(--paper);
  color: var(--ink); font-weight: 600; font-size: 0.9375rem;
}
.pick-btn:hover, .pick-btn[aria-expanded="true"] { background: var(--tan); }
.pick-btn.filtered { background: var(--crimson); border-color: var(--crimson); color: var(--on-dark); }
.pick-btn.filtered:hover, .pick-btn.filtered[aria-expanded="true"] { background: var(--crimson-dark); border-color: var(--crimson-dark); }
.pick-btn .short { display: none; }

.panel {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  box-shadow: 0 12px 32px rgba(30, 30, 30, 0.14);
  padding: 16px;
  display: grid; gap: 12px;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.panel-title { color: var(--ink); font-weight: 700; font-size: 1rem; }
.panel-actions { display: flex; gap: 18px; }

.textbtn {
  justify-self: start;
  border: none; background: none; padding: 2px 0;
  color: var(--crimson); font-weight: 600; font-size: 0.875rem;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.textbtn:hover:not(:disabled) { color: var(--crimson-dark); }
.textbtn:disabled { color: var(--faint); text-decoration: none; }

/* checklists that drop under their button */
.drop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: 17rem; }
.opts { display: grid; }
.opt {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 6px; border: none; background: none; text-align: left;
  color: var(--ink); font-size: 0.9375rem;
}
.opt::before {
  content: ""; flex: none;
  width: 18px; height: 18px;
  border: 2px solid var(--ink); background: var(--paper);
}
.opt[aria-checked="true"]::before {
  border-color: var(--crimson);
  background: var(--crimson) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.opt:hover:not(:disabled) { background: var(--wash); }
.opt:disabled::before { opacity: 0.55; }

/* Month calendar: drops under the when-control; days with shows are live, the rest greyed */
.date-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; width: 360px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
  padding-bottom: 4px; text-align: center;
  color: var(--muted); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.cal-day {
  height: 42px; padding: 0;
  border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink); font-family: var(--slab); font-size: 0.9375rem;
}
.cal-day:hover:not(:disabled) { border-color: var(--ink); background: var(--tan); }
.cal-day:disabled { border-color: transparent; color: #b7b7b7; }
.cal-day.today { font-weight: 500; box-shadow: inset 0 -3px 0 var(--crimson); }
.cal-day[aria-pressed="true"] { background: var(--crimson); border-color: var(--crimson); color: var(--on-dark); box-shadow: none; }

/* venue picker: chips grouped by kind */
.venue-panel { max-height: min(60vh, 480px); overflow-y: auto; }
#chips { display: grid; gap: 16px; }
.chip-group { display: grid; gap: 8px; }
.group-label {
  color: var(--crimson); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 12px;
  border: 1px solid var(--rule-strong); border-radius: 0; background: var(--paper);
  color: var(--ink); font-size: 0.875rem; text-align: left;
}
.chip:hover { border-color: var(--ink); }
.chip .n { margin-left: 8px; color: var(--muted); font-family: var(--slab); font-size: 0.8125rem; }
.chip[aria-pressed="true"] { background: var(--crimson); border-color: var(--crimson); color: var(--on-dark); }
.chip[aria-pressed="true"] .n { color: #f3d2d7; }

/* ── Listings ───────────────────────────────────────────── */

.list { padding-top: 8px; padding-bottom: 72px; }
.loading, .empty { padding: 48px 0; color: var(--muted); font-size: 1rem; }
.empty .textbtn { margin-left: 6px; }
.alert { margin: 32px 0; padding: 14px 16px; border-left: 4px solid var(--crimson); background: var(--wash); color: var(--ink); }

.day-group { margin-top: 28px; }
.day {
  position: sticky; top: var(--bar-h); z-index: 5;
  display: flex; align-items: baseline; gap: 12px;
  padding: 18px 0 10px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}
.day::before {
  content: ""; position: absolute; left: 0; top: 6px;
  width: 40px; height: 4px; background: var(--crimson);
}
.day-name { color: var(--ink); font-weight: 700; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }
.day-date { color: var(--muted); font-family: var(--slab); font-weight: 300; font-size: 1.0625rem; }
.day-count { margin-left: auto; color: var(--muted); font-size: 0.8125rem; letter-spacing: 0.04em; }

.show {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) 15rem 6.5rem;
  column-gap: 20px;
  align-items: baseline;
  padding: 14px 10px 14px 0;
  border-bottom: 1px solid var(--rule);
  color: inherit; text-decoration: none;
  transition: background-color 120ms ease;
}
a.show:hover { background: var(--wash); box-shadow: inset 4px 0 0 var(--crimson); color: inherit; }
a.show:hover .head { color: var(--crimson); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a.show:focus-visible { outline: 3px solid var(--crimson); outline-offset: -3px; }

.time { padding-left: 10px; color: var(--muted); font-family: var(--slab); font-size: 0.9375rem; white-space: nowrap; }
.head { color: var(--ink); font-weight: 600; font-size: 1.0625rem; line-height: 1.35; overflow-wrap: anywhere; }
.with { display: block; margin-top: 3px; color: var(--muted); font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; }
.where { display: grid; gap: 1px; min-width: 0; }
.venue { color: var(--ink); font-weight: 500; font-size: 0.9375rem; }
.area { color: var(--muted); font-size: 0.8125rem; }
.price {
  color: var(--ink); font-size: 0.875rem; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.price.free { color: var(--crimson); font-weight: 600; }

/* ── Footer ─────────────────────────────────────────────── */

.foot { background: var(--ink); color: var(--on-dark-muted); padding: 56px 0 64px; }
.foot .wrap { display: grid; gap: 48px; }
.foot-title { position: relative; padding-top: 16px; color: var(--on-dark); font-weight: 700; font-size: 1.5rem; }
.foot-title::before { content: ""; position: absolute; left: 0; top: 0; width: 40px; height: 4px; background: var(--crimson); }
.venue-index {
  list-style: none; margin: 20px 0 0; padding: 0;
  columns: 3 17rem; column-gap: 40px;
  font-size: 0.9375rem; line-height: 1.5;
}
.venue-index > li { break-inside: avoid; margin-bottom: 24px; }
.venue-index ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.venue-index .group-label { color: #e8a3ad; }
.venue-index a { color: var(--on-dark); text-decoration-color: var(--crimson); text-decoration-thickness: 2px; }
.venue-index a:hover { color: var(--on-dark); text-decoration-color: var(--on-dark); }
.venue-index .muted { display: block; color: var(--on-dark-muted); font-size: 0.8125rem; }
.venue-index .stale { display: block; color: #f39b9d; font-size: 0.8125rem; }
.foot-about p { margin-top: 16px; max-width: 46em; font-family: var(--slab); font-weight: 300; line-height: 1.7; }

/* ── Tablets ────────────────────────────────────────────── */

@media (max-width: 900px) {
  .show { grid-template-columns: 5rem minmax(0, 1fr) 11rem 5.5rem; column-gap: 14px; }
}

/* ── Phones ─────────────────────────────────────────────── */

/* The filters scroll away with the page (set once, then scan) and only the
   day header stays pinned; each show is "time · venue · price" over the lineup. */
@media (max-width: 680px) {
  :root { --gutter: 16px; }
  .masthead-row { min-height: 68px; }
  .wordmark { padding-left: 12px; }
  .wordmark-name { font-size: 1.125rem; }
  .wordmark-sub { font-size: 0.8125rem; }
  .masthead-nav { gap: 16px; }
  .masthead-nav a { font-size: 0.75rem; }
  .hero { padding: 28px 0 24px; }
  .lede { font-size: 1rem; }

  .bar { position: static; box-shadow: none; }
  .bar-inner { gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .bar-row { gap: 10px; }
  .search { flex-basis: 100%; }
  #q { height: 44px; }
  .when-wrap, .when { flex: 1 1 100%; }
  .seg-opt { flex: 1 1 auto; height: 42px; padding: 0 6px; font-size: 0.875rem; }
  .has-caret::after, .pick-btn::after { margin-left: 6px; width: 6px; height: 6px; }
  .when .long, .pick-btn .long { display: none; }
  .when .short, .pick-btn .short { display: inline; }
  .pickers { gap: 8px; flex-wrap: nowrap; }
  .pickers > * { flex: 1 1 0; min-width: 0; }
  .drop-wrap > .pick-btn { flex: 1 1 auto; min-width: 0; }
  .pick-btn { height: 42px; padding: 0 8px; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; }
  .date-panel { left: 0; right: auto; width: calc(100vw - 2 * var(--gutter)); }
  /* checklists span the picker row, like the calendar spans the page */
  .pickers { position: relative; }
  .drop-wrap { position: static; }
  .drop { left: 0; right: 0; width: auto; }

  .day-group { margin-top: 20px; }
  .day { top: 0; padding: 16px 0 8px; }
  .day::before { top: 4px; }
  .day-name { font-size: 1.25rem; }
  .day-date { font-size: 0.9375rem; }

  .show { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 4px; padding: 12px 2px; }
  a.show:hover { box-shadow: none; }
  .time { order: 1; padding-left: 0; font-size: 0.875rem; }
  .time:empty { display: none; }
  .where { order: 2; display: block; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .venue { font-size: 0.875rem; color: var(--muted); font-weight: 500; }
  .area { display: none; }
  .price { order: 3; font-size: 0.8125rem; }
  .acts { order: 4; flex-basis: 100%; }
  .head { font-size: 1rem; }
  .with { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

  .foot { padding: 40px 0 48px; }
}

@media (max-width: 360px) {
  .seg-opt, .pick-btn { padding: 0 4px; font-size: 0.8125rem; }
}
