/* ══════════════════════════════════════════════════
   Groom — Stylesheet
   ══════════════════════════════════════════════════ */

/* ── Variables ──
   Warm palette derived from the brand colour #9a8e82 (HSL ~25°,11%,56%).
   Equivalent perceived lightness / contrast as the previous grayscale theme,
   only the hue is shifted towards warm taupe/cream.                          */
:root {
    --bg:           #F2EFEB;             /* warm cream — was #F2F2F2 */
    --surface:      #FCFAF7;             /* off-white — was #FFFFFF */
    --surface2:     #ECE7E1;             /* slightly darker cream */
    --border:       rgba(80,65,50,.14);  /* warm tinted border */
    --label:        #1B1612;             /* near-black warm — was #000 */
    --label2:       rgba(60,48,38,.80);  /* WCAG AA on cream */
    --label3:       rgba(70,55,45,.55);
    --fill:         rgba(154,142,130,.22);
    --fill2:        rgba(154,142,130,.14);
    --danger:       #FF3B30;
    --blue:         #007AFF;
    --green:        #34C759;
    --orange:       #FF9500;
    --pink:         #FF2D55;
    --purple:       #AF52DE;
    --brand:        #9a8e82;
    --r-card:       16px;
    --shadow:       0 2px 12px rgba(60,40,20,.10), 0 1px 3px rgba(60,40,20,.06);
    --shadow-modal: 0 20px 60px rgba(40,28,15,.20);
    --topbar-h:     52px;
    --bottombar-h:  52px;
}

html.dark {    --bg:           #1C1814;             /* very dark warm — was #161616 */
    --surface:      #322D27;             /* warm surface — was #2C2C2C */
    --surface2:     #221D18;             /* deeper dark cream */
    --border:       rgba(240,228,212,.12);
    --label:        #F8F2E8;             /* warm-tinted white */
    --label2:       rgba(238,228,212,.80);
    --label3:       rgba(238,228,212,.55);
    --fill:         rgba(154,142,130,.30);
    --fill2:        rgba(154,142,130,.18);
    --shadow:       0 2px 16px rgba(0,0,0,.5);
    --shadow-modal: 0 20px 60px rgba(0,0,0,.65);
    color-scheme: dark;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
/* Neutralizes double-tap zoom (preserves pinch-zoom + scroll + mouse).
   Pinch-zoom stays active since it comes from the viewport's multi-touch gesture. */
body { touch-action: manipulation; }

/* ── Accessibility: skip link (visible only on keyboard focus) ── */
.skip-link {
    position: fixed; top: 0; left: 0; z-index: 9999;
    transform: translateY(-200%);
    background: var(--label); color: var(--surface);
    padding: .6rem 1rem; border-radius: 0 0 8px 0;
    font-weight: 600; text-decoration: none;
    transition: transform .15s;
}
.skip-link:focus { transform: translateY(0); outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── Global focus-visible (keyboard only) ── */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

/* ── sr-only: visible only to screen readers ── */
.sr-only {
    position: absolute !important; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

html { background: var(--bg); height: 100%; }
body {
    background: var(--bg);
    color: var(--label);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    font-size: 15px; line-height: 1.5;
    min-height: 100vh; min-height: 100dvh; min-height: 100lvh;
    height: 100vh; height: 100dvh;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════
   LOGO
   ══════════════════════════════════════════════════ */
.logo-long {
    -webkit-mask-image: url("../images/logo_long.svg"); mask-image: url("../images/logo_long.svg");
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-position: left center; mask-position: left center;
    background-color: currentColor;
}
.sidebar-logo-icon { width: 109px; height: 19px; object-fit: contain; flex-shrink: 0; filter: none; }
.sidebar-logo-icon svg { width: 100%; height: 100%; }
/* Animated GROOM logo (eyes blink in the O letters). currentColor drives
   letters/pupils/lids; eye whites pick up var(--surface) for clean dark mode. */
.groom-eyes { display: block; width: 100%; height: auto; }
.groom-eyes .groom-letters,
.groom-eyes .lid           { fill: currentColor; }
.groom-eyes .sclera,
.groom-eyes .glint  { fill: #ffffff; }
.groom-eyes .pupil  { fill: #15140f; }
.mob-logo-long svg { position: absolute; top: 50%; left: 0; width: 100%; height: auto; transform: translateY(-50%); display: block; }
.login-logo-icon   { width: 136px; height: 23px; min-width: 136px; min-height: 23px; margin-bottom: 1.1rem; flex-shrink: 0; display: inline-flex; align-items: center; color: var(--label); }
.login-logo-icon svg { width: 100%; height: 100%; }

.mob-logo-long { width: 110px; height: 22px; color: var(--label); display: block; position: relative; }

/* ══════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════ */
.layout { display: flex; height: 100vh; height: 100dvh; height: 100lvh; overflow: hidden; max-width: 100vw; }

.sidebar {
    width: 248px; flex-shrink: 0; background: var(--bg);
    padding: 1.5rem 1rem;
    display: flex; flex-direction: column; gap: 1.5rem;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo { display: flex; align-items: center; gap: .75rem; padding: .25rem .5rem; margin-top: 7px; margin-bottom: 10px; color: inherit; cursor: default; }

.nav-section-label { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--label3); padding: 0 .6rem; margin-bottom: .25rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav > button {
    display: flex; align-items: center; gap: .65rem; width: 100%;
    padding: .6rem .75rem; border-radius: 10px;
    color: var(--label2); text-decoration: none;
    font-size: .9rem; font-weight: 500; text-align: left;
    background: transparent; border: 0; font-family: inherit;
    transition: background .12s, color .12s;
    cursor: pointer; -webkit-user-select: none; user-select: none;
}
.nav a:hover, .nav > button:hover  { background: var(--fill2); color: var(--label); }
.nav a.active, .nav > button.active { background: var(--fill);  color: var(--label); font-weight: 600; }
.nav-icon { width: 16px; height: 16px; display: block; flex-shrink: 0; opacity: .6; }
.nav a.active .nav-icon, .nav a:hover .nav-icon, .nav > button.active .nav-icon, .nav > button:hover .nav-icon { opacity: 1; }

@media (prefers-color-scheme: light) {
    .nav a.active, .nav > button.active { background: rgba(154,142,130,.18); }
}

/* ── Sidebar filters ── */
.sidebar-filters { display: flex; flex-direction: column; gap: .35rem; }

.filter-chip {
    display: flex; align-items: center; gap: .55rem;
    width: 100%; padding: .42rem .75rem; border-radius: 10px;
    background: transparent; border: 1.5px solid transparent;
    cursor: pointer; font-family: inherit; font-size: .85rem; font-weight: 500; color: var(--label);
    transition: background .12s, border-color .12s;
}
.filter-chip:hover    { background: var(--fill2); }
.filter-chip.on       { background: var(--fill2); border-color: var(--border); }
.filter-chip.disabled { opacity: .3; pointer-events: none; }
.filter-chip span     { flex: 1; text-align: left; }

@media (prefers-color-scheme: light) {
    .filter-chip.on           { background: transparent; border-color: rgba(60,40,20,.85); }
    .filter-chip.on .fc-icon svg  { stroke: #000000; }
    .filter-chip.on .fc-check svg { stroke: #000000; }
}
html.dark .filter-chip.on { background: transparent; border-color: rgba(248,242,232,.65); }
html.dark .filter-chip:not(.on) { background: transparent; border-color: transparent; }
html.dark .filter-chip:not(.on):hover { background: rgba(154,142,130,.20); }

.fc-icon { width: 15px; height: 15px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.fc-icon svg { width: 14px; height: 14px; stroke: var(--label2); fill: none; stroke-width: 2; }
.fc-check { width: 14px; height: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.fc-check svg { width: 13px; height: 13px; stroke: var(--label); fill: none; stroke-width: 2.5; }
.filter-chip.on .fc-check { opacity: 1; }
.sidebar-footer { margin-top: auto; }

/* ── Weather widget ── */
.weather-widget {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--label2);
  padding: .4rem .5rem;
  border-radius: 8px;
  margin-bottom: .5rem;
  width: fit-content;
}
.weather-widget .weather-icon { display: flex; align-items: center; }
.weather-widget .weather-icon img { opacity: .6; filter: none; }
.weather-widget .weather-temp { letter-spacing: -.02em; color: var(--label2); }
html.dark .weather-widget .weather-icon img { filter: invert(1) !important; opacity: .6; }
.weather-widget .weather-rain.no-rain { color: var(--label3); background: transparent; }
.weather-widget .weather-rain {
  font-size: .7rem;
  font-weight: 400;
  color: #007AFF;
  background: rgba(0,122,255,.1);
  padding: 1px 5px;
  border-radius: 4px;
}
/* ── Weather tooltip 6h ── */
.weather-widget { position: relative; cursor: pointer; }
.weather-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(40,28,15,.18);
  padding: .5rem .65rem;
  width: max-content;
  z-index: 600;
  gap: .2rem;
  flex-direction: column;
  white-space: nowrap;
  pointer-events: none;
}
@media (max-width: 768px) {
  .weather-tooltip {
    position: absolute; top: calc(100% + 8px); bottom: auto; right: 1rem; left: auto;
    /* Mobile: always dark, regardless of system theme. */
    background: #1C1C1C !important;
    border-color: rgba(240,228,212,.12) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,.45) !important;
  }
  .weather-tooltip .wtip-row   { color: #fff; }
  .weather-tooltip .wtip-time  { color: rgba(238,228,212,.65); }
  .weather-tooltip .wtip-icon  { filter: invert(1); }
  .weather-tooltip .wtip-precip { background: rgba(64,156,255,.18); color: #4d9eff; }
}
.weather-widget[data-tip-open] .weather-tooltip { display: flex; }
.wtip-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--label);
}
.wtip-time { color: var(--label2); min-width: 38px; }
.wtip-icon { opacity: .6; flex-shrink: 0; }
.wtip-temp { font-weight: 600; }
.wtip-precip {
  font-size: .7rem;
  color: #007AFF;
  background: rgba(0,122,255,.1);
  padding: 1px 4px;
  border-radius: 4px;
}
html.dark .wtip-icon { filter: invert(1); }
html.dark .wtip-precip { background: rgba(64,156,255,.15); color: #4d9eff; }
/* Mobile: sits on the page-header row, right-aligned */
.mob-weather {
  margin-bottom: 0;
  flex-shrink: 0;
  background: none;
  padding: 0;
}
@media (min-width: 769px) {
  .mob-weather { display: none !important; }
  /* Mobile-only bottom sheets: hide entirely on desktop. They sit fixed at
     bottom:0 with transform:translateY(100%), and their box-shadow rises into
     the viewport creating a faint gradient strip at the bottom of the page. */
  #search-overlay, #search-sheet-backdrop,
  #status-sheet,   #status-sheet-backdrop,
  #filter-sheet,   #filter-sheet-backdrop { display: none !important; }
}
html.dark .weather-widget .weather-rain { background: rgba(64,156,255,.15); color: #4d9eff; }

/* ── Sidebar search ── */
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
input[type="search"]::-webkit-search-decoration     { -webkit-appearance: none; }

.sidebar-search-wrap { position: relative; }
.sidebar-search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; opacity: .4; pointer-events: none; }
.sidebar-search-wrap .search-input { width: 100%; background: var(--fill2); border-color: transparent; font-size: .8rem; padding: .45rem 1.9rem; }
.sidebar-search-wrap .search-input:focus { background: var(--surface); border-color: rgba(80,65,50,.22); }

@media (prefers-color-scheme: light) {
    .sidebar-search-wrap svg { opacity: .6; }
    .sidebar-search-wrap .search-input { background: rgba(154,142,130,.18); }
    .sidebar-search-wrap .search-input::placeholder { color: rgba(60,40,20,.45); }
}

.search-clear { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; background: transparent; transition: opacity .12s; }
.search-clear:hover { opacity: .6; }
.icon-clear { display: block; width: 14px; height: 14px; flex-shrink: 0; -webkit-mask-image: url("../ui/circle-cross.svg"); mask-image: url("../ui/circle-cross.svg"); -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-position: center; mask-position: center; background-color: var(--label2); }

/* ── Main ── */
/* .main-wrap = column flex container for the (mobile) topbar + .main.
   On desktop the topbar is hidden, .main-wrap simply forwards flex space
   to .main. The whole point of this wrapper is to make the mobile topbar
   in-flow so .main doesn't need a brittle padding-top calc. */
.main-wrap { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.main { flex: 1; padding: 0 2.5rem 2rem; min-width: 0; overflow-y: auto; overflow-x: hidden; position: relative; }

/* ══════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════ */
.page-header { margin-bottom: .20rem; display: flex; flex-direction: column; justify-content: center; height: calc(1.5rem + 40px + 1.5rem); }
.page-header h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.5px; margin-bottom: .2rem; }
.page-header p  { font-size: .9rem; color: var(--label2); }
.count-label    { font-size: .85rem; color: var(--label2); }

/* ══════════════════════════════════════════════════
   SEARCH INPUT
   ══════════════════════════════════════════════════ */
.search-input { width: 100%; padding: .52rem .75rem .52rem 2rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--label); font-size: .875rem; font-family: inherit; outline: none; transition: border-color .15s; }
.search-input:focus { border-color: rgba(80,65,50,.35); }

/* ══════════════════════════════════════════════════
   CARDS GRID
   ══════════════════════════════════════════════════ */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

.elem-card {
    position: relative;
    background: var(--surface); border-radius: var(--r-card);
    box-shadow: var(--shadow);
    display: flex; flex-direction: column;
    transition: transform .15s, box-shadow .15s, opacity .25s;
    border: 1px solid var(--border); cursor: pointer;
    transform: translateZ(0); will-change: transform;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    min-width: 0; max-width: 100%;
}
.elem-card > .card-img { border-radius: var(--r-card) var(--r-card) 0 0; overflow: hidden; }
.elem-card:hover  { transform: translateY(-5px) translateZ(0); box-shadow: 0 12px 36px rgba(40,28,15,.26), 0 4px 10px rgba(60,40,20,.16); z-index: 10; }
.elem-card:has(.act-btn[data-st]:hover),
.elem-card:has(.act-btn.tt-show) { z-index: 10; }
.elem-card::after  { content: ''; position: absolute; bottom: -1rem; left: 0; right: 0; height: 1rem; }
.elem-card::before { content: ''; position: absolute; top: -5px; left: 0; right: 0; height: 5px; }
.elem-card.dimmed { opacity: .3; }

.card-img { position: relative; height: 172px; overflow: hidden; flex-shrink: 0; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .3s; opacity: 0; will-change: transform; -webkit-user-drag: none; user-select: none; }
.card-img img.loaded { opacity: 1; }
/* If the image is rendered already-loaded (cached re-render path), skip the
   opacity transition entirely — kills the residual flicker on every
   re-render even when the cached pixels are decoded synchronously. */
.card-img img[src].loaded { transition: none; }
.card-img-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.card-img-ph svg { width: 32px; height: 32px; opacity: .25; color: white; }
html.dark .card-img, html.dark .detail-img { background-color: #1C1814 !important; }

.badges-tl { position: absolute; bottom: .85rem; left: .85rem; right: 110px; display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 4px; }
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; height: 22px; border-radius: 99px; font-size: .68rem; font-weight: 700; color: white; white-space: nowrap; }
.badge-lastdays { background: var(--danger); }
.badge-event    { background: var(--purple); }
.badge-upcoming { background: var(--blue); }

.badge-lastdays::before, .badge-event::before, .badge-upcoming::before { content: ''; display: inline-block; width: 10px; height: 10px; flex-shrink: 0; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-position: center; mask-position: center; background-color: white; }
.badge-event::before    { -webkit-mask-image: url("../ui/bolt.svg");           mask-image: url("../ui/bolt.svg"); }
.badge-lastdays::before { -webkit-mask-image: url("../ui/clock.svg");          mask-image: url("../ui/clock.svg"); }
.badge-upcoming::before { -webkit-mask-image: url("../ui/calendar-clock.svg"); mask-image: url("../ui/calendar-clock.svg"); }

.badge-open { position: absolute; bottom: .85rem; right: .85rem; display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; height: 22px; border-radius: 99px; font-size: .68rem; font-weight: 700; white-space: nowrap; background: white; border: none; cursor: pointer; }

.pulse-dot { width: 7px; height: 7px; border-radius: 50%; position: relative; flex-shrink: 0; }
.pulse-dot::before { content: ''; position: absolute; inset: -3px; border-radius: 50%; background: inherit; opacity: .4; animation: pulse 1.5s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .4; } 100% { transform: scale(2.4); opacity: 0; } }

.card-body  { padding: .85rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card-title { font-size: 1rem; font-weight: 700; line-height: 1.3; color: var(--label); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta  { display: flex; align-items: center; gap: 4px; font-size: .82rem; color: var(--label2); overflow: hidden; }
.card-meta svg { width: 11px; height: 11px; flex-shrink: 0; opacity: .5; }
.card-venue-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card-desc  { font-size: .82rem; color: var(--label2); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; flex: 0 0 auto; max-height: calc(.82rem * 1.65 * 4); }
/* Card height stays constant by balancing description lines against
   title-wrap (t1/t2) and presence of the date row (d1/d0).
   Baseline: t1 + d1 → 4 lines. */
.elem-card.t1.d0 .card-desc { -webkit-line-clamp: 5; max-height: calc(.82rem * 1.65 * 5); }
.elem-card.t2.d1 .card-desc { -webkit-line-clamp: 3; max-height: calc(.82rem * 1.65 * 3); }
/* t2.d0 keeps the 4-line default. */
.det-editorial { display: flex; flex-direction: column; gap: .35rem; background: #FFD60A; color: #1B1612; border-radius: 10px; padding: .65rem .75rem; }
.det-editorial:not(:has(.det-editorial-text)) { padding: .5rem .65rem; border-radius: 8px; }
.det-editorial-header { display: flex; align-items: center; gap: .35rem; }
.det-editorial-star { display: inline-block; flex-shrink: 0; width: 13px; height: 13px; background-color: #1B1612; -webkit-mask: url('../ui/star-fill.svg') no-repeat center/contain; mask: url('../ui/star-fill.svg') no-repeat center/contain; }
.det-editorial-label { font-size: .82rem; font-weight: 500; letter-spacing: normal; }
.det-editorial-text { font-size: .82rem; font-weight: 400; line-height: 1.55; }
.det-editorial-edit { display: flex; flex-direction: column; gap: .4rem; margin-top: .25rem; }
.det-editorial-input { width: 100%; box-sizing: border-box; font-size: .78rem; font-family: inherit; padding: .45rem .5rem; border: 1.5px solid rgba(60,40,20,.20); border-radius: 7px; background: rgba(248,242,232,.60); color: #1B1612; resize: none; height: 5rem; line-height: 1.5; }
.det-editorial-input:focus { outline: none; border-color: rgba(60,40,20,.45); background: rgba(248,242,232,.85); }
.det-editorial-save-btn { width: 100%; font-size: .78rem; font-family: inherit; font-weight: 600; padding: .45rem; border: none; border-radius: 7px; background: rgba(60,40,20,.16); color: #1B1612; cursor: pointer; }
.det-editorial-save-btn:hover { background: rgba(28,24,20,.30); }

/* ── Selection star badge ── */
@keyframes sel-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.sel-star-badge {
  position: absolute;
  top: .5rem;
  right: .5rem;
  z-index: 3;
  cursor: default;
}
.sel-star-icon {
  display: block;
  width: 18px;
  height: 18px;
  background-color: #FFD60A;
  -webkit-mask: url('../ui/star-fill.svg') no-repeat center/contain;
  mask: url('../ui/star-fill.svg') no-repeat center/contain;
  filter: drop-shadow(0 1px 3px rgba(40,28,15,.40));
  animation: sel-spin 12s linear infinite;
}

.card-actions { display: flex; align-items: center; justify-content: space-between; padding-top: .65rem; margin-top: auto; border-top: 1px solid var(--border); }
.act-left, .act-right { display: flex; gap: 2px; align-items: center; }
.act-btn { width: 36px; height: 36px; border-radius: 10px; background: none; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--label2); transition: background .12s, color .12s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; position: relative; }
.act-btn:hover  { background: var(--fill2); color: var(--label); }
.act-btn svg    { width: 18px; height: 18px; }
/* Guest / logged-out: status buttons are shown but visibly inert. Clicks are
   intercepted by toggleSt() and route to showLogin() to push sign-up. */
body.is-guest .act-btn[data-action="toggleSt"],
body.is-guest .det-act-btn[data-action="toggleSt"] { opacity: .4; }
body.is-guest .act-btn[data-action="toggleSt"]:hover,
body.is-guest .det-act-btn[data-action="toggleSt"]:hover { opacity: .55; }
html.dark .act-btn img { filter: invert(1); }
.act-btn.a-ts   { color: var(--blue); }
.act-btn.a-fav  { color: var(--pink); }
.act-btn.a-seen { color: var(--green); }
.act-btn.a-hid  { color: var(--orange); }
.act-btn.a-ts svg, .act-btn.a-fav svg { fill: currentColor; }
/* Tooltip bulle au-dessus du bouton */
.act-btn[data-st]::before { content: attr(title); position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%) translateY(5px); color: #fff; font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; padding: 4px 8px; border-radius: 6px; pointer-events: none; opacity: 0; transition: opacity .18s, background-color .25s; z-index: 200; background: #000; box-shadow: 0 2px 8px rgba(60,40,20,.20); }
@keyframes tt-in { from { opacity: 0; transform: translateX(-50%) translateY(5px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@media (hover: hover) and (pointer: fine) {
  .act-btn[data-st]:hover::before { animation: tt-in .18s cubic-bezier(.22,.68,0,1.2) forwards; }
}
.act-btn.tt-show::before { animation: tt-in .18s cubic-bezier(.22,.68,0,1.2) forwards; }
.act-btn[data-st="toSee"].tt-show::before    { background: var(--blue); }
.act-btn[data-st="favorite"].tt-show::before { background: var(--pink); }
.act-btn[data-st="seen"].tt-show::before     { background: var(--green); }
.act-btn[data-st="hidden"].tt-show::before   { background: var(--orange); }
body.is-guest .act-btn[data-st]::before { display: none; }
.guest-hint { position: fixed; background: #000; color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; z-index: 99999; pointer-events: none; opacity: 0; transition: opacity .18s; box-shadow: 0 2px 8px rgba(60,40,20,.20); }
@keyframes gh-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.guest-hint.show { animation: gh-in .18s cubic-bezier(.22,.68,0,1.2) forwards; }
.icon-star { display:inline-block; background-color:currentColor; -webkit-mask:url('../ui/star.svg') no-repeat center/contain; mask:url('../ui/star.svg') no-repeat center/contain; flex-shrink:0; }
.act-btn.a-dnm { color: #FFD60A; }
.act-btn.a-dnm .icon-star,
.det-act-btn-dnm.a-dnm .icon-star { -webkit-mask-image:url('../ui/star-fill.svg?v=2'); mask-image:url('../ui/star-fill.svg?v=2'); }

/* ══════════════════════════════════════════════════
   DETAIL MODAL
   ══════════════════════════════════════════════════ */
.modal-close-row { display: flex; justify-content: flex-end; width: 100%; max-width: 440px; flex-shrink: 0; pointer-events: none; }
#modal-detail .modal-close-row { max-width: 560px; }
.modal-close-row .btn { pointer-events: none; background: rgba(248,242,232,.20); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(248,242,232,.28); font-weight: 600; }
.modal-backdrop.open .modal-close-row .btn { pointer-events: auto; }
#modal-detail .modal { padding: 1.5rem; max-width: 560px; max-height: calc(var(--real-vh,100vh) - 5rem - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: none; }
@media (min-width: 769px) {
  #modal-detail .modal { max-height: calc(100vh - 10rem); }
}
.detail-block  { margin-top: 1.25rem; }

.detail-img { border-radius: 0; overflow: hidden; aspect-ratio: 4 / 3; background: #c4c4c8; position: relative; margin: -1.5rem -1.5rem 1rem -1.5rem; }
.detail-img .badges-tl { left: 1.5rem; bottom: 14px; right: auto; }
.detail-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .3s; opacity: 0; -webkit-user-drag: none; user-select: none; }
.detail-img img.loaded { opacity: 1; }
.detail-title    { font-size: 1.05rem; font-weight: 700; letter-spacing: -.3px; line-height: 1.3; margin-bottom: .25rem; }
.detail-title + .detail-block { margin-top: 0; }
.detail-meta-row { display: flex; align-items: flex-start; gap: .45rem; font-size: .82rem; color: var(--label2); margin-bottom: .3rem; }
.detail-meta-row svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 3px; opacity: .5; }
.detail-meta-venue { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.detail-desc     { font-size: 15px; color: var(--label); line-height: 1.55; white-space: pre-line; }

.hours-status-row { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 500; margin-bottom: .75rem; padding: .5rem .65rem; border-radius: 8px; background: var(--fill2); }
.hours-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.hours-list { display: flex; flex-direction: column; }
.hours-row  { display: flex; justify-content: space-between; padding: .45rem 0; font-size: .82rem; color: var(--label2); border-bottom: 1px solid var(--border); }
.hours-row:last-child { border-bottom: none; }
.hours-row.today { color: var(--label); font-weight: 600; }

.detail-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 0; }
.det-act-btn { flex: 1; min-width: 70px; min-height: 30px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 4px; padding: .35rem .4rem; border-radius: 8px; border: none; cursor: pointer; font-size: .75rem; font-weight: 600; line-height: 1; font-family: inherit; background: var(--fill2); color: var(--label2); transition: all .12s; text-decoration: none; }
.det-act-btn:hover      { background: var(--fill); color: var(--label); }
.det-act-btn svg        { width: 12px; height: 12px; }
.det-act-btn.a-ts       { background: var(--blue);   color: #fff; }
.det-act-btn.a-fav      { background: var(--pink);   color: #fff; }
.det-act-btn.a-seen     { background: var(--green);  color: #fff; }
.det-act-btn.a-hid      { background: var(--orange); color: #fff; }
.det-act-btn.a-ts svg, .det-act-btn.a-fav svg { fill: currentColor; }
.det-act-btn.a-seen svg, .det-act-btn.a-hid svg { fill: none; stroke: currentColor; }
.det-act-btn-dnm.a-dnm { background: #FFD60A; color: #000; }
.det-act-btn-dnm { width: 100%; margin-top: 0; }

/* ══════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════ */
.modal-backdrop { display: none; position: fixed; inset: 0; z-index: 200; background: rgba(28,24,20,.65); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); align-items: center; justify-content: center; flex-direction: column; gap: .75rem; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: 16px; padding: 1.5rem; width: 100%; max-width: 440px; box-shadow: var(--shadow-modal); animation: modal-in .22s cubic-bezier(.32,.72,0,1); }
@keyframes modal-in { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .52rem 1rem; border-radius: 10px; border: none; font-size: .875rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: opacity .12s, background .12s; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary                      { background: var(--label); color: var(--surface); }
.btn-primary:hover:not(:disabled) { opacity: .85; }
.btn-ghost                        { background: var(--fill2); color: var(--label2); -webkit-tap-highlight-color: transparent; }
.btn-ghost:hover:not(:disabled),
.btn-ghost:active:not(:disabled)  { background: var(--fill);  color: var(--label); }
.btn-sm   { padding: .38rem .75rem; font-size: .8rem; }
.btn-full { width: 100%; padding: .75rem; margin-top: .5rem; }
.btn-danger                      { color: var(--danger); background: rgba(255,59,48,.08); }
.btn-danger:hover:not(:disabled) { background: rgba(255,59,48,.14); }

/* ══════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: .3rem; padding: .65rem 0; }
.field label  { font-size: .78rem; font-weight: 600; color: var(--label2); }
.field input  { background: var(--fill2); border: 1px solid var(--border); border-radius: 10px; padding: .55rem .75rem; font-size: .875rem; font-family: inherit; color: var(--label); outline: none; transition: border-color .15s, background .15s; }
.field input:focus   { border-color: rgba(80,65,50,.35); background: var(--surface); }
.field input.valid   { border-color: var(--green); }
.field input.invalid { border-color: var(--danger); }
.field-hint  { font-size: .72rem; color: var(--label3); }
.field-avail { font-size: .72rem; display: flex; align-items: center; gap: 4px; }

.flash { padding: .7rem 1rem; border-radius: 10px; font-size: .875rem; font-weight: 500; margin-bottom: 1rem; }
.flash.error   { background: rgba(255,59,48,.1);  color: var(--danger); }
.flash.success { background: rgba(52,199,89,.12); color: #1a7a34; }

/* ══════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════ */
#login-screen { position: fixed; inset: 0; z-index: 500; background: var(--bg); display: none; align-items: flex-start; justify-content: center; padding: 1.5rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#login-screen.open { display: flex; }
/* Cached / guest visitors: suppress the default login-screen flash during the
   parse → JS-ready window. The flag is set by boot.js in <head> and removed
   by app.js once initial state has been reconciled. */
html.booted-in #login-screen.open { display: none; }
.login-box { background: var(--surface); border-radius: 16px; padding: 2.25rem 2rem; width: 100%; max-width: 360px; box-shadow: var(--shadow-modal); overflow: visible; margin: auto; }
.login-sub { font-size: .875rem; color: var(--label2); margin-bottom: 1.75rem; }

/* ══════════════════════════════════════════════════
   EMPTY / SPINNER
   ══════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--label2); grid-column: 1/-1; }
.empty-icon  { font-size: 2.2rem; margin-bottom: .65rem; }
.empty-icon img { width: 56px; height: 56px; opacity: .35; }
html.dark .empty-icon img { filter: invert(1); }

.spinner-wrap { display: flex; align-items: center; justify-content: center; padding: 4rem; grid-column: 1/-1; }
.spinner { width: 26px; height: 26px; border: 2.5px solid var(--border); border-top-color: var(--label); border-radius: 50%; animation: spin .65s linear infinite; }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ══════════════════════════════════════════════════
   USER AREA
   ══════════════════════════════════════════════════ */
.user-area { display: flex; flex-direction: column; gap: .35rem; }
.user-area-guest { flex-direction: row; align-items: stretch; gap: .35rem; }
.user-area-guest .btn { flex: 1; justify-content: center; height: 32px; padding: 0 .75rem; }
.user-area-guest .icon-btn { width: 32px; height: 32px; flex-shrink: 0; background: var(--fill2); color: var(--label2); }
.user-area-guest .icon-btn:hover { background: var(--fill); color: var(--label); }
.user-info-card { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; background: var(--fill2); border-radius: 12px; }
.user-avatar { display: none; }
.user-name  { font-weight: 700; font-size: .875rem; color: var(--label); }
.user-email { font-size: .72rem; color: var(--label2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: none; background: var(--fill); color: var(--label2); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover        { background: var(--fill2); color: var(--label); }
.icon-btn-danger:hover { background: rgba(255,59,48,.12); color: var(--danger); }

/* ══════════════════════════════════════════════════
   SETTINGS POPOVER
   ══════════════════════════════════════════════════ */

.settings-section { padding: .9rem 0; }
.settings-section:last-child { padding-bottom: 0; }
.settings-label { font-size: .75rem; font-weight: 600; color: var(--label2); text-transform: uppercase; letter-spacing: .04em; }
.settings-danger-zone { margin-top: .25rem; }

.main.map-active { overflow: hidden; }

/* ══════════════════════════════════════════════════
   RESPONSIVE — ≤768px
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .user-avatar { display: flex; }

    .layout { height: 100dvh; }
    /* .main is the scrollable area below the in-flow topbar. No more calc on
       padding-top — the topbar takes its own space via flex layout, so iOS
       PWA can't drift between the two during async env() resolution. */
    .main { padding: 10px 1rem calc(50px + min(env(safe-area-inset-bottom, 0px), 40px) + 5.5rem); width: 100%; box-sizing: border-box; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; }
    .page-header { margin-bottom: .75rem; height: auto; padding-top: .4rem; }
    .page-header h1 { font-size: 1.3rem; margin-bottom: 0; }
    .page-header p { font-size: .82rem; }
    .cards-grid { grid-template-columns: 1fr; gap: .75rem; max-width: 100%; }
    .elem-card:hover { transform: translateZ(0); box-shadow: var(--shadow); }

    /* Mobile-specific modal max-height: account for topbar + bottombar */
    #modal-detail .modal { max-height: calc(var(--real-vh,100vh) - var(--topbar-h) - var(--bottombar-h) - 4rem - env(safe-area-inset-bottom,0px)); }

    .modal-backdrop { justify-content: flex-start !important; padding: calc(2rem + env(safe-area-inset-top, 0px)) 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px)) !important; z-index: 450 !important; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    #modal-settings .modal { max-height: calc(var(--real-vh,100vh) - 5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .detail-actions { display: grid !important; grid-template-columns: 1fr 1fr; }
    .detail-actions:has(> :nth-child(3):last-child) { display: flex !important; }



    /* Map / search sheet open: hide bottombar, show close button in topbar */
    body.map-open .mob-bottombar { display: none !important; }
    body.map-open .mob-topbar-map-close { display: flex !important; }
    body.map-open .mob-account-btn { display: none !important; }
    body.map-open #weather-mobile { display: none !important; }
}



/* ══════════════════════════════════════════════════
   TOP BAR mobile
   ══════════════════════════════════════════════════ */
.mob-topbar { display: none; }

@media (max-width: 768px) {
    /* In-flow (flex child of .main-wrap). No position:fixed → no padding-top
       calc on .main → iOS PWA can't drift between topbar height and main
       padding during async env() resolution. */
    /* In-flow flex child of .main-wrap. padding-top clears the iOS status
       bar (env on Safari, clamped floor in PWA standalone — see below). */
    .mob-topbar { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; height: var(--topbar-h); padding-top: env(safe-area-inset-top, 0px); z-index: 370; background: rgba(18,15,12,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding-left: 1rem; padding-right: 1rem; box-shadow: 0 2px 12px rgba(40,28,15,.30); box-sizing: content-box; }
    /* PWA standalone: floor padding-top at 47px because iOS returns env=0
       for the first paint frame on cold launch — without the floor the
       GROOM logo would appear behind the Dynamic Island for 1 frame then
       snap down. Clamped at 60px for safety. */
    @media (display-mode: standalone) {
      .mob-topbar { padding-top: clamp(47px, env(safe-area-inset-top, 0px), 60px); }
    }
    .mob-topbar .mob-logo-long { color: #fff; }
    .mob-topbar-logo { display: flex; align-items: center; background: transparent; border: none; padding: .25rem .5rem; margin-left: -.5rem; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
    .mob-account-btn { width: 30px; height: 30px; border-radius: 50%; background: rgba(248,242,232,.18); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: rgba(248,242,232,.85); font-size: .8rem; font-weight: 700; transition: background .12s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
    .mob-account-btn:hover { background: rgba(248,242,232,.24); }
    .mob-account-btn svg { width: 16px; height: 16px; }
    .mob-account-btn span { color: rgba(248,242,232,.95) !important; }
    .mob-topbar-map-close { color: #fff !important; }
    /* Topbar: always uses the "dark mode" look, regardless of system theme */
    .mob-topbar .weather-widget,
    .mob-topbar .weather-widget .weather-temp { color: rgba(248,242,232,.85) !important; }
    .mob-topbar .weather-widget .weather-icon img { filter: invert(1) !important; opacity: .85; }
    .mob-topbar .weather-widget .weather-rain { background: rgba(64,156,255,.18) !important; color: #4d9eff !important; }
    .mob-topbar .weather-widget .weather-rain.no-rain { background: transparent !important; color: rgba(248,242,232,.55) !important; }
}

/* ══════════════════════════════════════════════════
   BOTTOM BAR mobile
   ══════════════════════════════════════════════════ */
.mob-bottombar { display: none !important; }

@media (max-width: 768px) {
    /* Single pill */
    .mob-bottombar { display: flex !important; align-items: center; justify-content: space-around; position: fixed; bottom: calc(min(env(safe-area-inset-bottom, 0px), 40px) + 1.5rem); left: 50%; transform: translateX(-50%); width: auto; min-width: 260px; z-index: 350; background: rgba(18,15,12,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 99px; box-shadow: 0 8px 32px rgba(40,28,15,.35); padding: 0 .65rem; height: 66px; gap: 0; }

    .mob-bar-btn { flex-shrink: 0; position: relative; display: flex; align-items: center; justify-content: center; width: 60px; height: 52px; border-radius: 99px; border: none; background: transparent; color: rgba(248,242,232,.78); cursor: pointer; transition: color .15s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; padding: 0; overflow: visible; }
    .mob-bar-btn > svg    { width: 21px; height: 21px; flex-shrink: 0; position: relative; top: -2px; z-index: 1; transition: opacity .15s, transform .2s cubic-bezier(.32,.72,0,1); }
    #mob-filter-btn > svg, #mob-burger-btn > svg { width: 24px; height: 24px; }
    .mob-bar-btn:active { opacity: .6; }
    .mob-bar-btn.active { color: #fff; }
    .mob-bar-btn.sheet-open { color: #fff; }

    .mob-bar-cross { position: absolute; top: calc(50% - 2px); left: 50%; transform: translate(-50%, -50%) rotate(-45deg) scale(.7); opacity: 0; transition: opacity .15s, transform .2s cubic-bezier(.32,.72,0,1); pointer-events: none; width: 21px; height: 21px; display: flex; align-items: center; justify-content: center; }
    .mob-bar-cross svg { width: 21px; height: 21px; stroke: #fff; transition: none; transform: none; opacity: 1; }

    .mob-bar-btn.sheet-open > svg { opacity: 0; transform: rotate(45deg) scale(.7); }
    .mob-bar-btn.sheet-open .mob-bar-cross { opacity: 1; transform: translate(-50%, -50%) rotate(0deg) scale(1); }
    #mob-map-btn.active > svg         { opacity: 0; transform: rotate(45deg) scale(.7); }
    #mob-map-btn.active .mob-bar-cross { opacity: 1; transform: translate(-50%, -50%) rotate(0deg) scale(1); }

    .mob-filter-count { display: none; position: absolute; top: 2px; right: 4px; background: var(--danger); color: #fff; font-size: .6rem; font-weight: 800; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 99px; line-height: 15px; text-align: center; pointer-events: none; }
    #mob-filter-btn.active .mob-filter-count { display: block; }
}

/* ══════════════════════════════════════════════════
   SEARCH SHEET mobile
   ══════════════════════════════════════════════════ */
#search-sheet-backdrop { display: none; position: fixed; inset: 0; z-index: 300; background: rgba(28,24,20,.30); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
#search-sheet-backdrop.open { display: block; }

#search-overlay { position: fixed; left: 0; right: 0; bottom: 0; height: 75dvh; z-index: 310; background: var(--bg); border-radius: 16px 16px 0 0; border-top: 1px solid var(--border); transform: translateY(100%); transition: transform .32s cubic-bezier(.32,.72,0,1); box-shadow: 0 -4px 32px rgba(60,40,20,.12); display: flex; flex-direction: column; overflow: hidden; }
#search-overlay.open { transform: translateY(0); }

.search-sheet-input-row { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); flex-shrink: 0; min-height: 60px; }
.search-sheet-input-row svg { flex-shrink: 0; width: 17px; height: 17px; opacity: .45; }
.search-sheet-input-row .search-input { flex: 1; min-width: 0; background: transparent; border: none; font-size: 17px; color: var(--label); outline: none; padding: 0; }
.search-sheet-input-row .mob-search-clear { position: static; transform: none; flex-shrink: 0; background: transparent; border: none; width: 30px; height: 30px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }

.so-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 1rem; }
.so-empty  { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 4rem 2rem; text-align: center; color: var(--label2); font-size: .9rem; }
.so-empty .empty-icon { font-size: 2.5rem; }




/* ══════════════════════════════════════════════════
   STATUS BOTTOM SHEET
   ══════════════════════════════════════════════════ */
#status-sheet-backdrop { display: none; position: fixed; inset: 0; z-index: 300; background: rgba(28,24,20,.30); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
#status-sheet-backdrop.open { display: block; }
#status-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 310; background: var(--surface2); border-radius: 16px 16px 0 0; border-top: 1px solid var(--border); padding: 0 1rem calc(env(safe-area-inset-bottom,0px) + 7rem) 1rem; transform: translateY(100%); transition: transform .32s cubic-bezier(.32,.72,0,1); box-shadow: 0 -4px 32px rgba(60,40,20,.12); }
#status-sheet.open { transform: translateY(0); }
@media (prefers-color-scheme: light) { #status-sheet { background: #E8E2D9; } }

/* ══════════════════════════════════════════════════
   FILTER BOTTOM SHEET
   ══════════════════════════════════════════════════ */
#filter-sheet-backdrop { display: none; position: fixed; inset: 0; z-index: 300; background: rgba(28,24,20,.30); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: opacity .32s cubic-bezier(.32,.72,0,1); }
#filter-sheet-backdrop.open { display: block; }

#filter-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 310; background: var(--surface2); border-radius: 16px 16px 0 0; border-top: 1px solid var(--border); padding: 0 1rem calc(env(safe-area-inset-bottom,0px) + 7rem) 1rem; transform: translateY(100%); transition: transform .32s cubic-bezier(.32,.72,0,1); box-shadow: 0 -4px 32px rgba(60,40,20,.12); }
#filter-sheet.open { transform: translateY(0); }

@media (prefers-color-scheme: light) { #filter-sheet { background: #E8E2D9; } }


.sheet-filters { display: flex; flex-direction: column; gap: .5rem; padding-top: .85rem; }

.sheet-filter-row { display: flex; align-items: center; gap: .65rem; padding: .6rem .9rem; border-radius: 12px; background: rgba(154,142,130,.08); border: 1.75px solid transparent; -webkit-tap-highlight-color: transparent; transition: background .15s, border-color .15s; cursor: pointer; width: 100%; font-family: inherit; text-align: left; }
.sheet-filter-row:focus    { outline: none; }
.sheet-filter-row:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[role="dialog"]:focus { outline: none; }
.sheet-filter-row:active   { background: rgba(154,142,130,.22); }
.sheet-filter-row.on       { background: rgba(154,142,130,.08); border-color: var(--border); }
.sheet-filter-row.disabled { opacity: .35; pointer-events: none; }

@media (prefers-color-scheme: light) {
    .sheet-filter-row:not(.on) { background: rgba(154,142,130,.16); border-color: transparent; }
    .sheet-filter-row.on       { background: transparent; border-color: rgba(60,40,20,.85); }
}
html.dark .sheet-filter-row { background: rgba(154,142,130,.18); }
html.dark .sheet-filter-row.on { background: transparent; border-color: rgba(248,242,232,.65); }

.sheet-filter-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sheet-filter-icon svg { width: 17px; height: 17px; stroke: var(--label2); fill: none; stroke-width: 2; }
.sheet-filter-icon .icon-star { color: var(--label2); }
.sheet-filter-label { flex: 1; font-size: .95rem; font-weight: 500; color: var(--label); line-height: 1.2; }
.sheet-filter-check { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.sheet-filter-check svg { width: 16px; height: 16px; stroke: var(--label); fill: none; stroke-width: 2.5; }
.sheet-filter-row.on .sheet-filter-check { opacity: 1; }

/* ══════════════════════════════════════════════════
   Mobile sheets: permanent "dark mode" look
   ══════════════════════════════════════════════════ */
#status-sheet, #filter-sheet, #search-overlay { background: #1C1814 !important; border-top-color: rgba(240,228,212,.12) !important; }
#search-overlay .search-sheet-input-row {
  /* Floating bubble pinned at the top of the panel. Cards in .so-scroll
     pass underneath. Radius matches the panel's top corners. */
  position: absolute;
  top: calc(1rem + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem - 15px);
  max-width: 405px;
  height: 52px;
  min-height: 0;
  margin: 0;
  padding: 0 1.1rem;
  background: rgba(154,142,130,.34);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: none;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(40,28,15,.35);
  z-index: 5;
}
#search-overlay .search-input { color: #fff !important; caret-color: #fff; }
#search-overlay .search-input::placeholder { color: rgba(248,242,232,.45); }
#search-overlay .so-empty { color: rgba(238,228,212,.78); }
#search-overlay .so-scroll {
  /* Leave room for the floating bubble at top + the floating bottombar at bottom. */
  padding-top: 6.2rem;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 7rem);
}
/* Top fade: cards disappear behind an opaque-to-transparent gradient before
   they reach the panel's top edge, sitting visually behind the floating bubble.
   Mobile only — on desktop the search overlay has no floating bubble to hide behind. */
@media (max-width: 768px) {
  #search-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6.2rem;
    background: linear-gradient(to bottom, #1C1814 55%, rgba(28,24,20,0) 100%);
    pointer-events: none;
    z-index: 3;
  }
}
#search-overlay .search-sheet-input-row svg { stroke: #fff; opacity: .85; }
#search-overlay .icon-clear { background-color: #fff !important; }
#search-overlay .so-empty img { filter: invert(1); }
#status-sheet .sheet-filter-row,
#filter-sheet .sheet-filter-row { background: rgba(154,142,130,.18); border-color: transparent; }
#status-sheet .sheet-filter-row.on,
#filter-sheet .sheet-filter-row.on { background: transparent; border-color: rgba(248,242,232,.65); }
#status-sheet .sheet-filter-icon svg,
#filter-sheet .sheet-filter-icon svg { stroke: rgba(238,228,212,.78); }
#status-sheet .sheet-filter-icon .icon-star,
#filter-sheet .sheet-filter-icon .icon-star { color: rgba(238,228,212,.78); }
#status-sheet .sheet-filter-label,
#filter-sheet .sheet-filter-label { color: #fff; }
#status-sheet .sheet-filter-check svg,
#filter-sheet .sheet-filter-check svg { stroke: #fff; }
#status-sheet .sheet-handle,
#filter-sheet .sheet-handle,
#search-overlay .sheet-handle { background: rgba(248,242,232,.32) !important; }

/* ── Utility classes (replace inline JS styles) ────────────────────────── */
.det-act-btn-hide  { width: 100%; margin-top: 0; margin-bottom: 0; }
.btn-field-action     { margin-top: .5rem; }
.btn-danger           { color: var(--danger); }
.btn-full-center      { width: 100%; justify-content: center; }
.field-mt             { margin-top: .35rem; }
.flash-mb             { margin-bottom: 1rem; }
.sidebar-user-info    { flex: 1; min-width: 0; }
.sidebar-user-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.link-blue            { color: var(--blue); }
.avail-ok             { color: var(--green); }
.avail-ko             { color: var(--danger); }

/* ── Anti-zoom iOS mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  input, textarea, select { font-size: 16px !important; }
  a, button, [role="button"], label, select, input, textarea { touch-action: manipulation; }
}

/* ══════════════════════════════════════════════════
   SHARE POPOVER
   ══════════════════════════════════════════════════ */
/* "Lien copié" feedback — invert palette (label bg + surface text) so it
   stays high-contrast in both themes without leaving the warm taupe palette. */
.btn-copied {
  background: var(--label) !important;
  color: var(--surface) !important;
}
.btn-copied svg { stroke: var(--surface); fill: none; }

.share-popover {
  position: absolute;
  z-index: 900;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  padding: .75rem;
  width: 300px;
  animation: modal-in .15s cubic-bezier(.32,.72,0,1);
}
.share-popover-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--label3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .5rem;
}
.share-popover-row {
  display: flex;
  gap: .4rem;
  align-items: center;
}
.share-popover-input {
  flex: 1;
  min-width: 0;
  background: var(--fill2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .38rem .6rem;
  font-size: .78rem;
  font-family: inherit;
  color: var(--label2);
  outline: none;
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-popover-copy {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
  padding: .38rem .7rem;
  border-radius: 8px;
  border: none;
  background: var(--label);
  color: var(--surface);
  font-size: .8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .12s;
  white-space: nowrap;
}
.share-popover-copy svg { width: 13px; height: 13px; flex-shrink: 0; stroke: var(--surface); }
.share-popover-copy:hover { opacity: .85; }
.share-popover-copy.copied { background: #fff; color: #1B1612; }

/* ── Place badge (category) ── */
.badge-place {
  background: var(--brand);
  color: #fff;
}

/* Exhibitions icon — uses ui/exhibitions.svg as a mask so currentColor applies. */
.icon-exhibitions {
  display: inline-block;
  background-color: currentColor;
  -webkit-mask: url('../ui/exhibitions.svg') no-repeat center/contain;
          mask: url('../ui/exhibitions.svg') no-repeat center/contain;
  flex-shrink: 0;
}
.nav-icon.icon-exhibitions { width: 16px; height: 16px; }
.sheet-filter-icon .icon-exhibitions { width: 17px; height: 17px; color: var(--label2); }
#status-sheet .sheet-filter-icon .icon-exhibitions { color: rgba(238,228,212,.78); }


/* Theme cycle button tooltip — same look as status pill, brand-coloured. */
#theme-toggle-btn, #mob-theme-toggle-btn { position: relative; }
#theme-toggle-btn::before,
#mob-theme-toggle-btn::before {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  z-index: 200;
  background: #15140f;
  box-shadow: 0 2px 8px rgba(60,40,20,.20);
}
#theme-toggle-btn.tt-show::before,
#mob-theme-toggle-btn.tt-show::before {
  animation: tt-in .18s cubic-bezier(.22,.68,0,1.2) forwards;
}
/* Hide the mobile theme toggle when the map overlay is fullscreen
   (same rule as #mob-account-btn). */
body.map-open #mob-theme-toggle-btn { display: none !important; }

/* ── Detail gallery (places with multiple images) ── */
.detail-gallery { border-radius: 0; overflow: hidden; aspect-ratio: 4 / 3; background: #c4c4c8; position: relative; margin: -1.5rem -1.5rem 1rem -1.5rem; }
.detail-gallery-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* Tell the browser to keep horizontal pan here even inside a
       vertically-scrolling modal — fixes hijacked swipes on iOS. */
    touch-action: pan-x;
    overscroll-behavior-x: contain;
}
.detail-gallery-track::-webkit-scrollbar { display: none; }
.detail-gallery-track img {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    scroll-snap-align: start;
    -webkit-user-drag: none;
    user-select: none;
}
/* Minimal pill-shaped indicator: small dot per image, active is wider.
   Tightly clustered & centered — never grabs attention away from the photo. */
/* Numbered circles, finger-friendly hit-target. */
.detail-gallery-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}
.detail-gallery-dots .dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: rgba(0,0,0,.45);
    color: rgba(255,255,255,.9);
    font: 600 12px/26px -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    text-align: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    transition: background .2s, color .2s, transform .12s;
    -webkit-tap-highlight-color: transparent;
}
.detail-gallery-dots .dot:active { transform: scale(.92); }
.detail-gallery-dots .dot.active { background: #fff; color: #15140f; }
.detail-gallery .badges-tl { left: 1.5rem; bottom: 22px; right: auto; }

/* Desktop: just the rotating icon docked next to the GROOM logo, no pill, no
   slide — pure fade-in / fade-out in place. */
@media (min-width: 769px) {
  #groom-spinner {
    top: 33px !important;
    left: auto !important;
    right: calc(100vw - 248px + 16px) !important;
    transform: none !important;
    width: 20px !important;
    height: 20px !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: opacity .25s ease !important;
  }
  #groom-spinner svg { width: 20px !important; height: 20px !important; }
}
