/* ==========================================================================
   Logos of NYC
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --pill: #292929;
  --pill-hover: #383838;
  --menu: #464646;
  --blue: #0158c1;
  --blue-hover: #1769d4;
  --text: #ffffff;
  --muted: #9a9a9a;
  --track: #636363;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --t-fast: 220ms;
  --t-med: 480ms;
  --t-slow: 720ms;

  --pad-x: 43px;
  --detail-w: 380px;
  --detail-gap: 25px;
  --radius: 15px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Almarai", system-ui, sans-serif;
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
p, h2, ul { margin: 0; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.ms {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  display: inline-block;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
  transition: font-variation-settings var(--t-fast) var(--ease-out), transform var(--t-med) var(--ease-out);
}

.only-mobile { display: none !important; }

/* --------------------------------------------------------------------------
   Pills / buttons
   -------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 45px;
  padding: 0 14px;
  border-radius: 99px;
  background: var(--pill);
  font-size: 15px;
  white-space: nowrap;
  transition:
    background-color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out),
    opacity var(--t-med) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.pill:hover { background: var(--pill-hover); }
.pill:active { transform: scale(.965); }
.pill > span:first-child:not(.ms):not(.swap) { padding-top: 2px; } /* Almarai sits high */
.pill-blue { background: var(--blue); }
.pill-blue:hover { background: var(--blue-hover); }
.pill-round { width: 46px; height: 46px; padding: 0; }

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  transition: background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.icon-btn:hover { background: rgba(255,255,255,.1); }
.icon-btn:active { transform: scale(.92); }

/* Swap: text + icon that animate between two states (view toggle) */
.swap {
  position: relative;
  display: inline-grid;
  overflow: hidden;
  height: 24px;
  align-items: center;
}
.swap-item {
  grid-area: 1 / 1;
  display: inline-block;
  padding-top: 2px;
  transition: transform var(--t-med) var(--ease-out), opacity var(--t-med) var(--ease-out), filter var(--t-med) var(--ease-out);
}
.swap-icon .swap-item { padding-top: 0; }
.view-map  .swap-item[data-view="grid"],
.view-grid .swap-item[data-view="map"] { transform: translateY(110%); opacity: 0; filter: blur(2px); }
.view-grid .swap-item[data-view="grid"] { transform: none; opacity: 1; }
.view-map .swap-item[data-view="map"] { transform: none; opacity: 1; }
.swap-item.leaving { transform: translateY(-110%) !important; opacity: 0 !important; filter: blur(2px); }
.swap-icon .swap-item.leaving { transform: translateY(-110%) rotate(-90deg) scale(.6) !important; }
.view-toggle .swap:first-child { text-align: right; }

/* --------------------------------------------------------------------------
   App layout (desktop)
   -------------------------------------------------------------------------- */
.app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  row-gap: clamp(16px, 2.9vh, 30px);
  padding: clamp(16px, 2.8vh, 29px) var(--pad-x) clamp(20px, 3.6vh, 37px);
}

.top-row {
  display: flex;
  align-items: flex-start;
  min-height: 52px;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 25px; }
.top-row > .pill-blue { margin-top: 9px; }
.brand-logo { width: 78px; height: 49px; }
.tagline { font-size: 21px; line-height: 1.12; padding-top: 3px; }

/* Stage = detail panel + views */
.stage {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 0px minmax(0, 1fr);
  column-gap: 0px;
  transition:
    grid-template-columns var(--t-slow) var(--ease-out),
    column-gap var(--t-slow) var(--ease-out),
    filter var(--t-slow) var(--ease-out),
    transform var(--t-slow) var(--ease-out),
    opacity var(--t-slow) var(--ease-out);
}
.has-selection .stage {
  grid-template-columns: var(--detail-w) minmax(0, 1fr);
  column-gap: var(--detail-gap);
}
.modal-open .stage { filter: blur(14px); transform: scale(.99); opacity: .85; }

.views { position: relative; min-width: 0; min-height: 0; }
.view {
  position: absolute;
  inset: 0;
  transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out), filter var(--t-slow) var(--ease-out), visibility 0s linear var(--t-slow);
}
.view-map .view-grid-pane,
.view-grid .view-map-pane {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  filter: blur(8px);
}
.view-map .view-grid-pane { transform: scale(1.03); }
.view-grid .view-map-pane { transform: scale(.97); }
.view-map .view-map-pane,
.view-grid .view-grid-pane { transition-delay: 0s; visibility: visible; }

/* --------------------------------------------------------------------------
   Map
   -------------------------------------------------------------------------- */
.map {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #e6e6e4;
  isolation: isolate;
}
.maplibregl-canvas { outline: none; }
.maplibregl-ctrl-attrib { font-family: system-ui, sans-serif; font-weight: 400; font-size: 10px; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(255,255,255,.75); }

.pin {
  --size: var(--pin-size, 24px);
  width: var(--size);
  height: var(--size);
  cursor: pointer;
  z-index: 1;
}
.pin-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #ddd;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.95), 0 2px 6px rgba(0,0,0,.28);
  transition:
    transform var(--t-med) var(--ease-spring),
    filter var(--t-med) var(--ease-out),
    opacity var(--t-med) var(--ease-out),
    box-shadow var(--t-med) var(--ease-out);
  will-change: transform;
}
.pin-inner img { width: 100%; height: 100%; object-fit: cover; }
.pin:hover { z-index: 5; }
.pin.is-hidden-pre .pin-inner { transform: scale(.6); opacity: 0; }
.pin.no-anim .pin-inner { transition: none !important; }
.pin.is-filtered { pointer-events: none; }
.pin.is-filtered .pin-inner { transform: scale(0); opacity: 0; }
.has-selection .pin:not(.is-selected) .pin-inner { filter: grayscale(1) contrast(.9); opacity: .9; }
.pin.is-selected { z-index: 10; }
.pin.is-selected .pin-inner { transform: scale(var(--pin-sel, 2)); box-shadow: 0 0 0 1px #fff, 0 8px 22px rgba(0,0,0,.32); }

/* --------------------------------------------------------------------------
   Grid (desktop = horizontal, 2 rows)
   -------------------------------------------------------------------------- */
.grid-scroll {
  position: absolute;
  inset: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.grid-scroll::-webkit-scrollbar { display: none; }
.grid {
  height: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-columns: max-content;
  gap: 24px;
}
.tile {
  position: relative;
  height: 100%;
  aspect-ratio: 4 / 5;
  cursor: pointer;
  border-radius: 2px;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}
.tile-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #1b1b1b;
  transition: transform var(--t-med) var(--ease-out), border-radius var(--t-med) var(--ease-out), filter var(--t-med) var(--ease-out), opacity var(--t-med) var(--ease-out);
}
.tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity var(--t-slow) var(--ease-out), transform 1.2s var(--ease-out);
}
.tile-media img.is-loaded { opacity: 1; transform: none; }
.tile:hover .tile-media { transform: scale(.94); border-radius: 10px; }
.tile:active .tile-media { transform: scale(.91); }
.tile.is-selected .tile-media { transform: scale(.94); border-radius: 10px; box-shadow: 0 0 0 2px #fff; }
.has-selection .tile:not(.is-selected) .tile-media { filter: saturate(.85) brightness(.85); }
.has-selection .tile:not(.is-selected):hover .tile-media { filter: none; }
.tile.is-gone { display: none; }

.empty {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-med) var(--ease-out);
}
.empty > span {
  transform: translateY(8px);
  transition: transform var(--t-med) var(--ease-out);
}
.empty.is-visible { opacity: 1; }
/* plain text: dark over the light map, white over the dark grid */
.view-map .empty { color: #0a0a0a; }
.view-grid .empty { color: #fff; }
.empty.is-visible > span { transform: none; pointer-events: auto; }
.empty .link { text-decoration: underline; text-underline-offset: 3px; font-weight: 700; transition: opacity var(--t-fast) var(--ease-out); }
.empty .link:hover { opacity: .7; }
.is-empty .pin { pointer-events: none; }
/* no matches: soften whatever view is showing behind the message (same feel as the popup blur) */
.view-grid.is-empty .view-grid-pane { filter: blur(10px); opacity: .85; transform: scale(.99); }
/* map: a blur veil inside the rounded frame, so the frame edge stays crisp */
.map-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  backdrop-filter: blur(10px) saturate(.9);
  -webkit-backdrop-filter: blur(10px) saturate(.9);
  background: rgba(240,240,238,.15);
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease-out);
}
.view-map.is-empty .map-veil { opacity: 1; }

/* Scrubber */
.scrubber {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, calc(100% + clamp(0px, .1vh, 2px)));
  padding: 8px 10px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out);
  touch-action: none;
}
.view-grid:not(.is-loading) .scrubber.is-scrollable { opacity: 1; pointer-events: auto; }
.scrubber-track {
  position: relative;
  width: 68px;
  height: 11px;
}
.scrubber-track::before {
  content: "";
  position: absolute;
  left: 5px; right: 0; top: 2px; height: 7px;
  border-radius: 999px;
  background: var(--track);
  transition: background-color var(--t-fast) var(--ease-out);
}
.scrubber:hover .scrubber-track::before { background: #7a7a7a; }
.scrubber-thumb {
  position: absolute;
  left: 0; top: 0;
  width: 26px; height: 11px;
  border-radius: 999px;
  background: #fff;
  transition: width var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
  will-change: transform;
}
.scrubber.is-dragging .scrubber-thumb,
.scrubber:hover .scrubber-thumb { box-shadow: 0 0 0 3px rgba(255,255,255,.18); }

/* --------------------------------------------------------------------------
   Detail panel
   -------------------------------------------------------------------------- */
.detail {
  position: relative;
  min-width: 0;
  overflow: hidden;
}
.detail-inner {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--detail-w);
  display: flex;
  flex-direction: column;
}
.detail-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: detailIn var(--t-slow) var(--ease-out) both;
}
.detail-content.is-leaving { animation: detailOut 260ms var(--ease-in-out) both; position: absolute; inset: 0; }
@keyframes detailIn { from { opacity: 0; transform: translateX(-18px); filter: blur(6px); } }
@keyframes detailOut { to { opacity: 0; transform: translateX(-10px); filter: blur(4px); } }

.detail-close {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 2;
  background: rgba(10,10,10,.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.detail:hover .detail-close, .detail-close:focus-visible { opacity: 1; }
.detail-close:hover { background: rgba(10,10,10,.8); }

.detail-media {
  position: relative;
  flex: 0 1 auto;
  height: min(449px, calc(100% - 222px));
  aspect-ratio: 4 / 5;
  max-width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #1b1b1b;
}
.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: imgIn 900ms var(--ease-out) both;
}
@keyframes imgIn { from { opacity: 0; transform: scale(1.06); } }
.detail-body { display: contents; }
.detail-media { order: 0; }
.detail-title { order: 1; font-size: 22px; line-height: 1.2; padding-top: clamp(14px, 3vh, 31px); }
.detail-meta { order: 2; }
.colorbar { order: 3; }
.detail-meta {
  display: grid;
  grid-template-columns: 1fr 140px;
  column-gap: 16px;
  row-gap: 12px;
  margin-top: 16px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.1;
}
.detail-meta dt { font-weight: 700; }
.detail-meta dd { margin: 0; font-weight: 400; }
.detail-meta dd u { text-underline-offset: 2px; }
.detail-meta dd a { transition: opacity var(--t-fast) var(--ease-out); }
.detail-meta dd a:hover { opacity: .7; }
.colorbar {
  display: flex;
  height: 40px;
  border-radius: 999px;
  overflow: hidden;
  margin-top: auto;
  flex: none;
  position: relative;
}
.colorbar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  pointer-events: none;
}
.colorbar .swatch-seg {
  position: relative;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
  cursor: copy;
}
.swatch-seg.is-light { color: #0a0a0a; }
.seg-label {
  padding-top: 2px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.swatch-seg:hover .seg-label,
.swatch-seg:focus-visible .seg-label,
.swatch-seg.is-copied .seg-label { opacity: 1; transform: none; }
.swatch-seg:focus-visible { outline-offset: -3px; }
.colorbar .swatch-seg {
  flex: 1;
  transform-origin: left;
  animation: barIn 900ms var(--ease-out) both;
}
@keyframes barIn { from { transform: scaleX(0); } }

/* --------------------------------------------------------------------------
   Bottom bar + filters
   -------------------------------------------------------------------------- */
.bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.bottom-left { display: flex; align-items: center; gap: 38px; }
.view-toggle { justify-self: end; }

.ig { display: flex; align-items: center; gap: 10px; font-size: 15px; line-height: 1.1; }
.ig-text { padding-top: 2px; }
.ig-handle { color: var(--muted); transition: color var(--t-fast) var(--ease-out); }
.ig:hover .ig-handle { color: #fff; }
.ig-ring {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex: none;
  transition: transform var(--t-med) var(--ease-spring);
}
.ig-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #a1329c, #e22b6e, #fb9f40, #e22b6e, #a1329c);
  animation: igSpin 3.2s linear infinite;
}
@keyframes igSpin { to { transform: rotate(1turn); } }
.ig-avatar {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #000;
  border: 2px solid var(--bg);
  display: grid; place-items: center;
  overflow: hidden;
}
.ig-avatar img { width: 100%; height: 100%; object-fit: cover; }

.filters { display: flex; align-items: center; gap: 15px; }
.filter-label { font-size: 15px; padding-top: 2px; }
.filter { position: relative; }
.filter-btn { gap: 10px; }
.filter-btn .dots { display: inline-flex; gap: 3px; }
.filter-btn .dots:empty { display: none; }
.filter-btn .dot {
  width: 23px; height: 23px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
  animation: popIn var(--t-med) var(--ease-spring) both;
}
.filter-btn .dots .dot + .dot { margin-left: -12px; box-shadow: 0 0 0 2px var(--pill); }
.filter-btn .label { padding-top: 2px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.filter-btn .chev { width: 24px; height: 24px; flex: none; }
.filter-btn .chev .tri { transform-origin: 14.5px 12.55px; transition: transform var(--t-med) var(--ease-out); }
.filter.is-open .chev .tri { transform: rotate(180deg); }
.filter.is-active .filter-btn { background: var(--blue); }
.filter.is-active .filter-btn:hover { background: var(--blue-hover); }
.filter.is-active .filter-btn .dots .dot + .dot { box-shadow: 0 0 0 2px var(--blue); }
@keyframes popIn { from { transform: scale(0); opacity: 0; } }

.menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 40;
  min-width: 100%;
  padding: 19px 15px 20px 13px;
  border-radius: 22px;
  background: var(--menu);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  transform-origin: 30px 100%;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.94);
  filter: blur(4px);
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-med) var(--ease-out), filter var(--t-fast) var(--ease-out), visibility 0s linear var(--t-med);
}
.filter.is-open .menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  filter: none;
  transition-delay: 0s;
}
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  white-space: nowrap;
  text-align: left;
  opacity: .92;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.menu-item:hover { opacity: 1; }
.menu-item .ms { font-size: 20px; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20; }
.menu-item[aria-checked="true"] { opacity: 1; }
.menu-item[aria-checked="true"] .ms { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20; }
.menu-item span:last-child { padding-top: 2px; }
.filter.is-open .menu-item { animation: itemIn var(--t-med) var(--ease-out) both; }
@keyframes itemIn { from { opacity: 0; transform: translateY(6px); } }

.swatches { display: grid; grid-template-columns: repeat(3, 36px); gap: 10px; }
.swatch {
  width: 36px; height: 36px; border-radius: 50%;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  transition: transform var(--t-med) var(--ease-spring), box-shadow var(--t-fast) var(--ease-out);
}
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--menu), 0 0 0 4px #fff; }
.filter.is-open .swatch { animation: popIn var(--t-med) var(--ease-spring) both; }
.beta-note { font-size: 11px; line-height: 1.15; margin-top: 10px; max-width: 160px; }

/* --------------------------------------------------------------------------
   Modal (desktop = centered card)
   -------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative;
  width: 540px;
  max-width: 100%;
  min-height: min(562px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--bg);
  border-radius: 12px;
  padding: 39px 41px 39px 41px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  animation: modalIn var(--t-slow) var(--ease-out) both;
}
.modal.is-closing .modal-card { animation: modalOut 320ms var(--ease-in-out) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); filter: blur(6px); } }
@keyframes modalOut { to { opacity: 0; transform: translateY(10px) scale(.98); filter: blur(4px); } }
.modal-close { position: absolute; top: 5px; right: 5px; }
.modal-close .ms { font-size: 22px; }
.drag-bar { display: none; }

.modal-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.modal-head h2 { font-size: 22px; line-height: 1.05; font-weight: 700; }
.updated { font-size: 11px; white-space: nowrap; padding-bottom: 3px; }
.rules {
  margin-top: 26px;
  padding-left: 16px;
  font-size: 14px;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rules li::marker { font-size: 12px; }
.modal hr { border: 0; border-top: .5px solid #fff; margin: 28px 0; }
.fine { font-size: 14px; line-height: 1.2; }
.email-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.copy-email { overflow: hidden; }
.copy-email .copy-label { transform: none; opacity: 1; white-space: nowrap; }
.copy-email.is-copied { background: #1f3b26; }
.copy-email .copy-icon { transition: transform var(--t-med) var(--ease-spring); }
.copy-email.is-copied .copy-icon { transform: scale(1.1); }
.modal-blank .modal-body { min-height: 1px; }

/* --------------------------------------------------------------------------
   Loader
   -------------------------------------------------------------------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
}
/* backdrop is its own layer so the reveal is an opacity fade, not a full-screen repaint */
.loader::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  will-change: opacity;
  transition: opacity 900ms var(--ease-in-out);
}
.loader.is-landing { pointer-events: none; }
.loader.is-landing::before { opacity: 0; }
.loader.is-done { display: none; }
.loader-logo {
  width: 132px;
  height: auto;
  grid-area: 1 / 1;
  position: relative;
  z-index: 2;
  animation: logoIn 1100ms var(--ease-out) backwards;
  will-change: transform, opacity;
  transition: transform 700ms var(--ease-in-out), opacity 500ms var(--ease-in-out);
}
.loader.is-landing .loader-logo { transform: scale(.92); opacity: 0; }
@keyframes logoIn {
  from { opacity: 0; transform: scale(.94); }
}
.loader-ring { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.ring-dot {
  position: fixed;
  left: 0; top: 0;
  width: var(--dot, 40px); height: var(--dot, 40px);
  margin: calc(var(--dot, 40px) / -2) 0 0 calc(var(--dot, 40px) / -2);
  border-radius: 50%;
  overflow: hidden;
  background: #222;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.9), 0 4px 14px rgba(0,0,0,.4);
  will-change: transform;
}
.ring-dot img { width: 100%; height: 100%; object-fit: cover; }

/* Intro: chrome waits for the loader */
.chrome { transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out); }
.is-loading .chrome { opacity: 0; pointer-events: none; }
.is-loading .top { transform: translateY(-14px); }
.is-loading .bottom { transform: translateY(14px); }

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 899px) {
  :root { --pad-x: 16px; }
  .only-desktop { display: none !important; }
  .only-mobile { display: revert !important; }
  .pill.only-mobile, .view-toggle-float.only-mobile { display: inline-flex !important; }

  .app { display: block; padding: 0; }

  /* Overlays */
  .top, .bottom {
    position: fixed;
    left: 0; right: 0;
    z-index: 30;
    background: var(--bg);
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .top {
    top: 0;
    padding-top: calc(25px + env(safe-area-inset-top));
    padding-bottom: 16px;
    border-radius: 0 0 30px 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
  }
  .bottom {
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-radius: 30px 30px 0 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,.12);
    transition: border-radius var(--t-med) var(--ease-out), opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out), box-shadow var(--t-med) var(--ease-out);
  }
  .sheet-open .bottom { border-radius: 0; box-shadow: none; }
  .modal-open .bottom { transform: translateY(110%); }
  /* popups get the whole screen: the top bar slides up and away too */
  .modal-open .top { transform: translateY(-110%); box-shadow: none; }

  .top-row { min-height: 0; align-items: center; }
  .brand { gap: 13px; }
  .brand-logo { width: 55px; height: 35px; }
  .tagline { font-size: 16px; line-height: 1.12; }
  .filter-label { margin-top: 21px; }
  .filters { margin-top: 15px; gap: 10px; }
  .filter { flex: 0 1 auto; min-width: 0; }
  .filter-btn { height: 48px; padding: 0 11px; gap: 6px; max-width: 100%; font-size: 14px; }
  .filter-btn .chev { width: 20px; height: 20px; }
  .filter-btn .label { min-width: 0; }
  .pill { height: 48px; }
  .pill-blue { padding: 0 12px; }

  .menu {
    bottom: auto;
    top: calc(100% + 10px);
    transform-origin: 30px 0;
    transform: translateY(-8px) scale(.94);
  }
  .filters .filter:last-child .menu { left: auto; right: 0; transform-origin: calc(100% - 30px) 0; }

  /* Floating toggle */
  .view-toggle-float {
    position: fixed;
    left: 50%;
    bottom: calc(112px + env(safe-area-inset-bottom));
    z-index: 28;
    height: 48px;
    padding: 0 12px;
    gap: 9px;
    font-size: 15px;
    box-shadow: 0 4px 15.6px rgba(0,0,0,.25);
    transform: translateX(-50%);
    transition: transform var(--t-med) var(--ease-out), opacity var(--t-med) var(--ease-out), background-color var(--t-fast) var(--ease-out);
  }
  .view-toggle-float:active { transform: translateX(-50%) scale(.965); }
  .is-loading .view-toggle-float { transform: translate(-50%, 24px); }
  .sheet-open .view-toggle-float,
  .modal-open .view-toggle-float { transform: translate(-50%, 140px); opacity: 0; pointer-events: none; }

  /* Stage fills the screen beneath overlays */
  .stage {
    position: fixed;
    inset: 0;
    display: block;
  }
  .has-selection .stage { grid-template-columns: none; }
  .views { position: absolute; inset: 0; }
  .map, .map-veil { border-radius: 0; }

  .pin { --size: var(--pin-size, 26px); }
  .pin.is-selected .pin-inner { transform: scale(var(--pin-sel, 1.85)); }

  /* Vertical grid */
  .grid-scroll {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .grid {
    height: auto;
    grid-auto-flow: row;
    grid-template-rows: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-columns: auto;
    gap: 17px;
    padding: calc(var(--top-h, 196px) + 16px) 17px calc(var(--bottom-h, 99px) + 90px);
  }
  .tile { height: auto; width: 100%; }
  .tile:hover .tile-media { transform: none; border-radius: 2px; }
  .tile:active .tile-media { transform: scale(.96); border-radius: 8px; }
  .scrubber { display: none; }

  /* Detail = bottom sheet */
  .detail {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 25;
    max-height: calc(100dvh - var(--top-h, 181px) + 30px);
    background: var(--bg);
    border-radius: 30px 30px 0 0;
    transform: translateY(105%);
    transition: transform var(--t-slow) var(--ease-out);
    box-shadow: 0 -12px 40px rgba(0,0,0,.25);
    touch-action: none;
  }
  .detail.is-dragging { transition: none; }
  .has-selection .detail { transform: translateY(var(--drag, 0px)); }
  .detail-inner {
    position: relative;
    inset: auto;
    width: auto;
    padding: 18px 16px calc(var(--bottom-h, 99px) + 12px);
  }
  .detail .drag-bar { display: block; }
  .detail-content { animation-name: sheetContentIn; }
  @keyframes sheetContentIn { from { opacity: 0; transform: translateY(16px); } }
  .detail-content.is-leaving { animation-name: sheetContentOut; }
  @keyframes sheetContentOut { to { opacity: 0; transform: translateY(8px); } }
  .detail-close { display: none; }
  .detail-title { order: 0; margin-top: 18px; padding-top: 0; font-size: 23px; }
  .detail-body {
    display: grid;
    grid-template-columns: minmax(0, 205fr) minmax(0, 140fr);
    gap: 24px;
    align-items: end; /* info text sits on the bottom edge of the image */
    margin-top: 16px;
    min-height: 0;
  }
  .detail-media { width: 100%; height: auto; }
  .detail-meta { grid-template-columns: 1fr; margin: 0; row-gap: 0; font-size: 14px; }
  .detail-meta dt { font-size: 16px; margin-top: 20px; }
  .detail-meta dt:first-child { margin-top: 0; }
  .detail-meta dd { margin-top: 8px; }
  .colorbar { order: 0; margin-top: 24px; }

  .drag-bar {
    width: 58px;
    height: 8px;
    margin: 0 auto;
    border-top: 2px solid #727272;
    border-bottom: 2px solid #727272;
    flex: none;
  }

  /* Modal = bottom sheet */
  .modal { place-items: end stretch; padding: 0; }
  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top));
    min-height: min(640px, calc(100dvh - 24px - env(safe-area-inset-top)));
    border-radius: 30px 30px 0 0;
    padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
    animation-name: sheetIn;
    touch-action: pan-y;
  }
  .modal-card .drag-bar { display: block; margin-bottom: 30px; }
  .modal.is-closing .modal-card { animation-name: sheetOut; }
  @keyframes sheetIn { from { transform: translateY(100%); } }
  @keyframes sheetOut { to { transform: translateY(100%); } }
  .modal-close { top: 12px; right: 12px; }
  .modal-head { display: block; }
  .modal-head h2 { font-size: 23px; }
  .updated { margin-top: 10px; }
  .rules { margin-top: 26px; padding-left: 19px; gap: 14px; }
  .email-actions { justify-content: center; }
  .modal-open .stage { filter: blur(10px); transform: none; }
}

@media (max-width: 380px) {
  .filters { gap: 6px; }
  .bottom .pill-blue span:first-child { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* ==========================================================================
   Mobile sizing: back to the mobile design's proportions (desktop keeps the larger type)
   ========================================================================== */
@media (max-width: 899px) {
  .pill { height: 44px; padding: 0 12px; gap: 8px; font-size: 14px; }
  .pill-round { width: 44px; height: 44px; padding: 0; }
  .pill .ms { font-size: 22px; }
  .tagline { font-size: 14px; line-height: 1.15; }
  .brand-logo { width: 52px; height: 33px; }
  .top { padding-top: calc(18px + env(safe-area-inset-top)); padding-bottom: 14px; border-radius: 0 0 26px 26px; }
  .filter-label { font-size: 14px; margin-top: 16px; }
  .filters { margin-top: 10px; gap: 8px; }
  .filter-btn { height: 42px; padding: 0 9px 0 11px; gap: 5px; font-size: 14px; }
  .filter-btn .chev { width: 18px; height: 18px; }
  .filters { justify-content: space-between; }
  .menu-item { font-size: 14px; }
  .menu-item .ms { font-size: 18px; }

  /* bottom bar: IG on the left, submit on the right, always inside the bar */
  .bottom { gap: 12px; padding-top: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; }
  .bottom-left { min-width: 0; flex: 0 1 auto; }
  .ig { font-size: 14px; gap: 9px; }
  .ig-ring { width: 40px; height: 40px; }
  .ig-avatar { width: 36px; height: 36px; }

  .bottom .pill-blue { flex: 0 1 auto; min-width: 0; padding: 0 12px; }
  .bottom .pill-blue span:first-child { overflow: hidden; text-overflow: ellipsis; }

  .view-toggle-float { height: 42px; font-size: 13px; padding: 0 12px; bottom: calc(var(--bottom-h, 84px) + 14px); }

  /* detail sheet */
  .detail-inner { padding: 14px 16px calc(var(--bottom-h, 84px) + 10px); }
  .detail-title { font-size: 19px; margin-top: 14px; }
  .detail-body { gap: 18px; margin-top: 12px; }
  .detail-meta { font-size: 12px; }
  .detail-meta dt { font-size: 14px; margin-top: 16px; }
  .detail-meta dd { margin-top: 6px; }
  .colorbar { height: 34px; margin-top: 18px; }
  .seg-label { font-size: 11px; }

  /* popups */
  .modal-head h2 { font-size: 20px; }
  .updated { font-size: 10px; }
  .rules, .fine { font-size: 13px; }
  .rules { gap: 12px; margin-top: 22px; }
  .modal hr { margin: 22px 0; }
  .email-actions { margin-top: 24px; gap: 8px; }

  .empty { font-size: 15px; }

}

@media (max-width: 360px) {
  .bottom .ig-text { font-size: 13px; }
  .bottom .pill-blue .ms { display: none; }
}

@media (max-width: 370px) {
  .filter-btn { font-size: 13px; padding: 0 8px 0 10px; gap: 4px; }
  .filter-btn .chev { width: 16px; height: 16px; }
}

/* loader: smaller on phones */
@media (max-width: 899px) {
  .loader-logo { width: 96px; }
  .ring-dot { --dot: 32px; box-shadow: 0 0 0 1.25px rgba(255,255,255,.9), 0 3px 10px rgba(0,0,0,.4); }
}

/* grid view: the whole grid eases back a little while a logo is selected, then returns */
.grid-scroll {
  transform-origin: 50% 50%;
  transition: transform var(--t-slow) var(--ease-out);
}
.has-selection .grid-scroll { transform: scale(.95); }
@media (max-width: 899px) {
  /* on phones the visible strip is between the top bar and the sheet, so shrink toward the top */
  .grid-scroll { transform-origin: 50% var(--top-h, 160px); }
  .has-selection .grid-scroll { transform: scale(.93); }
}
