/* ==========================================================================
   Residency Virtual Open House -- site stylesheet
   All colours come from CSS custom properties emitted by templates/header.php
   out of $CONFIG['theme'], so the palette is changed in config.php.
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}

h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .5em; font-weight: 750; letter-spacing: -.015em; }
h1 { font-size: clamp(1.55rem, 1.1rem + 1.6vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.wrap      { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 1480px; margin: 0 auto; padding: 0 20px; }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--brand); color: #fff;
  padding: 10px 16px; z-index: 100;
}
.skip:focus { left: 0; }

/* --------------------------------------------------------------- header -- */

.site-head {
  background: var(--card-bg);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(16,48,46,.05);
}
.head-inner { display: flex; align-items: center; gap: 18px; min-height: 68px; }
.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand:hover { text-decoration: none; opacity: .88; }
.brand svg { height: 42px; width: auto; }

.mainnav { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.mainnav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.mainnav a {
  display: block; padding: 8px 13px; border-radius: 8px;
  color: var(--ink); font-weight: 600; font-size: .945rem;
  transition: background .15s, color .15s;
}
.mainnav a:hover { background: var(--brand-light); color: var(--brand-dark); text-decoration: none; }
.mainnav a.on { color: var(--brand-dark); background: var(--brand-light); }

.head-user { display: flex; align-items: center; gap: 9px; }
.who {
  font-size: .875rem; color: var(--ink-soft); font-weight: 600;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav-toggle {
  display: none; margin-left: auto; width: 42px; height: 38px;
  background: none; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; padding: 9px 9px;
}
.nav-toggle span { display: block; height: 2px; background: var(--ink); border-radius: 2px; margin: 3px 0; }

/* ---------------------------------------------------------------- hero --- */

.hero { padding: 30px 0 6px; }
.hero h1 { margin-bottom: 6px; }
.hero p  { color: var(--ink-soft); margin: 0 0 4px; font-size: 1.03rem; max-width: 62ch; }

/* ------------------------------------------------------------- toolbar --- */

.toolbar {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 18px 0 22px;
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end;
  box-shadow: var(--shadow);
  position: sticky; top: 68px; z-index: 40;
}
.tool { display: flex; flex-direction: column; gap: 5px; }
.tool label {
  font-size: .715rem; font-weight: 750; text-transform: uppercase;
  letter-spacing: .075em; color: var(--ink-soft);
}
.tool select, .tool input[type=search], .tool input[type=text] {
  font: inherit; font-size: .92rem; padding: 9px 12px; min-width: 168px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.tool select:focus, .tool input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.tool-grow { flex: 1 1 220px; }
.tool-grow input { width: 100%; }

.toolbar .count {
  margin-left: auto; font-size: .875rem; color: var(--ink-soft);
  padding-bottom: 9px; white-space: nowrap;
}
.chip-clear {
  display: inline-flex; align-items: center; gap: 6px; font-size: .85rem;
  padding: 8px 12px; border-radius: 999px; background: var(--brand-light);
  color: var(--brand-dark); font-weight: 650;
}
.chip-clear:hover { text-decoration: none; background: color-mix(in srgb, var(--brand) 22%, #fff); }

/* --------------------------------------------------------------- cards --- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 22px;
  padding-bottom: 40px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
  transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s, border-color .22s;
}
.card::after {
  /* brand wash that fades in on hover */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px transparent;
  transition: box-shadow .22s;
}
.card:hover, .card:focus-within {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--brand) 38%, var(--line));
}
.card:hover::after, .card:focus-within::after {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 34%, transparent);
}
.card:hover .card-img img { transform: scale(1.045); }
.card:hover .card-top { background: var(--brand-dark); }

/* stretched link keeps the whole card clickable but leaves inner links usable */
.card-link { position: absolute; inset: 0; z-index: 2; text-indent: -9999px; overflow: hidden; }
.card-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

.card-top {
  background: var(--brand);
  color: #fff;
  padding: 12px 15px 13px;
  transition: background .22s;
}
.card-specialty {
  display: block; font-size: .705rem; font-weight: 800; letter-spacing: .085em;
  text-transform: uppercase; color: color-mix(in srgb, #fff 76%, var(--brand));
  margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-inst {
  font-size: 1.015rem; font-weight: 750; line-height: 1.28; margin: 0 0 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-when {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 9px;
  font-size: .855rem; font-weight: 600;
  border-top: 1px solid rgba(255,255,255,.2); padding-top: 7px;
}
.card-when .date { color: #fff; }
.card-when .time { color: color-mix(in srgb, #fff 80%, var(--brand)); font-weight: 500; }
.card-when .rel {
  margin-left: auto; font-size: .74rem; font-weight: 700;
  background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 999px;
  white-space: nowrap;
}
.card-when .rel.past { background: rgba(255,255,255,.24); }

.card-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* Announcement flyers are almost always portrait, and the whole point of the
   stamp is that it travels with the image -- so the thumbnail is letterboxed
   (contain) rather than cropped, and the frame is portrait to waste less space. */
.card-img {
  overflow: hidden; aspect-ratio: 4 / 5;
  background: linear-gradient(160deg, #eef2f2, #e3eaea);
  display: grid; place-items: center;
}
.card-img img {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform .35s cubic-bezier(.2,.7,.3,1);
}

/* text-only card: generic hospital photo behind a readable scrim */
.card-text {
  position: relative; flex: 1; min-height: 196px;
  padding: 16px 16px 18px; display: flex; flex-direction: column; justify-content: flex-end;
  background-size: cover; background-position: center;
  isolation: isolate;
}
.card-text::before {
  /* Let the generic hospital photo read at the top of the card while keeping
     full contrast behind the text at the bottom. */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg,
              rgba(255,255,255,.42) 0%, rgba(255,255,255,.78) 34%,
              rgba(255,255,255,.94) 62%, rgba(255,255,255,.985) 100%);
}
.card-text .ct-inst { font-weight: 800; font-size: 1rem; margin: 0 0 1px; color: var(--ink); }
.card-text .ct-spec { font-weight: 750; font-size: .87rem; color: var(--brand-dark); margin: 0 0 8px; }
.card-text .ct-body {
  font-size: .855rem; color: var(--ink-soft); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.card-text .ct-empty { font-style: italic; }

/* ------------------------------------------------- expired (past) cards --- */
/* A card whose programme has no future session left: drained of colour so the
   eye skips it, while staying readable. */
.card.is-expired .card-img img,
.card.is-expired .card-text { filter: grayscale(100%); }

.card.is-expired .card-top {
  /* desaturated, nearly grey version of the brand bar */
  background: #788886;
}
.card.is-expired:hover .card-top { background: #64726f; }
.card.is-expired .card-specialty,
.card.is-expired .card-when .time { color: rgba(255,255,255,.82); }
.card.is-expired .card-when .rel { background: rgba(255,255,255,.26); }
.card.is-expired:hover, .card.is-expired:focus-within {
  border-color: color-mix(in srgb, #788886 45%, var(--line));
}
.card.is-expired:hover::after, .card.is-expired:focus-within::after {
  box-shadow: inset 0 0 0 2px rgba(120,136,134,.45);
}
.badge-expired { background: #e9ecec; color: #5c6968; border: 1px solid #d6dbdb; }

.card-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--line);
  font-size: .795rem; color: var(--ink-soft);
}
.card-foot .loc { font-weight: 650; }
.card-foot .more { margin-left: auto; color: var(--brand); font-weight: 700; }

.badge {
  display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 5px;
}
.badge-pending { background: #fff3e2; color: #94581a; border: 1px solid #f0d5b0; }
.badge-saved   { background: var(--brand-light); color: var(--brand-dark); }
.badge-status  { background: #eef1f1; color: var(--ink-soft); }

/* -------------------------------------------------------------- panels --- */

.panel {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin: 0 0 22px;
}
.panel.narrow { max-width: 560px; margin: 40px auto; }
.panel h1:first-child, .panel h2:first-child { margin-top: 0; }
.panel-pad-0 { padding: 0; overflow: hidden; }

.empty {
  text-align: center; padding: 60px 20px; color: var(--ink-soft);
  background: var(--card-bg); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty h2 { color: var(--ink); }

/* ------------------------------------------------------------- buttons --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 700; font-size: .915rem; line-height: 1.2;
  padding: 11px 17px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .12s, color .15s, border-color .15s;
  text-align: center;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

.btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); }

.btn-ghost { background: #fff; color: var(--brand-dark); border-color: var(--line); }
.btn-ghost:hover { background: var(--brand-light); color: var(--brand-dark); border-color: var(--brand); }

.btn-soft { background: var(--brand-light); color: var(--brand-dark); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 24%, #fff); color: var(--brand-dark); }

.btn-danger { background: #b3261e; }
.btn-danger:hover { background: #8d1d17; }

.btn-sm { padding: 7px 12px; font-size: .845rem; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }

/* row of event actions, repeated above and below the flyer */
.action-row {
  display: flex; flex-wrap: wrap; gap: 9px;
  padding: 14px 0;
}
.action-row .btn { flex: 0 1 auto; }
.action-row .sep {
  width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px;
}

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

.field { margin-bottom: 16px; }
.field > label, .field-label {
  display: block; font-size: .78rem; font-weight: 750; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px;
}
.field .hint { font-size: .82rem; color: var(--ink-soft); margin: 5px 0 0; font-weight: 400;
               text-transform: none; letter-spacing: 0; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=url], input[type=number], input[type=datetime-local], input[type=date],
input[type=month], input[type=search], select, textarea {
  font: inherit; width: 100%; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
textarea { min-height: 130px; resize: vertical; line-height: 1.55; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 18px; }

.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.radio-card {
  border: 2px solid var(--line); border-radius: 12px; padding: 13px 15px; cursor: pointer;
  transition: border-color .15s, background .15s; background: #fff;
}
.radio-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.radio-card input { margin-right: 8px; }
.radio-card strong { display: block; font-size: .95rem; }
.radio-card span { font-size: .82rem; color: var(--ink-soft); }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }

.check-row { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; font-size: .93rem; }
.check-row input { width: auto; }

.form-actions {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  border-top: 1px solid var(--line); padding-top: 18px; margin-top: 22px;
}
.form-actions .spacer { margin-left: auto; }

fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 4px; margin: 0 0 18px; }
legend { font-weight: 750; font-size: .9rem; padding: 0 8px; color: var(--brand-dark); }

.flash {
  border-radius: 10px; padding: 12px 16px; margin: 16px 0; font-weight: 600; font-size: .93rem;
  border: 1px solid;
}
.flash-ok    { background: #e8f5ee; border-color: #b9dfc9; color: #1c5c38; }
.flash-error { background: #fdecea; border-color: #f3c4bf; color: #8d1d17; }
.flash-warn  { background: #fff6e5; border-color: #f0d9a8; color: #855b12; }
.flash-info  { background: var(--brand-light); border-color: color-mix(in srgb, var(--brand) 30%, #fff); color: var(--brand-dark); }

.form-error { color: #8d1d17; font-size: .85rem; margin-top: 5px; font-weight: 600; }

/* --------------------------------------------------------- drag & drop --- */

.dropzone {
  border: 2.5px dashed color-mix(in srgb, var(--brand) 40%, var(--line));
  border-radius: 14px; background: var(--brand-light);
  padding: 34px 22px; text-align: center; cursor: pointer;
  transition: background .18s, border-color .18s, transform .18s;
}
.dropzone:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, #fff); }
.dropzone.dragover {
  border-color: var(--accent); background: #fff5eb; transform: scale(1.01);
}
.dropzone h3 { margin: 10px 0 4px; }
.dropzone p  { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.dropzone .dz-icon { font-size: 2.1rem; line-height: 1; }
.dz-preview { margin-top: 16px; display: none; }
.dz-preview.on { display: block; }
.dz-preview img {
  max-height: 340px; width: auto; margin: 0 auto; border-radius: 10px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.dz-status { margin-top: 12px; font-size: .9rem; font-weight: 650; color: var(--brand-dark); }
.dz-status.err { color: #8d1d17; }

.spinner {
  display: inline-block; width: 15px; height: 15px; vertical-align: -2px;
  border: 2.5px solid color-mix(in srgb, var(--brand) 28%, transparent);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite; margin-right: 7px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------- event page --- */

.event-head { margin: 24px 0 4px; }
.event-head .eyebrow {
  font-size: .76rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 6px;
}
.event-meta {
  display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--ink-soft);
  font-size: .93rem; margin-bottom: 6px;
}
.event-meta b { color: var(--ink); }

.event-figure {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin: 4px 0;
  position: relative;
}
.event-figure img { width: 100%; height: auto; }

/* Past event: half-drained flyer under a translucent "Expired" stamp. */
.event-figure.is-expired img { filter: grayscale(50%); }
.event-figure.is-expired::after {
  content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.28);
  pointer-events: none;
}
.expired-stamp {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  font-size: clamp(2.6rem, 13vw, 8rem); font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: rgba(90,104,102,.30);
  border: .09em solid rgba(90,104,102,.30); border-radius: .12em;
  padding: .04em .16em; white-space: nowrap; pointer-events: none;
  text-shadow: 0 2px 10px rgba(255,255,255,.55);
}

.date-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.date-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.date-list .d-when { font-weight: 700; }
.date-list .d-rel { font-size: .8rem; color: var(--ink-soft); }
.date-list .d-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.date-list li.is-saved { border-color: var(--brand); background: var(--brand-light); }

.event-text {
  white-space: pre-wrap; font-size: .97rem; line-height: 1.7; color: var(--ink);
  max-height: 30em; overflow: auto;
}
.event-text.clamped { max-height: 16em; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 24px; align-items: start; }

/* --------------------------------------------------------------- modal --- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,48,46,.55); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.modal-backdrop.on { opacity: 1; pointer-events: auto; }
/* Column layout: header and footer are pinned, only the body scrolls, so the
   Save / Cancel buttons are always visible without scrolling the dialog. */
.modal {
  background: #fff; border-radius: 16px; width: min(520px, 100%);
  max-height: min(90vh, 780px);
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(16,48,46,.35);
  transform: translateY(12px) scale(.985); transition: transform .18s;
}
.modal-backdrop.on .modal { transform: none; }
.modal-head {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
  flex: 0 0 auto;
}
.modal form { display: contents; }
.modal-head h2 { margin: 0; font-size: 1.12rem; }
.modal-head .sub { font-size: .86rem; color: var(--ink-soft); margin: 3px 0 0; }
.modal-close {
  margin-left: auto; background: none; border: 0; font-size: 1.6rem; line-height: 1;
  color: var(--ink-soft); cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--ink); }
.modal-body {
  padding: 20px 22px;
  flex: 1 1 auto; overflow-y: auto; min-height: 0;
}
.modal-foot {
  padding: 14px 22px 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  flex: 0 0 auto; border-top: 1px solid var(--line); background: #fff;
  border-radius: 0 0 16px 16px;
}
.modal-foot .spacer { margin-left: auto; }

/* Compact the bookmark form so it usually fits without scrolling at all. */
.modal-body .field { margin-bottom: 13px; }
.modal-body fieldset { padding: 12px 14px 2px; margin-bottom: 4px; }
.modal-body .check-row { margin-bottom: 7px; }
.modal-body textarea { min-height: 76px; }

/* ------------------------------------------------------------ calendar --- */

.cal-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.cal-head h2 { margin: 0; min-width: 210px; }
.cal-nav { display: flex; gap: 8px; align-items: center; }

.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; background: #fff; }
.calendar th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-soft); padding: 9px 6px; border-bottom: 1px solid var(--line); font-weight: 800;
}
.calendar td {
  border: 1px solid var(--line); vertical-align: top; height: 118px; padding: 5px;
  width: 14.28%;
}
.calendar td.other { background: #fafbfb; }
.calendar td.today { background: color-mix(in srgb, var(--accent) 8%, #fff); }
.calendar .daynum { font-size: .78rem; font-weight: 750; color: var(--ink-soft); display: block; margin-bottom: 3px; }
.calendar td.today .daynum {
  color: #fff; background: var(--accent); border-radius: 999px;
  width: 22px; height: 22px; display: grid; place-items: center;
}
.cal-ev {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  font-size: .715rem; line-height: 1.25; padding: 3px 6px; margin-bottom: 3px;
  border-radius: 5px; border: 1px solid transparent;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: #eef1f1; color: var(--ink-soft);
  transition: transform .12s, filter .12s;
}
.cal-ev:hover { transform: translateX(2px); filter: brightness(.96); }
.cal-ev.saved { background: var(--brand); color: #fff; font-weight: 700; }
.cal-ev.saved.will_attend     { background: var(--brand); }
.cal-ev.saved.may_attend      { background: var(--accent); }
.cal-ev.saved.attended        { background: #5a6c8c; }
.cal-ev.saved.will_not_attend { background: #97a3a2; }
.cal-more { font-size: .68rem; color: var(--ink-soft); padding-left: 6px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--ink-soft); margin-top: 12px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; vertical-align: -1px; margin-right: 5px; }

/* --------------------------------------------------------------- table --- */

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th {
  font-size: .715rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-soft); font-weight: 800; background: #fafbfb; white-space: nowrap;
}
.table th a { color: var(--ink-soft); }
.table th a.on { color: var(--brand); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--brand-light); }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.table .thumb {
  width: 66px; height: 50px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line);
}

.tabs { display: flex; gap: 5px; border-bottom: 1px solid var(--line); margin: 0 0 20px; flex-wrap: wrap; }
.tabs a {
  padding: 10px 16px; font-weight: 700; font-size: .93rem; color: var(--ink-soft);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--brand-dark); text-decoration: none; }
.tabs a.on { color: var(--brand-dark); border-bottom-color: var(--brand); }

.pager { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 8px 0 44px; }

.divider-or {
  display: flex; align-items: center; gap: 12px; margin: 20px 0;
  color: var(--ink-soft); font-size: .82rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em;
}
.divider-or::before, .divider-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.btn-google {
  background: #fff; color: #3c4043; border: 1px solid #dadce0; font-weight: 600;
}
.btn-google:hover { background: #f7f8f8; color: #3c4043; border-color: #c9ccd0; }
.btn-google svg { width: 18px; height: 18px; }

/* -------------------------------------------------------------- footer --- */

.site-foot {
  margin-top: 30px; background: var(--card-bg);
  border-top: 1px solid var(--line); padding: 26px 0 34px;
}
.foot-inner { display: flex; flex-wrap: wrap; gap: 16px 30px; align-items: center; }
.foot-brand { display: flex; align-items: center; gap: 11px; }
.foot-brand strong { display: block; font-size: .94rem; }
.foot-brand span { font-size: .82rem; color: var(--ink-soft); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-left: auto; font-size: .89rem; font-weight: 600; }
.foot-note { flex-basis: 100%; font-size: .8rem; color: var(--ink-soft); margin: 4px 0 0; max-width: 88ch; }

/* --------------------------------------------------------- responsive --- */

@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .mainnav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--card-bg); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px 20px 16px;
    box-shadow: 0 10px 24px rgba(16,48,46,.10);
  }
  .mainnav.open { display: flex; }
  .mainnav ul { flex-direction: column; gap: 2px; }
  .mainnav a { padding: 11px 12px; }
  .head-user { padding-top: 10px; border-top: 1px solid var(--line); margin-top: 8px; }
  .toolbar { position: static; }
  .calendar td { height: 92px; }
}

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; gap: 16px; }
  .toolbar { padding: 12px; }
  .tool { flex: 1 1 100%; }
  .tool select, .tool input { width: 100%; min-width: 0; }
  .toolbar .count { margin-left: 0; padding-bottom: 0; }
  .panel { padding: 18px 15px; }
  .action-row .btn { flex: 1 1 100%; }
  .calendar td { height: 74px; padding: 3px; }
  .cal-ev { font-size: 0; padding: 3px; height: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .card:hover { transform: none; }
}

@media print {
  .site-head, .site-foot, .toolbar, .action-row, .nav-toggle { display: none !important; }
  .card, .panel { box-shadow: none; break-inside: avoid; }
}

/* Obfuscated links inside announcement text. */
.event-text .ext-link { word-break: break-all; text-decoration: underline; }
.event-text .ext-link:hover { color: var(--brand-dark); }

/* Obfuscated links inside a card sit above the stretched .card-link overlay,
   otherwise the overlay would swallow the click and open the event instead. */
.card-text .ext-link {
  position: relative; z-index: 3;
  color: var(--brand-dark); font-weight: 650; text-decoration: underline;
  word-break: break-word;
}
.card-text .ext-link:hover { color: var(--accent-dark); }
