/* ============================================================
   onsombul - design system v2
   Bright, modern, editorial-theatrical. Light, high-contrast, readable.
   Display: Momo Trust Display (geometric rounded).  UI/body: Inter.
   ============================================================ */
:root {
  /* App identity (constant - never overridden by a society) */
  --app-1: #6d28d9;          /* violet */
  --app-2: #ec4899;          /* pink   */
  --app-grad: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);

  /* Brand accent - defaults to violet, overridden per-society */
  --brand: #6d28d9;
  --brand-tint: #6d28d914;
  --brand-ink: #ffffff;

  /* Neutrals - warm-cool light */
  --bg: #f6f4fb;
  --bg-2: #efeafc;
  --surface: #ffffff;
  --surface-2: #f4f1fb;
  --ink: #1d1832;            /* near-black, strong contrast */
  --muted: #615d77;
  --line: #e8e3f3;

  --ok: #15803d;
  --warn: #b45309;
  --err: #dc2626;

  /* chrome bits that themes remap */
  --header-bg: rgba(255,255,255,.82);
  --hero-grad: linear-gradient(160deg, #ffffff 0%, #faf5ff 55%, #fdf0f8 100%);
  --body-bg:
    radial-gradient(1100px 460px at 88% -8%, #f6e6fb 0%, rgba(246,230,251,0) 60%),
    radial-gradient(900px 420px at -5% 0%, #e6effb 0%, rgba(230,239,251,0) 55%),
    var(--bg);

  --radius: 18px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(29,24,50,.06), 0 2px 8px rgba(29,24,50,.05);
  --shadow: 0 4px 14px rgba(29,24,50,.07), 0 12px 32px rgba(109,40,217,.07);
  --shadow-lg: 0 12px 28px rgba(29,24,50,.10), 0 28px 60px rgba(109,40,217,.14);

  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Momo Trust Display", "Avenir Next", "Avenir", "Century Gothic", "Trebuchet MS", system-ui, sans-serif;
}
:root {
  /* tonal shades derived from the (possibly per-society) brand */
  --brand-strong: color-mix(in srgb, var(--brand) 80%, #000);
  --brand-soft:   color-mix(in srgb, var(--brand) 12%, #fff);
  --brand-grad:   linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #ec4899));
  /* cohesive jewel-tone palette for the different content areas (not a rainbow) */
  --c-music: #7c3aed; --c-scenes: #0d9488; --c-schedule: #d97706;
  --c-images: #e11d48; --c-videos: #4f46e5; --c-settings: #475569; --c-cast: #0369a1;
}

/* ---- Easy-reading comfort themes (remap neutrals; accents kept) ---- */
/* Warm dim (sepia): warm off-white, dimmed, low blue - accents read as-is */
:root[data-theme="warm"] {
  --bg: #e9e1d2; --bg-2: #e2d8c6;
  --surface: #f3ecdf; --surface-2: #e7dfce;
  --ink: #2f2a24; --muted: #6f675b; --line: #d8cfbc;
  --header-bg: rgba(243,236,223,.86);
  --hero-grad: linear-gradient(160deg, #f3ecdf 0%, #efe6d6 55%, #f1e7da 100%);
  --body-bg: radial-gradient(1100px 460px at 88% -8%, #efe2cf 0%, rgba(239,226,207,0) 60%), radial-gradient(900px 420px at -5% 0%, #ece4d2 0%, rgba(236,228,210,0) 55%), var(--bg);
  --brand-soft: color-mix(in srgb, var(--brand) 12%, var(--surface));
  --shadow-sm: 0 1px 2px rgba(70,52,28,.06), 0 2px 8px rgba(70,52,28,.05);
  --shadow: 0 4px 14px rgba(70,52,28,.07), 0 12px 32px rgba(90,62,28,.06);
  --shadow-lg: 0 12px 28px rgba(70,52,28,.10), 0 28px 60px rgba(90,62,28,.12);
}

/* Dusk: a soft warm dark - neutrals dark, accent foregrounds lightened to stay legible */
:root[data-theme="dusk"] {
  --bg: #211f26; --bg-2: #1b1a20;
  --surface: #2a2832; --surface-2: #322f3b;
  --ink: #ece6dc; --muted: #a79fb0; --line: #3a3744;
  --header-bg: rgba(33,31,38,.85);
  --hero-grad: linear-gradient(160deg, #2a2832 0%, #2c2733 55%, #30293a 100%);
  --body-bg: radial-gradient(1100px 460px at 88% -8%, #2c2536 0%, rgba(44,37,54,0) 60%), radial-gradient(900px 420px at -5% 0%, #232733 0%, rgba(35,39,51,0) 55%), var(--bg);
  --brand-soft: color-mix(in srgb, var(--brand) 24%, var(--surface));
  --brand-tint: color-mix(in srgb, var(--brand) 26%, var(--surface));
  --shadow-sm: 0 1px 2px rgba(0,0,0,.40);
  --shadow: 0 4px 14px rgba(0,0,0,.45);
  --shadow-lg: 0 14px 40px rgba(0,0,0,.55);
}
/* Lighten accent foregrounds on dusk (keeps the per-society hue, just brighter) */
:root[data-theme="dusk"] a,
:root[data-theme="dusk"] .btn-ghost,
:root[data-theme="dusk"] .badge-brand,
:root[data-theme="dusk"] .accent-tags a.badge,
:root[data-theme="dusk"] .transition .tr-label,
:root[data-theme="dusk"] .crumbs a:hover,
:root[data-theme="dusk"] .main-nav a.who:hover { color: color-mix(in srgb, var(--brand) 48%, #fff); }
/* Solid buttons keep their white-on-gradient text (the rule above must not leak into them) */
/* Solid buttons always keep their white-on-gradient text, in any theme or container */
:root[data-theme] .btn:not(.btn-ghost) { color: var(--brand-ink); }
:root[data-theme="dusk"] a.badge:hover { background: color-mix(in srgb, var(--brand) 24%, var(--surface)); color: color-mix(in srgb, var(--brand) 48%, #fff); }
:root[data-theme="dusk"] .badge-ok { background: #1f3a2a; color: #8fe0ad; }
:root[data-theme="dusk"] .badge-warn { background: #3a2e1c; color: #f0c478; }
.ic { display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; }
.btn .ic, .viewtoggle .ic, .crumbs .ic, h1 .ic, h2 .ic, summary .ic { vertical-align: -0.16em; }

/* Large area tiles (production hub) */
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin: 8px 0 4px; }
.tile-link { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); position: relative; overflow: hidden; }
.tile-link:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.tile-link::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 120% at 100% 0%, var(--areac) 0%, transparent 55%); opacity: .07; pointer-events: none; }
.tile-link .chip { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; background: linear-gradient(140deg, var(--areac), color-mix(in srgb, var(--areac) 58%, #000)); box-shadow: 0 6px 16px color-mix(in srgb, var(--areac) 40%, transparent); }
.tile-link h3 { margin: 0; font-size: 1.12rem; }
.tile-link .tsub { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.tile-link .tgo { margin-left: auto; color: var(--muted); opacity: .6; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--body-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-reduced-motion: no-preference) {
  a, .btn, .tile, .card, .chip, .segmented button { transition: all .16s ease; }
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
a { color: var(--brand); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; color: var(--ink); }
h1 { font-size: 2.1rem; margin: 0 0 8px; }
h2 { font-size: 1.4rem; margin: 30px 0 14px; }
h3 { font-size: 1.12rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.lead { color: var(--muted); font-size: 1.1rem; line-height: 1.55; margin-bottom: 22px; }

/* Header */
.site-header {
  background: var(--header-bg);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.header-inner { display: flex; align-items: center; flex-wrap: wrap; min-height: 68px; gap: 10px 16px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.3rem; color: var(--ink); display: inline-flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--app-grad); color: #fff; font-size: 1.15rem; box-shadow: 0 4px 12px rgba(124,58,237,.35);
}
.brand-logo { width: 36px; height: 36px; border-radius: 10px; display: block; box-shadow: 0 4px 12px rgba(124,58,237,.35); }
.main-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.main-nav a:not(.btn) { color: var(--ink); font-weight: 600; }
.main-nav a:not(.btn):hover { color: var(--brand); text-decoration: none; }
.main-nav a.who { color: var(--muted); font-size: .9rem; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.main-nav a.who:hover { color: var(--brand); }
.main-nav a.who .ic { vertical-align: -0.16em; }
.header-right { display: flex; align-items: center; gap: 14px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.theme-pick { display: inline-flex; margin: 0; }
.theme-pick select { font-family: var(--ui); font-size: .8rem; padding: 5px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
/* Header search: an icon that opens a search row under the nav */
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.search-panel { border-top: 1px solid var(--line); background: var(--header-bg); }
.search-panel[hidden] { display: none; }
.searchbar { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; margin: 10px 0; }
.searchbar .sb-ic { color: var(--muted); display: inline-flex; }
.searchbar input { border: 0; background: none; outline: none; font: inherit; font-size: .92rem; color: var(--ink); flex: 1; min-width: 0; }
.searchbar input::placeholder { color: var(--muted); }
.search-scope { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.chip-toggle { display: inline-block; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .85rem; font-weight: 600; }
.chip-toggle:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.chip-toggle.on { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
@media (max-width: 760px) {
  .main-nav { gap: 10px 14px; }
  .header-right { gap: 10px; }
}

/* Inline area search filter */
.area-filter { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; margin-bottom: 14px; max-width: 320px; width: 100%; }
.area-filter .sb-ic { color: var(--muted); display: inline-flex; }
.area-filter input { border: 0; background: none; outline: none; font: inherit; font-size: .9rem; color: var(--ink); width: 100%; }
.filter-hidden { display: none !important; }

/* Vertical only - keep .wrap's horizontal padding so content keeps edge margins on mobile. */
.page { padding-top: 30px; padding-bottom: 80px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--brand-grad); color: var(--brand-ink); border: 1px solid transparent;
  border-radius: 999px; padding: 11px 20px; font-size: 1rem; font-weight: 600;
  font-family: var(--ui); cursor: pointer; line-height: 1; box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; filter: saturate(1.05); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-lg { padding: 15px 30px; font-size: 1.08rem; }
.btn-ghost { background: var(--surface); color: var(--brand); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { background: var(--brand-tint); border-color: var(--brand); }
.btn-danger { background: var(--err); color: #fff; }
.btn-block { width: 100%; }

/* Cards & tiles */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tile-body { padding: 20px; flex: 1; }
.tile-accent { height: 7px; background: var(--app-grad); }
.tile h3 a { color: var(--ink); }
.tile h3 a:hover { color: var(--brand); text-decoration: none; }
.stat { font-family: var(--display); font-size: 2.2rem; font-weight: 600; line-height: 1; color: var(--brand); }

/* Badges */
.badge { display: inline-block; border-radius: 999px; padding: 3px 11px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }
.badge-brand { background: var(--brand-tint); color: var(--brand); border-color: transparent; }
.badge-ok { color: var(--ok); background: #e7f6ed; border-color: transparent; }
a.badge { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
a.badge:hover { text-decoration: none; background: var(--brand-tint); color: var(--brand); border-color: transparent; }
/* On accent-tinted entries (songs/scenes), tags adopt the entry's accent.
   badge-brand already reads --brand/--brand-tint, which the card overrides;
   this also tints clickable link-tags (e.g. songs in a scene). */
.accent-tags a.badge { background: var(--brand-tint); color: var(--brand); border-color: transparent; }
h1 > .ic:first-child, h2 > .ic:first-child { color: var(--brand); vertical-align: -0.15em; margin-right: 4px; }
.empty .big .ic { color: var(--brand); opacity: .8; }
summary > .ic:first-child { color: var(--brand); margin-right: 4px; }
.badge-warn { color: var(--warn); background: #fdf2e2; border-color: transparent; }

/* Forms */
form.stack { display: grid; gap: 18px; max-width: 560px; }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=tel], input[type=search], input[type=url],
select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 1rem; font-family: var(--ui); background: var(--surface); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #9b97ad; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
textarea { min-height: 120px; resize: vertical; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
.field-hint { font-weight: 400; color: var(--muted); font-size: .85rem; }

/* Flash */
.flash { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .95rem; font-weight: 500; border: 1px solid transparent; }
.flash-info    { background: #eaf1fe; color: #1e4fa3; }
.flash-success { background: #e7f6ed; color: var(--ok); }
.flash-error   { background: #fdeaea; color: var(--err); }
.flash-warn    { background: #fdf3e2; color: var(--warn); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: .95rem; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
th { background: var(--surface-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }

/* Breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; margin-bottom: 16px; }
.crumbs a { color: var(--muted); font-weight: 500; }
.crumbs a:hover { color: var(--brand); }
.crumbs span { color: #c9c3da; }
.crumb-current { color: var(--ink); font-weight: 600; }

/* Back-navigation buttons */
.backbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.backbar .ic { vertical-align: -0.18em; }

/* Empty states */
.empty { text-align: center; padding: 60px 22px; color: var(--muted); background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.empty .big { font-size: 2.6rem; margin-bottom: 10px; }

/* Segmented control - part selector */
.segmented { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 18px; }
.segmented button {
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 10px 20px; font-size: .95rem; font-weight: 600; font-family: var(--ui); cursor: pointer; box-shadow: var(--shadow-sm);
}
.segmented button:hover { border-color: var(--brand); color: var(--brand); }
.segmented button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); box-shadow: var(--shadow); }

/* Audio player */
.player {
  position: sticky; bottom: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 20px; margin-top: 20px; z-index: 20;
}
.player .now { font-family: var(--display); font-weight: 600; font-size: 1.15rem; margin-bottom: 14px; }
.player .transport { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.player .big-play { width: 60px; height: 60px; border-radius: 50%; font-size: 1.4rem; flex: 0 0 auto; background: var(--app-grad); border: 0; box-shadow: 0 6px 18px rgba(124,58,237,.4); }
.player .big-play:hover { transform: scale(1.05); }
.scrubber { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 200px; }
.scrubber input[type=range] { flex: 1; accent-color: var(--brand); height: 6px; }
.time { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--muted); min-width: 44px; font-weight: 500; }
.player-tools { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.chip { background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: .82rem; font-weight: 600; cursor: pointer; color: var(--ink); display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { border-color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand); border-color: var(--brand); }
.speed-group { display: inline-flex; gap: 5px; }

.part-row.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

/* Lyrics + sheet music */
.lyrics { white-space: pre-wrap; font-size: 1.08rem; line-height: 1.75; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.sheet-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.sheet-img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }

/* Recorder */
.recorder { text-align: center; padding: 26px; border: 2px dashed var(--line); border-radius: var(--radius); background: linear-gradient(var(--surface), var(--surface-2)); }
.rec-dot { color: var(--err); }
.timer { font-family: var(--display); font-variant-numeric: tabular-nums; font-size: 1.9rem; font-weight: 600; margin: 10px 0; }
.waveform { width: 100%; height: 56px; display: block; margin: 6px 0; }

/* Schedule - toolbar, compact list, calendar */
.sched-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.viewtoggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.viewtoggle a { padding: 7px 16px; font-size: .85rem; color: var(--ink); font-weight: 600; }
.viewtoggle a:hover { text-decoration: none; background: var(--surface-2); }
.viewtoggle a.on { background: var(--brand); color: var(--brand-ink); }

.sdate { font-family: var(--display); font-weight: 600; font-size: .98rem; margin: 16px 0 2px; }
.sdate.past { color: var(--muted); font-weight: 500; }
.srow { display: flex; align-items: baseline; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.srow .stype { font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; flex: 0 0 auto; }
.srow .stime { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; min-width: 52px; flex: 0 0 auto; }
.srow .sbody { flex: 1; min-width: 0; }
.srow .sbody strong { font-weight: 600; font-size: .94rem; }
.srow .smeta { display: block; color: var(--muted); font-size: .8rem; }
.srow .sact { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.srow .ical { text-decoration: none; font-size: 1rem; opacity: .8; }
.srow .ical:hover { opacity: 1; }
.srow .sedit { display: inline; }
.srow .sedit > summary { cursor: pointer; list-style: none; opacity: .7; font-size: .9rem; }
.srow .sedit > summary::-webkit-details-marker { display: none; }
.srow .xbtn { border: 0; background: none; cursor: pointer; font-size: .9rem; opacity: .7; padding: 0; }
.srow .xbtn:hover, .srow .sedit > summary:hover { opacity: 1; }

.calnav { margin: 8px 0 10px; }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.caldow { text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.calcell { min-height: 76px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: var(--surface); overflow: hidden; }
.calcell.empty { background: transparent; border: 0; }
.calcell.past { background: var(--surface-2); opacity: .55; }
.calcell.today { border: 2px solid var(--brand); box-shadow: 0 0 0 2px var(--brand-tint); }
.caldate { font-weight: 700; color: var(--muted); font-size: .8rem; margin-bottom: 2px; }
.calcell.today .caldate { color: var(--brand); }
.calev { display: block; border-radius: 4px; padding: 1px 5px; margin-bottom: 2px; font-size: .66rem; font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calev:hover { text-decoration: none; filter: brightness(.97); }
@media (max-width: 560px) {
  .calcell { min-height: 58px; padding: 2px; }
  .caldate { font-size: .72rem; }
  .calev { font-size: 0; padding: 3px; margin-bottom: 2px; border-radius: 3px; } /* dots on mobile */
}

/* Rehearsal images gallery */
.gallery { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.gal-item { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.gal-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; cursor: zoom-in; background: var(--surface-2); }
.gal-item figcaption { padding: 8px 10px; font-size: .85rem; display: flex; flex-direction: column; gap: 4px; }
.lightbox { position: fixed; inset: 0; background: rgba(15,10,20,.88); display: grid; place-items: center; z-index: 100; padding: 20px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 95vw; max-height: 90vh; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lb-close { position: fixed; top: 16px; right: 20px; font-size: 2rem; line-height: 1; color: #fff; background: none; border: 0; cursor: pointer; }

/* Modal popup (event details, etc.) */
.modal { position: fixed; inset: 0; background: rgba(15,10,20,.6); display: grid; place-items: center; z-index: 120; padding: 20px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-width: 460px; width: 100%; padding: 22px 24px; position: relative; max-height: 88vh; overflow: auto; }
.modal-x { position: absolute; top: 10px; right: 12px; font-size: 1.6rem; line-height: 1; color: var(--muted); background: none; border: 0; cursor: pointer; }
.modal-x:hover { color: var(--ink); }
.evtype { display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; }
.evtitle { margin: 10px 0 14px; }
.evrow { display: flex; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.evrow .evlabel { flex: 0 0 70px; color: var(--muted); font-weight: 600; }
.evactions { margin-top: 16px; }

/* Accent swatch picker */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches .swatch { position: relative; cursor: pointer; font-weight: 400; }
.swatches .swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatches .swatch .dot { display: block; width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 1.5px var(--line); }
.swatches .swatch input:checked + .dot { box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 2.5px var(--ink); }
.swatches .swatch-inherit { display: inline-flex; align-items: center; padding: 4px 12px; border: 1.5px solid var(--line); border-radius: 999px; font-size: .85rem; color: var(--muted); }
.swatches .swatch-inherit:has(input:checked) { border-color: var(--ink); color: var(--ink); font-weight: 600; }

/* Video library scene sub-headers */
.vid-subhead { font-family: var(--ui); font-weight: 700; font-size: .92rem; letter-spacing: .01em; color: var(--ink); margin: 16px 0 10px; }
.vid-subhead.muted { font-weight: 600; color: var(--muted); }
.vid-subhead .ic { vertical-align: -0.16em; }

/* Collapsible act sections (music / scenes / videos) */
.act-section { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.act-section > .act-summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 15px 18px;
  font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--ink);
  border-left: 5px solid var(--act-accent, var(--brand));
  background: linear-gradient(90deg, color-mix(in srgb, var(--act-accent, var(--brand)) 10%, var(--surface)), var(--surface)); }
.act-section > .act-summary::-webkit-details-marker { display: none; }
.act-section > .act-summary::after { content: ''; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.act-section[open] > .act-summary::after { transform: rotate(45deg); }
.act-summary .act-count { font-family: var(--ui); font-weight: 600; font-size: .8rem; color: var(--muted); }
.act-body { padding: 14px 16px; }
.act-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); font-size: .85rem; color: var(--muted); }
.act-tools form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.act-tools .swatches .swatch .dot { width: 20px; height: 20px; }
.act-tools .swatch-inherit { padding: 2px 8px; font-size: .78rem; }

/* Video tiles - larger landscape cards with an inline player */
.vgrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.vcard { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); border-left: 4px solid var(--brand); display: flex; flex-direction: column; }
.vplayer { width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: contain; display: block; }
.vcard .vmeta { padding: 10px 13px; }
.vcard .vmeta .badge { font-size: .64rem; padding: 2px 8px; }
.vcard .vmeta .vtitle { font-weight: 600; font-size: .92rem; display: block; margin: 5px 0 2px; }

/* Scene cards - compact */
.scene-card { padding: 12px 14px; }
.scene-card .sc-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.scene-card .sc-meta { font-size: .82rem; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.scene-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.scene-imgs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; cursor: zoom-in; border: 1px solid var(--line); }
.scene-imgs .si-wrap { position: relative; }
.scene-imgs .si-del { position: absolute; top: -6px; right: -6px; background: var(--surface); border: 1px solid var(--line); border-radius: 50%; width: 20px; height: 20px; line-height: 1; cursor: pointer; color: var(--err); font-size: .8rem; padding: 0; }

/* Stage-direction transition note between scenes - distinct but clean & readable */
.transition { border: 1px solid var(--line); border-left: 4px solid color-mix(in srgb, var(--brand) 60%, var(--line)); border-radius: 10px;
  padding: 11px 15px; margin: 8px 0 8px 22px; background: var(--surface-2); color: var(--ink); }
.transition .tr-label { display: inline-flex; align-items: center; gap: 5px; font-family: var(--ui); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); margin-bottom: 5px; }
.transition .tr-label .ic { vertical-align: -0.12em; }
.transition .tr-body { white-space: pre-wrap; line-height: 1.5; font-size: .92rem; color: var(--ink); }

/* Clickable schedule rows / calendar events */
.srow[data-ev] { cursor: pointer; }
.srow[data-ev]:hover { background: var(--brand-tint); }

/* Dropzone */
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); background: var(--surface); cursor: pointer; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }

/* Hero (landing) */
.hero { position: relative; text-align: center; padding: 60px 26px; border-radius: 26px; overflow: hidden;
  background: var(--hero-grad); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hero h1 { font-size: 2.6rem; margin: 6px 0 4px; }
.hero .emoji { font-size: 3rem; }
.hero-brand { display: inline-flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.hero-wordmark { font-family: var(--display); font-size: 2.5rem; line-height: 1; color: var(--ink); }
.hero .lead { max-width: 620px; margin: 10px auto 24px; }
/* Compact hero for utility pages (enquiry, privacy, feedback) - less vertical space */
.hero.hero-sm { padding: 30px 26px; }
.hero-sm h1 { font-size: 2rem; }
.hero-sm .hero-brand { margin-bottom: 12px; }
.hero-sm .hero-wordmark { font-size: 1.9rem; }

/* Logged-out landing: colour-coded feature tiles + screenshot lightbox */
.feature-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.feature-card {
  text-align: left; font: inherit; color: var(--ink); cursor: pointer; width: 100%;
  border-left: 4px solid var(--tile);
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.feature-card:focus-visible { outline: 2px solid var(--tile); outline-offset: 2px; }
.feature-chip {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
  background: color-mix(in srgb, var(--tile) 15%, var(--surface));
  color: var(--tile); margin-bottom: 6px;
}
.feature-card h3 { margin: 2px 0 0; }
.feature-card > p { margin: 0; }
.feature-see {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem; font-weight: 600; color: var(--tile);
  background: color-mix(in srgb, var(--tile) 12%, var(--surface));
  padding: 5px 11px; border-radius: 999px;
}
.modal-wide { max-width: 920px; }
.shot-img { max-width: 100%; max-height: 72vh; width: auto; height: auto; margin: 0 auto; border-radius: 12px; border: 1px solid var(--line); display: block; }

/* Utility */
.stack-list > * + * { margin-top: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.right { text-align: right; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }
details > summary { cursor: pointer; font-weight: 600; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; padding: 26px 0; margin-top: 30px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; }
.footer-legal { margin: 0; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--brand); }
.field-error { display: block; color: var(--err); font-size: .85rem; margin-top: 5px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.radio-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.radio-pill { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 16px; background: var(--surface); }
.radio-pill:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-strong); }
.radio-pill input { accent-color: var(--brand); margin: 0; }
/* ---- Dashboard ("My societies") ---- */
.dash-h { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; margin: 28px 0 12px; }
.dash-h .ic { color: var(--brand); }
.quick-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; }
.quick-tile { flex: 0 1 340px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px; margin: 0; }
.quick-tile:hover { text-decoration: none; }
.quick-tile > span:last-child { display: flex; flex-direction: column; align-items: center; line-height: 1.35; }
.quick-tile .muted { font-size: .85rem; }
.quick-ic { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: color-mix(in srgb, var(--qc, var(--brand)) 15%, var(--surface)); color: var(--qc, var(--brand)); flex: none; }
/* upcoming calls - grouped by day, then society/production */
.cal-day { padding: 12px 0; border-top: 1px solid var(--line); }
.cal-day:first-of-type { border-top: 0; padding-top: 0; }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-date { font-weight: 700; font-family: var(--display); font-size: 1.05rem; }
.cal-group-head { font-size: .82rem; font-weight: 600; color: var(--muted); margin: 8px 0 4px; padding-left: 9px; border-left: 3px solid var(--pc, var(--brand)); }
.cal-ev { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; color: var(--ink); }
.cal-ev:hover { text-decoration: none; background: var(--brand-soft); }
.cal-ev.is-clash { background: color-mix(in srgb, var(--err) 9%, transparent); }
.cal-time { flex: none; width: 56px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.cal-ev-title { min-width: 0; }
.stype { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
/* per-day availability status tag + toggle */
.cal-avail { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.av-tag { font-size: .72rem; font-weight: 700; padding: 3px 11px; border-radius: 999px; text-transform: uppercase; letter-spacing: .02em; }
.av-yes { background: color-mix(in srgb, #15803d 16%, transparent); color: #15803d; }
.av-no  { background: color-mix(in srgb, var(--err) 15%, transparent); color: var(--err); }
.avail-toggle { background: none; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; color: var(--muted);
  font: inherit; font-size: .78rem; padding: 4px 12px; }
.avail-toggle:hover { border-color: var(--brand); color: var(--brand); }
/* star toggle */
.star-form { line-height: 0; }
.star-btn { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 8px; line-height: 0; }
.star-btn svg { fill: none; }
.star-btn:hover { color: #f59e0b; background: color-mix(in srgb, #f59e0b 14%, transparent); }
.star-btn.is-fav { color: #f59e0b; }
.star-btn.is-fav svg { fill: #f59e0b; }
/* societies + productions */
.society-block .soc-head { display: inline-flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.soc-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.soc-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.prod-list { display: flex; flex-direction: column; gap: 8px; }
.prod-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--pc, var(--brand)); }
.prod-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prod-roles { font-size: .82rem; }
.prod-actions { display: flex; align-items: center; gap: 6px; }
.fav-tile .tile-body { gap: 10px; }
.past-block summary { display: flex; align-items: center; gap: 8px; }

/* ---- Society page header + admin action cards ---- */
.soc-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.soc-accent { width: 16px; height: 16px; border-radius: 5px; flex: none; }
.soc-meta { margin: 2px 0 0; font-size: .9rem; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; margin-bottom: 22px; }
.admin-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease; }
a.admin-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.admin-card-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-card-wrap .admin-card { border: 0; box-shadow: none; background: none; }
.admin-summary { cursor: pointer; list-style: none; }
.admin-summary::-webkit-details-marker { display: none; }
.admin-card-wrap[open] .admin-summary { border-bottom: 1px solid var(--line); }
.admin-form { padding: 16px 18px; }
.a-ic { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: color-mix(in srgb, var(--ac, var(--brand)) 15%, var(--surface)); color: var(--ac, var(--brand)); }
.a-text { display: flex; flex-direction: column; line-height: 1.3; }
.a-text .muted { font-size: .85rem; }

/* ---- Cast availability grid ---- */
.avail-filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.af-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.af-roles { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rf-label { font-size: .82rem; color: var(--muted); font-weight: 600; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: .82rem; cursor: pointer; background: var(--surface); user-select: none; line-height: 1.2; }
.chip-check input { margin: 0; accent-color: var(--brand); }
.chip-check:has(input:checked), .chip-check.rf-on { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-strong); }
.chip-crew:has(input:checked) { border-color: var(--c-cast); background: color-mix(in srgb, var(--c-cast) 12%, var(--surface)); color: var(--c-cast); }
.avail-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: .82rem; color: var(--muted); margin: 6px 0 12px; }
.avail-legend .cell { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-weight: 700; margin-right: 3px; }
.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.avail-grid { border-collapse: collapse; font-size: .85rem; width: max-content; min-width: 100%; }
.avail-grid th, .avail-grid td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; }
.avail-grid .rowhead { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; min-width: 180px; }
.avail-grid thead .rowhead { z-index: 2; }
.rh-roles { display: block; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.colhead { vertical-align: bottom; min-width: 88px; border-top: 3px solid var(--cc, var(--brand)) !important; }
.date-group { font-weight: 700; text-align: center; background: var(--surface-2); white-space: nowrap; }
/* stronger divider between days in the grid */
.avail-grid .date-group { border-left: 2px solid var(--ink); }
.avail-grid .date-start { border-left: 2px solid var(--ink) !important; }
.colhead2 { vertical-align: bottom; min-width: 78px; border-top: 3px solid var(--cc, var(--brand)) !important; }
.colhead2 .ch-type { display: block; font-weight: 600; font-size: .74rem; color: var(--ink); }
.colhead2 .ch-time { display: block; font-size: .7rem; color: var(--muted); margin: 1px 0 4px; }
.ch-date { display: block; font-weight: 700; }
.ch-type { display: block; font-size: .72rem; color: var(--muted); margin: 1px 0 4px; }
.ch-count { font-size: .68rem; }
/* by-date view: one card per day, activities grouped inside */
.avail-day { padding: 12px 14px; }
.avail-day-head { font-size: 1.05rem; border-bottom: 1px solid var(--line); padding-bottom: 7px; margin-bottom: 4px; }
.avail-act { padding: 9px 0 9px 12px; }
.avail-act + .avail-act { border-top: 1px solid var(--line); }
td.cell { font-weight: 700; min-width: 46px; }
.cell-clash { background: color-mix(in srgb, var(--err) 22%, transparent); color: var(--err); }
.cell-away  { background: color-mix(in srgb, var(--err) 8%, transparent); color: color-mix(in srgb, var(--err) 55%, var(--muted)); }
.cell-ok    { background: color-mix(in srgb, #15803d 13%, transparent); color: #15803d; }
.cell-na    { color: var(--muted); }
@media print {
  .site-header, .site-footer, .backbar, .crumbs, .avail-filters, .theme-pick { display: none !important; }
  .grid-wrap { overflow: visible; border: 0; }
  .avail-grid { font-size: .68rem; }
}

/* ---- Unavailability entries (My account) ---- */
.ua-item { border-top: 1px solid var(--line); }
.ua-item > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; }
.ua-item > summary::-webkit-details-marker { display: none; }
.ua-edit-label { font-size: .8rem; color: var(--brand); white-space: nowrap; }
.ua-panel { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 16px; }
.ua-carve { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }

/* Long-form legal / content pages */
.legal { max-width: 760px; margin-inline: auto; line-height: 1.65; }
.legal h2 { font-size: 1.25rem; margin: 30px 0 8px; }
.legal h2:first-child { margin-top: 0; }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 14px; padding-left: 22px; }
.legal li { margin-bottom: 7px; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 2.1rem; }
  .player { bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
}
