/* ============================================================
   GLOBAL VARIABLES & RESET
============================================================ */
:root {
  --blue: #2a5d9f;
  --gold: #ffc107;
  --red: #dc3545;
  --green: #07b009;
  --teal: #20c997;
  --purple: #6f42c1;
  --pink: #e83e8c;
  --orange: #fd7e14;

  /* Unified taupe system */
  --taupe-bg: #f3eee8;
  --taupe-border: #ddd7d0;
}

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

body, h1, h2, h3, h4, h5, h6, p, ul {
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #fafafa;
  color: #333;
}

/* ============================================================
   BRANDING & LOGO
============================================================ */
.logo {
  height: 70px;
  width: auto;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  font-size: 1.5rem;
}

/* ============================================================
   HEADINGS
============================================================ */
h1, h2, h3, h4, h5, h6 {
  color: #000;
  margin-left: 20px;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

@media (max-width: 768px) {
  h1, h2, h3, h4, h5, h6 {
    margin-left: 10px;
  }
}

.text-teal { color: var(--teal); }
.text-purple { color: var(--purple); }
.text-pink { color: var(--pink); }
.text-orange { color: var(--orange); }

.highlight {
  background: #fff3a3;
  padding: 0 2px;
  border-radius: 3px;
}

/* ============================================================
   BUTTONS
============================================================ */
.button {
  display: inline-block;
  margin: 1em 0;
  padding: 0.6em 1.2em;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.3s ease;
  color: #fff;
  text-align: center;
}

.button-group .button {
  margin-right: 1rem;
}

/* Button colours */
.button.blue { background-color: var(--blue); }
.button.gold { background-color: var(--gold); color: white; }
.button.red { background-color: var(--red); }
.button.green { background-color: var(--green); }
.button.teal { background-color: var(--teal); }
.button.purple { background-color: var(--purple); }
.button.pink { background-color: var(--pink); }
.button.orange { background-color: var(--orange); }

/* Hover */
.button:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.button.blue:hover { background-color: #003060; }
.button.gold:hover { background-color: darkgoldenrod; }
.button.red:hover { background-color: darkred; }
.button.green:hover { background-color: darkgreen; }
.button.teal:hover { background-color: #138f75; }
.button.purple:hover { background-color: #4b2a8a; }
.button.pink:hover { background-color: #c2186b; }
.button.orange:hover { background-color: #cc5f00; }

/* Focus */
.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.8), 0 0 8px rgba(0,0,0,0.6);
  transform: scale(1.02);
}

.button.diary-link {
  margin: 1rem 0 1rem 2rem;
}

/* ============================================================
   HEADER & NAVIGATION
============================================================ */
header {
  background-color: var(--blue);
  color: white;
  padding: 1rem 2rem;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.nav-toggle {
  background: none;
  cursor: pointer;
  padding: 0.5rem;
  border: none;
  display: none;
}

#main-menu {
  width: 100%;
  background-color: var(--blue);
}

#main-menu ul {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
}

#main-menu ul li {
  margin-right: 1.5rem;
}

#main-menu ul li:last-child {
  margin-right: 0;
}

#main-menu ul li a {
  color: white;
  text-decoration: none;
  font-weight: 500;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px;
  z-index: 100;
  transition: top 0.3s;
}

.skip-link:focus { top: 0; }

/* Back to Top button */
.back-to-top {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: var(--blue);
  color: white;
  padding: 0.6rem 0.9rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.25s ease;
  z-index: 999;
}

.back-to-top:hover {
  transform: translateY(-3px);
  background: #003060;
}

/* Visible state */
.back-to-top.show {
  opacity: 1;
  visibility: visible;
}


/* Mobile nav */
@media (max-width: 768px) {
  .nav { flex-direction: column; align-items: flex-start; }
  .nav-toggle { display: block; }

  #main-menu ul {
    display: none;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
  }

  #main-menu ul.show {
    display: flex;
    max-height: 500px;
    margin-top: 1rem;
  }

  #main-menu ul li {
    margin: 0.5rem 0;
  }
}

/* ============================================================
   HERO & LAYOUT
============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.hero {
  background: url('/images/Banner1.jpg') no-repeat center center;
  background-size: cover;
  color: white;
  padding: 4rem 1rem;
}

.hero h1, .hero h2, .hero p {
  color: #fff;
}

.two-col {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.two-col img.about-photo {
  max-width: 40%;
  height: auto;
  flex: 0 0 40%;
  border-radius: 8px;
}

.two-col > div { flex: 1; min-width: 300px; }

@media (max-width: 768px) {
  .two-col { flex-direction: column; text-align: center; }
  .two-col img.about-photo { max-width: 100%; margin-bottom: 1rem; }
}

/* ============================================================
   CARDS
============================================================ */
.cards, .event-cards, .script-grid, .dance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.card {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.card h3 {
  color: white;
  padding: 0.6em 1em;
  margin: 0;
  border-radius: 6px 6px 0 0;
}

.card.blue h3 { background-color: #004080; }
.card.gold h3 { background-color: goldenrod; }
.card.red h3 { background-color: crimson; }
.card.green h3 { background-color: seagreen; }
.card.teal h3 { background-color: teal; }
.card.purple h3 { background-color: purple; }
.card.pink h3 { background-color: deeppink; }
.card.orange h3 { background-color: darkorange; }

.card .schedule { list-style: none; padding: 0.5em 1em; margin: 0; }
.card .schedule li { padding: 0.3em 0; border-bottom: 1px solid #eee; }

.card .extras { font-style: italic; padding: 0.5em 1em; color: #555; }
.card p { padding: 0.75em 1em; margin: 0; line-height: 1.4; }

/* ============================================================
   CONTACT SECTION
============================================================ */
.section-blue {
  background-color: var(--blue);
  color: #fff;
  padding: 3rem 1rem;
}

#contact h2 { color: #fff; }

.contact-wrap {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.section-blue h2 { margin-bottom: 1rem; }
.section-blue p { margin-bottom: 1.5rem; }

/* ============================================================
   FOOTER
============================================================ */
footer {
  background-color: var(--blue);
  color: white;
  padding: 1rem 2rem;
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer-links a {
  color: white;
  margin-left: 1rem;
  text-decoration: none;
}

/* ============================================================
   CONTACT FORM
============================================================ */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 600px;
  margin: 2rem auto;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.contact-form button { align-self: flex-start; }

/* ============================================================
   MESSAGE BOXES
============================================================ */
.message-box {
  max-width: 600px;
  margin: 3rem auto;
  padding: 1.5rem;
  border-radius: 6px;
  font-size: 1.1rem;
  text-align: center;
}

.message-success { background-color: #d4edda; border: 1px solid #28a745; color: #155724; }
.message-error { background-color: #f8d7da; border: 1px solid #dc3545; color: #721c24; }
.message-warning { background-color: #fff3cd; border: 1px solid #ffc107; color: #856404; }

.message-box a {
  display: inline-block;
  margin-top: 1rem;
  padding: 10px 20px;
  background: #007BFF;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
}

.message-box a:hover { background: #0056b3; }

/* ============================================================
   ANNUAL SUMMARY TABLE
============================================================ */
.annual-summary {
  margin: 2rem auto;
  max-width: 900px;
  padding: 1rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 0.5rem;
}

.summary-row { display: contents; }

.summary-row > div {
  padding: 0.75rem;
  border-bottom: 1px solid #ccc;
}

.summary-row.header > div {
  font-weight: bold;
  background-color: #f5f5f5;
}

.summary-row.festival > div {
  background-color: #fff8e1;
  border-left: 4px solid goldenrod;
}

@media (max-width: 600px) {
  .summary-grid { grid-template-columns: 1fr; }
  .summary-row > div {
    border-bottom: none;
    padding: 0.5rem 0;
  }
  .summary-row.header { display: none; }
}

/* ============================================================
   UNIFIED FILTER BARS (Diary + Clubs + Local)
============================================================ */
#diary-filters,
#club-filters,
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  background: var(--taupe-bg);
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--taupe-border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 1000px;
  margin: 1.5rem auto 2rem;
  position: sticky;
  top: 60px;
  z-index: 900;
}

/* Labels */
#diary-filters label,
#club-filters label,
.filters label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  display: block;
}

/* Selects */
#diary-filters select,
#club-filters select,
.filters select {
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
}

/* Filter item wrappers */
#diary-filters .filter-item,
#club-filters .filter-item,
#club-filters > div,
.filters .filter-item {
  flex: 1 1 220px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}

/* Responsive breakpoints for filters */
@media (max-width: 768px) {
  #diary-filters,
  #club-filters,
  .filters {
    flex-direction: column;
    gap: 0.75rem;
  }

  #diary-filters .filter-item,
  #club-filters .filter-item,
  #club-filters > div,
  .filters .filter-item {
    width: 100%;
  }
}

/* Up to 480px: compact, full-width controls */
@media (max-width: 480px) {
  #diary-filters,
  #club-filters,
  .filters {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    top: 50px;
  }

  #diary-filters .filter-item,
  #club-filters .filter-item,
  #club-filters > div,
  .filters .filter-item {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  #diary-filters input,
  #club-filters input,
  .filters input,
  #diary-filters select,
  #club-filters select,
  .filters select,
  #diary-filters button,
  #club-filters button,
  .filters button {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.95rem;
  }
}
/* Disable sticky behaviour for all filter bars */
#diary-filters,
#club-filters,
.filters {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
}

/* ============================================================
   LOCAL CLUBS — CARDS & DETAILS
============================================================ */
.local-clubs-wrapper {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.club-card {
  background: #EDE6DF;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.club-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.club-card details summary {
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem 0;
  list-style: none;
}

.club-card details summary::-webkit-details-marker { display: none; }

.club-card details[open] summary {
  color: var(--blue);
}

.club-card p {
  margin: 0.5rem 0 1rem 0;
  line-height: 1.5;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: white;
  border-radius: 8px;
}

.schedule-table th {
  background: #d8d1c9;
  padding: 0.75rem;
  text-align: left;
  font-weight: 700;
}

.schedule-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #eee;
}

.schedule-table tr:last-child td {
  border-bottom: none;
}

.club-card.hidden { display: none; }

.club-extras {
  font-style: italic;
  color: #444;
  margin-top: 0.75rem;
}

.club-card .button { margin-top: 1rem; }

/* ============================================================
   MONTH CARDS (Annual Diary)
============================================================ */
.month-card {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 10px 0;
  margin-bottom: 25px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transition: box-shadow 0.25s ease;
}

.month-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}

.month-header {
  width: 100%;
  background: #f4f4f4;
  padding: 12px;
  font-size: 1.2rem;
  text-align: left;
  border: none;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.month-header:hover {
  background-color: #dcdcdc;
  color: #000;
}

.month-content {
  max-height: 0;
  transition: max-height 0.35s ease;
  padding: 0 15px;
  overflow: hidden;
}

.month-card.open .month-content {
  max-height: 1000px;
  padding: 10px 15px;
}

.event {
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.event:hover {
  background-color: #f7f7f7;
  transform: translateX(4px);
}

.event.text-orange {
  background: #fff4e5;
  padding: 10px 12px;
  border-radius: 4px;
  position: relative;
}

.event.text-orange::before {
  content: "Festival";
  position: absolute;
  top: -8px;
  right: 10px;
}

/* Expand/collapse icons */
.month-header::after {
  content: "▶";
  float: right;
  transition: transform 0.25s ease;
  font-size: 1rem;
  margin-left: 0.5rem;
}

.month-card.open .month-header::after {
  transform: rotate(90deg);
}

/* ============================================================
   PRINT OPTIONS
============================================================ */

/* Screen-only print button */
.print-button {
  background: var(--blue, #2a6fdb);
  color: white;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  margin: 1rem 0;
  display: inline-block;
  width: auto !important; /* prevent full-width on screen */
}

.print-button:hover {
  background: #1f57ad;
}

/* Hide print header/footer on screen */
#printHeader,
#printFooter {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ============================================================
   PRINT MODE — FINAL, CHROME-SAFE VERSION
============================================================ */
@media print {

  /* Hide interactive UI and navigation */
  .print-button,
  .jump-menu,
  #diary-filters,
  #club-filters,
  .filters,
  button,
  .button,
  nav,
  header {
    display: none !important;
  }

  /* Show print header/footer */
  #printHeader,
  #printFooter {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    padding: initial !important;
    margin: initial !important;
  }

/* ------------------------------------------------------------
   PRINT TYPOGRAPHY POLISH
------------------------------------------------------------ */

  /* Page margins */
  @page {
    margin: 20mm;
  }

  /* Base text */
  body {
    font-family: "Arial", sans-serif;
    font-size: 11pt;
    line-height: 1.45;
    color: #000;
  }

  /* Main title */
  h1 {
    font-size: 20pt;
    margin: 0 0 10mm 0;
    text-align: left;
    font-weight: bold;
  }

  /* Month headers */
  .month-header {
    font-size: 16pt;
    font-weight: bold;
    background: #f0f0f0 !important;
    padding: 8px 12px !important;
    border-bottom: 1px solid #ccc;
    margin-bottom: 4mm;
  }

  /* Month content spacing */
  .month-content {
    padding: 0 5mm !important;
  }

  /* Event rows */
  .event {
    font-size: 11pt;
    padding: 3mm 0;
    border-bottom: 1px solid #ddd;
  }

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

  /* Festival highlight */
  .event.text-orange {
    background: #fff7e6 !important;
    border-left: 4px solid #ff9900;
    padding: 4mm 5mm;
    border-radius: 4px;
  }

  /* Tables (January & June) */
  table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6mm;
    font-size: 11pt;
  }

  table th {
    background: #e6e6e6;
    padding: 4mm;
    font-size: 12pt;
    text-align: left;
    border-bottom: 1px solid #ccc;
  }

  table td {
    padding: 3mm;
    border-bottom: 1px solid #eee;
  }

  table tr:last-child td {
    border-bottom: none;
  }

  /* Improve spacing between month cards */
  .month-card {
    margin-bottom: 15mm;
    padding: 0;
    border-radius: 4px;
  }

  /* CRITICAL FIX:
     Prevent Chrome from forcing a page break after the header */
  #printHeader {
    page-break-after: avoid !important;
    break-after: avoid-page !important;
  }

  /* Improve print typography */
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.4;
  }

  /* Month card styling for print */
  .month-card {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid !important;
    break-inside: avoid-page !important;
  }

  /* CRITICAL FIX:
     Prevent Chrome from inserting a break before January */
  .month-card:first-of-type {
    page-break-before: avoid !important;
    break-before: avoid-page !important;
  }

  /* Start each month on a new page EXCEPT the first */
  .month-card:not(:first-of-type) {
    page-break-before: always !important;
    break-before: page !important;
  }
}
