/* Tralee Bay Coastal Parks — Direction 1a "Classic". Shared tokens + public map. */
:root {
  --accent: #8a6d2f;
  --ink: #2b2720;
  --ink-2: #312c23;
  --ink-3: #3a352b;
  --muted: #6f6a5d;
  --muted-2: #8a8474;
  --muted-3: #9a9484;
  --muted-4: #a79f8f;
  --sidebar: #faf7f1;
  --panel: #ffffff;
  --well: #f2ece0;
  --water: #eeece6;
  --line: #e9e2d4;
  --line-2: #efe8db;
  --line-3: #e7e1d5;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --ui: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --sh-control: 0 6px 16px -6px rgba(40, 30, 15, 0.3);
  --sh-row: 0 1px 3px rgba(45, 35, 20, 0.07);
  --sh-card: 0 18px 40px -12px rgba(40, 30, 15, 0.5);
  --sh-pin: 0 4px 9px rgba(38, 30, 20, 0.34);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; font-family: var(--ui); color: var(--ink-3); background: var(--sidebar); }
button, input { font-family: inherit; }

/* ---------------- App shell ---------------- */
.app { display: grid; grid-template-columns: 340px 1fr; height: 100vh; overflow: hidden; }

/* ---------------- Sidebar rail ---------------- */
.rail { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }

.rail-head { display: flex; align-items: center; gap: 13px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line-2); }
.rail-logo { width: 50px; height: 50px; flex: none; border-radius: 50%; object-fit: contain; }
.rail-name { font-family: var(--display); font-weight: 700; font-size: 15.5px; line-height: 1.02; color: var(--ink-3); }
.rail-sub { font-weight: 600; font-size: 9.5px; letter-spacing: 1.6px; color: var(--accent); margin-top: 3px; }

.rail-search { padding: 16px 20px 6px; }
.rail-search { position: relative; }
.rail-search svg { position: absolute; left: 33px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; fill: none; stroke: #a29a8a; stroke-width: 2; stroke-linecap: round; }
.rail-search input { width: 100%; height: 44px; background: #fff; border: 1px solid var(--line-3); border-radius: 12px; padding: 0 13px 0 34px; font-weight: 500; font-size: 13.5px; color: var(--ink-3); outline: none; }
.rail-search input::placeholder { color: #a49d8f; }
.rail-search input:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-3)); }

.rail-filterhead { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 8px; }
.rail-filterhead span { font-weight: 700; font-size: 10.5px; letter-spacing: 1.4px; color: var(--muted-4); }
#reset { border: none; background: none; font-weight: 600; font-size: 11.5px; color: var(--accent); cursor: pointer; padding: 0; }

.rail-filters { flex: 1; min-height: 0; overflow: auto; padding: 2px 12px 12px; display: flex; flex-direction: column; gap: 2px; }

.filt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: none; border-radius: 11px; cursor: pointer; background: #fff; box-shadow: var(--sh-row); text-align: left; transition: background .18s, box-shadow .18s, opacity .18s; }
.filt.off { background: transparent; box-shadow: none; }
.filt-sw { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--c); border: 1.5px solid var(--c); transition: .18s; }
.filt.off .filt-sw { background: var(--well); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.filt-sw svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.filt.off .filt-sw svg { stroke: var(--c); }
.filt-sw i { font-size: 15px; color: #fff; }
.filt.off .filt-sw i { color: var(--c); }
.filt-label { flex: 1; font-weight: 600; font-size: 13.5px; color: var(--ink-3); }
.filt.off .filt-label { color: var(--muted-3); }
.filt-count { font-weight: 600; font-size: 11px; padding: 2px 8px; border-radius: 999px; color: color-mix(in srgb, var(--c) 90%, black); background: color-mix(in srgb, var(--c) 13%, transparent); }
.filt.off .filt-count { color: #b6b0a2; background: var(--well); }
.filt-vis { flex: none; width: 18px; height: 18px; display: grid; place-items: center; color: #8f9683; }
.filt-vis svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.filt .ic-eyeoff { display: none; }
.filt.off .ic-eye { display: none; }
.filt.off .ic-eyeoff { display: block; }
.filt.off .filt-vis { color: var(--muted-4); }
.filt { cursor: pointer; }

/* Expandable unit list under each category */
.filt-group { display: flex; flex-direction: column; }
.filt-caret { flex: none; width: 22px; height: 22px; margin-left: 2px; padding: 0; border: none; background: none; cursor: pointer; color: var(--muted-3); display: grid; place-items: center; border-radius: 6px; }
.filt-caret:hover { background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--ink-3); }
.filt-caret svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s; }
.filt-group.open .filt-caret svg { transform: rotate(90deg); }

.filt-pins { display: none; flex-direction: column; gap: 1px; padding: 2px 4px 8px 42px; }
.filt-group.open .filt-pins { display: flex; }
.filt.off + .filt-pins { opacity: .45; }
.filt-pin { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none; text-align: left; padding: 6px 8px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.filt-pin:hover { background: #fff; color: var(--ink-3); box-shadow: var(--sh-row); }
.fp-name { flex: 1; font-weight: 500; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-target { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; color: color-mix(in srgb, var(--c) 55%, var(--muted-3)); }
.filt-pin:hover .fp-target { background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); }
.fp-target svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.fp-empty { padding: 4px 10px; font-size: 12px; color: var(--muted-3); }

.rail-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-2); }
.foot-dots { display: inline-flex; }
.foot-dots i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.foot-dots i:last-child { margin-left: -3px; }
.rail-foot span:last-child { font-weight: 500; font-size: 11.5px; color: var(--muted-2); }

/* ---------------- Map canvas ---------------- */
.canvas { position: relative; overflow: hidden; background: var(--water); }
#map { position: absolute; inset: 0; }
.leaflet-container { background: var(--water); font: inherit; }

/* Loading overlay */
.tb-loading { position: fixed; inset: 0; z-index: 3000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--sidebar); transition: opacity 0.45s ease; }
.tb-loading.hidden { opacity: 0; pointer-events: none; }
.tb-load-logo { width: 58px; height: 58px; border-radius: 50%; }
.tb-spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--accent) 22%, transparent); border-top-color: var(--accent); animation: tb-spin 0.8s linear infinite; }
@keyframes tb-spin { to { transform: rotate(360deg); } }
.tb-load-text { font-size: 13px; color: var(--muted-2); }

/* Pin name label (shows on hover / tap) */
.leaflet-tooltip.pin-label { background: #fff; color: var(--ink-2); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; font-family: var(--ui); font-weight: 600; font-size: 12px; box-shadow: 0 3px 10px rgba(30, 22, 12, 0.22); white-space: nowrap; pointer-events: none; }
.leaflet-tooltip.pin-label::before { display: none; }

/* Teardrop pin */
.tb-pin-wrap { background: none; border: none; }
.tb-pin { position: relative; width: 34px; height: 42px; transform-origin: 50% 88%; transition: transform .18s ease; }
.tb-pin.sel { transform: scale(1.16); z-index: 5; }
.tb-pin-drop { position: absolute; left: 2px; top: 0; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 2.5px solid #fff; box-shadow: var(--sh-pin); }
.tb-pin.sel .tb-pin-drop { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent), 0 6px 12px rgba(38, 30, 20, 0.4); }
.tb-pin-ic { position: absolute; left: 2px; top: 0; width: 30px; height: 30px; display: grid; place-items: center; }
.tb-pin-ic svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.tb-pin-ic i { color: #fff; font-size: 15px; }

/* Park-jump control */
.parkjump { position: absolute; z-index: 500; top: 16px; right: 16px; display: flex; gap: 2px; padding: 4px; background: rgba(250, 247, 241, 0.92); backdrop-filter: blur(6px); border: 1px solid rgba(60, 50, 35, 0.1); border-radius: 11px; box-shadow: var(--sh-control); }
.parkjump button { border: none; background: transparent; font-weight: 600; font-size: 12px; color: #7a7466; padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.parkjump button.on { background: #fff; color: var(--ink-3); box-shadow: 0 1px 3px rgba(45, 35, 20, 0.18); }

/* Attribution */
.attribution { position: absolute; z-index: 500; left: 14px; bottom: 12px; font-weight: 500; font-size: 10.5px; color: rgba(58, 53, 43, 0.5); }

/* Leaflet zoom control restyle */
.leaflet-control-zoom { border: 1px solid rgba(60, 50, 35, 0.12) !important; border-radius: 11px !important; overflow: hidden; box-shadow: var(--sh-control) !important; }
.leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 40px !important; color: #57513f !important; background: #fff !important; font-size: 20px !important; border: none !important; }
.leaflet-control-zoom a.leaflet-control-zoom-in { border-bottom: 1px solid #eee6d7 !important; }
.leaflet-bar { border: none; }

/* ---------------- Info card (popup) ---------------- */
.tb-popup .leaflet-popup-content-wrapper { background: transparent; box-shadow: none; padding: 0; }
.tb-popup .leaflet-popup-content { margin: 0; width: 304px !important; }
.tb-popup .leaflet-popup-tip { background: #fff; box-shadow: none; width: 15px; height: 15px; }
.leaflet-popup.tb-popup a.leaflet-popup-close-button { top: 10px; right: 10px; width: 30px; height: 30px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: #312c23; font: 500 19px/30px var(--ui); text-align: center; box-shadow: 0 2px 8px rgba(30, 22, 12, 0.3); }
.leaflet-popup.tb-popup a.leaflet-popup-close-button:hover { background: #fff; color: #000; }

.tb-card { width: 304px; background: #fff; border-radius: 15px; overflow: hidden; border: 1px solid rgba(60, 50, 35, 0.08); box-shadow: var(--sh-card); animation: tb-fadeup .24s ease; }
@keyframes tb-fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.tb-card-img { position: relative; height: 152px; background: var(--well); }
.tb-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.tb-shot.on { opacity: 1; }
.tb-shot-empty { display: grid; place-items: center; background: linear-gradient(140deg, color-mix(in srgb, var(--c) 45%, #fff), color-mix(in srgb, var(--c) 78%, #000)); }
.tb-shot-empty svg { width: 42px; height: 42px; fill: none; stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tb-shot-empty i { font-size: 40px; color: rgba(255, 255, 255, 0.9); }
.tb-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: none; border-radius: 50%; background: rgba(30, 26, 20, 0.42); color: #fff; cursor: pointer; display: grid; place-items: center; z-index: 3; padding: 0; }
.tb-arrow:hover { background: rgba(30, 26, 20, 0.62); }
.tb-arrow:active { transform: translateY(-50%) scale(0.92); }
.tb-arrow svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tb-prev { left: 10px; }
.tb-next { right: 10px; }
.tb-dots { position: absolute; left: 12px; bottom: 11px; display: flex; gap: 5px; z-index: 3; }
.tb-dot { width: 6px; height: 6px; padding: 0; border: none; border-radius: 999px; background: rgba(255, 255, 255, 0.55); cursor: pointer; transition: width .2s; }
.tb-dot.on { width: 18px; background: #fff; }
.tb-count { position: absolute; right: 12px; bottom: 10px; font-weight: 600; font-size: 10px; color: #fff; background: rgba(30, 26, 20, 0.42); padding: 2px 7px; border-radius: 6px; }

.tb-card-body { padding: 15px 16px 16px; }
.tb-eyebrow { font-weight: 600; font-size: 11.5px; }
.tb-card-name { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink-2); margin: 3px 0 8px; }
.tb-card-desc { font-weight: 400; font-size: 12.8px; line-height: 1.5; color: var(--muted); margin: 0; }
.tb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.tb-chip { font-weight: 600; font-size: 11px; padding: 5px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 12%, transparent); color: color-mix(in srgb, var(--c) 78%, black); }
.tb-walk { display: flex; align-items: center; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.tb-walk-ic { width: 15px; height: 15px; flex: none; fill: none; stroke: #9a9484; stroke-width: 1.8; }
.tb-walk-t { font-weight: 600; font-size: 12.5px; color: #5a5446; }
.tb-details { margin-left: auto; font-weight: 600; font-size: 12.5px; text-decoration: none; white-space: nowrap; }

/* "Check availability" CTA in the card */
.tb-book { display: block; width: 100%; margin-top: 13px; padding: 11px 14px; border: none; border-radius: 10px; background: var(--c, var(--accent)); color: #fff; font-family: var(--ui); font-weight: 600; font-size: 14px; cursor: pointer; }
.tb-book:hover { filter: brightness(0.94); }
.tb-book:active { transform: translateY(1px); }

/* Booking widget modal */
.book-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.book-modal[hidden] { display: none; }
.book-backdrop { position: absolute; inset: 0; background: rgba(20, 16, 10, 0.45); }
.book-dialog { position: relative; z-index: 1; width: 440px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); background: #fff; border-radius: 16px; overflow: hidden; box-shadow: var(--sh-card); display: flex; flex-direction: column; }
.book-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.book-title { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--ink-2); }
.book-close { flex: none; width: 30px; height: 30px; border: none; border-radius: 50%; background: var(--well); color: var(--ink-3); font-size: 15px; cursor: pointer; }
.book-body { padding: 16px; overflow: auto; -webkit-overflow-scrolling: touch; }
.book-loading { display: grid; place-items: center; min-height: 170px; }
.book-err { font-size: 14px; line-height: 1.5; color: var(--muted); margin: 0; }
.book-err a { color: var(--accent); font-weight: 600; }
@media (max-width: 768px) {
  .book-modal { align-items: flex-end; }
  .book-dialog { width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; max-height: 90vh; padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* ---------------- Collapse (desktop): hide rail → full-screen map ---------------- */
.rail-collapse { margin-left: auto; flex: none; width: 30px; height: 30px; border: none; background: none; border-radius: 8px; cursor: pointer; color: var(--muted-3); display: grid; place-items: center; }
.rail-collapse:hover { background: var(--well); color: var(--ink-3); }
.rail-collapse svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.app.rail-collapsed { grid-template-columns: 0 1fr; }
.rail-collapsed .rail { display: none; }
.rail-open { position: absolute; z-index: 600; top: 16px; left: 16px; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--sh-control); cursor: pointer; display: none; place-items: center; color: var(--ink-3); }
.rail-collapsed .rail-open { display: grid; }
.rail-open svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Mobile-only chrome — hidden on desktop */
.m-top, .fab-filters, .sheet-backdrop, .info-sheet, .sheet-handle { display: none; }

/* ---------------- Mobile: full-bleed map + bottom sheets ("app" feel) ---------------- */
@media (max-width: 768px) {
  .app { display: block; }
  .canvas { position: fixed; inset: 0; }
  .rail-collapse, .rail-open { display: none !important; }
  .leaflet-control-zoom { display: none !important; }
  .attribution { display: none; }

  .m-top { display: flex; align-items: center; position: fixed; z-index: 700; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 12px; background: rgba(250, 247, 241, 0.92); backdrop-filter: blur(8px); border: 1px solid rgba(60, 50, 35, 0.1); border-radius: 999px; padding: 5px; box-shadow: var(--sh-control); }
  .m-logo { width: 34px; height: 34px; border-radius: 50%; flex: none; }
  .m-name { display: none; }

  .parkjump { top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; z-index: 700; }
  .parkjump button { padding: 7px 13px; font-size: 12.5px; }

  .fab-filters { display: inline-flex; align-items: center; gap: 8px; position: fixed; z-index: 700; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 13px 22px; font: inherit; font-weight: 600; font-size: 15px; box-shadow: 0 8px 24px rgba(40, 30, 15, 0.3); cursor: pointer; }
  .fab-filters svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
  .fab-filters:active { transform: translateX(-50%) scale(0.97); }
  body.filters-open .fab-filters, body.info-open .fab-filters { opacity: 0; pointer-events: none; }

  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 1100; background: rgba(20, 16, 10, 0.4); opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
  body.filters-open .sheet-backdrop, body.info-open .sheet-backdrop { opacity: 1; pointer-events: auto; }

  .sheet-handle { display: block; width: 38px; height: 5px; border-radius: 999px; background: var(--line-3); margin: 8px auto 2px; flex: none; }

  /* Filters bottom sheet = the rail */
  .rail { display: flex; position: fixed; z-index: 1200; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: auto; max-height: 86vh; border-right: none; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 44px rgba(30, 22, 12, 0.28); transform: translateY(101%); transition: transform 0.44s cubic-bezier(0.32, 0.72, 0, 1); padding-bottom: env(safe-area-inset-bottom, 0px); overflow: hidden; }
  body.filters-open .rail { transform: translateY(0); }
  .rail-head { border-bottom: 1px solid var(--line-2); }
  .rail-filters { min-height: 0; -webkit-overflow-scrolling: touch; }
  .filt, .filt-pin { min-height: 44px; }

  /* Info bottom sheet */
  .info-sheet { display: block; position: fixed; z-index: 1200; left: 0; right: 0; bottom: 0; background: var(--panel); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 44px rgba(30, 22, 12, 0.28); transform: translateY(101%); transition: transform 0.44s cubic-bezier(0.32, 0.72, 0, 1); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); max-height: 88vh; overflow: auto; -webkit-overflow-scrolling: touch; }
  body.info-open .info-sheet { transform: translateY(0); }
  /* image fills the top of the sheet; grab handle floats over it (no white strip) */
  .info-sheet .sheet-handle { position: absolute; z-index: 6; top: 10px; left: 50%; transform: translateX(-50%); margin: 0; background: rgba(255, 255, 255, 0.8); box-shadow: 0 1px 4px rgba(30, 22, 12, 0.3); }
  .info-body { padding: 0; }
  .info-body .tb-card { width: auto; border: none; box-shadow: none; border-radius: 0; animation: none; }
  .info-body .tb-card-img { height: 220px; border-radius: 0; }
  .sheet-close { position: absolute; z-index: 5; top: 14px; right: 14px; width: 34px; height: 34px; border: none; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: #312c23; font-size: 17px; line-height: 34px; text-align: center; cursor: pointer; box-shadow: 0 2px 10px rgba(30, 22, 12, 0.35); padding: 0; }
  .info-body .tb-card-body { padding: 16px 18px 20px; }
  .info-body .tb-card-name { font-size: 21px; }
  .info-body .tb-card-desc { font-size: 14.5px; }
}
