/* RG Events — schedule page. Header reuses ONLY the top band of the Días
   que Cuentan calendar (top.png / top-sil / top-frame at the site root),
   recolorable via /calendar-colors.css (--brand-blue). Below it, flat cards. */

:root {
  --brand-blue: #1e6ee0; /* overridden at runtime from the sheet's Config.Color */
  --text: #1c2434;
  --muted: #6b7686;
  --card: #ffffff;
}

* { box-sizing: border-box; }

/* The page must never pan sideways, whatever any engine quirk does to an
   element's width (see the .rg-header note in new-frame.css). clip where
   supported (no scroll container, sticky unaffected), hidden as fallback. */
html { overflow-x: hidden; overflow-x: clip; }

body {
  margin: 0;
  font-family: var(--font-readable, sans-serif);
  font-size: 17px;       /* readable floor — this crowd reads a LOT */
  line-height: 1.45;
  color: var(--text);
  background: #eef2f8;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation; /* no double-tap zoom (pinch still works) */
}

/* form controls default to the system font — pull them into the same type */
button, input, select, textarea { font-family: inherit; }

.container {
  max-width: 430px;
  margin: 0 auto;
  padding: 0 0 60px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- header: just the calendar top band ---------- */

.calendar-top {
  width: 100%;
  aspect-ratio: 1289 / 430;
  background: url('/top.png?v=2') center bottom / 100% auto no-repeat;
  position: relative;
  filter: drop-shadow(0 8px 18px rgba(6, 26, 82, 0.22));
  margin-bottom: 10px;
  flex: none;
}

.calendar-title {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 6%;
  margin: 0;
  text-align: center;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

/* Header: ONE hamburger; every action lives in the dropdown below it,
   each row showing icon + name. Toggles color their row when active. */
.header-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}
.ico {
  /* translucent chip so the icons read on ANY theme art */
  background: rgba(255, 255, 255, .55);
  border-radius: 12px;
  border: none;
  padding: 7px 9px;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  color: #9aa4b2;                 /* off / muted */
  -webkit-tap-highlight-color: transparent;
}
.ico:active { transform: scale(.92); }

/* the hamburger: solid white chip, burger in the theme's accent — reads on
   any art, light or dark. Gold dot when a filter inside the menu is active. */
#menu-btn {
  background: #fff;
  color: var(--brand-blue, #1e6ee0);
}
#menu-btn.filtered::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f5b301;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .8);
}
#menu-btn { position: relative; }

/* Dropdown wears the theme accent: white border, white text, each icon on
   its own white chip (colored with the accent to match). */
.menu-pop {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  background: var(--brand-blue, #1e6ee0);
  border: 2px solid #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(6, 26, 82, .35);
  padding: 8px;
  min-width: 262px;
  /* admin-built extras can make it long — scroll inside, never off-screen */
  max-height: min(72dvh, 560px);
  overflow-y: auto;
}
.menu-pop.show { display: block; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--brand-blue, #1e6ee0);
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 12px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  color: #fff;
  text-align: left;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.menu-item:active { background: rgba(255, 255, 255, .18); }
.menu-item i {
  flex: none;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 12px;
  font-size: 1.7rem;
}
/* checked toggle: its icon flips to the SOLID cut of the same glyph… */
.menu-item.on i { --fa-style: 900; }
/* …and the row gets a real fa-check, not a text checkmark */
.menu-item.on::after {
  content: '\f00c';
  font-family: 'Font Awesome 7 Pro';
  font-weight: 900;
  margin-left: auto;
  font-size: 1.1rem;
}
.menu-item[disabled] { opacity: .55; cursor: default; }
.menu-item .chip {
  margin-left: auto;
  font-style: normal;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .03em;
  background: rgba(255, 255, 255, .28);
  color: #fff;
  padding: 2px 8px;
  border-radius: 99px;
}

#fab-edit i {
  --fa-primary-color: #ffd166;
  --fa-secondary-color: #ffffff;
  --fa-secondary-opacity: .95;
}
.menu-item i { color: var(--brand-blue, #1e6ee0); } /* icon = accent on white */
#tg-star.on i { color: #f5b301; } /* only-mine active → gold star */
#tg-done.on i { color: #1c1c1c; } /* hide-finished active → black eye */

/* ---------- content below the band: flat, like plain cards ---------- */

.content {
  padding: 0 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
#schedule { flex: 1; }

.event-meta { text-align: center; color: var(--text); margin: 2px 0 10px; }
.event-meta .dates { font-weight: 600; }
.event-meta .venue { font-size: .95rem; color: var(--muted); }
.event-meta img.logo { max-width: 60%; max-height: 80px; margin: 6px auto; display: block; border-radius: 8px; }

.announce {
  background: #fff7d6;
  color: #5a4500;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 10px;
  font-size: .95rem;
}

/* ---------- schedule ---------- */

.day-head {
  position: sticky;
  top: min(45.8334vw, 197.1px); /* just under the anchored header (its height) */
  z-index: 5;
  background: var(--brand-blue);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 500;   /* was 700 — dates read lighter */
  letter-spacing: .02em;
  padding: 3px 12px;
  border-radius: 8px;
  margin: 9px 0 3px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .15);
}

.ev {
  background: var(--card);
  border-radius: 12px;
  padding: 9px 11px;
  margin: 5px 0;
  box-shadow: 0 1px 4px rgba(6, 26, 82, .12);
  cursor: pointer;
}
.ev.done { opacity: .55; }
.ev .row1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ev .time { font-weight: 500; color: var(--brand-blue); white-space: nowrap; } /* was 700 */
.ev .room { margin-left: auto; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.ev .star {
  background: none; border: none; font-size: 1.05rem; cursor: pointer;
  padding: 0 4px 0 0; filter: grayscale(1) opacity(.45);
}
.ev.starred .star { filter: none; }
/* title + info icon share one row, same height — the icon's own width
   (flex: none) is what reserves the title's "space to the right" so long
   names wrap around it instead of running underneath. */
.name-row { display: flex; align-items: center; gap: 8px; margin: 2px 0 0; }
.name-row .name { flex: 1; min-width: 0; margin: 0; }
.ev .name { font-size: 1.1rem; font-weight: 400; }

/* personal reminder cards: dashed accent outline + bell, clearly "mine",
   visually apart from the official program */
.ev.rem { border: 1.5px dashed var(--brand-blue); box-shadow: none; }
.ev.rem .rbell { color: var(--brand-blue); font-size: 1rem; padding: 0 4px 0 2px; }
.ev.rem .room { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }

/* reminder list inside the sheet — tap a row to edit it */
.rem-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  margin: 0 0 6px;
  cursor: pointer;
  background: #fff;      /* white chip row on the accent sheet */
  color: var(--text);
}
.rem-row.sel { border-color: var(--brand-blue); background: #f4f8ff; }
.rem-row .rem-when {
  flex: none;
  font-size: .8rem;
  font-weight: 600;
  color: var(--brand-blue);
  white-space: nowrap;
}
.rem-row .rem-what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rem-intro p { font-size: .95rem; margin: 8px 0; }
#rem-intro p.hint { font-size: .85rem; }

/* text menu items open here (consuite hours, wifi password, …) */
#info-body { white-space: pre-wrap; overflow-wrap: break-word; }

/* gathering-menu builder rows: icon chip + label + one link-or-text box */
.mb-group { font-weight: 700; margin: 16px 0 6px; }
.mb-item { margin: 0 0 10px; }
.mb-item label { font-size: .85rem; }
/* label above; icon chip and box share a row, centered on each other */
.mb-row { display: flex; gap: 10px; align-items: center; }
.mb-ico {
  flex: none;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;      /* matches the menu's white icon chips */
  border-radius: 9px;
  color: var(--brand-blue);
  font-size: 1.05rem;
}
/* .form scope: outrank .form textarea's 70px floor — one line until typed in */
.form .mb-row textarea { min-height: 42px; flex: 1; min-width: 0; }
.ev .desc { display: none; margin: 6px 0 0; font-size: .95rem; color: var(--muted); white-space: pre-wrap; }
.ev.open .desc { display: block; }

/* "More info" — an admin-set link out to a bio/program page (no photo
   upload needed: the RG's own site hosts the real content). Sits beside
   the event title, same row/height (.name-row), always at its own width. */
.ev-info {
  flex: none;
  display: inline-flex;
  color: var(--brand-blue);
  text-decoration: none;
}
.ev-info i { font-size: 1.2rem; }

.updated { text-align: center; font-size: .75rem; color: var(--muted); margin: 12px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.schedule-wait .fa-spin {
  display: block;
  font-size: 46px;
  margin: 0 auto 12px;
  color: var(--brand-blue);
}

/* ---------- admin FAB: the ONE edit button ---------- */

#fab-edit {
  position: fixed;
  right: 28px;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--brand-blue);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(6, 26, 82, .35);
  display: none;
}
body.is-admin #fab-edit { display: block; }

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 20, 40, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.overlay.show { display: flex; }

/* Sheets wear the menu look: accent body, white border, white ink; form
   fields and list rows sit on their own white chips, like the menu icons. */
.sheet {
  background: var(--brand-blue, #1e6ee0);
  border: 2px solid #fff;
  color: #fff;
  width: 100%;
  max-width: 430px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 18px;
  padding: 16px 16px 20px;
}
.sheet h3 {
  margin: -16px -16px 10px;
  padding: 16px 16px 10px;
  display: flex;
  align-items: center;
  /* anchored (with its ✕) while the sheet body scrolls underneath */
  position: sticky;
  top: -16px;
  z-index: 3;
  background: inherit;
  border-radius: 14px 14px 0 0;
}
.sheet h3 .close { margin-left: auto; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: rgba(255, 255, 255, .9); }

.qr-box { text-align: center; }
.qr-box svg, .qr-box img { max-width: 240px; width: 100%; height: auto; background: #fff; border-radius: 10px; padding: 6px; }
.qr-box .link { font-size: .75rem; color: rgba(255, 255, 255, .85); word-break: break-all; margin: 8px 0; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  background: var(--brand-blue);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  margin: 4px 4px 0 0;
}
.btn.soft { background: #e8eef8; color: var(--brand-blue); }
.btn.danger { background: #d64545; }
.btn.wide { width: 100%; margin: 8px 0 0; }
/* inside accent sheets the roles invert: primary = white chip */
.sheet .btn { background: #fff; color: var(--brand-blue); }
.sheet .btn.soft { background: rgba(255, 255, 255, .22); color: #fff; }
.sheet .btn.danger { background: #d64545; color: #fff; }
.sheet .density-row .btn.soft.on { background: #fff; color: var(--brand-blue); }

/* admin edit screen */
.adm-day { font-weight: 700; font-size: .95rem; color: #fff; letter-spacing: .02em; margin: 10px 0 0; }
.adm-ev {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  font-size: .9rem;
  background: #fff;      /* white chip rows on the accent sheet */
  color: var(--text);
  border-radius: 8px;
  margin: 4px 0;
}
.adm-group .adm-ev:last-child { border-bottom: none; }
.adm-ev .grip {
  cursor: grab;
  color: #aab3c2;
  font-size: 1.1rem;
  padding: 0 2px;
  touch-action: none; /* let Sortable own the touch gesture */
  user-select: none;
}
.adm-ev .t { color: var(--muted); white-space: nowrap; }
.adm-ev .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-haslink { flex: none; font-size: .75rem; color: var(--brand-blue); }
.adm-ev button { background: none; border: none; font-size: 1.05rem; cursor: pointer; padding: 2px 6px; }
.sortable-ghost { opacity: .35; background: #e8eef8; }
.sortable-chosen { box-shadow: 0 4px 12px rgba(6, 26, 82, .18); border-radius: 8px; }

.adm-admin { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: .9rem; }
.adm-admin .who { flex: 1; }
.adm-admin .sub { font-size: .72rem; color: rgba(255, 255, 255, .75); }

/* event form */
.form label { display: block; font-size: .8rem; color: rgba(255, 255, 255, .9); margin: 10px 0 3px; }
.form input, .form textarea, .form select {
  width: 100%;
  border: 1px solid #d5dbe6;
  border-radius: 9px;
  padding: 9px 10px;
  /* 16px minimum is load-bearing: anything smaller makes iOS Safari
     auto-zoom the page on focus — and the zoom sticks after the sheet
     closes, leaving the schedule horizontally pannable. */
  font-size: 16px;
  font-family: inherit;
  background: #fff;
}
.form textarea { min-height: 70px; resize: vertical; }
.form .two { display: flex; gap: 10px; }
.form .two > div { flex: 1; }
.hint { font-size: .75rem; color: var(--muted); margin: 4px 0; }
.sheet .hint { color: rgba(255, 255, 255, .85); }

/* setup guide (create a gathering) */
.steps { margin: 0 0 12px; padding-left: 20px; font-size: .9rem; }
.steps li { margin: 8px 0; }
.steps .btn { margin-top: 6px; }

.logo-row { display: flex; align-items: center; gap: 10px; }
.logo-row img { max-height: 54px; max-width: 110px; border-radius: 8px; border: 1px solid #e2e7f0; }
.logo-row input[type="file"] { flex: 1; min-width: 0; border: none; padding: 6px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  background: #222c3d;
  color: #fff;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: .85rem;
  z-index: 90;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; }

/* ---------- background-theme picker (settings + per-phone override) ---------- */

.themes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 264px;
  overflow-y: auto;
  padding: 2px;
}
.themes-row { max-height: 200px; margin-top: 8px; }
.thm-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: #fff;
  margin: 16px 0 0;
  text-align: left;
}
/* ---------- inline button spinner (e.g. "Creating your gathering…") ---------- */
.btn .spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rgspin .8s linear infinite;
  vertical-align: -2px;
  margin-right: 8px;
}
@keyframes rgspin { to { transform: rotate(360deg); } }

/* ---------- venue autocomplete dropdown (Photon / OSM) ---------- */
.vwrap { position: relative; }
.venue-list {
  position: absolute;
  left: 0; right: 0; top: 100%;
  z-index: 30;
  background: #fff;
  border: 1px solid #d5dbe6;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(6, 26, 82, .18);
  max-height: 230px;
  overflow-y: auto;
}
.venue-list button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid #eef1f6;
  padding: 9px 12px;
  font-size: .88rem;
  cursor: pointer;
}
.venue-list button:last-child { border-bottom: none; }
.venue-list button:hover { background: #f0f4fa; }
.venue-list .sub { display: block; font-size: .72rem; color: #8b95a5; margin-top: 1px; }

/* ---------- Now / Next card (auto-appears on event days) ---------- */
.nownext {
  background: var(--card);
  border: 2px solid var(--brand-blue);
  border-radius: 12px;
  padding: 7px 11px;
  margin: 2px 0 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.nn-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; }
.nn-tag {
  flex: none;
  background: var(--brand-blue);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 1px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}
.nn-tag.nn-next { background: transparent; color: var(--brand-blue); border: 1.5px solid var(--brand-blue); }
.nn-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nn-meta { margin-left: auto; flex: none; color: var(--muted); font-size: .85rem; }
body.compact .nownext { padding: 4px 9px; }

/* ---------- print: clean black-on-white one-pager ---------- */
@media print {
  body { background: #fff !important; color: #000; font-size: 11pt; }
  .container { max-width: none; box-shadow: none; padding: 0; min-height: 0; }
  .rg-header {
    aspect-ratio: auto !important; height: auto !important; background: none !important;
    display: block; position: static !important; /* sticky would repeat it per page */
  }
  .ev-info { color: #000 !important; }
  .header-top-info { padding: 0 0 6pt; }
  .header-name { color: #000 !important; text-shadow: none; font-size: 22pt; }
  .header-sub, .header-sub .vlink { color: #000 !important; border-bottom: none; }
  .header-actions, .header-gears-strip, #fab-edit, .overlay, .toast,
  .updated, .nownext { display: none !important; }
  .content { background: #fff !important; padding: 0; }
  .event-meta, .event-meta .venue { color: #000; }
  .announce { border: 1pt solid #999; background: #fff; color: #000; }
  .day-head {
    position: static;
    background: #fff;
    color: #000;
    box-shadow: none;
    border-radius: 0;
    border-bottom: 1.5pt solid #000;
    padding: 2pt 0;
    margin: 10pt 0 4pt;
    page-break-after: avoid;
  }
  .ev {
    box-shadow: none;
    border: .75pt solid #bbb;
    border-radius: 4pt;
    margin: 3pt 0;
    page-break-inside: avoid;
    cursor: default;
  }
  .ev .time { color: #000; }
  .ev .room, .ev .desc { color: #333; }
  .ev .star { display: none; }
  .ev .desc { display: block; } /* paper shows every description */
}

/* ---------- create-flow disclaimer ---------- */
.disclaim p { margin: 12px 0; line-height: 1.5; }
.disclaim .disclaim-icon {
  text-align: center;
  font-size: 44px;
  margin: 4px 0 10px;
  color: #b45309;
}
.disclaim .disclaim-warn {
  background: #fff3e6;
  border-radius: 10px;
  padding: 12px 14px;
  color: #7c2d12;
}

/* ---------- density toggle (Look & feel) ---------- */
.density-row { display: flex; gap: 8px; }
.density-row .btn { flex: 1; margin: 0; }
.density-row .btn.soft.on { background: var(--brand-blue); color: #fff; }

/* Compact: more schedule per screen, still Atkinson */
body.compact .content { font-size: 15px; }
body.compact .ev { padding: 5px 10px; margin: 4px 0; border-radius: 10px; }
body.compact .ev .name { font-size: 1rem; }
body.compact .ev .desc { font-size: .9rem; }
body.compact .ev .row1 { gap: 6px; }
body.compact .day-head { padding: 2px 10px; margin: 6px 0 2px; font-size: .95rem; }
body.compact .announce { padding: 5px 10px; font-size: .88rem; }
body.compact .event-meta { margin: 0 0 6px; }

.theme-cat {
  grid-column: 1 / -1;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7b8698;
  margin: 6px 0 -2px;
  text-align: left;
}
.theme-cat:first-child { margin-top: 0; }
.theme-opt {
  position: relative;
  border: 2px solid #d5dbe6;
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  background: #fff;
  cursor: pointer;
}
.theme-opt img {
  display: block;
  width: 100%;
  aspect-ratio: 320 / 120;
  object-fit: cover;
}
.theme-opt span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: .66rem;
  padding: 2px 6px;
  background: rgba(255, 255, 255, .85);
  color: #333;
  text-align: left;
}
.theme-opt.auto {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 320 / 120;
  font-size: .74rem;
  font-weight: 600;
  color: #56607a;
}
.theme-opt.sel { border-color: var(--brand-blue); box-shadow: 0 0 0 2px rgba(30, 110, 224, .25); }
.theme-opt.sel::after {
  content: '✓';
  position: absolute;
  top: 5px; right: 5px;
  width: 20px; height: 20px;
  background: var(--brand-blue);
  color: #fff;
  border-radius: 50%;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-opt.auto.sel::after { content: none; }
