/* ═══════════════════════════════════════════════════
   patch-core.css — layout & structure only
   No colours, no fonts — those live in skin-*.css

   DESIGN TOKENS (set in skin-*.css :root):
   --space-xs   4px
   --space-sm   8px
   --space-md   16px
   --space-lg   24px
   --space-xl   40px
   --quiz-max   580px   max-width of quiz card
   --rh-h       56px    results header height
   --map-pct    55%     map pane width
   ═══════════════════════════════════════════════════ */

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

html {
  min-height: 100%;
  height: 100%;
}

body {
  min-height: 100vh;
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

button, input, select, textarea { appearance: none; }
button { border: 0; }

/* ── WATERCOLOUR BLOBS ─────────────────────────────── */
.blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.blobs svg {
  position: absolute;
  display: block;
  overflow: visible;
}

/* ── PROGRESS BAR ──────────────────────────────────── */
#prog {
  position: fixed;
  top: 0; left: 0;
  z-index: 40;
  width: 100%;
  height: 3px;
}
#pf {
  width: 0%;
  height: 100%;
  transition: width 220ms ease;
}

/* ══════════════════════════════════════════════════
   QUIZ SCREENS
   ══════════════════════════════════════════════════ */
.sc {
  /* NO position:relative — avoids stacking context that clips children */
  z-index: 1;
  display: none;
  flex-direction: column;
  align-items: center;          /* centre everything horizontally */
  min-height: 100vh;
  width: 100%;
  /* Vertical padding: top gives logo room, bottom gives nav room */
  padding: var(--space-md) var(--space-lg) 80px;
}

.sc.on { display: flex; }

/* Masthead — logo area */
.mast {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: var(--space-sm) 0 var(--space-sm);
  text-align: center;
}

/* Quiz card wrapper — centred column */
.qwrap {
  width: 100%;
  max-width: var(--quiz-max, 580px);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.qcard {
  position: relative;
  width: 100%;
  padding: 28px 30px;
}

.qcard h1, .qcard h2, .qcard p { margin: 0; }
.qcard h1, .qcard h2 { margin-top: 6px; }
.qcard p, .intro { margin-top: 6px; }

.eyebrow, .kicker, .field-hint { display: inline-block; }

/* Age slider */
.age-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.age-readout {
  display: flex;
  align-items: end;
  gap: 8px;
}
.age-readout span { display: inline-block; }

input[type="range"] {
  width: 100%;
  height: 12px;
  margin: 0;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px;
  border-radius: 50%;
}

/* Interest / neighbourhood grids */
.igrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

/* Buttons */
.ibtn, .cbtn, .hood-pick {
  min-height: 56px;
  padding: 12px 18px;
  text-align: left;
  font-size: 0.95rem;
}
.cbtn {
  min-height: 72px;
  text-align: center;
}
.ibtn small, .cbtn small {
  display: block;
  margin-top: 3px;
}

/* Forms */
.fg input, .fg select, .fg textarea,
#hood-in, .token-input { width: 100%; }
.fg textarea { min-height: 100px; resize: vertical; }

input:not([type="range"]), select, textarea {
  min-height: 44px;
  padding: 10px 14px;
}
textarea { line-height: 1.4; }

/* Nav row — now inside the card */
.nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid rgba(30, 26, 20, 0.08);
}

.bbk, .bnx, .bcan, .bpub, .token-save {
  min-height: 48px;
  padding: 0 24px;
}
.bbk { visibility: visible; }
#s-age .bbk { visibility: hidden; }

/* Sports sub-grid */
#ssub { display: none; margin-top: 14px; }
#ssub.on { display: block; }

/* ══════════════════════════════════════════════════
   RESULTS SCREEN — SPLIT PANE
   ══════════════════════════════════════════════════ */

/* #sr overrides the .sc padding entirely */
#sr {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  padding: 0;
  /* No overflow:hidden here — let children manage their own overflow */
}
#sr.on { display: flex; }

/* ── RESULTS HEADER ─────────────────────────────── */
.rh-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  width: 100%;
  height: var(--rh-h, 60px);
}

/* Filter button group container */
.rh-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

/* Each filter group — button + dropdown */
.rh-fgroup {
  position: relative;
}

/* Filter trigger button */
.rh-fbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.rh-fbtn-arrow {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.rh-fgroup.open .rh-fbtn-arrow {
  transform: rotate(180deg);
}

/* Dropdown panel */
.rh-fdrop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 100;
  min-width: 240px;
  padding: 16px;
  border-radius: 16px;
  display: none;
  flex-direction: column;
  gap: 10px;
  animation: dropIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.rh-fgroup.open .rh-fdrop {
  display: flex;
}

.rh-fdrop-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rh-fdrop-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* Search inside dropdown */
.rh-search-wrap {
  position: relative;
  width: 100%;
}

.rh-search {
  width: 100%;
  min-height: 36px;
  padding: 7px 16px 7px 40px;
  border-radius: 10px;
}

.rh-search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.4;
}

/* Suggestions */
.rh-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 110;
  border-radius: 10px;
  overflow: hidden;
  display: none;
}
.rh-suggestions.on { display: block; }
.rh-suggestion {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.84rem;
}

/* Filter pills inside dropdowns */
.fpill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.fpill:active { transform: scale(0.91); }

/* Sticky results header */
.rh {
  position: sticky;
  top: 0;
  z-index: 35;
  width: 100%;
  min-height: var(--rh-h, 100px);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.rh > div { display: flex; flex-shrink: 0; align-items: center; gap: 10px; }
.vtoggle { display: none; }
.vtbtn, .rh-add { min-height: 34px; padding: 0 14px; }

/* Split-pane body — direct child of #sr */
.sr-body {
  display: flex;
  flex: 1;
  width: 100%;
  height: calc(100vh - var(--rh-h, 60px));
  max-height: 620px;
}

/* MAP — left pane — 66% width, 34% for list */
#map-view {
  width: 66%;
  flex: 0 0 66%;
  height: 100%;
  position: relative;
  display: block;
  padding: 14px 10px 14px 18px;
  background: var(--parch, #f2ede3);
}

#map-el {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 108px);
  display: block;
  border-radius: 12px;
  overflow: hidden;
}

/* Token banner overlays the map */
#token-banner {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  gap: 14px;
  text-align: center;
}
#token-banner.on { display: flex; }
.token-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  width: 100%;
  max-width: 400px;
}

/* LIST — right pane, scrollable — 34% width */
#list-view {
  width: 34%;
  flex: 0 0 34%;
  height: calc(100vh - var(--rh-h, 60px));
  overflow-y: auto;
  padding: 20px 18px 80px 16px;
  display: block;
}
#list-view.off { display: none; }

/* ── MOBILE ────────────────────────────────────────── */
@media (max-width: 767px) {
  .sc { padding: var(--space-sm) var(--space-md) 72px; }

  .sr-body {
    flex-direction: column;
    height: auto;
  }

  #map-view {
    flex: none;
    width: 100%;
    height: 55vw;
    min-height: 240px;
    max-height: 380px;
  }

  #list-view {
    flex: none;
    height: auto;
    overflow-y: visible;
    padding: var(--space-md) var(--space-md) 60px;
  }
}

/* ── DESKTOP wider padding + 3-col interest grid ────── */
@media (min-width: 768px) {
  .sc { padding: var(--space-md) var(--space-xl) 80px; }
  .qcard { padding: var(--space-lg) var(--space-xl); }
  .igrid { grid-template-columns: repeat(3, 1fr); }
}

/* ══════════════════════════════════════════════════
   EVENT LIST — shared elements
   ══════════════════════════════════════════════════ */
.wcs, .notice, .parts, .dbar { width: 100%; }

.wcs {
  display: grid;
  gap: 14px;
  padding: 20px 24px;
}
.wcs p { max-width: 54ch; margin: 0; }

.wcs-tags, .etags, .emeta, .efoot, .parts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.notices { display: grid; gap: 8px; margin-top: 14px; }
.notice { padding: 11px 14px; }

.sh {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 12px;
}
.sh::before {
  display: inline-block;
  width: 11px; height: 11px;
  content: "";
}

#pevs, #wc-evs, #all-evs, #user-evs {
  display: grid;
  gap: 14px;
}

.ecard {
  position: relative;
  width: 100%;
  padding: 18px 20px;
}
.ecard:nth-of-type(3n)::after {
  position: absolute;
  top: 10px; right: 16px;
  width: 14px; height: 8px;
  content: "";
}

.etop { display: grid; gap: 10px; }
.etags { align-items: flex-start; }
.emeta { margin-top: 12px; }
.edesc { margin: 12px 0 0; }
.efoot {
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
}

.emap, .bexp, .fab, .rh-add { min-height: 34px; padding: 0 12px; }

.tag, .lp-tag, .ptag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 4px 8px 3px;
}

.parts {
  justify-content: center;
  margin-top: 28px;
  padding: 16px;
}
.parts-lbl { width: 100%; text-align: center; }

.dbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
}

/* ── FAB ────────────────────────────────────────────── */
.fab {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  width: 54px; height: 54px;
  padding: 0;
  border-radius: 50%;
}
.fab.on { display: flex; }

/* ── ADD-EVENT OVERLAY ─────────────────────────────── */
.ov {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ov.on { display: flex; }

.asheet {
  width: min(100%, 640px);
  max-height: calc(100vh - 48px);
  padding: 32px 36px 28px;
  overflow-y: auto;
  border-radius: 20px;
}
.asheet h3 { margin: 0 0 16px; }

.fgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.fg { display: grid; gap: 6px; }
.fg.full { grid-column: 1 / -1; }

.aacts {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

@media (min-width: 600px) {
  .fgrid { grid-template-columns: 1fr 1fr; }
}

/* ── MAP CONTROLS — vertical alignment fix ─────────── */
.mapboxgl-ctrl-top-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  top: 12px !important;
  left: 12px !important;
}

.mapboxgl-ctrl-top-left .mapboxgl-ctrl {
  margin: 0 !important;
  float: none !important;
}

/* ── AGE SLIDER LABELS ──────────────────────────────── */
.age-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
}

/* ── MAP POPUP ──────────────────────────────────────── */
.lp { max-width: 260px; padding: 14px 16px 12px; }
.lp-title, .lp-meta, .lp-desc { margin: 0; }
.lp-meta { display: grid; gap: 2px; margin-top: 6px; }
.lp-desc { margin-top: 6px; }


/* ── BRAND AREA ──────────────────────────────────── */
.rh-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
  /* Min-width reserved for future Patch logo */
  min-width: 120px;
}

.rh-brand-sub {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.4;
  font-weight: 600;
}

/* ── SEARCH ALWAYS VISIBLE ───────────────────────── */
.rh-search-wrap {
  flex: 1;
  position: relative;
  max-width: 360px;
}

.rh-search {
  width: 100%;
  min-height: 36px;
  padding: 7px 14px 7px 34px;
  border-radius: 999px;
}

.rh-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.4;
}

.rh-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 110;
  border-radius: 12px;
  overflow: hidden;
  display: none;
}
.rh-suggestions.on { display: block; }
.rh-suggestion { padding: 9px 14px; cursor: pointer; font-size: 0.84rem; }

/* ── HEADER ACTIONS ──────────────────────────────── */
.rh-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Filter toggle button */
.rh-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: all 0.15s ease;
}

.filter-active-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 2px;
}

/* ── FILTER SIDE PANEL ───────────────────────────── */
.filter-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(30,26,20,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.filter-overlay.on {
  opacity: 1;
  pointer-events: auto;
}

.filter-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.filter-panel.open {
  transform: translateX(0);
}

.fp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  flex-shrink: 0;
}

.fp-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0;
}

.fp-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.fp-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.fp-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fp-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fp-section-hint {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.72rem;
  opacity: 0.6;
}

.fp-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Filter pills */
.fpill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.fpill:active { transform: scale(0.91); }

.fp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  flex-shrink: 0;
  border-top: 1px solid rgba(30,26,20,0.1);
}

.fp-clear {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.fp-done {
  padding: 10px 28px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

/* ── MULTI-LINK FIELDS ───────────────────────────── */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.link-input {
  flex: 1;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
}
.add-link-btn {
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  background: none;
  border: none;
  text-align: left;
}
