/* FilmEU Partner Holiday Calendar
   Palette from the FilmEU brand sheet:
     #00A9CC cyan   - public holidays, primary actions
     #ED1B2F red    - school closures
     #D3E0E2 pale   - surfaces and rules
     #606161 grey   - secondary text
     #000000 black  - text
   Countries are deliberately NOT colour-coded: eight arbitrary colours would
   fight the brand and stop being distinguishable. Country codes are labelled
   instead, and colour carries the one distinction that matters. */

:root {
  --cyan:  #00A9CC;
  --red:   #ED1B2F;
  --pale:  #D3E0E2;
  --grey:  #606161;
  --black: #000000;

  --cyan-soft:  #e5f6fa;
  --red-soft:   #fdeaec;
  --pale-soft:  #f4f8f9;
  --white:      #ffffff;

  --radius: 6px;
  --gap: 1rem;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.18);
}

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

/* Several elements below set `display`, which would otherwise beat the
   `hidden` attribute the JavaScript toggles. */
[hidden] { display: none !important; }

body {
  margin: 0;
  /* The brand guide specifies Montserrat Medium, so 500 is the base weight. */
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--black);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 700; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 2px solid var(--pale);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }

.brand-mark {
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}
.brand-mark-accent { color: var(--cyan); }

.brand-divider {
  width: 1px;
  height: 1.4rem;
  background: var(--pale);
}

.brand-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--grey);
}

.intro {
  max-width: 62ch;
  color: var(--grey);
  margin: 1.75rem 0 1.5rem;
}

/* ---------- Buttons ---------- */

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  cursor: pointer;
  background: transparent;
  color: var(--black);
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.btn-primary { background: var(--cyan); color: var(--white); }
.btn-primary:hover { background: #0093b3; }

.btn-ghost { border-color: var(--pale); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }

.btn-small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }

.btn-icon {
  border: 1px solid var(--pale);
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}
.btn-icon:hover { border-color: var(--cyan); color: var(--cyan); }

.link-btn {
  font: inherit;
  font-size: 0.85rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--cyan);
  cursor: pointer;
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.tabs {
  display: inline-flex;
  border: 1px solid var(--pale);
  border-radius: var(--radius);
  overflow: hidden;
}

.tab {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1.1rem;
  border: none;
  background: var(--white);
  color: var(--grey);
  cursor: pointer;
  border-right: 1px solid var(--pale);
}
.tab:last-child { border-right: none; }
.tab:hover { color: var(--cyan); }
.tab[aria-selected='true'] { background: var(--cyan); color: var(--white); }

.period-nav { display: flex; align-items: center; gap: 0.5rem; }

.period-label {
  font-weight: 600;
  min-width: 11rem;
  text-align: center;
}

/* ---------- Filters ---------- */

.filters {
  background: var(--pale-soft);
  border: 1px solid var(--pale);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.filter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: 0.65rem;
}

.filter-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--grey); }
.filter-actions { display: flex; gap: 0.85rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--pale);
  background: var(--white);
  color: var(--grey);
  border-radius: 100px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.chip:hover { border-color: var(--cyan); }

.chip[aria-pressed='true'] {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}

.chip-code { font-weight: 700; font-size: 0.75rem; }

/* ---------- Legend ---------- */

.legend {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--grey);
  margin-bottom: 1rem;
}

.legend-item { display: inline-flex; align-items: center; gap: 0.45rem; }

.swatch { width: 0.85rem; height: 0.85rem; border-radius: 3px; display: inline-block; }
.swatch-public { background: var(--cyan); }
.swatch-closure { background: var(--red); }

.legend-note { margin-left: auto; }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 3rem;
}

.calendar-col { min-width: 0; }

.detail-col { position: sticky; top: 5.5rem; }

.detail-panel {
  border: 1px solid var(--pale);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--white);
}

.detail-empty { color: var(--grey); font-size: 0.9rem; margin: 0; }

.detail-date { font-size: 1rem; margin-bottom: 0.85rem; }

.detail-entry {
  border-top: 1px solid var(--pale);
  padding: 0.75rem 0;
}
.detail-entry:first-of-type { border-top: none; padding-top: 0; }

.detail-school { font-weight: 600; font-size: 0.9rem; }
.detail-city { color: var(--grey); font-weight: 400; }
.detail-name { font-size: 0.9rem; }
.detail-name-local { color: var(--grey); font-style: italic; font-size: 0.85rem; }

.detail-source {
  font-size: 0.75rem;
  color: var(--grey);
  margin-top: 0.35rem;
  word-break: break-word;
}
.detail-source a { color: var(--cyan); }

.tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  vertical-align: 0.1em;
}
.tag-public { background: var(--cyan-soft); color: #00697e; }
.tag-closure { background: var(--red-soft); color: #b3121f; }

.delete-btn {
  font: inherit;
  font-size: 0.75rem;
  background: none;
  border: 1px solid var(--pale);
  border-radius: var(--radius);
  color: var(--red);
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  margin-top: 0.4rem;
}
.delete-btn:hover { border-color: var(--red); }

/* ---------- Month view ---------- */

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-left: 1px solid var(--pale);
  border-top: 1px solid var(--pale);
}

.weekday {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey);
  padding: 0.5rem;
  text-align: left;
  border-right: 1px solid var(--pale);
  border-bottom: 1px solid var(--pale);
  background: var(--pale-soft);
}

.day {
  border-right: 1px solid var(--pale);
  border-bottom: 1px solid var(--pale);
  min-height: 96px;
  padding: 0.4rem;
  text-align: left;
  font: inherit;
  background: var(--white);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.day:hover { background: var(--pale-soft); }
.day.is-outside { background: #fbfcfc; color: #b9c4c6; cursor: default; }
.day.is-weekend { background: var(--pale-soft); }
.day.is-outside:hover { background: #fbfcfc; }

/* align-self keeps the "today" pill hugging the number instead of
   stretching across the flex column. */
.day-num { font-size: 0.8rem; font-weight: 600; align-self: flex-start; }

.day.is-today .day-num {
  background: var(--black);
  color: var(--white);
  border-radius: 100px;
  padding: 0.05rem 0.45rem;
}

.day.is-selected { box-shadow: inset 0 0 0 2px var(--cyan); }

.day-chips { display: flex; flex-wrap: wrap; gap: 2px; }

.day-chip {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  background: var(--cyan);
  color: var(--white);
}
.day-chip.is-closure { background: var(--red); }

/* ---------- Year view ---------- */

.year-scroll {
  overflow-x: auto;
  border: 1px solid var(--pale);
  border-radius: var(--radius);
  padding-bottom: 0.25rem;
}

.year-grid {
  display: grid;
  grid-template-columns: 168px 1fr;
  min-width: 1100px;
}

.year-months {
  display: grid;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--grey);
  background: var(--pale-soft);
  border-bottom: 1px solid var(--pale);
}

.year-month-label {
  padding: 0.4rem 0.3rem;
  border-left: 1px solid var(--pale);
  overflow: hidden;
  white-space: nowrap;
}

.year-corner { background: var(--pale-soft); border-bottom: 1px solid var(--pale); }

.year-row-label {
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid var(--pale);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
}
.year-row-label .detail-city { font-size: 0.72rem; }

.year-row {
  display: grid;
  border-bottom: 1px solid var(--pale);
  height: 34px;
  align-items: stretch;
}

.year-cell { border-left: 1px solid transparent; }
.year-cell.is-month-start { border-left: 1px solid var(--pale); }
.year-cell.is-weekend { background: var(--pale-soft); }
.year-cell.is-public { background: var(--cyan); }
.year-cell.is-closure { background: var(--red); }
.year-cell.is-public, .year-cell.is-closure { cursor: pointer; }

/* ---------- Upcoming view ---------- */

.upcoming-day {
  border: 1px solid var(--pale);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1rem;
}

.upcoming-date { font-weight: 700; font-size: 0.9rem; }
.upcoming-weekday { display: block; color: var(--grey); font-weight: 500; font-size: 0.8rem; }
.upcoming-entry { font-size: 0.9rem; }
.upcoming-entry + .upcoming-entry { margin-top: 0.35rem; }
.upcoming-code { font-weight: 700; }

.empty-state {
  border: 1px dashed var(--pale);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--grey);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--pale);
  padding: 1.5rem 0 2.5rem;
  font-size: 0.8rem;
  color: var(--grey);
}
.site-footer p { max-width: 78ch; margin: 0; }

/* ---------- Admin drawer ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 40;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  background: var(--white);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--pale);
  position: sticky;
  top: 0;
  background: var(--white);
}
.admin-head h2 { font-size: 1.05rem; }

.admin-body { padding: 1.25rem; }

.admin-note { font-size: 0.82rem; color: var(--grey); margin: 0 0 1rem; }
.admin-subhead { font-size: 0.9rem; margin-bottom: 0.85rem; }
.admin-rule { border: none; border-top: 1px solid var(--pale); margin: 1.5rem 0; }

.field { display: block; margin-bottom: 0.9rem; border: none; padding: 0; }

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--grey);
  margin-bottom: 0.3rem;
  padding: 0;
}

.field-optional, .field-required {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.field-required { color: var(--red); }

.field input[type='text'],
.field input[type='password'],
.field input[type='date'],
.field select {
  font: inherit;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--pale);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black);
}
.field input:focus, .field select:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: var(--cyan); }

.field-help { display: block; font-size: 0.75rem; color: var(--grey); margin-top: 0.35rem; }

.radio { display: block; font-size: 0.9rem; margin-bottom: 0.2rem; font-weight: 500; }
.radio input { margin-right: 0.4rem; }

.form-error, .form-success {
  font-size: 0.85rem;
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  margin: 0 0 0.85rem;
}
.form-error { background: var(--red-soft); color: #b3121f; }
.form-success { background: var(--cyan-soft); color: #00697e; }

.manual-list { display: flex; flex-direction: column; gap: 0.5rem; }

.manual-item {
  border: 1px solid var(--pale);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}
.manual-item .delete-btn { margin-top: 0; flex-shrink: 0; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .detail-col { position: static; }
  .legend-note { margin-left: 0; width: 100%; }
}

@media (max-width: 620px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding-left: 0.5rem; padding-right: 0.5rem; }
  .period-nav { justify-content: space-between; }
  .period-label { min-width: 0; flex: 1; }
  .day { min-height: 68px; padding: 0.25rem; }
  .weekday { padding: 0.4rem 0.25rem; font-size: 0.6rem; }
  .upcoming-day { grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
  .brand-title { font-size: 0.85rem; }
}
