* {
  box-sizing: border-box;
}

:root {
  --tile-size: 220px;
  --tile-gap: 10px;
  --radius-xl: 26px;
  --radius-l: 18px;
  --radius-m: 13px;
  --radius-s: 10px;
  --shadow-soft: 0 14px 36px rgba(14, 23, 35, 0.16);
  --shadow-strong: 0 24px 46px rgba(8, 16, 26, 0.24);
  --pointer-x: 50%;
  --pointer-y: 18%;
}

body.gallery-page {
  --bg-0: #f2efe8;
  --bg-1: #e8e4d8;
  --panel: rgba(255, 255, 255, 0.65);
  --panel-strong: rgba(255, 255, 255, 0.88);
  --ink: #132037;
  --ink-soft: #485973;
  --line: rgba(19, 32, 55, 0.14);
  --accent-a: #0ea5a0;
  --accent-b: #f06543;
  --accent-c: #f2b53b;
  --glow: rgba(14, 165, 160, 0.24);
  --surface-dark: rgba(10, 10, 10, 0.86);

  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Bricolage Grotesque", sans-serif;
  background:
    radial-gradient(circle at var(--pointer-x) var(--pointer-y), color-mix(in srgb, var(--accent-a) 24%, transparent), transparent 36%),
    radial-gradient(circle at 10% 10%, color-mix(in srgb, var(--accent-b) 22%, transparent), transparent 28%),
    radial-gradient(circle at 85% 16%, color-mix(in srgb, var(--accent-c) 26%, transparent), transparent 32%),
    linear-gradient(140deg, var(--bg-0), var(--bg-1));
  overflow-x: hidden;
}

body.gallery-page[data-theme="classic"] {
  --bg-0: #1e1e1e;
  --bg-1: #111111;
  --panel: rgba(22, 22, 22, 0.82);
  --panel-strong: rgba(18, 18, 18, 0.94);
  --ink: #fff4c9;
  --ink-soft: #e2cb68;
  --line: rgba(255, 218, 84, 0.46);
  --accent-a: #ffe600;
  --accent-b: #f9cf26;
  --accent-c: #fff3a2;
  --glow: rgba(255, 230, 0, 0.26);
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.36);
  --shadow-strong: 0 30px 54px rgba(0, 0, 0, 0.52);
  --surface-dark: rgba(10, 10, 10, 0.86);
}

body.gallery-page[data-theme="midnight"] {
  --bg-0: #0c1020;
  --bg-1: #050913;
  --panel: rgba(13, 19, 36, 0.78);
  --panel-strong: rgba(9, 14, 28, 0.94);
  --ink: #d8ebff;
  --ink-soft: #8eb2d9;
  --line: rgba(118, 170, 255, 0.28);
  --accent-a: #4cc9f0;
  --accent-b: #8b5cf6;
  --accent-c: #2dd4bf;
  --glow: rgba(76, 201, 240, 0.28);
  --shadow-soft: 0 18px 40px rgba(2, 6, 18, 0.46);
  --shadow-strong: 0 30px 58px rgba(0, 2, 10, 0.62);
  --surface-dark: rgba(7, 11, 22, 0.88);
}

body.gallery-page[data-theme="ember"] {
  --bg-0: #26130d;
  --bg-1: #150a07;
  --panel: rgba(48, 24, 14, 0.78);
  --panel-strong: rgba(32, 15, 9, 0.94);
  --ink: #ffe8d8;
  --ink-soft: #ffc4a2;
  --line: rgba(255, 165, 110, 0.34);
  --accent-a: #ff7b54;
  --accent-b: #ffb02e;
  --accent-c: #ffd166;
  --glow: rgba(255, 123, 84, 0.3);
  --shadow-soft: 0 18px 40px rgba(16, 4, 1, 0.5);
  --shadow-strong: 0 30px 58px rgba(8, 2, 0, 0.66);
  --surface-dark: rgba(24, 11, 7, 0.88);
}

body.gallery-page[data-theme="jade"] {
  --bg-0: #0f1f1a;
  --bg-1: #09130f;
  --panel: rgba(14, 34, 27, 0.78);
  --panel-strong: rgba(10, 24, 19, 0.94);
  --ink: #d7f6e7;
  --ink-soft: #9ccdb8;
  --line: rgba(118, 209, 170, 0.3);
  --accent-a: #18c47f;
  --accent-b: #43d9bd;
  --accent-c: #e4c869;
  --glow: rgba(24, 196, 127, 0.28);
  --shadow-soft: 0 18px 40px rgba(2, 12, 8, 0.5);
  --shadow-strong: 0 30px 58px rgba(0, 7, 4, 0.66);
  --surface-dark: rgba(8, 19, 14, 0.88);
}

body.gallery-page[data-theme="paperink"] {
  --bg-0: #f8f1e7;
  --bg-1: #efe4d4;
  --panel: rgba(255, 252, 246, 0.72);
  --panel-strong: rgba(255, 252, 246, 0.9);
  --ink: #15110d;
  --ink-soft: #66584b;
  --line: rgba(21, 17, 13, 0.18);
  --accent-a: #1a1713;
  --accent-b: #d4552d;
  --accent-c: #b99267;
  --glow: rgba(212, 85, 45, 0.2);
  --shadow-soft: 0 14px 34px rgba(44, 26, 12, 0.16);
  --shadow-strong: 0 24px 44px rgba(44, 26, 12, 0.22);
  --surface-dark: rgba(245, 235, 220, 0.92);
}

body.gallery-page[data-theme="mintpop"] {
  --bg-0: #e6fff5;
  --bg-1: #d9f1ff;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --ink: #123242;
  --ink-soft: #4e7384;
  --line: rgba(18, 50, 66, 0.18);
  --accent-a: #00b894;
  --accent-b: #ff4f81;
  --accent-c: #6c63ff;
  --glow: rgba(255, 79, 129, 0.2);
  --shadow-soft: 0 14px 34px rgba(13, 47, 62, 0.14);
  --shadow-strong: 0 24px 44px rgba(13, 47, 62, 0.2);
  --surface-dark: rgba(238, 253, 255, 0.92);
}

body.gallery-page[data-theme="noir"] {
  --bg-0: #161616;
  --bg-1: #0a0a0a;
  --panel: rgba(24, 24, 24, 0.8);
  --panel-strong: rgba(15, 15, 15, 0.94);
  --ink: #f2f2f2;
  --ink-soft: #b8b8b8;
  --line: rgba(232, 232, 232, 0.22);
  --accent-a: #ffffff;
  --accent-b: #c6c6c6;
  --accent-c: #8e8e8e;
  --glow: rgba(255, 255, 255, 0.18);
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.5);
  --shadow-strong: 0 30px 58px rgba(0, 0, 0, 0.66);
  --surface-dark: rgba(8, 8, 8, 0.9);
}

body.gallery-page[data-theme="rainbow"] {
  --bg-0: #21102a;
  --bg-1: #0f1a2b;
  --panel: rgba(22, 16, 30, 0.66);
  --panel-strong: rgba(15, 11, 23, 0.84);
  --ink: #fffbf3;
  --ink-soft: #ffe7bb;
  --line: rgba(255, 255, 255, 0.36);
  --accent-a: #ff4e72;
  --accent-b: #43deff;
  --accent-c: #ffe45d;
  --glow: rgba(255, 132, 96, 0.32);
  --shadow-soft: 0 18px 42px rgba(3, 3, 6, 0.58);
  --shadow-strong: 0 32px 60px rgba(0, 0, 0, 0.72);
  --surface-dark: rgba(14, 11, 22, 0.84);
  --rainbow-border-base: #050309;
  background:
    radial-gradient(135% 132% at 0% 0%, rgba(255, 76, 112, 0.46), transparent 42%),
    radial-gradient(136% 134% at 100% 0%, rgba(255, 180, 62, 0.42), transparent 42%),
    radial-gradient(134% 132% at 100% 100%, rgba(70, 229, 255, 0.4), transparent 42%),
    radial-gradient(134% 132% at 0% 100%, rgba(103, 255, 132, 0.4), transparent 42%),
    radial-gradient(102% 98% at 52% 44%, rgba(255, 236, 96, 0.28), transparent 50%),
    radial-gradient(90% 90% at 56% 60%, rgba(111, 124, 255, 0.26), transparent 54%),
    radial-gradient(84% 84% at 46% 56%, rgba(244, 113, 255, 0.26), transparent 58%),
    linear-gradient(132deg, #2a1321 0%, #1a2540 34%, #1f351a 62%, #3a1a13 80%, #241538 100%);
  background-size: 176% 176%, 176% 176%, 176% 176%, 176% 176%, 156% 156%, 152% 152%, 152% 152%, 100% 100%;
  background-blend-mode: screen, screen, screen, screen, screen, screen, screen, normal;
  animation: rainbowDrift 5.2s cubic-bezier(0.42, 0, 0.58, 1) infinite alternate;
}

body.gallery-page[data-theme="rainbow"]::before {
  background:
    radial-gradient(circle at 84% 90%, rgba(255, 255, 255, 0.14), transparent 26%),
    conic-gradient(from 0deg, #ff4e72, #ff9a41, #ffe85b, #62ff8d, #44deff, #6f7cff, #ef6dff, #ff4e72);
  mix-blend-mode: screen;
  opacity: 0.34;
  filter: blur(34px);
  animation: rainbowPulse 4.6s ease-in-out infinite alternate, rainbowHueShift 9s linear infinite;
}

body.gallery-page[data-theme="rainbow"]::after {
  content: "";
  position: fixed;
  inset: -28%;
  pointer-events: none;
  z-index: -3;
  opacity: 0.34;
  background: conic-gradient(from 0deg, #ff4a6f, #ff8d33, #ffe95c, #62ff86, #49dfff, #6674ff, #ec63ff, #ff4a6f);
  mix-blend-mode: screen;
  filter: blur(56px) saturate(152%);
  transform-origin: center;
  animation: rainbowSpin 4.1s linear infinite;
}

body.gallery-page[data-theme="rainbow"] .ambient--left {
  background: conic-gradient(from 30deg, rgba(255, 86, 123, 0.52), rgba(255, 186, 80, 0.44), rgba(116, 255, 157, 0.38), rgba(84, 229, 255, 0.44), rgba(232, 118, 255, 0.48), rgba(255, 86, 123, 0.52));
  opacity: 0.72;
  filter: blur(26px) saturate(138%);
  animation: rainbowBlobLeft 5.4s ease-in-out infinite alternate;
}

body.gallery-page[data-theme="rainbow"] .ambient--right {
  background: conic-gradient(from 190deg, rgba(255, 104, 70, 0.48), rgba(255, 230, 103, 0.42), rgba(98, 255, 140, 0.38), rgba(72, 219, 255, 0.44), rgba(146, 110, 255, 0.42), rgba(255, 104, 70, 0.48));
  opacity: 0.7;
  filter: blur(26px) saturate(132%);
  animation: rainbowBlobRight 6.2s ease-in-out infinite alternate;
}

body.gallery-page[data-theme="rainbow"] .ambient-grid {
  opacity: 0.44;
  background-image:
    linear-gradient(rgba(255, 146, 170, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 228, 255, 0.18) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 226, 110, 0.14), rgba(120, 255, 167, 0.14));
  background-size: 34px 34px, 34px 34px, 220% 220%;
  animation: rainbowGridShift 7.2s linear infinite;
}

body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .search-wrap,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .select-wrap,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .pill-button,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .pill-link,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .chip-head-button,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .chip,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .timeline-chip,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .custom-select-trigger,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .custom-select-option,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .deck-stats,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .gallery-count-pill,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .shortcut-content kbd {
  background: var(--surface-dark);
}

body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .icon-button:hover {
  background: var(--surface-dark);
}

body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .pill-button.is-active,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .chip-head-button.is-active,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .chip.is-active,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .timeline-chip.is-active,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .custom-select-option.is-active {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent-a) 62%, var(--line));
  background: color-mix(in srgb, var(--panel-strong) 84%, black 16%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 22%, transparent);
}

body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .custom-select-menu {
  background: color-mix(in srgb, var(--surface-dark) 86%, black 14%);
  border-color: color-mix(in srgb, var(--accent-a) 34%, var(--line));
}

body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .select-wrap.has-custom-select:hover,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .select-wrap.has-custom-select:focus-within,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .custom-select-option:hover,
body.gallery-page:is([data-theme="classic"], [data-theme="midnight"], [data-theme="ember"], [data-theme="jade"], [data-theme="paperink"], [data-theme="mintpop"], [data-theme="noir"], [data-theme="rainbow"]) .custom-select-option:focus-visible {
  border-color: color-mix(in srgb, var(--accent-a) 58%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 22%, transparent);
}

body.gallery-page[data-theme="rainbow"] .control-deck {
  background:
    linear-gradient(122deg, rgba(255, 96, 141, 0.36), rgba(255, 196, 92, 0.32), rgba(124, 255, 161, 0.28), rgba(91, 229, 255, 0.3), rgba(236, 124, 255, 0.33)),
    rgba(15, 11, 24, 0.8);
  border-color: color-mix(in srgb, var(--rainbow-border-base) 94%, var(--accent-b) 6%);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.gallery-page[data-theme="rainbow"] .search-wrap,
body.gallery-page[data-theme="rainbow"] .select-wrap,
body.gallery-page[data-theme="rainbow"] .pill-button,
body.gallery-page[data-theme="rainbow"] .pill-link,
body.gallery-page[data-theme="rainbow"] .chip-head-button,
body.gallery-page[data-theme="rainbow"] .chip,
body.gallery-page[data-theme="rainbow"] .timeline-chip,
body.gallery-page[data-theme="rainbow"] .custom-select-trigger,
body.gallery-page[data-theme="rainbow"] .custom-select-option,
body.gallery-page[data-theme="rainbow"] .gallery-count-pill,
body.gallery-page[data-theme="rainbow"] .deck-stats,
body.gallery-page[data-theme="rainbow"] .shortcut-content kbd {
  background:
    linear-gradient(114deg, rgba(255, 108, 146, 0.33), rgba(255, 201, 103, 0.28), rgba(132, 255, 160, 0.23), rgba(96, 229, 255, 0.26), rgba(231, 130, 255, 0.3)),
    rgba(13, 10, 20, 0.82);
  border-color: color-mix(in srgb, var(--rainbow-border-base) 92%, var(--accent-a) 8%);
  color: #fff9f0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rainbow-border-base) 94%, var(--accent-c) 6%);
}

body.gallery-page[data-theme="rainbow"] .icon-button:hover {
  border-color: color-mix(in srgb, var(--rainbow-border-base) 90%, var(--accent-b) 10%);
  background: linear-gradient(112deg, rgba(255, 106, 131, 0.36), rgba(255, 194, 87, 0.3), rgba(110, 255, 152, 0.26), rgba(88, 223, 255, 0.3), rgba(229, 126, 255, 0.34));
}

body.gallery-page[data-theme="rainbow"] .custom-select-menu {
  background:
    linear-gradient(118deg, rgba(255, 108, 146, 0.3), rgba(255, 201, 103, 0.24), rgba(132, 255, 160, 0.2), rgba(96, 229, 255, 0.24), rgba(231, 130, 255, 0.28)),
    rgba(12, 9, 18, 0.94);
  border-color: color-mix(in srgb, var(--rainbow-border-base) 90%, var(--accent-b) 10%);
  box-shadow: var(--shadow-soft), 0 0 22px rgba(74, 223, 255, 0.22);
}

body.gallery-page[data-theme="rainbow"] .deck-input,
body.gallery-page[data-theme="rainbow"] #gallery-counts,
body.gallery-page[data-theme="rainbow"] .chip-title,
body.gallery-page[data-theme="rainbow"] .select-wrap > span,
body.gallery-page[data-theme="rainbow"] .deck-input::placeholder {
  color: rgba(255, 247, 231, 0.9);
}

body.gallery-page[data-theme="rainbow"] .pill-button.is-active,
body.gallery-page[data-theme="rainbow"] .chip-head-button.is-active,
body.gallery-page[data-theme="rainbow"] .chip.is-active,
body.gallery-page[data-theme="rainbow"] .timeline-chip.is-active,
body.gallery-page[data-theme="rainbow"] .custom-select-option.is-active {
  background: linear-gradient(115deg, #ff8ba7, #ffc56f, #fff27c, #9effb8, #87efff, #9ba1ff, #ff9ef0, #ff8ba7);
  background-size: 260% 260%;
  border-color: color-mix(in srgb, var(--rainbow-border-base) 88%, var(--accent-a) 12%);
  color: #1a0f22;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rainbow-border-base) 90%, var(--accent-c) 10%), 0 10px 22px rgba(88, 227, 255, 0.25);
  animation: rainbowUiCycle 7.5s linear infinite;
}

body.gallery-page[data-theme="rainbow"] .pill-button:hover,
body.gallery-page[data-theme="rainbow"] .pill-link:hover,
body.gallery-page[data-theme="rainbow"] .chip-head-button:hover,
body.gallery-page[data-theme="rainbow"] .chip:hover,
body.gallery-page[data-theme="rainbow"] .timeline-chip:hover,
body.gallery-page[data-theme="rainbow"] .custom-select-option:hover,
body.gallery-page[data-theme="rainbow"] .custom-select-option:focus-visible {
  background-image: linear-gradient(112deg, rgba(255, 106, 131, 0.28), rgba(255, 194, 87, 0.24), rgba(110, 255, 152, 0.22), rgba(88, 223, 255, 0.24), rgba(229, 126, 255, 0.26));
  border-color: color-mix(in srgb, var(--rainbow-border-base) 88%, var(--accent-b) 12%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rainbow-border-base) 90%, var(--accent-a) 10%), 0 0 20px rgba(77, 225, 255, 0.24);
}

body.gallery-page[data-theme="rainbow"] .select-wrap.has-custom-select:hover,
body.gallery-page[data-theme="rainbow"] .select-wrap.has-custom-select:focus-within {
  border-color: color-mix(in srgb, var(--rainbow-border-base) 88%, var(--accent-c) 12%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rainbow-border-base) 90%, var(--accent-b) 10%), 0 0 20px rgba(77, 225, 255, 0.24);
}

body.gallery-page[data-theme="rainbow"] .pill-link--instagram:hover,
body.gallery-page[data-theme="rainbow"] .pill-link--instagram:focus-visible,
body.gallery-page[data-theme="rainbow"] .pill-link--instagram:focus-within {
  border-color: color-mix(in srgb, var(--rainbow-border-base) 88%, var(--accent-a) 12%);
}

/* Remove inner borders from Sort/Theme dropdown menus and options. */
.custom-select[data-select-id="gallery-sort"] .custom-select-menu,
.custom-select[data-select-id="gallery-theme"] .custom-select-menu {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.custom-select[data-select-id="gallery-sort"] .custom-select-option,
.custom-select[data-select-id="gallery-theme"] .custom-select-option {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.custom-select[data-select-id="gallery-sort"] .custom-select-option:hover,
.custom-select[data-select-id="gallery-sort"] .custom-select-option:focus-visible,
.custom-select[data-select-id="gallery-sort"] .custom-select-option.is-active,
.custom-select[data-select-id="gallery-theme"] .custom-select-option:hover,
.custom-select[data-select-id="gallery-theme"] .custom-select-option:focus-visible,
.custom-select[data-select-id="gallery-theme"] .custom-select-option.is-active {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

body.gallery-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 80% 90%, rgba(255, 255, 255, 0.4), transparent 24%);
  mix-blend-mode: soft-light;
  opacity: 0.9;
  z-index: -4;
}

.gallery-brandbar {
  position: relative;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1700px, calc(100% - 2.2rem));
  min-height: 64px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
  font-family: "Bricolage Grotesque", sans-serif;
}

.gallery-brandbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
}

.gallery-brandbar__brand > span {
  display: block;
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 2.2rem;
  background: var(--accent-a);
  -webkit-mask: url("/site-logo.png") center / contain no-repeat;
  mask: url("/site-logo.png") center / contain no-repeat;
}

.gallery-brandbar__brand strong {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.gallery-brandbar nav {
  display: flex;
  gap: 1.2rem;
}

.gallery-brandbar nav a {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.gallery-brandbar nav a:hover,
.gallery-brandbar nav a[aria-current="page"] {
  color: var(--accent-a);
}

.ambient {
  position: fixed;
  width: min(44vw, 580px);
  height: min(44vw, 580px);
  border-radius: 999px;
  pointer-events: none;
  filter: blur(22px);
  opacity: 0.55;
  z-index: -3;
  animation: floatGlow 16s ease-in-out infinite;
}

.ambient--left {
  top: -120px;
  left: -110px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-a) 34%, transparent), transparent 67%);
}

.ambient--right {
  right: -120px;
  top: 20vh;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-b) 30%, transparent), transparent 68%);
  animation-delay: -8s;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 45%, black 20%, transparent 75%);
}

.gallery-shell {
  width: min(1700px, calc(100% - 2.2rem));
  margin: 1rem auto 3.5rem;
  position: relative;
  z-index: 3;
}

@media (max-width: 520px) {
  .gallery-brandbar {
    width: min(100% - 1.3rem, 1700px);
  }

  .gallery-brandbar__brand strong {
    display: none;
  }

  .gallery-brandbar nav {
    gap: 0.8rem;
  }
}

.hero {
  position: relative;
  margin: 0 auto 1rem;
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.16));
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}

.hero-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
}

.hero-title {
  margin: 0;
  font-size: clamp(2rem, 5.5vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  font-weight: 800;
  text-wrap: balance;
  background: linear-gradient(120deg, var(--accent-b), var(--accent-a), var(--accent-c));
  background-size: 160% 160%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: titleShift 10s linear infinite;
}

.hero-subtitle {
  margin: 0.65rem 0 1rem;
  max-width: 76ch;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  line-height: 1.35;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.hero-stat {
  position: relative;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.65rem 0.75rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  overflow: hidden;
}

.hero-stat::after {
  content: "";
  position: absolute;
  inset: auto -35% -70% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 66%);
  pointer-events: none;
}

.hero-stat-value {
  display: block;
  font-family: "Space Mono", monospace;
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero-stat-label {
  display: block;
  margin-top: 0.15rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 700;
}

.control-deck {
  position: relative;
  top: auto;
  z-index: 40;
  margin-bottom: 1rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
  padding: 0.85rem;
  display: grid;
  gap: 0.72rem;
  transition: box-shadow 0.22s ease, background 0.22s ease;
}

.deck-collapse-sentinel {
  height: 0;
  pointer-events: none;
}

.control-deck.is-condensed {
  position: sticky;
  top: 12px;
  padding: 0.85rem;
  gap: 0.72rem;
}

.control-deck .deck-row--actions,
.control-deck .deck-stats,
.control-deck .chip-section {
  max-height: 800px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  pointer-events: auto;
  transition: max-height 0.28s ease, opacity 0.22s ease, transform 0.22s ease, margin 0.22s ease, padding 0.22s ease;
}

.control-deck .deck-row--actions {
  position: relative;
  z-index: 20;
  overflow: visible;
}

.control-deck .chip-section {
  overflow: visible;
}

.control-deck .deck-stats,
.control-deck .chip-section,
.control-deck .timeline-section {
  position: relative;
  z-index: 5;
}

.control-deck.is-condensed .deck-row--actions,
.control-deck.is-condensed .deck-stats,
.control-deck.is-condensed .chip-section {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.control-deck.is-condensed .deck-row--actions {
  overflow: hidden;
}

.control-deck.is-condensed .chip-section {
  overflow: hidden;
}

.control-deck.is-condensed .timeline-section:not([hidden]) {
  display: grid;
  gap: 0.35rem;
}

.control-deck.is-condensed .timeline-section[hidden] {
  display: none;
}

.control-deck.is-condensed .timeline-section:not([hidden]) .chip-title {
  max-height: 0;
  opacity: 0;
  margin: 0;
}

.control-deck.is-condensed.is-condensed-expanded {
  box-shadow: var(--shadow-strong);
}

.control-deck.is-condensed.is-condensed-expanded .deck-row--actions {
  max-height: 800px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  overflow: visible;
}

.control-deck.is-condensed.is-condensed-expanded .deck-stats {
  max-height: 800px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.control-deck.is-condensed.is-condensed-expanded .chip-section {
  max-height: 800px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  overflow: visible;
}

.control-deck.is-condensed.is-condensed-expanded .timeline-section:not([hidden]) {
  gap: 0.35rem;
}

.control-deck.is-condensed.is-condensed-expanded .timeline-section:not([hidden]) .chip-title {
  max-height: 24px;
  opacity: 1;
  margin: 0;
}

.deck-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.deck-row--main {
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1 1 320px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  padding: 0 0.6rem;
}

.search-wrap > i {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.deck-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
}

.deck-input::placeholder {
  color: color-mix(in srgb, var(--ink-soft) 78%, transparent);
}

.deck-input:focus {
  outline: none;
}

.icon-button {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.icon-button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.icon-button:active {
  transform: scale(0.94);
}

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.42rem;
  min-width: 110px;
  min-height: 44px;
  padding: 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: rgba(255, 255, 255, 0.55);
}

.select-wrap > span {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
  line-height: 1;
  margin: 0;
}

.deck-select {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
}

.deck-select:focus {
  outline: none;
}

.select-wrap.has-custom-select .deck-select.is-native-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
  margin: 0;
  padding: 0;
}

.custom-select {
  position: static;
  flex: 1 1 auto;
  min-width: 0;
}

.select-wrap.has-custom-select:hover,
.select-wrap.has-custom-select:focus-within {
  border-color: color-mix(in srgb, var(--accent-a) 42%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 22%, transparent);
}

.custom-select-trigger {
  width: 100%;
  min-height: 30px;
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-strong) 58%, transparent);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.34rem 0.46rem 0.34rem 0.62rem;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.gallery-page .select-wrap.has-custom-select .custom-select-trigger {
  border: 0 !important;
  border-radius: 8px;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 34px;
  padding: 0.34rem 0.22rem;
}

.custom-select-trigger:hover {
  border-color: color-mix(in srgb, var(--accent-a) 42%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 22%, transparent);
}

.custom-select-trigger:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent-a) 52%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 24%, transparent);
}

.gallery-page .select-wrap.has-custom-select .custom-select-trigger:hover,
.gallery-page .select-wrap.has-custom-select .custom-select-trigger:focus-visible {
  border-color: transparent !important;
  box-shadow: none !important;
  background: transparent !important;
}

.custom-select-caret {
  font-size: 0.62rem;
  opacity: 0.86;
  transition: transform 0.18s ease;
}

.custom-select.is-open .custom-select-caret {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 0.34rem);
  left: 0;
  right: auto;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  z-index: 90;
  display: grid;
  gap: 0.28rem;
  padding: 0.36rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-strong) 92%, transparent);
  box-sizing: border-box;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(-5px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.custom-select.is-open .custom-select-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.custom-select-option {
  min-height: 34px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: left;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease, background 0.16s ease;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent-a) 45%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 24%, transparent);
}

.custom-select-option:active {
  transform: translateY(1px) scale(0.98);
}

.custom-select-option.is-active {
  border-color: var(--accent-a);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-a) 18%, white), color-mix(in srgb, var(--accent-b) 18%, white));
  color: var(--ink);
}

.pill-button,
.pill-link {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.42rem 0.78rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.pill-button:hover,
.pill-link:hover {
  border-color: color-mix(in srgb, var(--accent-a) 44%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 24%, transparent);
}

.pill-button:active,
.pill-link:active {
  transform: translateY(1px) scale(0.98);
}

.pill-button.is-active {
  border-color: var(--accent-a);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-a) 18%, white), color-mix(in srgb, var(--accent-b) 18%, white));
}

.pill-link--instagram {
  position: relative;
  z-index: 10;
}

body.gallery-page .pill-link--instagram:hover,
body.gallery-page .pill-link--instagram:focus-visible,
body.gallery-page .pill-link--instagram:focus-within {
  border-color: rgba(255, 255, 255, 0.58);
  background: linear-gradient(135deg, #f9ce34 0%, #ee2a7b 48%, #6228d7 100%);
  box-shadow: 0 0 0 2px rgba(238, 42, 123, 0.24), 0 10px 20px rgba(98, 40, 215, 0.22);
  color: #ffffff;
  z-index: 130;
}

.insta-preview {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  right: auto;
  width: 210px;
  height: auto;
  max-width: min(54vw, 230px);
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  display: block;
  object-fit: contain;
  opacity: 0;
  transform-origin: top center;
  transform: translateX(-50%) scale(0.82);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
  z-index: 140;
}

.pill-link--instagram:hover .insta-preview {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.gallery-count-pill {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-strong) 72%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  padding: 0.42rem 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip-section {
  display: grid;
  gap: 0.35rem;
}

.chip-head {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.chip-head-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.36rem;
  align-items: center;
}

.chip-head-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.28rem 0.62rem;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.chip-head-button:hover {
  border-color: color-mix(in srgb, var(--accent-a) 46%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 22%, transparent);
}

.chip-head-button:active {
  transform: translateY(1px) scale(0.98);
}

.chip-head-button[aria-pressed="true"] {
  border-color: var(--accent-a);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-a) 18%, white), color-mix(in srgb, var(--accent-b) 18%, white));
}

.chip-head-button--toggle {
  min-width: 34px;
  padding: 0.28rem 0.45rem;
  font-family: "Space Mono", monospace;
  font-size: 0.9rem;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

.chip-subtitle {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

.tag-filter-panel,
.collections-panel {
  display: grid;
  gap: 0.42rem;
}

.tag-filter-panel[hidden],
.collections-panel[hidden] {
  display: none !important;
}

.tag-filter-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
}

.tag-filter-column {
  display: grid;
  gap: 0.3rem;
}

.chip-group--dense {
  gap: 0.32rem;
}

.chip-group--dense .chip {
  font-size: 0.67rem;
  letter-spacing: 0.03em;
  padding: 0.3rem 0.58rem;
}

.chip--filter.chip--exclude.is-active {
  border-color: color-mix(in srgb, #d7263d 64%, var(--line));
  background: linear-gradient(135deg, rgba(215, 38, 61, 0.2), rgba(255, 186, 127, 0.2));
}

.deck-stats {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: color-mix(in srgb, var(--panel-strong) 72%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  padding: 0.42rem 0.6rem;
}

#gallery-counts {
  display: block;
  font-family: "Space Mono", monospace;
  font-size: 0.74rem;
  line-height: 1.35;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}

.timeline-section {
  display: grid;
  gap: 0.35rem;
}

.timeline-section[hidden] {
  display: none !important;
}

body.gallery-page[data-sort-mode="random"] #date-timeline-wrap {
  display: none !important;
}

.timeline-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.42rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding: 2px 1px;
  margin: -2px -1px;
  scroll-padding-inline: 1px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.timeline-group::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.timeline-chip {
  white-space: nowrap;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  padding: 0.42rem 0.78rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.timeline-chip:hover {
  border-color: color-mix(in srgb, var(--accent-a) 44%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 24%, transparent);
}

.timeline-chip:active {
  transform: translateY(1px) scale(0.98);
}

.timeline-chip.is-active {
  border-color: var(--accent-a);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-a) 18%, white), color-mix(in srgb, var(--accent-b) 18%, white));
  color: var(--ink);
}

.chip-title {
  margin: 0;
  max-height: 24px;
  overflow: hidden;
  font-size: 0.66rem;
  color: var(--ink-soft);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 1;
  transition: max-height 0.22s ease, opacity 0.2s ease, margin 0.2s ease;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  padding: 0.36rem 0.76rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.chip:hover {
  border-color: color-mix(in srgb, var(--accent-a) 55%, var(--line));
  transform: translateY(-1px);
}

.chip:active {
  transform: translateY(0) scale(0.98);
}

.chip.is-active {
  border-color: var(--accent-a);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-a) 18%, white), color-mix(in srgb, var(--accent-b) 18%, white));
  color: var(--ink);
}

#country-tags .chip--country {
  --country-flag-image: none;
  width: 4.3em;
  min-width: 4.3em;
  padding-left: 0;
  padding-right: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  color: #f8fbff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.72);
}

#country-tags .chip--country.is-active {
  color: #f8fbff;
  border-color: var(--accent-a);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 34%, transparent), 0 0 14px color-mix(in srgb, var(--accent-a) 28%, transparent);
}

#country-tags .chip[data-tag="*"] {
  width: auto;
  min-width: 4.3em;
  padding-left: 0.66rem;
  padding-right: 0.66rem;
  color: var(--ink);
  text-shadow: none;
}

#country-tags .chip--flag-chile {
  --country-flag-image: url("https://flagcdn.com/w160/cl.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-france {
  --country-flag-image: url("https://flagcdn.com/w160/fr.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-greece {
  --country-flag-image: url("https://flagcdn.com/w160/gr.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-ireland {
  --country-flag-image: url("https://flagcdn.com/w160/ie.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-italy {
  --country-flag-image: url("https://flagcdn.com/w160/it.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-korea {
  --country-flag-image: url("https://flagcdn.com/w160/kr.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-malta {
  --country-flag-image: url("https://flagcdn.com/w160/mt.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-norway {
  --country-flag-image: url("https://flagcdn.com/w160/no.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-poland {
  --country-flag-image: url("https://flagcdn.com/w160/pl.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-spain {
  --country-flag-image: url("https://flagcdn.com/w160/es.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-switzerland {
  --country-flag-image: url("https://flagcdn.com/w160/ch.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-uae {
  --country-flag-image: url("https://flagcdn.com/w160/ae.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

#country-tags .chip--flag-usa {
  --country-flag-image: url("https://flagcdn.com/w160/us.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), var(--country-flag-image);
}

body.gallery-page[data-theme="rainbow"] #country-tags .chip[data-tag="*"].is-active {
  background-image: linear-gradient(115deg, #ff8ba7, #ffc56f, #fff27c, #9effb8, #87efff, #9ba1ff, #ff9ef0, #ff8ba7);
  background-size: 260% 260%;
  border-color: color-mix(in srgb, var(--rainbow-border-base) 88%, var(--accent-a) 12%);
  color: #1a0f22;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rainbow-border-base) 90%, var(--accent-c) 10%), 0 10px 22px rgba(88, 227, 255, 0.25);
  animation: rainbowUiCycle 7.5s linear infinite;
}

body.gallery-page[data-theme="rainbow"] #country-tags .chip--country.is-active {
  border-color: color-mix(in srgb, var(--rainbow-border-base) 88%, var(--accent-a) 12%);
  color: #1a0f22;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rainbow-border-base) 90%, var(--accent-c) 10%), 0 10px 22px rgba(88, 227, 255, 0.25);
  background-image:
    linear-gradient(115deg, rgba(255, 139, 167, 0.45), rgba(255, 197, 111, 0.4), rgba(255, 242, 124, 0.38), rgba(158, 255, 184, 0.36), rgba(135, 239, 255, 0.4), rgba(155, 161, 255, 0.36), rgba(255, 158, 240, 0.4)),
    linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)),
    var(--country-flag-image);
  background-size: 260% 260%, cover, cover;
  background-position: 0% 50%, center, center;
  animation: rainbowUiCycle 7.5s linear infinite;
}

.gallery-stage {
  width: 100%;
  margin: 0 auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow-strong);
  padding: 0.65rem 0.3rem;
  min-height: min(70vh, 920px);
}

.grid {
  margin: 0 auto;
  position: relative;
}

.grid::after {
  content: "";
  display: block;
  clear: both;
}

.item {
  float: left;
  margin-bottom: var(--tile-gap);
  position: relative;
  transform-origin: center;
  transition: filter 0.24s ease, opacity 0.2s ease;
}

.item--landscape,
.item--square,
.item--portrait {
  width: var(--tile-size);
}

.item--landscape {
  height: calc(var(--tile-size) * 0.7);
}

.item--square {
  height: var(--tile-size);
}

.item--portrait {
  height: calc(var(--tile-size) * 1.45);
}

.item--panorama {
  width: calc((var(--tile-size) * 2) + var(--tile-gap));
  height: calc(var(--tile-size) * 0.7);
}

.tile-link,
.tile {
  display: block;
  width: 100%;
  height: 100%;
}

.tile-link {
  text-decoration: none;
  color: inherit;
}

.tile-permalink-chip {
  position: absolute;
  top: 0.42rem;
  right: 0.42rem;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.2rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(9, 17, 28, 0.62);
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.item:hover .tile-permalink-chip,
.item:focus-within .tile-permalink-chip {
  opacity: 1;
  transform: translateY(0);
}

.tile-permalink-chip:hover,
.tile-permalink-chip:focus-visible {
  border-color: rgba(255, 255, 255, 0.8);
  outline: none;
}

.tile {
  position: relative;
  border-radius: var(--radius-l);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.14));
  box-shadow: 0 8px 18px rgba(7, 14, 24, 0.15);
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.001);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.3s ease;
}

.tile-overlay {
  position: absolute;
  inset: auto 0 0;
  padding: 0.6rem;
  display: grid;
  gap: 0.25rem;
  color: #fff;
  background: linear-gradient(180deg, rgba(9, 17, 28, 0) 0%, rgba(9, 17, 28, 0.8) 70%);
  transform: translateY(10px);
  opacity: 0;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.tile-title {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.22;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.tile-tags {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-size: 0.64rem;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.82);
}

.item:hover {
  z-index: 5;
}

.item:hover .tile {
  box-shadow: 0 18px 30px rgba(9, 19, 32, 0.25);
}

.item:hover .tile img {
  transform: scale(1.06);
  filter: contrast(1.06) saturate(1.08);
}

.item:hover .tile-overlay,
.item:focus-within .tile-overlay {
  opacity: 1;
  transform: translateY(0);
}

.grid.timeline-hover-active .item .tile {
  opacity: 0.36;
  filter: grayscale(0.38) brightness(0.8);
}

.grid.timeline-hover-active .item.is-timeline-hover-target .tile {
  opacity: 1;
  filter: none;
  border-color: color-mix(in srgb, var(--accent-a) 55%, rgba(255, 255, 255, 0.34));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-a) 28%, transparent), 0 18px 30px rgba(9, 19, 32, 0.32);
}

.grid.timeline-hover-active .item.is-timeline-hover-target .tile img {
  transform: scale(1.05);
  filter: contrast(1.05) saturate(1.08);
}

.lg-links {
  margin: 0.4rem 0 0;
  font-size: 0.74rem;
}

.lg-permalink-link {
  color: #9ed8ff;
  text-decoration: none;
  font-weight: 600;
}

.lg-permalink-link:hover,
.lg-permalink-link:focus-visible {
  text-decoration: underline;
}

.item.isotope-hidden {
  pointer-events: none;
}

.scroll-progress {
  --scroll-progress: 0;
  position: fixed;
  right: max(14px, calc(12px + env(safe-area-inset-right)));
  bottom: max(14px, calc(12px + env(safe-area-inset-bottom)));
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--accent-a) calc(var(--scroll-progress) * 1%), rgba(255, 255, 255, 0.26) 0);
  cursor: pointer;
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.94);
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: var(--shadow-soft);
}

.scroll-progress::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: var(--panel-strong);
}

.scroll-progress > i {
  position: relative;
  z-index: 1;
  color: var(--ink);
}

.scroll-progress.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.shortcut-dialog {
  border: 0;
  border-radius: var(--radius-l);
  width: min(92vw, 460px);
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.shortcut-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.shortcut-content {
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--panel-strong);
  padding: 1rem;
  box-shadow: var(--shadow-strong);
}

.shortcut-content h2 {
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
}

.shortcut-content ul {
  margin: 0 0 0.9rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.36rem;
}

.shortcut-content li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.shortcut-content kbd {
  min-width: 2.3rem;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  font-family: "Space Mono", monospace;
  text-align: center;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}

.lg-sub-html {
  font-family: "Bricolage Grotesque", sans-serif !important;
}

.lg-sub-html.lg-exif-collapsed > .lg-title,
.lg-sub-html.lg-exif-collapsed > .lg-tags {
  display: none;
}

.lg-title {
  margin: 0 0 0.25rem;
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  line-height: 1.2;
}

.lg-tags {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-size: 0.84rem;
  opacity: 0.84;
}

.lg-sub-html:not(.lg-exif-collapsed) > .lg-title,
.lg-sub-html:not(.lg-exif-collapsed) > .lg-tags {
  width: fit-content;
  max-width: min(92vw, 780px);
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 13, 20, 0.48);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.lg-sub-html:not(.lg-exif-collapsed) > .lg-title {
  margin: 0 auto;
  padding: 0.36rem 0.65rem 0.12rem;
  border-radius: 12px 12px 0 0;
  border-bottom: 0;
  color: rgba(255, 255, 255, 0.97);
}

.lg-sub-html:not(.lg-exif-collapsed) > .lg-tags {
  margin: 0 auto 0.38rem;
  padding: 0.08rem 0.65rem 0.38rem;
  border-radius: 0 0 12px 12px;
  color: rgba(255, 255, 255, 0.84);
}

.lg-toolbar .lg-fullscreen-toggle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.42);
  color: #f3f6ff;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.14s ease;
}

.lg-toolbar .lg-fullscreen-toggle:hover {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(0, 0, 0, 0.64);
}

.lg-toolbar .lg-fullscreen-toggle:active {
  transform: scale(0.96);
}

.lg-toolbar .lg-fullscreen-toggle.is-active {
  border-color: rgba(255, 255, 255, 0.44);
  background: rgba(0, 0, 0, 0.7);
}

.lg-toolbar .lg-fullscreen-toggle > i {
  font-size: 0.9rem;
  pointer-events: none;
}

.lg-toolbar .lg-actual-size {
  display: none !important;
}

.lg-exif-panel {
  margin-top: 0.6rem;
  position: relative;
  padding: 0.55rem 2.35rem 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 13, 20, 0.48);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.lg-exif-panel.is-collapsed {
  padding: 0.44rem 2.35rem 0.44rem 0.65rem;
}

.lg-exif-preview {
  display: none;
  gap: 0.12rem;
}

.lg-exif-panel.is-collapsed .lg-exif-preview {
  display: grid;
}

.lg-exif-preview.is-empty {
  display: none;
}

.lg-exif-preview-title,
.lg-exif-preview-tags {
  margin: 0;
}

.lg-exif-preview-title {
  font-size: 0.9rem;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.97);
}

.lg-exif-preview-tags {
  font-family: "Space Mono", monospace;
  font-size: 0.74rem;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.84);
  opacity: 0.95;
}

.lg-exif-preview-title.is-empty,
.lg-exif-preview-tags.is-empty {
  display: none;
}

.lg-exif-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(6, 11, 18, 0.56);
  color: rgba(255, 255, 255, 0.94);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.14s ease, background 0.16s ease;
}

.lg-exif-toggle:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(6, 11, 18, 0.78);
}

.lg-exif-toggle:active {
  transform: scale(0.96);
}

.lg-exif-toggle > i {
  font-size: 0.64rem;
  transition: transform 0.18s ease;
}

.lg-exif-panel.is-collapsed .lg-exif-toggle > i {
  transform: rotate(180deg);
}

.lg-exif-body.is-loading,
.lg-exif-body.is-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
}

.lg-exif-panel.is-collapsed .lg-exif-body {
  display: none;
}

.lg-exif-row {
  display: grid;
  grid-template-columns: minmax(70px, auto) 1fr;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.82rem;
  line-height: 1.3;
}

.lg-exif-row + .lg-exif-row {
  margin-top: 0.2rem;
}

.lg-exif-key {
  font-family: "Space Mono", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.74);
}

.lg-exif-value {
  color: rgba(255, 255, 255, 0.95);
  word-break: break-word;
}

@keyframes floatGlow {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, 22px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes titleShift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@keyframes rainbowDrift {
  0% {
    background-position: 0% 0%, 100% 0%, 100% 100%, 0% 100%, 50% 50%, 50% 50%, 50% 50%, 50% 50%;
  }
  50% {
    background-position: 38% 14%, 70% 18%, 82% 74%, 20% 80%, 46% 36%, 58% 60%, 34% 66%, 50% 50%;
  }
  100% {
    background-position: 100% 34%, 8% 10%, 44% 100%, 6% 26%, 64% 62%, 30% 30%, 76% 34%, 50% 50%;
  }
}

@keyframes rainbowSpin {
  0% {
    transform: rotate(0deg) scale(1) translate3d(0, 0, 0);
  }
  50% {
    transform: rotate(180deg) scale(1.12) translate3d(1.5%, -2%, 0);
  }
  100% {
    transform: rotate(360deg) scale(1) translate3d(0, 0, 0);
  }
}

@keyframes rainbowPulse {
  0% {
    opacity: 0.22;
    transform: scale(1);
  }
  50% {
    opacity: 0.46;
    transform: scale(1.08);
  }
  100% {
    opacity: 0.32;
    transform: scale(1.02);
  }
}

@keyframes rainbowHueShift {
  0% {
    filter: blur(34px) hue-rotate(0deg) saturate(118%);
  }
  100% {
    filter: blur(34px) hue-rotate(360deg) saturate(145%);
  }
}

@keyframes rainbowBlobLeft {
  0% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
  50% {
    transform: translate3d(6%, 9%, 0) scale(1.15) rotate(12deg);
  }
  100% {
    transform: translate3d(-4%, 16%, 0) scale(1.06) rotate(-8deg);
  }
}

@keyframes rainbowBlobRight {
  0% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
  50% {
    transform: translate3d(-7%, 10%, 0) scale(1.12) rotate(-14deg);
  }
  100% {
    transform: translate3d(5%, -5%, 0) scale(1.04) rotate(7deg);
  }
}

@keyframes rainbowGridShift {
  0% {
    background-position: 0 0, 0 0, 0% 50%;
  }
  100% {
    background-position: 34px 34px, -34px 34px, 220% 50%;
  }
}

@keyframes rainbowUiCycle {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 260% 50%;
  }
}

@media (min-width: 761px) {
  .control-deck.is-condensed {
    padding: 0.62rem 0.68rem 0.48rem;
    gap: 0.32rem;
  }

  .control-deck.is-condensed .deck-row--actions,
  .control-deck.is-condensed .deck-stats,
  .control-deck.is-condensed .chip-section {
    display: none;
  }

  .control-deck.is-condensed .timeline-section:not([hidden]) {
    gap: 0.2rem;
    width: fit-content;
    max-width: 100%;
    justify-self: start;
  }

  .control-deck.is-condensed .timeline-group {
    width: fit-content;
    max-width: 100%;
  }

  .control-deck.is-condensed.is-condensed-expanded {
    padding: 0.85rem;
    gap: 0.72rem;
  }

  .control-deck.is-condensed.is-condensed-expanded .deck-row--actions {
    display: flex;
  }

  .control-deck.is-condensed.is-condensed-expanded .deck-stats {
    display: block;
  }

  .control-deck.is-condensed.is-condensed-expanded .chip-section {
    display: grid;
  }

  .control-deck.is-condensed.is-condensed-expanded .timeline-section:not([hidden]) {
    width: auto;
    max-width: 100%;
    gap: 0.35rem;
  }
}

@media (max-width: 1180px) {
  .gallery-shell {
    width: min(1700px, calc(100% - 1.1rem));
  }

  .control-deck.is-condensed {
    top: 8px;
  }
}

@media (max-width: 900px) {
  :root {
    --tile-gap: 8px;
  }

  .hero {
    padding: 0.9rem;
  }

  .hero-subtitle {
    margin-bottom: 0.75rem;
  }

  .hero-stats {
    gap: 0.45rem;
  }

  .hero-stat {
    padding: 0.55rem 0.6rem;
  }

  .pill-button,
  .pill-link {
    padding: 0.38rem 0.62rem;
    font-size: 0.72rem;
  }

  .select-wrap {
    min-width: 96px;
  }

  .custom-select-trigger {
    min-height: 28px;
    font-size: 0.76rem;
    padding: 0.32rem 0.44rem 0.32rem 0.52rem;
  }

  .custom-select-option {
    min-height: 32px;
    font-size: 0.74rem;
  }

  .tag-filter-columns {
    grid-template-columns: 1fr;
  }

  .chip-head-button {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }
}

@media (max-width: 760px) {
  .gallery-shell {
    margin-top: 0.55rem;
  }

  .hero {
    border-radius: 20px;
  }

  .hero-kicker {
    font-size: 0.62rem;
  }

  .hero-title {
    font-size: clamp(1.8rem, 10vw, 2.7rem);
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .control-deck {
    border-radius: 20px;
    padding: 0.72rem;
    transition: none;
    will-change: auto;
  }

  .control-deck.is-condensed {
    top: calc(env(safe-area-inset-top) + 6px);
    max-height: calc(100vh - env(safe-area-inset-top) - 12px);
    max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0.44rem 0.52rem;
    gap: 0.2rem;
  }

  .control-deck .deck-row--main {
    max-height: 240px;
    opacity: 1;
    transform: translateY(0);
    overflow: visible;
    position: relative;
    z-index: 30;
    pointer-events: auto;
    transition: max-height 0.28s ease, opacity 0.22s ease, transform 0.22s ease, margin 0.22s ease, padding 0.22s ease;
  }

  .control-deck.is-condensed .deck-row--main {
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .control-deck.is-condensed.is-condensed-expanded .deck-row--main {
    max-height: 240px;
    opacity: 1;
    transform: translateY(0);
    overflow: visible;
    pointer-events: auto;
  }

  .control-deck.is-condensed.is-condensed-expanded .deck-row--actions,
  .control-deck.is-condensed.is-condensed-expanded .deck-stats,
  .control-deck.is-condensed.is-condensed-expanded .chip-section {
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
  }

  .control-deck.is-condensed .timeline-section[hidden] {
    display: none;
  }

  .control-deck.is-condensed .timeline-section:not([hidden]) {
    display: grid;
    gap: 0.12rem;
  }

  .control-deck.is-condensed .timeline-section:not([hidden]) .chip-title {
    max-height: 0;
    opacity: 0;
    margin: 0;
  }

  body.gallery-page[data-sort-mode="random"] .control-deck.is-condensed .timeline-section {
    display: none !important;
  }

  body.gallery-page[data-sort-mode="random"] .control-deck.is-condensed:not(.is-condensed-expanded) {
    display: none;
  }

  .control-deck.is-condensed.is-condensed-expanded .timeline-section:not([hidden]) .chip-title {
    max-height: 0;
    opacity: 0;
    margin: 0;
  }

  .deck-row--main {
    align-items: stretch;
  }

  .search-wrap {
    flex-basis: 100%;
  }

  .select-wrap {
    flex: 1 1 0;
    min-width: 0;
  }

  .custom-select-trigger {
    min-height: 30px;
    font-size: 0.78rem;
  }

  .custom-select-menu {
    top: calc(100% + 0.3rem);
    padding: 0.3rem;
    gap: 0.24rem;
    z-index: 180;
  }

  .custom-select-option {
    min-height: 30px;
    font-size: 0.72rem;
    padding: 0.31rem 0.48rem;
  }

  .deck-row--actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.3rem;
  }

  .pill-button,
  .pill-link {
    flex: 0 0 auto;
    width: 100%;
    min-height: 34px;
    padding: 0.3rem 0.52rem;
    gap: 0.28rem;
    font-size: 0.62rem;
    letter-spacing: 0.03em;
  }

  .pill-link--instagram .insta-preview {
    display: none;
  }

  #show-shortcuts {
    display: none !important;
  }

  .gallery-count-pill {
    grid-column: 1 / -1;
    justify-content: center;
  }

  #country-tags,
  #collection-tags,
  #tag-filter-panel {
    max-height: min(42vh, 320px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.2rem;
  }

  .chip {
    font-size: 0.7rem;
    padding: 0.33rem 0.66rem;
  }

  #gallery-counts {
    font-size: 0.68rem;
  }

  .timeline-chip {
    font-size: 0.68rem;
    padding: 0.3rem 0.62rem;
  }

  .gallery-stage {
    border-radius: 16px;
    padding: 0.45rem 0.28rem calc(0.55rem + env(safe-area-inset-bottom));
  }

  .tile-permalink-chip {
    opacity: 1;
    transform: none;
    top: 0.34rem;
    right: 0.34rem;
    font-size: 0.54rem;
    padding: 0.18rem 0.36rem;
  }

}

@media (max-width: 520px) {
  .gallery-shell {
    width: calc(100% - 0.7rem);
  }

  .hero,
  .control-deck {
    border-radius: 18px;
  }

  .gallery-stage {
    border-radius: 14px;
  }

  .deck-input {
    font-size: 0.87rem;
  }

  .item,
  .item--landscape,
  .item--square,
  .item--portrait,
  .item--panorama {
    width: var(--tile-size);
  }

  .item--panorama {
    height: calc(var(--tile-size) * 0.74);
  }

  .scroll-progress {
    width: 46px;
    height: 46px;
  }
}

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