/* ── Gather — Hebridean styling ───────────────────────────────────
   Palette drawn from Barra itself:
   deep sea   #0e3c46   (Castlebay harbour at dusk)
   turquoise  #2ba9a2   (Tràigh Mhòr shallows)  · deep #17756f
   machair    #5c8d57   (summer grassland)
   peat       #54422f   (cut peat banks)
   sand       #f7f2e7   (Vatersay Bay)  · shell white #fffdf7
   buttercup  #e3b23c   (machair flowers)
   heather    #8a6fae   (moorland, used sparingly)               */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --sea-deep: #0e3c46;
  --sea: #14525c;
  --turquoise: #2ba9a2;
  --turquoise-deep: #17756f;
  --machair: #5c8d57;
  --machair-deep: #46703f;
  --peat: #54422f;
  --heather: #8a6fae;
  --sand: #f7f2e7;
  --shell: #fffdf7;
  --gold: #e3b23c;
  --ink: #2f2a22;
  --muted: #7a7260;
  --line: #e5dccb;
  --danger: #a63d2f;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--sand);
  color: var(--ink);
  min-height: 100dvh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ── Icons ── */
.icon {
  width: 1.1em; height: 1.1em;
  display: inline-block; vertical-align: -0.18em;
  flex: none;
}
.icon-tile { width: 36px; height: 36px; }

/* ── Top bar: tweed over deep sea, wave-cut lower edge ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  color: #fff;
  padding: 12px 16px 18px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background:
    repeating-linear-gradient(45deg,  rgba(255,255,255,0.04) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,0.06)       0 2px, transparent 2px 6px),
    linear-gradient(170deg, var(--sea-deep), var(--sea));
}
.topbar::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 8' preserveAspectRatio='none'%3E%3Cpath d='M0 8V4Q7.5 0 15 4T30 4T45 4T60 4T75 4T90 4T105 4T120 4V8Z' fill='%23f7f2e7'/%3E%3C/svg%3E") repeat-x bottom / 120px 8px;
}
.brand {
  display: flex; flex-direction: column; align-items: flex-start;
  color: #fff; text-decoration: none;
}
.brand-name {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 800; letter-spacing: 0.03em;
  line-height: 1.05; color: #fffdf7;
}
.brand-gaelic {
  font-family: var(--serif); font-style: italic;
  font-size: 0.78rem; color: #9fd6cf;
  line-height: 1; margin-top: 2px; white-space: nowrap;
}
.topbar-right { display: inline-flex; align-items: center; gap: 8px; }
.island-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; white-space: nowrap;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px 4px 6px; border-radius: 999px;
}
.about-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: none;
  color: #fff; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.about-pill .icon { width: 15px; height: 15px; }
.support-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
  color: #4a3200; text-decoration: none;
  background: var(--gold);
  padding: 4px 10px; border-radius: 999px;
}
.support-pill .icon { width: 0.95em; height: 0.95em; }
@media (max-width: 380px) {
  .brand-gaelic { display: none; } /* make room for the support pill */
}
.flag {
  width: 19px; height: 13px; flex: none;
  border-radius: 2.5px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.demo-banner {
  background: var(--gold); color: #4a3200;
  font-size: 0.8rem; text-align: center; padding: 6px 12px;
}
.demo-banner code { font-size: 0.75rem; }

/* ── Layout ── */
.view { max-width: 640px; margin: 0 auto; padding: 16px; }

.page-title {
  font-family: var(--serif);
  font-size: 1.5rem; color: var(--sea-deep);
  margin: 4px 0 6px;
  display: flex; align-items: center; gap: 9px;
}
.page-title .icon { width: 1em; height: 1em; color: var(--turquoise-deep); }
.intro { margin-bottom: 14px; }
.muted { color: var(--muted); font-size: 0.88rem; }
.gaelic {
  font-family: var(--serif); font-style: italic;
  color: var(--machair-deep); font-size: 1.02rem;
  margin: 2px 0 10px;
}

.day-heading {
  font-size: 0.82rem; font-weight: 700; color: var(--turquoise-deep);
  text-transform: uppercase; letter-spacing: 0.09em;
  margin: 20px 0 8px;
  display: flex; align-items: center; gap: 10px;
}
.day-heading::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* ── Cards ── */
.card {
  background: var(--shell);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(14, 60, 70, 0.07);
}

.event-card {
  display: flex; gap: 12px; align-items: flex-start;
  text-decoration: none; color: inherit;
  transition: transform 0.08s ease;
}
.event-card:active { transform: scale(0.985); }
.event-time {
  flex: 0 0 auto;
  background: var(--sea-deep); color: var(--gold);
  font-weight: 600; font-size: 0.85rem;
  border-radius: 10px; padding: 8px 10px;
  min-width: 62px; text-align: center;
}
.event-body { min-width: 0; }
.event-title { font-weight: 650; font-size: 1.02rem; margin-bottom: 2px; }
.event-venue {
  color: var(--muted); font-size: 0.86rem; margin-bottom: 6px;
  display: flex; align-items: center; gap: 4px;
}
.event-venue .icon { width: 0.95em; height: 0.95em; color: var(--turquoise-deep); }
.event-meta { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Calendar ── */
.cal { padding: 12px 14px 14px; }
.cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.cal-title {
  font-family: var(--serif); font-weight: 700;
  font-size: 1.05rem; color: var(--sea-deep);
}
.cal-nav { display: flex; gap: 4px; align-items: center; }
.cal-btn {
  border: 1px solid var(--line); background: var(--sand);
  border-radius: 8px; width: 30px; height: 30px;
  font-family: inherit; font-size: 1rem; color: var(--sea-deep);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.cal-today-btn { width: auto; padding: 0 10px; font-size: 0.72rem; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow {
  text-align: center; font-size: 0.6rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; padding: 2px 0 4px;
}
.cal-day {
  position: relative; aspect-ratio: 1;
  border: none; background: none; border-radius: 9px;
  font-family: inherit; font-size: 0.82rem; color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cal-blank { cursor: default; }
.cal-past { color: var(--muted); }
.cal-today { box-shadow: inset 0 0 0 1.5px var(--turquoise); font-weight: 700; }
.cal-sel { background: var(--turquoise-deep); color: #fff; font-weight: 700; }
.cal-sel.cal-past { color: #fff; }
.cal-dot {
  position: absolute; bottom: 3.5px; left: 50%; transform: translateX(-50%);
  width: 4.5px; height: 4.5px; border-radius: 50%;
  background: var(--turquoise-deep);
}
.cal-sel .cal-dot { background: #fff; }

.btn-showmore { width: 100%; margin-top: 4px; }

/* ── Interest ── */
.interest-line {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.9rem; font-weight: 600; color: var(--machair-deep);
  margin: 4px 0 6px;
}
.interest-line.hidden { display: none; }
.btn-interested { background: var(--machair-deep); }

/* ── Group jump bar ── */
.jumpbar {
  display: flex; gap: 6px; overflow-x: auto;
  margin: 0 0 12px; padding-bottom: 4px;
  scrollbar-width: none;
}
.jumpbar::-webkit-scrollbar { display: none; }
.day-heading[id] { scroll-margin-top: 76px; }

/* ── Tonight strip ── */
.tonight-strip {
  display: flex; flex-direction: column; gap: 2px;
  background: linear-gradient(135deg, #f7e8c4, #f2ddb0);
  border: 1px solid #e8d59e; border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 12px;
  text-decoration: none; color: var(--ink); font-size: 0.92rem;
}
.tonight-strip em { color: var(--muted); font-style: normal; font-size: 0.8rem; }
.tonight-label {
  font-family: var(--serif); font-style: italic; font-weight: 700;
  font-size: 0.8rem; color: #7c5a12;
}

/* ── Info search ── */
.info-search {
  display: block; width: 100%;
  font-family: inherit; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 18px; margin-bottom: 14px;
  background: var(--shell); color: var(--ink);
}
.info-search:focus { outline: 2px solid var(--turquoise); border-color: var(--turquoise); }
.search-context {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--turquoise-deep);
}

/* ── Local notices ── */
.about-card p { margin-bottom: 12px; line-height: 1.6; }
.about-card p:last-child { margin-bottom: 0; }

.notice-card { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.notice-card a { color: var(--turquoise-deep); }
.notice-tag {
  align-self: flex-start;
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  background: var(--sand); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 7px;
}

/* ── Support & sponsorship ── */
.sponsor-strip {
  font-size: 0.8rem; color: var(--muted); text-align: center;
  padding: 6px 10px 10px;
}
.sponsor-strip a { color: var(--turquoise-deep); font-weight: 600; }
.donate-line {
  text-align: center; font-size: 0.82rem; color: var(--muted);
  margin: 4px 0 10px;
}
.donate-line a { color: var(--turquoise-deep); font-weight: 600; }
.supporter-tag {
  font-size: 0.68rem; font-weight: 700; color: #7c5a12;
  background: #f7e8c4; border-radius: 6px; padding: 1px 7px;
  vertical-align: middle;
}
.supporter-card { border-left: 4px solid var(--gold); }
.person-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 0; border-top: 1px solid var(--line);
}
.person-row:first-child { border-top: none; }
.person-who { display: flex; flex-direction: column; min-width: 0; }
.person-who .muted { font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; }
.person-role {
  font-family: inherit; font-size: 0.85rem;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; background: var(--shell); color: var(--ink);
}

.views-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.views-table td { padding: 5px 4px; border-top: 1px solid var(--line); }
.views-table tr:first-child td { border-top: none; }
.views-n { text-align: right; font-weight: 700; color: var(--turquoise-deep); }

#browse-results {
  /* keep auto-scrolled results clear of the fixed top/bottom bars */
  scroll-margin-top: 84px;
  scroll-margin-bottom: calc(84px + env(safe-area-inset-bottom));
}

.event-past { opacity: 0.78; }
.event-past .event-time { background: #8b857a; color: var(--sand); }

/* ── Chips / filter bar ── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.76rem; color: var(--ink);
  background: var(--sand); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px;
  white-space: nowrap;
}
.chip .icon { width: 0.95em; height: 0.95em; color: var(--turquoise-deep); }
button.chip { cursor: pointer; font-family: inherit; }
.chip-active {
  background: var(--machair); border-color: var(--machair-deep); color: #fff;
}
.chip-active .icon { color: #fff; }
.chip-cat { background: #ecf3ec; border-color: #d8e6d6; }

.filterbar {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 2px 16px 10px; margin: 0 -16px;
  scrollbar-width: none;
}
.filterbar::-webkit-scrollbar { display: none; }

/* ── Detail page ── */
.backlink {
  display: inline-block; color: var(--turquoise-deep);
  text-decoration: none; font-size: 0.9rem; margin-bottom: 10px;
}
.detail h1 {
  font-family: var(--serif);
  font-size: 1.45rem; color: var(--sea-deep); margin-bottom: 10px;
}
.detail-meta p {
  margin-bottom: 6px; font-size: 0.95rem;
  display: flex; align-items: center; gap: 7px;
}
.detail-meta .icon { color: var(--turquoise-deep); }
.detail-when { font-weight: 600; }
.detail-desc { margin: 14px 0; line-height: 1.55; white-space: pre-line; }
.pending-note {
  margin-top: 14px; padding: 10px 12px;
  background: #f7ecd2; border: 1px solid #e8d9ae;
  border-radius: 10px; font-size: 0.88rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  background: var(--turquoise-deep); color: #fff;
  border: none; border-radius: 10px;
  padding: 10px 16px; cursor: pointer;
  text-decoration: none;
}
.btn:active { opacity: 0.85; }
.btn-primary { background: var(--machair-deep); }
.btn-secondary { background: #e8e1d2; color: var(--sea-deep); }
.btn-secondary .icon { color: var(--turquoise-deep); }
.btn-danger { background: var(--danger); }
.btn-small { padding: 6px 10px; font-size: 0.8rem; }
.btnrow { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

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

/* ── Forms ── */
.form label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--sea-deep); margin-bottom: 12px;
}
.form input, .form select, .form textarea {
  display: block; width: 100%;
  font-family: inherit; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-top: 4px;
  background: #fff; color: var(--ink);
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: 2px solid var(--turquoise); border-color: var(--turquoise);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.form button[type="submit"] { width: 100%; margin-top: 4px; }
.hp { position: absolute; left: -9999px; height: 1px; width: 1px; opacity: 0; }

/* ── Useful info ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; text-decoration: none; color: inherit;
  padding: 20px 10px; margin-bottom: 0;
  transition: transform 0.08s ease;
}
.info-tile:active { transform: scale(0.97); }
.info-tile .icon-tile { color: var(--turquoise-deep); }
.info-tile-name {
  font-family: var(--serif);
  font-weight: 650; font-size: 0.98rem; color: var(--sea-deep);
}
.info-tile .muted { font-size: 0.75rem; }

.install-card {
  display: flex; flex-direction: column; gap: 5px;
  border-left: 4px solid var(--turquoise);
}
.install-steps { display: block; font-size: 0.82rem; line-height: 1.55; }
.install-steps > span { display: block; margin-top: 2px; }

.about-footer {
  text-align: center; font-size: 0.85rem; margin: 18px 0 6px;
}
.about-footer a {
  color: var(--turquoise-deep); text-decoration: none; font-weight: 600;
}

.made-on {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 26px 0 6px;
  font-family: var(--serif); font-style: italic;
  font-size: 0.85rem; color: var(--muted);
  text-align: center;
}
.made-on .flag { box-shadow: 0 0 0 1px var(--line); }

.info-entry { display: flex; flex-direction: column; gap: 5px; }
.info-name { font-weight: 600; font-size: 0.95rem; }
.info-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.info-note {
  font-size: 0.82rem;
  display: flex; align-items: center; gap: 4px;
}
.info-note .icon { width: 0.9em; height: 0.9em; color: var(--turquoise-deep); }
.verify-tag {
  font-size: 0.68rem; font-weight: 600; color: #7c6420;
  background: #f7ecd2; border-radius: 6px; padding: 1px 6px;
  vertical-align: middle;
}

/* ── Pending / moderation ── */
.pending-card { border-left: 4px solid var(--gold); }

/* ── Empty & spinner ── */
.empty { text-align: center; padding: 48px 16px; }
.empty p { margin-bottom: 10px; }
.empty a { color: var(--turquoise-deep); }

.spinner {
  width: 28px; height: 28px; margin: 48px auto;
  border: 3px solid var(--line); border-top-color: var(--turquoise);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Bottom nav ── */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex;
  background: var(--shell);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(14, 60, 70, 0.08);
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px;
  font-size: 0.68rem; color: var(--muted); text-decoration: none;
  border-top: 2px solid transparent;
}
.bottomnav .icon { width: 22px; height: 22px; }
.bottomnav .nav-active {
  color: var(--turquoise-deep); font-weight: 700;
  border-top-color: var(--turquoise);
}

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  background: var(--sea-deep); color: #fff;
  font-size: 0.88rem; padding: 10px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 30; max-width: 90vw; text-align: center;
}
.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 700px) {
  .view { padding: 24px 16px; }
}
