/* Site-wide styles. Keep it small; add a section per page only when needed. */

:root {
  --colour-text: #1d1d1f;
  --colour-accent: #7a1f2b;
  --colour-background: #ffffff;
  --colour-burgundy: #640c23;  /* the old site's page colour */
  --colour-gold: #fed73e;      /* the lyre and the current menu item */
  --max-width: 60rem;
}

/* Burgundy textured page, with the content on a white panel (as on the old site) */
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  line-height: 1.6;
  color: var(--colour-text);
  background: var(--colour-burgundy) url("../img/background.a2b2d7f6b8e9.jpg") fixed;
  overflow-x: clip; /* the tilted filmstrip's corners must not cause sideways scrolling */
}

.site-header,
main,
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem;
}

main {
  padding: 1.5rem;
  border-radius: 4px;
  background: var(--colour-background);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}

.site-footer {
  color: #ddd;
  text-align: center;
}

/* --- Home page filmstrip: 4 photos on a slightly tilted strip of film ------------- */

.banner {
  max-width: var(--max-width);
  margin: 0.75rem auto 2rem;
  padding: 0 1rem;
}

.filmstrip {
  position: relative;
  padding: 22px 12px;
  border-radius: 3px;
  background: #161616;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  transform: rotate(-1.5deg);
}

/* The sprocket holes along the top and bottom edges */
.filmstrip::before,
.filmstrip::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 9px;
  background: radial-gradient(closest-side, #e9e3d8 80%, transparent 100%) 0 0 / 22px 9px repeat-x;
}

.filmstrip::before {
  top: 6px;
}

.filmstrip::after {
  bottom: 6px;
}

.filmstrip__frames {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.filmstrip__frame {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #000;
}

.filmstrip__frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* fill the frame, cropping the edges if needed */
  transition: opacity 0.6s ease;
}

.filmstrip__frame img.is-fading {
  opacity: 0;
}

@media (max-width: 600px) {
  .filmstrip__frames {
    grid-template-columns: repeat(2, 1fr);
  }

  .filmstrip__frame:nth-child(n + 3) {
    display: none; /* 2 photos on phones */
  }
}

@media (prefers-reduced-motion: reduce) {
  .filmstrip__frame img {
    transition: none;
  }
}

/* --- Header: lyre logo, title and subtitle, menu on the right ---------------------- */

.brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  color: #fff;
  text-decoration: none;
}

.brand__logo {
  width: 120px;
  height: auto;
}

.brand__text {
  display: flex;
  flex-direction: column;
  font-family: "Mate", Georgia, serif;
}

.brand__title {
  font-size: 2.5rem;
  font-variant: small-caps;
  line-height: 1.1;
}

.brand__subtitle {
  margin-top: 0.4rem;
  color: #ddd;
  font-size: 0.95rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.25rem 1.5rem;
  margin-top: 0.5rem;
}

.site-nav a,
.site-nav .nav-logout button {
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav .nav-logout button:hover {
  color: yellow;
}

/* The page you're on: yellow with a gold underline */
.site-nav a[aria-current="page"] {
  border-bottom-color: var(--colour-gold);
  color: yellow;
}

@media (max-width: 600px) {
  .brand {
    gap: 0.75rem;
  }

  .brand__logo {
    width: 60px;
  }

  .brand__title {
    font-size: 1.55rem;
  }

  .brand__subtitle {
    display: none;
  }

  .site-nav {
    justify-content: flex-start;
    gap: 0.25rem 1rem;
  }

  main {
    padding: 1rem;
    border-radius: 0;
  }
}

a {
  color: var(--colour-accent);
}

.muted {
  color: #666;
  font-size: 0.9em;
}

.button {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  background: var(--colour-accent);
  color: #fff;
  text-decoration: none;
}

.button--secondary {
  background: #fff;
  color: var(--colour-accent);
  box-shadow: inset 0 0 0 2px var(--colour-accent); /* border without changing the size */
}

/* A row of buttons, evenly spaced, wrapping on small screens */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  background: #f3e3c3;
  font-size: 0.8rem;
}


/* --- Engagements list --------------------------------------------------- */

.month {
  margin-top: 2rem;
  border-bottom: 2px solid var(--colour-accent);
}

.events {
  width: 100%;
  border-collapse: collapse;
}

.events td {
  padding: 1.5rem 0.5rem;
  border-bottom: 2px solid var(--colour-accent); /* a clear line between engagements */
  vertical-align: top;
}

.events tr:nth-child(even) td {
  background: #faf6f6; /* every other engagement tinted, so each one stands apart */
}

.events td:first-child {
  padding-left: 0.75rem;
}

.events tr:last-child td {
  border-bottom: none; /* the month heading or page end follows */
}

.events__poster {
  width: 10rem;
}

.events__title {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  font-weight: bold;
}

.events__title a {
  color: inherit;
  text-decoration: none;
}

.events__title a:hover {
  text-decoration: underline;
}

.events__when {
  margin: 0.25rem 0;
  font-weight: 600;
}

.events__where {
  margin: 0.25rem 0 0.75rem;
}

/* Poster thumbnail, or a tile with the title when there's no image */
.poster {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 10rem;
  aspect-ratio: 1 / 1.414; /* A-series paper, like a printed poster */
  padding: 0;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster--placeholder {
  padding: 0.75rem;
  border: none;
  background: var(--colour-accent);
  color: #fff;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
  cursor: default;
}

a.poster--placeholder {
  cursor: pointer;
}

.poster--placeholder small {
  margin-top: 0.5rem;
  font-weight: normal;
  text-decoration: underline;
}

.poster-pdf {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

/* --- Event detail page ---------------------------------------------------- */

.event-detail {
  display: grid;
  grid-template-columns: 1fr 18rem; /* details | poster */
  gap: 2rem;
  align-items: start;
}

.event-detail__title {
  margin-top: 0;
}

/* "When / Where / Tickets" as label + value rows */
.facts {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.75rem 1rem;
  margin: 1rem 0;
}

.facts dt {
  font-weight: bold;
  color: var(--colour-accent);
}

.facts dd {
  margin: 0;
}

.event-detail__description {
  padding-top: 0.5rem;
  border-top: 1px solid #ddd;
}

.poster--large {
  width: 100%;
}

@media (max-width: 700px) {
  .event-detail {
    grid-template-columns: 1fr; /* poster drops below the details */
  }

  .event-detail__poster {
    max-width: 18rem;
  }
}

/* --- Home: next concert ---------------------------------------------------- */

.next-event {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 2rem;
  padding: 1.25rem;
  border-left: 4px solid var(--colour-accent);
  background: #faf6f6;
}

.next-event__poster img {
  display: block;
  width: 9rem;
  border: 1px solid #ccc;
}

.next-event__label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--colour-accent);
}

.next-event__title {
  margin: 0.25rem 0;
}

.next-event__title a {
  color: inherit;
  text-decoration: none;
}

@media (max-width: 600px) {
  .next-event {
    flex-direction: column;
  }
}

/* --- The Band (roster) ----------------------------------------------------- */

/* Cards in as many columns as fit; one column on phones */
.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1rem;
}

.roster__section {
  padding: 0.75rem 1rem;
  border-top: 3px solid var(--colour-accent);
  background: #faf6f6;
}

.roster__section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--colour-accent);
}

.roster__section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}


/* --- Breadcrumbs: Members Area › Engagements › Christmas Concert ----------------- */

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.breadcrumbs li + li::before {
  content: "›";
  margin: 0 0.5rem;
  color: #999;
}

.breadcrumbs [aria-current="page"] {
  color: #666;
}

/* --- Navigation extras and messages ------------------------------------------ */

/* "Log out" is a form button (logging out must be a POST) dressed as a menu link */
.nav-logout {
  display: inline;
  margin: 0;
}

.nav-logout button {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
}

.message {
  padding: 0.6rem 1rem;
  border-left: 4px solid #2e7d32;
  background: #edf7ed;
}

.badge--private {
  background: #e3e7f3;
}


/* --- Members Area ------------------------------------------------------------- */

.login {
  max-width: 24rem;
}

.login label {
  display: block;
  margin-top: 1rem;
  font-weight: bold;
}

.login input {
  box-sizing: border-box;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #aaa;
  border-radius: 4px;
  font: inherit;
}

.login .button {
  margin-top: 1.25rem;
  border: none;
  font: inherit;
  cursor: pointer;
}

.form-error {
  padding: 0.6rem 1rem;
  border-left: 4px solid #c62828;
  background: #fdecea;
}

.band-events {
  width: 100%;
  border-collapse: collapse;
}

.band-events th {
  padding: 0.5rem;
  border-bottom: 2px solid var(--colour-accent);
  text-align: left;
}

.band-events td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #ddd;
  vertical-align: top;
}

.band-events tbody tr:nth-child(even) {
  background: #faf6f6;
}

/* Venues: one <tbody> per venue (its row plus hidden details), so stripe by tbody */
.venue-list tbody tr:nth-child(even) {
  background: none;
}

.venue-list tbody:nth-of-type(even) tr {
  background: #faf6f6;
}

.venue-list__actions {
  text-align: right;
  white-space: nowrap;
}

.venue-list__actions .link-button {
  margin-right: 1rem;
}

.venue-list tr:has(+ .venue-list__details:not([hidden])) td {
  border-bottom: none;  /* the row and its open details read as one */
}

.venue-details {
  display: flex;  /* columns only as wide as their text, close together */
  flex-wrap: wrap;
  gap: 0.75rem 3rem;
  padding: 0.25rem 0 0.5rem;
}

.venue-details section {
  max-width: 22rem;
}

.venue-details h2 {
  margin: 0 0 0.3rem;
  color: var(--colour-accent);
  font-size: 0.95rem;
}

.venue-details p {
  margin: 0 0 0.5rem;
}

/* Contact notes: blank lines become small gaps, not big ones */
.venue-details__notes {
  margin-top: 0.4rem;
  padding-left: 0.6rem;
  border-left: 3px solid var(--colour-gold);
  color: #555;
  font-size: 0.9rem;
}

.venue-details__notes p {
  margin: 0 0 0.3rem;
}

.venue-details__events {
  margin: 0;
  padding-left: 1.1rem;
}

/* First row of a new section in the People list */
.band-events tr.section-start td {
  border-top: 3px solid var(--colour-accent);
}

.band-events__date {
  white-space: nowrap;
}

.band-events__title {
  font-weight: bold;
}

.band-events__replies {
  min-width: 12rem;
  font-size: 0.9rem;
}

/* Yes/No answer buttons */
.answer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.4rem;
}

.answer__name {
  min-width: 8rem;
  font-size: 0.9rem;
}

.answer__button {
  padding: 0.25rem 0.9rem;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.answer__button--yes {
  border-color: #2e7d32;
  background: #2e7d32;
  color: #fff;
}

.answer__button--no {
  border-color: #c62828;
  background: #c62828;
  color: #fff;
}

/* Several people's answers: one row each, names in one column, buttons lined up */
.answers {
  display: grid;
  grid-template-columns: auto auto auto;  /* name | Yes | No */
  justify-content: start;
  column-gap: 0.35rem;
}

.answers .answer {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
}

.answers:not(:has(.answer__name)) {
  grid-template-columns: auto auto;  /* just one person: no name column */
}

.answers .answer__name {
  min-width: 0;
}

/* Tick-list marks */
.tick {
  font-weight: bold;
}

.tick--yes {
  color: #2e7d32;
}

.tick--no {
  color: #c62828;
}

.band-poster img {
  display: block;
  width: 100%;
  max-width: 14rem;
  margin-top: 1rem;
  border: 1px solid #ccc;
}

/* Members Area home: two equal columns of cards (one on phones).
   .card--wide and .cards__heading span both columns. */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 700px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

.cards__heading {
  grid-column: 1 / -1;
  margin: 1rem 0 0;
}

/* A card heading that links to that area's overview page */
.card h2 a {
  color: inherit;
  text-decoration: none;
}

.card h2 a:hover {
  text-decoration: underline;
}

.card {
  padding: 1rem 1.25rem;
  border-top: 3px solid var(--colour-accent);
  background: #faf6f6;
}

.card--wide {
  grid-column: 1 / -1; /* full width */
}

.card--committee {
  border-top-color: #3949ab;
  background: #f3f4fb;
}

.card h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.card__event {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #e5dada;
}

.card__more {
  margin-bottom: 0;
}

/* One engagement on the Members Area home: date block | details | my Yes/No */
.event-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.25rem 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e5dada;
}

.event-row:last-child {
  border-bottom: none;
}

.datebadge {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 3.25rem;
  padding: 0.3rem 0;
  border-radius: 6px;
  background: var(--colour-accent);
  color: #fff;
  line-height: 1.1;
}

.datebadge__day {
  font-size: 1.35rem;
  font-weight: bold;
}

.datebadge__month,
.datebadge__weekday {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.event-row__main .muted {
  font-size: 0.9rem;
}

/* Compact Yes/No buttons, names small and grey */
.event-row__answers .answers {
  justify-content: end;
}

.event-row__answers .answer {
  margin: 0.15rem 0;
}

.event-row__answers .answer__name {
  min-width: 0;
  margin-right: 0.25rem;
  color: #666;
  font-size: 0.8rem;
}

.event-row__answers .answer__button {
  padding: 0.1rem 0.65rem;
  font-size: 0.85rem;
}

/* Phones: Yes/No buttons go under the details */
@media (max-width: 600px) {
  .event-row {
    grid-template-columns: auto 1fr;
  }

  .event-row__answers {
    grid-column: 2;
  }

  .event-row__answers .answers {
    justify-content: start;
  }
}

/* Reply summary: thin yes/no bar plus "12 yes · 3 no · 8 not replied" */
.replies {
  margin-top: 0.3rem;
  font-size: 0.85rem;
}

.replies__bar {
  display: flex;
  max-width: 14rem;
  height: 4px;
  margin-bottom: 0.2rem;
  overflow: hidden;
  border-radius: 2px;
  background: #e0dada;
}

.replies__yes {
  background: #2e7d32;
}

.replies__no {
  background: #c62828;
}

.replies__text {
  color: #666;
}

.replies .tick--yes,
.replies .tick--no {
  font-weight: bold;
}

/* Search boxes and filter rows */
.search,
.filters,
.book-dep {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.search input,
.filters input,
.filters select,
.book-dep select {
  padding: 0.4rem;
  border: 1px solid #aaa;
  border-radius: 4px;
  font: inherit;
}

.search input {
  flex: 1;
  min-width: 10rem;
}

.search .button,
.filters .button,
.book-dep .button {
  border: none;
  font: inherit;
  cursor: pointer;
}

.pager {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* "Who's playing": one full-width table in score order */
.ticklist {
  width: 100%;
  border-collapse: collapse;
}

.ticklist thead th {
  padding: 0.4rem 0.5rem;
  border-bottom: 2px solid var(--colour-accent);
  text-align: left;
}

.ticklist td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid #eee;
}

/* A stronger line between sections, and a light band on every other section */
.ticklist__section {
  border-top: 2px solid #e5dada;
}

.ticklist__section:nth-of-type(even) {
  background: #faf6f6;
}

.ticklist__section-name {
  width: 12rem;
  padding: 0.3rem 0.5rem;
  color: var(--colour-accent);
  text-align: left;
  vertical-align: top;
}

@media (max-width: 600px) {
  .ticklist__section-name {
    width: auto;
    font-size: 0.85rem;
  }
}

.ticklist__answer {
  width: 1%; /* as narrow as its contents, so the names get the space */
  white-space: nowrap;
  text-align: right;
}

.ticklist .answer {
  margin: 0;
  flex-wrap: nowrap;
}

.ticklist .answer__button {
  padding: 0.05rem 0.6rem;
  font-size: 0.85rem;
}

.chip {
  display: inline-block;
  min-width: 3.5rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: #eee;
  color: #777;
  font-size: 0.8rem;
  text-align: center;
}

.chip--yes {
  background: #2e7d32;
  color: #fff;
}

.chip--no {
  background: #c62828;
  color: #fff;
}

.inline-form {
  display: inline;
}

.link-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--colour-accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.ticklist .inline-form {
  margin-left: 0.5rem; /* the committee's "Remove" next to a deputy's Yes */
}

/* Home: "Subscribe to our newsletter" */
.newsletter {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  border-radius: 4px;
  background: var(--colour-burgundy);
  color: #fff;
}

.newsletter h2 {
  margin-top: 0;
  font-family: "Mate", Georgia, serif;
}

.newsletter p {
  color: #eee;
}

.newsletter__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.newsletter__form label {
  display: flex;
  flex: 1 1 12rem;
  flex-direction: column;
  font-size: 0.9rem;
}

.newsletter__form input {
  padding: 0.5rem;
  border: none;
  border-radius: 4px;
  font: inherit;
}

.newsletter__form .button {
  border: 1px solid var(--colour-gold);
  background: var(--colour-gold);
  color: #3a0613;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
}

.newsletter__archive-title {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}

.newsletter__archive {
  columns: 2 16rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.newsletter__archive li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  break-inside: avoid;
}

.newsletter__archive a {
  color: #fff;
}

.newsletter__archive span {
  color: #ddd;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* A past newsletter, shown in a sealed frame */
.newsletter-frame {
  display: block;
  width: 100%;
  height: 80vh;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}

/* The spam trap: off-screen for people, still "there" for robots */
.newsletter__trap {
  position: absolute;
  left: -10000px;
}

/* A page title with a button on the right (e.g. "Edit engagement") */
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-head h1 {
  margin: 0 0 0.25rem;
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Send joining instructions: the email exactly as it will look */
.email-preview {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1rem;
  max-height: 30rem;
  overflow: auto;
}

.notice {
  background: #fff6e0;
  border-left: 4px solid #e0a800;
  padding: 0.75rem 1rem;
}

/* Contact Us: three contact cards side by side (stacked on phones) */
.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.contact-cards p {
  margin-bottom: 0;
}

.contact-address {
  margin-bottom: 1rem;
  font-style: normal;
  line-height: 1.5;
}

/* A small form laid out in a row: labelled fields side by side, button at the end.
   Used for "Upload a copy" and "Record a move" on a piece's page. */
.inline-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px dashed #d8c9c9;
  border-radius: 4px;
  background: #fff;
}

.inline-fields h3 {
  flex-basis: 100%;
  margin: 0;
  font-size: 1rem;
}

.inline-fields .field {
  flex: 1 1 12rem;
  margin: 0;
}

.inline-fields .field label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
  font-weight: bold;
}

.inline-fields input:not([type="file"]),
.inline-fields select,
.running-order__add input {
  box-sizing: border-box;
  width: 100%;
  height: 2.4rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid #aaa;
  border-radius: 4px;
  font: inherit;
}

.inline-fields input[type="file"] {
  width: 100%;
  font-size: 0.9rem;
}

.inline-fields .button,
.running-order__add .button {
  height: 2.4rem;
  border: none;
  font: inherit;
  cursor: pointer;
}

.danger-link {
  color: #c62828;
}

.actions__end {
  align-self: center;
  margin-left: auto; /* pushed to the far right, away from Save */
}

.button--danger {
  border: none;
  background: #c62828;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.button--small {
  padding: 0.15rem 0.7rem;
  font-size: 0.85rem;
}

/* Clickable column headings that sort a table (e.g. People) */
.sort-link {
  color: inherit;
  text-decoration: none;
}

.sort-link:hover {
  text-decoration: underline;
}

/* Library list: the committee's "Where" drop-down in each row */
.where-form {
  display: flex;
  gap: 0.3rem;
  margin: 0;
}

.where-form select {
  padding: 0.2rem 0.3rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
}

/* --- Photos (members' albums) --------------------------------------------------- */

.album h2 {
  margin-bottom: 0;
}

.album__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.5rem;
}

.album__photo {
  position: relative;
  margin: 0;
}

.album__open {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}

.album__open img,
.card__thumbs img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
}

/* A video takes two tiles, so its play controls are big enough to use */
.album__video {
  grid-column: span 2;
}

.album__video video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 3px;
  background: #000;
}

.album__video .album__delete {
  z-index: 1; /* above the video */
}

.album__delete {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0; /* only shows when you point at the photo */
  transition: opacity 0.15s;
}

.album__photo:hover .album__delete,
.album__delete:focus-within {
  opacity: 1;
}

/* Committee: "+ Filmstrip" / "✓ In filmstrip" in the bottom corner of a photo */
.album__filmstrip {
  margin: 0;
}

.album__badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 0.1rem 0.5rem;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
}

.album__badge--button {
  background: var(--colour-gold);
  color: #3a0613;
  font-weight: bold;
  cursor: pointer;
  opacity: 0; /* appears when you point at the photo, like the delete button */
  transition: opacity 0.15s;
}

.album__photo:hover .album__badge--button,
.album__badge--button:focus {
  opacity: 1;
}

/* Touch screens can't "point at" a photo, so always show the buttons there */
@media (hover: none) {
  .album__delete,
  .album__badge--button {
    opacity: 1;
  }
}

/* Members Area home: a strip of thumbnails in the Photos card */
.card__thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
}

/* --- Running order -------------------------------------------------------------- */

.running-order {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

/* One compact line per item: number | title + composer (+ instructions) | tools */
.running-order__item {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid #ece2e2;
}

.running-order__number {
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--colour-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
}

.running-order__main {
  min-width: 0; /* lets long titles wrap instead of pushing the buttons off */
  font-size: 0.95rem;
}

.running-order__title {
  margin-right: 0.35rem;
  font-weight: bold;
}

.running-order__note {
  margin: 0.1rem 0 0;
  padding-left: 0.5rem;
  border-left: 3px solid var(--colour-gold);
  font-size: 0.85rem;
}

.running-order__tools {
  position: relative; /* the ✎ box opens underneath, lined up with the right edge */
  display: flex;
  gap: 0.2rem;
}

.running-order__edit summary {
  display: grid;
  place-items: center;
  list-style: none; /* no ▸ marker */
}

.running-order__edit summary::-webkit-details-marker {
  display: none;
}

.running-order__edit[open] summary {
  border-color: var(--colour-accent);
  background: #f6eced;
}

.running-order__edit form {
  position: absolute;
  z-index: 10;
  top: calc(100% + 4px);
  right: 0;
  display: flex;
  gap: 0.4rem;
  width: min(24rem, 80vw);
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.running-order__edit input {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.4rem;
  border: 1px solid #aaa;
  border-radius: 4px;
  font: inherit;
  font-size: 0.9rem;
}

.running-order__edit .button {
  border: none;
  cursor: pointer;
}

.icon-button {
  box-sizing: border-box;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #555;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}

.icon-button--danger,
.running-order__edit summary {
  font-size: 0.95rem;
}

.icon-button:hover:not(:disabled) {
  border-color: var(--colour-accent);
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.icon-button--danger:hover {
  border-color: #c62828;
  color: #c62828;
}

.running-order__add {
  display: grid;
  grid-template-columns: 2fr 2fr auto;
  gap: 0.75rem;
  align-items: start;
}

.running-order__add .field {
  margin: 0;
}

.running-order__add .button {
  margin-top: 1.75rem; /* line up with the inputs below their labels */
}

@media (max-width: 700px) {
  .running-order__add {
    grid-template-columns: 1fr;
  }

  .running-order__add .button {
    margin-top: 0;
  }
}

/* INTERVAL / EXTRAS: a heading across the list, not a numbered piece */
.running-order__item--divider {
  margin-top: 0.5rem;
  border-bottom: 2px solid var(--colour-accent);
}

.running-order__divider {
  color: var(--colour-accent);
  letter-spacing: 0.12em;
}

.running-order__dividers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Heading with the committee's "Copy to another engagement" on the right */
.running-order__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.running-order__copy {
  position: relative;
}

.running-order__pdf {
  margin-left: auto; /* with "Copy to another engagement", both sit on the right */
}

.running-order__pdf + .running-order__copy {
  margin-left: 0;
}

.running-order__copy summary {
  list-style: none;
  cursor: pointer;
}

.running-order__copy summary::-webkit-details-marker {
  display: none;
}

.running-order__copy form {
  position: absolute;
  right: 0;
  z-index: 5;
  display: grid;
  gap: 0.4rem;
  width: min(22rem, 85vw);
  margin-top: 0.3rem;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.running-order__copy label {
  font-weight: bold;
}

.running-order__copy .field__help {
  margin: 0;
}

@media (max-width: 700px) {
  .running-order__copy form {
    position: static;  /* phones: opens in place under the button */
    width: auto;
  }
}

/* Password box with an eye button to show what's typed (js/show-password.js) */
.password-box {
  position: relative;
  display: block;
}

.password-box input {
  padding-right: 2.75rem !important; /* room for the eye */
}

.password-box__toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  color: #555;
  cursor: pointer;
  transform: translateY(-50%);
}

.password-box__toggle:hover,
.password-box__toggle:focus-visible {
  color: var(--colour-accent);
  background: #f3eaeb;
}

/* Upload feedback (js/upload-progress.js) */
.upload-progress {
  display: grid;
  gap: 0.3rem;
  max-width: 36rem;
  margin: 0.75rem 0;
}

.upload-progress progress {
  width: 100%;
  height: 0.9rem;
  accent-color: var(--colour-accent);
}

.upload-progress__text {
  font-weight: bold;
}

.upload-progress--error .upload-progress__text {
  color: #c62828;
}

form[data-uploading] button:disabled {
  cursor: progress;
  opacity: 0.7;
}

/* --- Library statistics (library/stats.py) ------------------------------------- */

/* Small figure + label boxes: "6 times played", "4 months in the pad" */
.stat-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1rem;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  min-width: 7.5rem;
  padding: 0.55rem 0.8rem;
  border-left: 4px solid var(--colour-accent);
  border-radius: 4px;
  background: #faf6f6;
}

.stat-tile__value {
  color: var(--colour-accent);
  font-size: 1.35rem;
  font-weight: bold;
  line-height: 1.2;
}

.stat-tile__label {
  color: #555;
  font-size: 0.85rem;
}

.piece-record h3 {
  margin: 0.75rem 0 0.3rem;
  font-size: 1rem;
}

.piece-record__played {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 1rem;
  align-items: start;
}

.stats-grid .panel {
  margin: 0;
}

.stats-grid h2 + h2,
.stats-grid ul + h2,
.stats-grid p + h2 {
  margin-top: 1.25rem;
}

.stats-table td,
.stats-table th {
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
}

.stats-table__number {
  text-align: right;
}

/* Horizontal bars: label | bar | count */
.stats-bars {
  margin: 0;
  padding: 0;
  list-style: none;
}

.stats-bars li {
  display: grid;
  grid-template-columns: minmax(6rem, 10rem) 1fr 2rem;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.stats-bars__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-bars__bar {
  display: block;
  width: var(--share);
  min-width: 3px;
  height: 0.7rem;
  border-radius: 0 3px 3px 0;
  background: var(--colour-accent);
}

.stats-bars__count {
  text-align: right;
}

@media (max-width: 500px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Search drop-down (search-dropdown.js) ------------------------------------ */

/* The script wraps each box in .autocomplete, so the list can sit right under it */
.autocomplete {
  position: relative;
}

.autocomplete input {
  box-sizing: border-box;
  width: 100%;
}

/* In a row of search controls, the search box takes the spare room */
.search .autocomplete,
.filters .autocomplete {
  flex: 1 1 14rem;
}

.autocomplete__list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 20rem;
  margin: 0;
  padding: 0.25rem 0;
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  list-style: none;
}

.autocomplete__list li {
  padding: 0.4rem 0.7rem;
  color: var(--colour-text);
  cursor: pointer;
}

.autocomplete__list li[aria-selected="true"],
.autocomplete__list li[role="option"]:hover {
  background: #f6eced;
}

.autocomplete__detail {
  display: block;
  color: #666;
  font-size: 0.8rem;
}

.autocomplete__empty {
  color: #888 !important;
  cursor: default !important;
}

/* A boxed section of a page, like the Members Area cards */
.panel {
  padding: 1rem 1.25rem;
  border-top: 3px solid var(--colour-accent);
  border-radius: 0 0 4px 4px;
  background: #faf6f6;
}

.panel h2 {
  margin-top: 0;
}

.panel--highlight {
  border-top-color: #2e7d32; /* "Can you play?" stands out in green */
  background: #f2f8f2;
}

.panel--spaced {
  margin-top: 1.5rem;
}

.event-detail__side {
  display: grid;
  gap: 1rem;
}

.event-detail__side .band-poster img {
  margin-top: 0;
}

/* News: Facebook posts as our own cards */
.news-feed {
  display: grid;
  gap: 1.25rem;
  max-width: 44rem;
}

.news-post {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e5dada;
}

.news-post:not(:has(.news-post__picture)) {
  grid-template-columns: 1fr; /* text-only posts use the full width */
}

.news-post__picture {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
}

.news-post__date {
  margin: 0 0 0.25rem;
  color: var(--colour-accent);
  font-size: 0.85rem;
  font-weight: bold;
}

.news-post__text p:first-child {
  margin-top: 0;
}

@media (max-width: 600px) {
  .news-post {
    grid-template-columns: 1fr;
  }
}

/* News fallback: Facebook's own box (at most 500px wide) */
.facebook-feed iframe {
  display: block;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  border: none;
}

.lead {
  margin-top: -0.5rem;
  color: var(--colour-accent);
  font-size: 1.15rem;
}

/* Join the Band: sections in two columns, one on phones */
.join-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2.5rem;
}

@media (max-width: 700px) {
  .join-grid {
    grid-template-columns: 1fr;
  }
}

.columns-list {
  columns: 2;
}

.columns-list li {
  break-inside: avoid;
}

.call-to-action {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--colour-accent);
  background: #faf6f6;
}

.call-to-action h2 {
  margin-top: 0;
}

/* A text column with a photo beside it (Musical Director); photo first on phones */
.profile {
  display: grid;
  grid-template-columns: 1fr 18rem;
  gap: 2rem;
  align-items: start;
}

.profile__text p:first-child {
  margin-top: 0;
}

.profile__photo {
  width: 100%;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

@media (max-width: 700px) {
  .profile {
    grid-template-columns: 1fr;
  }

  .profile__photo {
    order: -1;
    max-width: 18rem;
  }
}

/* Committee > Photos: a grid of thumbnails */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 1rem;
}

.photo-grid__item {
  margin: 0;
}

.photo-grid__item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
}

.photo-grid__item--hidden img {
  opacity: 0.4;
}

.photo-grid__item figcaption {
  font-size: 0.9rem;
}

/* --- Committee forms ------------------------------------------------------------ */

.simple-form {
  max-width: 36rem;
}

/* A heading partway down a form, e.g. "About me" on My details */
.form-section {
  margin: 2rem 0 0.25rem;
  padding-top: 1rem;
  border-top: 2px solid var(--colour-accent);
}

.form-section + .muted {
  margin-top: 0;
}

.field textarea {
  resize: vertical;
}

/* A person's "About me" answers, on the committee's person page */
.about-answers {
  max-width: 36rem;
}

.about-answers dt {
  margin-top: 0.75rem;
  font-weight: bold;
}

.about-answers dd {
  margin: 0.2rem 0 0;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: bold;
}

.field input:not([type="checkbox"]),
.field select,
.field textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 0.45rem;
  border: 1px solid #aaa;
  border-radius: 4px;
  font: inherit;
}

.field--checkbox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.field--checkbox label {
  display: inline;
  margin: 0;
}

.field--checkbox input {
  width: 1.2rem;
  height: 1.2rem;
}

.field--checkbox .field__help {
  flex-basis: 100%;
}

.field__help {
  margin: 0.2rem 0 0;
  color: #666;
  font-size: 0.85rem;
}

.field--error input,
.field--error select,
.field--error textarea {
  border-color: #c62828;
}

.required {
  color: #c62828;
}

.simple-form .button {
  border: none;
  font: inherit;
  cursor: pointer;
}

.temp-password {
  padding: 1rem;
  border-left: 4px solid var(--colour-accent);
  background: #faf6f6;
}

.temp-password__value {
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  user-select: all; /* one click selects the whole password */
}

/* Tabs (e.g. Members / Deputies / Former members) */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 2px solid var(--colour-accent);
}

.tabs a {
  padding: 0.4rem 0.9rem;
  border-radius: 4px 4px 0 0;
  text-decoration: none;
}

.tabs__current {
  background: var(--colour-accent);
  color: #fff !important;
}

/* Phones: each engagement becomes a stacked block */
@media (max-width: 600px) {
  .band-events thead {
    display: none;
  }

  .band-events tr,
  .band-events td {
    display: block;
  }

  .band-events td {
    padding: 0.25rem 0.5rem;
    border-bottom: none;
  }

  .band-events tr {
    padding: 0.5rem 0;
    border-bottom: 1px solid #ddd;
  }

  .band-events tr.section-start {
    border-top: 3px solid var(--colour-accent);
  }

  .band-events tr.section-start td {
    border-top: none;
  }
}

/* Full-size poster pop-up */
.poster-dialog {
  max-width: 95vw;
  max-height: 95vh;
  padding: 0;
  border: none;
}

.poster-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.poster-dialog img {
  display: block;
  max-width: 95vw;
  max-height: 90vh;
}

.poster-dialog__close {
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  border: none;
  background: none;
  color: #fff;
  font-size: 2rem;
  text-shadow: 0 0 4px #000;
  cursor: pointer;
}

/* Phones: stack the poster above the details */
@media (max-width: 600px) {
  .events tr,
  .events td {
    display: block;
  }

  .events td {
    border-bottom: none;
  }

  .events tr {
    border-bottom: 1px solid #ddd;
  }

  .events__poster,
  .poster {
    width: 100%;
    max-width: 16rem;
  }
}

/* A Yes/No click being saved (js/answers.js) */
.answer--saving .answer__button {
  opacity: 0.6;
  cursor: progress;
}

/* "Joining instructions last sent on ..." under the engagement's buttons */
.page-head__note {
  flex-basis: 100%;
  margin: 0;
  text-align: right;
}
