:root {
  --bg: #faf6f0;
  --bg-2: #efe8dd;
  --text: #15181b;
  --muted: #5d6468;
  --card: #fffdfa;
  --line: rgba(21, 24, 27, 0.14);
  --accent: #c2410c;
  --accent-rgb: 194, 65, 12;
  --shadow: 0 16px 40px rgba(21, 24, 27, 0.16);
  --photo-card-shadow: 0 10px 26px rgba(21, 24, 27, 0.2);
  --theme-color: #faf6f0;
  --scrollbar-track: rgba(239, 232, 221, 0.96);
  --scrollbar-thumb: rgba(93, 100, 104, 0.58);
  --scrollbar-thumb-border: rgba(239, 232, 221, 0.96);
  --media-chip-bg: color-mix(in srgb, #fffdfa 92%, rgba(21, 24, 27, 0.08));
  --media-chip-text: #1f252b;
  --modal-surface: color-mix(in srgb, #fffdfa 95%, transparent);
  --modal-backdrop: rgba(13, 18, 24, 0.54);
  --lightbox-media-bg: #171b20;
  --lightbox-scroll-track: rgba(93, 100, 104, 0.24);
  --lightbox-scroll-thumb: rgba(61, 68, 77, 0.52);
  --lightbox-scroll-thumb-border: rgba(93, 100, 104, 0.2);
  --dialog-scroll-track: rgba(93, 100, 104, 0.16);
  --dialog-scroll-thumb: rgba(61, 68, 77, 0.42);
  --dialog-scroll-thumb-border: rgba(93, 100, 104, 0.14);
  --trackpad-status-color: #5d6468;
  --auth-card-bg: color-mix(in srgb, #fffdfa 95%, transparent);
  --surface-input-bg: rgba(255, 253, 250, 0.96);
  --surface-panel-bg: rgba(247, 241, 232, 0.68);
  --surface-placeholder: color-mix(in srgb, var(--muted) 82%, #fff 18%);
  --text-strong-emphasis: #15181b;
  --message-neutral: #5a6470;
  --message-error: #cf4454;
  --message-success: #2d985b;
  --status-pill-border: color-mix(in srgb, #2d985b 44%, transparent);
  --status-pill-bg: color-mix(in srgb, #2d985b 14%, transparent);
  --status-pill-text: #2d985b;
  --doc-viewer-bg: rgba(255, 255, 255, 0.98);
  --doc-frame-bg: #ffffff;
}

html.dark,
body.dark {
  --bg: #14181c;
  --bg-2: #20262c;
  --text: #f4f2ee;
  --muted: #b5b9bc;
  --card: #1f252b;
  --line: rgba(244, 242, 238, 0.18);
  --accent: #f97316;
  --accent-rgb: 249, 115, 22;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
  --photo-card-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  --theme-color: #14181c;
  --scrollbar-track: rgba(18, 24, 31, 0.92);
  --scrollbar-thumb: rgba(214, 220, 228, 0.7);
  --scrollbar-thumb-border: rgba(18, 24, 31, 0.92);
  --media-chip-bg: color-mix(in srgb, #0f1318 78%, transparent);
  --media-chip-text: #f4f2ee;
  --modal-surface: #0f1318;
  --modal-backdrop: rgba(4, 7, 10, 0.9);
  --lightbox-media-bg: #000000;
  --lightbox-scroll-track: rgba(132, 145, 160, 0.28);
  --lightbox-scroll-thumb: rgba(214, 220, 228, 0.7);
  --lightbox-scroll-thumb-border: rgba(132, 145, 160, 0.22);
  --dialog-scroll-track: rgba(255, 255, 255, 0.16);
  --dialog-scroll-thumb: rgba(255, 255, 255, 0.42);
  --dialog-scroll-thumb-border: rgba(255, 255, 255, 0.12);
  --trackpad-status-color: #aab3bd;
  --auth-card-bg: color-mix(in srgb, #0f1318 90%, transparent);
  --surface-input-bg: rgba(17, 22, 29, 0.92);
  --surface-panel-bg: rgba(16, 21, 28, 0.42);
  --surface-placeholder: color-mix(in srgb, var(--muted) 78%, #fff 22%);
  --text-strong-emphasis: #ffffff;
  --message-neutral: #c2cad4;
  --message-error: #ff8b93;
  --message-success: #79d190;
  --status-pill-border: color-mix(in srgb, #79d190 48%, transparent);
  --status-pill-bg: color-mix(in srgb, #79d190 16%, transparent);
  --status-pill-text: #9de4b0;
  --doc-viewer-bg: rgba(255, 255, 255, 0.98);
  --doc-frame-bg: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
}

html {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;
  background: var(--theme-color);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y pinch-zoom;
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(110% 85% at 0% 0%, rgba(var(--accent-rgb), 0.2), transparent 56%),
    radial-gradient(95% 85% at 100% 100%, rgba(24, 82, 168, 0.2), transparent 62%),
    linear-gradient(120deg, var(--bg), var(--bg-2) 55%, var(--bg));
}

@media (pointer: fine) {
  html {
    scrollbar-gutter: stable both-edges;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  }

  html::-webkit-scrollbar,
  body::-webkit-scrollbar {
    width: 12px;
  }

  html::-webkit-scrollbar-track,
  body::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }

  html::-webkit-scrollbar-thumb,
  body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
    border: 2px solid var(--scrollbar-thumb-border);
  }
}

html.original-viewer-page {
  scrollbar-gutter: stable both-edges;
  overflow-y: auto;
  overflow-x: hidden;
}

html.lightbox-open-root,
html.terms-popup-open-root {
  overflow: hidden;
  overscroll-behavior: none;
  height: 100%;
}

html.standalone-mode body {
  overscroll-behavior-y: contain;
}

html.standalone-mode .site-header {
  padding-top: 0.55rem;
  padding-top: calc(env(safe-area-inset-top) + 0.55rem);
}

html.standalone-mode body.original-viewer .original-viewer-shell {
  padding-top: 0.6rem;
  padding-top: calc(env(safe-area-inset-top) + 0.6rem);
}

html.standalone-mode .hero {
  padding-top: 0.1rem; /* Reduce hero top gap in PWA standalone mode where safe-area already adds space */
}

.site-header,
main,
.site-footer {
  width: 100%;
  max-width: 1180px;
  padding-inline: 1rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  margin-inline: auto;
  overflow-x: hidden;
}

main {
  overflow-x: hidden;
}

.site-header {
  padding-block: 1rem;
  overflow: visible;
  position: relative;
  z-index: 900;
  isolation: isolate;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 1;
  overflow: visible;
  max-width: 100%;
}

.brand {
  text-decoration: none;
  color: var(--text);
  font-family: "Fraunces", serif;
  font-size: clamp(1.02rem, 2vw, 1.3rem);
  line-height: 1.15;
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
  padding-inline: 0.6rem;
  position: relative;
  z-index: 2;
}

.nav-actions > .chip,
.nav-actions > .profile-menu,
.nav-actions > .sort-switch-control {
  flex: 0 0 auto;
  min-width: 0;
}

.sort-switch-control {
  --sort-shell-top: #f5efe5;
  --sort-shell-mid: #ddd4c5;
  --sort-shell-bottom: #b6ab99;
  --sort-track-left: #7f8e9c;
  --sort-track-right: #2d3844;
  --sort-knob-top: #fffdfa;
  --sort-knob-bottom: #d8d2ca;
  --sort-shadow: rgba(16, 19, 24, 0.24);
  --sort-label-active: color-mix(in srgb, var(--text) 90%, #f4efe7 10%);
  display: inline-grid;
  justify-items: center;
  align-items: start;
  gap: 0;
  min-width: 6rem;
  padding: 0;
}

.sort-switch {
  position: relative;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}

.sort-switch__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.sort-switch__plate {
  position: relative;
  display: inline-block;
  width: 6rem;
  height: 2.18rem;
  border-radius: 999px;
  border: 1px solid rgba(104, 92, 79, 0.28);
  background: #e5ded2;
  overflow: visible;
}

.sort-switch__plate::before {
  content: "";
  position: absolute;
  inset: 0.22rem;
  border-radius: 999px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
}

.sort-switch__dial {
  position: absolute;
  inset: 0.38rem 0.74rem 0.38rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #6f7780;
  z-index: 1;
}

.sort-switch__track-labels {
  position: absolute;
  inset: 0.38rem 0.74rem;
  display: grid;
  place-items: center;
  padding-inline: 0.72rem;
  z-index: 2;
  pointer-events: none;
}

.sort-switch__track-label {
  grid-area: 1 / 1;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1;
  color: rgba(248, 251, 255, 0.96);
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(0.06rem);
}

.sort-switch__pivot {
  position: absolute;
  left: 0.3rem;
  top: calc((2.18rem - 1.58rem) / 2);
  width: 1.58rem;
  height: 1.58rem;
  border-radius: 999px;
  transform: translateX(0);
  border: 1px solid rgba(122, 111, 94, 0.24);
  background: #f1ece4;
  transition: transform 220ms ease, background 220ms ease;
  z-index: 3;
}

.sort-switch__lever {
  position: absolute;
  inset: 0.62rem auto auto 0.94rem;
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  transition: transform 220ms ease, opacity 180ms ease;
  z-index: 4;
}

.sort-switch__lever::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 0.54rem;
  height: 0.54rem;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.04);
}

.sort-switch__lever::after {
  content: "";
  position: absolute;
  inset: 0.18rem auto auto 0.2rem;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  filter: blur(0.01rem);
}

.sort-switch__input:checked + .sort-switch__plate .sort-switch__pivot {
  transform: translateX(3.82rem);
  background: #f1ece4;
}

.sort-switch__input:checked + .sort-switch__plate .sort-switch__lever {
  transform: translateX(3.82rem);
}

.sort-switch-control[data-mode="views"] .sort-switch__track-label--views {
  opacity: 1;
  transform: translate(0.38rem, 0);
}

.sort-switch-control[data-mode="likes"] .sort-switch__track-label--likes {
  opacity: 1;
  transform: translate(-0.38rem, 0);
}

.sort-switch__input:focus-visible + .sort-switch__plate {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sort-switch__input:active + .sort-switch__plate .sort-switch__pivot {
  filter: brightness(1.03);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  max-inline-size: 100%;
  overflow: visible;
  text-overflow: clip;
  touch-action: manipulation;
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.profile-menu {
  position: relative;
  flex: 0 0 auto;
  z-index: 320;
}

.profile-chip {
  position: relative;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 11.5rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  box-shadow: var(--shadow);
  padding: 0.35rem;
  z-index: 1200;
}

.categories-dropdown {
  right: auto;
  left: 0;
  min-width: 12rem;
}

.categories-dropdown .sort-switch-control--dropdown {
  justify-items: start;
  min-width: 0;
  margin-top: 0.45rem;
  padding: 0.2rem 0.6rem 0.1rem;
  border-top: 1px solid var(--line);
}

.profile-dropdown.is-floating {
  position: fixed;
  right: auto;
  bottom: auto;
  z-index: 1400;
  overflow: auto;
  max-height: min(68vh, calc(100dvh - 1rem));
}

.profile-action {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 0.58rem;
  background: transparent;
  color: var(--text);
  padding: 0.46rem 0.56rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.profile-action:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}

.category-action.active {
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: #fff;
}

.profile-admin {
  border-top: 1px solid var(--line);
  margin-top: 0.25rem;
  padding-top: 0.25rem;
}

.profile-admin .profile-action {
  margin-top: 0;
}

.profile-admin-trigger {
  color: var(--text);
}

.profile-admin-trigger:hover {
  color: var(--text);
}

.hero {
  padding: clamp(0.41rem, 1.125vw, 0.67rem) 0 clamp(1.2rem, 3.5vw, 2.1rem);
  text-align: center;
}

.tag {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tag-label {
  display: inline-block;
}

.tag-category {
  display: inline-block;
  text-transform: none;
  letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--accent) 74%, #ffffff 26%);
  border: 1px solid color-mix(in srgb, var(--accent) 44%, transparent);
  border-radius: 999px;
  padding: 0.08rem 0.52rem;
  font-size: 0.72rem;
  line-height: 1.2;
}

.tag-category[hidden] {
  display: none !important;
}

.hero-title {
  margin: 0.7rem auto 0.8rem;
  font-family: "Fraunces", serif;
  font-size: var(--hero-title-size, clamp(1.04rem, 4.1vw, 1.44rem));
  line-height: 0.98;
  max-width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.3em;
}

.hero-title-line {
  white-space: nowrap;
}

.lead {
  margin: 0 auto;
  max-width: 65ch;
  color: var(--muted);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
  padding-bottom: clamp(1.2rem, 3.5vw, 2.1rem);
}

.gallery.webkit-grid-fallback {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.photo-card {
  display: block;
  width: 100%;
  margin: 0;
  background: var(--card);
  border: 0;
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--photo-card-shadow, var(--shadow));
  transition: transform 260ms ease;
  position: relative;
}

.gallery.webkit-grid-fallback .photo-card {
  display: block;
  margin: 0;
  align-self: start;
  height: auto;
}

.gallery.webkit-grid-fallback .photo-card.hidden {
  display: none;
}

.photo-card:hover {
  transform: translateY(-5px);
}

.photo-card img {
  width: 100%;
  height: auto;
  display: block;
}

.photo-card.media-load-failed img {
  opacity: 0.16;
}

.photo-card.media-load-failed::after {
  content: "Media unavailable";
  position: absolute;
  inset: 0 auto auto 0;
  margin: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.52rem;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--media-chip-bg);
}

.media-badge {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--media-chip-bg);
  color: var(--media-chip-text);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.22rem 0.54rem;
  backdrop-filter: blur(8px);
}

.meta {
  padding: 0.36rem 0.65rem 0.56rem;
}

.meta-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.meta h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: var(--card-title-size, 1.02rem);
  line-height: 1.24;
  padding-top: 0.01em;
  padding-bottom: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  grid-column: 1;
}

.meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.card-engagement {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
  font-family: "Fraunces", serif;
  font-size: 0.82rem;
  line-height: 1;
  color: var(--muted);
  grid-column: 2;
  justify-self: end;
}

.views-counter {
  white-space: nowrap;
}

.likes-btn {
  border: 0;
  background: transparent;
  color: #ff5a63;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  padding: 0;
}

.likes-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, #ff5a63 75%, white 25%);
  outline-offset: 3px;
  border-radius: 0.35rem;
}

.heart-glyph {
  font-size: 1.02em;
}

.floating-heart {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, 0) scale(var(--float-scale, 1));
  opacity: 0;
  color: #ff5a63;
  pointer-events: none;
  animation: floatHeart var(--float-dur, 900ms) ease-out var(--float-delay, 0ms) forwards;
}

@keyframes floatHeart {
  0% {
    opacity: 0;
    transform: translate(-50%, 2px) scale(calc(var(--float-scale, 1) * 0.72));
  }

  15% {
    opacity: 0.95;
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--float-x, 0px)), -58px) scale(var(--float-scale, 1));
  }
}

.photo-card.hidden {
  display: none;
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 330ms ease, transform 330ms ease;
}

/* Keep gallery cards deterministic in Safari/WebKit after auth unlock. */
.photo-card.reveal {
  opacity: 1;
  transform: none;
}

.photo-card.reveal:hover {
  transform: translateY(-5px);
}

.reveal.show {
  opacity: 1;
  transform: translateY(0);
}

/* Keep landing media faintly visible behind auth gate without staggered fade-in. */
body.auth-locked .reveal,
body.auth-locked .reveal.show {
  opacity: 1;
  transform: none;
  transition: none;
}

.site-footer {
  margin-top: 0;
  padding: 0 0 1.2rem;
  text-align: center;
  color: var(--muted);
}

.site-footer > p:first-child {
  margin: 0;
}

.site-footer .terms {
  max-width: 86ch;
  margin: 0.55rem auto 0;
  font-size: 0.74rem;
  line-height: 1.45;
}

.site-footer .terms a {
  color: var(--text);
}

.lightbox {
  width: min(1140px, calc(100vw - 1rem));
  max-width: 1140px;
  max-height: calc(100vh - 1rem);
  max-height: calc(100dvh - 1rem);
  border: 0;
  padding: 0.6rem;
  border-radius: 1rem;
  background: var(--modal-surface);
  color: var(--text);
  isolation: isolate;
  overflow: hidden;
  overscroll-behavior: contain;
}

.lightbox::backdrop {
  background: var(--modal-backdrop);
  backdrop-filter: blur(2px);
}

.lightbox:not([open]) {
  display: none;
}

.lightbox-media {
  width: 100%;
  max-height: min(72vh, calc(100vh - 16rem));
  max-height: min(72vh, calc(100dvh - 16rem));
  overflow: auto;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--lightbox-media-bg);
  cursor: grab;
  touch-action: pan-x pan-y;
  isolation: isolate;
  scrollbar-color: var(--lightbox-scroll-thumb) var(--lightbox-scroll-track);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.lightbox-media.is-video {
  cursor: default;
  border: none;
  padding: 0;
  background: none;
}

.lightbox-media::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.lightbox-media::-webkit-scrollbar-track {
  background: var(--lightbox-scroll-track);
  border-radius: 999px;
}

.lightbox-media::-webkit-scrollbar-thumb {
  background: var(--lightbox-scroll-thumb);
  border-radius: 999px;
  border: 2px solid var(--lightbox-scroll-thumb-border);
}

.lightbox-media.trackpad-detected {
  cursor: grab;
}

body.lightbox-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.lightbox-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--modal-backdrop);
}

.lightbox.is-open {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}

.lightbox img {
  width: auto;
  max-width: none;
  max-height: none;
  object-fit: initial;
  border-radius: 0.7rem;
  display: block;
  filter: none !important;
  mix-blend-mode: normal !important;
  opacity: 1;
  background: var(--lightbox-media-bg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

#lightboxImage[hidden],
.lightbox-media.is-video #lightboxImage {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.video-wrapper {
  position: relative;
  width: 100%;
  line-height: 0;
  border-radius: 0.7rem;
  overflow: hidden;
}

.lightbox-video {
  width: 100%;
  max-width: 100%;
  max-height: min(72vh, calc(100vh - 16rem));
  max-height: min(72dvh, calc(100dvh - 16rem));
  display: block;
  border-radius: 0.7rem;
}

.lightbox-media.is-video #videoWrapper {
  display: block !important;
}

/* ── Custom video controls ── */
.video-controls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  border-radius: 0.7rem;
}

.video-controls.visible {
  opacity: 1;
  pointer-events: auto;
}

.video-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  padding: 0.4rem;
  opacity: 0.9;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

.video-btn--play svg {
  width: 3rem;
  height: 3rem;
}

.video-btn:not(.video-btn--play) svg {
  width: 2.2rem;
  height: 2.2rem;
}

.video-btn:active {
  opacity: 0.6;
}

.lightbox-media:not(.is-video) #lightboxVideo {
  display: none !important;
}

.zoom-controls.is-hidden {
  display: none;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.22rem;
  margin: 0 0 0.45rem;
  flex-wrap: wrap;
}

.zoom-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.68rem;
  font: inherit;
  cursor: pointer;
}

.zoom-level {
  min-width: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.trackpad-status {
  font-size: 0.82rem;
  color: var(--trackpad-status-color);
  white-space: normal;
  overflow-wrap: anywhere;
}

.close-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  margin: 0 0 0.4rem auto;
  display: block;
  font: inherit;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

#lightboxCaption {
  margin: 0;
  font-family: inherit;
  font-size: 0.917rem;
  font-weight: 700;
  color: var(--text);
}

.lightbox-meta {
  font-size: 0.917rem;
  line-height: 1.1;
}

.lightbox-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  column-gap: 0.7rem;
  row-gap: 0.05rem;
  margin-bottom: 0.17rem;
}

.lightbox-meta-row--headline {
  margin-top: 0.17rem;
}

.lightbox-meta-row--links {
  column-gap: 5ch;
  font-size: 0.75rem;
}

.lightbox-meta-row--details {
  display: block;
}

.lightbox-meta-row:last-child {
  margin-bottom: 0;
}

.lightbox-meta p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lightbox-meta-row--headline #lightboxCaption {
  color: var(--text);
  flex: 0 1 auto;
}

.lightbox-meta-row--headline #lightboxCategory,
.lightbox-meta-row--headline #lightboxLocation,
.lightbox-meta-row--details #lightboxCamera {
  flex: 0 1 auto;
}

.lightbox-meta-row--details #lightboxCamera,
.lightbox-meta-row--details #lightboxShot {
  display: block;
}

.lightbox-meta-row--details #lightboxShot {
  min-width: 0;
}

.terms-link {
  font: inherit;
  font-size: inherit;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.terms-action-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.terms-popup {
  width: min(840px, calc(100vw - 1rem));
  max-height: calc(100vh - 1rem);
  max-height: calc(100dvh - 1rem);
  overflow: auto;
  border: 0;
  border-radius: 1rem;
  padding: 0.9rem;
  background: var(--card);
  color: var(--text);
  scrollbar-color: var(--dialog-scroll-thumb) var(--dialog-scroll-track);
}

.terms-popup:not([open]) {
  display: none;
}

.terms-popup::-webkit-scrollbar {
  width: 12px;
}

.terms-popup::-webkit-scrollbar-track {
  background: var(--dialog-scroll-track);
  border-radius: 999px;
}

.terms-popup::-webkit-scrollbar-thumb {
  background: var(--dialog-scroll-thumb);
  border-radius: 999px;
  border: 2px solid var(--dialog-scroll-thumb-border);
}

.terms-popup::backdrop {
  background: var(--modal-backdrop);
  backdrop-filter: blur(2px);
}

body.terms-popup-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.terms-popup-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1099;
  background: var(--modal-backdrop);
}

html.auth-locked-root {
  overflow: hidden;
  width: 100%;
  overscroll-behavior: none;
}

body.auth-locked {
  overflow: hidden;
  overscroll-behavior: none;
}

/* Force the locked landing view to stay clear (no inherited haze/fog filters). */
body.auth-locked .site-header,
body.auth-locked main,
body.auth-locked .site-footer,
body.auth-locked .hero,
body.auth-locked .gallery,
body.auth-locked .photo-card,
body.auth-locked .photo-card img,
body.auth-locked .meta {
  -webkit-filter: none !important;
  filter: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
}

.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-x: hidden;
  width: 100%;
  background: transparent !important;
  -webkit-backdrop-filter: blur(3.2px) !important;
  backdrop-filter: blur(3.2px) !important;
}

.auth-gate-overlay[hidden] {
  display: none;
}

.auth-gate-overlay [hidden] {
  display: none !important;
}

.auth-gate-beams {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-gate-beam {
  position: absolute;
  bottom: -18%;
  left: var(--beam-origin-x, 50%);
  width: clamp(16vw, 20vw, 23vw);
  height: 120vh;
  transform-origin: 50% 100%;
  opacity: var(--beam-opacity, 0.15);
  background: linear-gradient(
    to top,
    rgba(244, 249, 255, 0.45) 0%,
    rgba(241, 247, 255, 0.18) 28%,
    rgba(236, 244, 255, 0.045) 56%,
    rgba(230, 240, 255, 0) 80%
  );
  clip-path: polygon(49% 100%, 51% 100%, 98% 0%, 2% 0%);
  filter: drop-shadow(0 0 4px rgba(240, 246, 255, 0.12));
  animation: authBeamSweep var(--beam-duration, 10s) ease-in-out var(--beam-delay, 0s) infinite alternate;
}

@keyframes authBeamSweep {
  0% {
    transform: translateX(-50%) rotate(var(--beam-angle-start, -22deg));
  }
  100% {
    transform: translateX(-50%) rotate(var(--beam-angle-end, 22deg));
  }
}

.auth-gate-card {
  position: relative;
  z-index: 1;
  width: min(414px, 100%);
  max-width: 100%;
  max-height: min(84vh, calc(100dvh - 1.25rem));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.74rem;
  background: var(--auth-card-bg);
  box-shadow: var(--shadow);
}

.auth-gate-card h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(1.06rem, 2.1vw, 1.5rem);
}

.auth-gate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.auth-gate-close-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  padding: 0.3rem 0.66rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.auth-gate-lead {
  margin: 0.28rem 0 0.58rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-gate-tabs {
  display: inline-flex;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem;
}

.auth-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.72rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--accent);
  color: #fff;
}

.auth-pane {
  display: none;
  margin-top: 0.72rem;
}

.auth-pane.active {
  display: grid;
  gap: 0.55rem;
}

.auth-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-pane label {
  display: grid;
  gap: 0.26rem;
  color: var(--muted);
  font-size: 0.83rem;
}

.auth-pane input,
.auth-pane textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  background: var(--surface-input-bg);
  color: var(--text);
  padding: 0.52rem 0.58rem;
  font: inherit;
  font-size: 1rem; /* 16px min prevents iOS Safari auto-zoom on input focus */
}

.auth-pane input::placeholder,
.auth-pane textarea::placeholder {
  color: var(--surface-placeholder);
  opacity: 1;
}

.auth-pane input:focus::placeholder,
.auth-pane textarea:focus::placeholder {
  color: transparent;
}

.auth-pane textarea {
  resize: vertical;
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap input {
  padding-right: 2.35rem;
}

.auth-password-icon-btn {
  position: absolute;
  right: 0.48rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  border-radius: 999px;
  padding: 0;
  margin: 0;
  background: transparent;
  color: rgba(224, 233, 244, 0.9);
  opacity: 0.7;
  width: 1.16rem;
  height: 1.16rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  z-index: 2;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.auth-password-icon-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1rem;
  height: 1rem;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dbe3ee' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.8-6 10-6 10 6 10 6-3.8 6-10 6-10-6-10-6Z'/%3E%3Ccircle cx='12' cy='12' r='2.7' fill='%23dbe3ee' stroke='none'/%3E%3C/svg%3E");
}

.auth-password-icon-btn::after {
  content: none;
}

.auth-password-icon-btn[aria-pressed="true"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dbe3ee' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.8-6 10-6 10 6 10 6-3.8 6-10 6-10-6-10-6Z'/%3E%3Ccircle cx='12' cy='12' r='2.7' fill='%23dbe3ee' stroke='none'/%3E%3Cline x1='4' y1='20' x2='20' y2='4'/%3E%3C/svg%3E");
}

.auth-password-icon-btn:hover,
.auth-password-icon-btn:focus-visible {
  opacity: 0.92;
}

.auth-primary-btn,
.auth-secondary-btn {
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  padding: 0.54rem 0.68rem;
  font: inherit;
  cursor: pointer;
}

.auth-pane .auth-primary-btn,
.auth-pane .auth-secondary-btn {
  justify-self: start;
  width: auto;
  border-radius: 999px;
  padding: 0.35rem 0.72rem;
  font-size: 0.82rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-signin-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.56rem;
}

.auth-forgot-link {
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--accent) 84%, #fff 16%);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.14rem;
}

.auth-forgot-link:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-forgot-link:hover,
.auth-forgot-link:focus-visible {
  color: color-mix(in srgb, var(--accent) 66%, #fff 34%);
}

.auth-primary-btn {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.auth-secondary-btn {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.auth-secondary-btn.is-unavailable {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.auth-primary-btn:disabled,
.auth-secondary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-gate-terms {
  margin-top: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 0.56rem 0.58rem;
  background: var(--surface-panel-bg);
}

.auth-gate-terms h3 {
  margin: 0 0 0.34rem;
  font-family: "Fraunces", serif;
  font-size: 0.9rem;
}

.auth-gate-terms-content {
  max-height: min(18vh, 126px);
  overflow: auto;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 0.78rem;
  line-height: 1.42;
  color: var(--muted);
  scrollbar-color: rgba(214, 220, 228, 0.7) rgba(132, 145, 160, 0.28);
}

.auth-gate-terms-content .terms {
  margin: 0 0 0.42rem;
}

.auth-gate-terms-content .terms:last-child {
  margin-bottom: 0;
}

.auth-gate-terms-content strong {
  color: var(--text-strong-emphasis);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.12em;
}

.auth-gate-check {
  margin-top: 0.42rem;
  padding-top: 0.38rem;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  display: flex;
  gap: 0.52rem;
  align-items: flex-start;
  color: var(--text);
  font-size: 0.86rem;
}

.auth-gate-check input {
  margin-top: 0.14rem;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--accent);
}

.auth-gate-hint {
  margin: 0.36rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.auth-gate-hint.is-hidden {
  display: none;
}

.auth-gate-message {
  margin: 0.6rem 0 0;
  min-height: 1.15rem;
  font-size: 0.83rem;
  color: var(--message-neutral);
}

.auth-gate-message[data-level="error"] {
  color: var(--message-error);
}

.auth-gate-message[data-level="success"] {
  color: var(--message-success);
}

.profile-dialog {
  width: min(760px, calc(100vw - 1rem));
}

#adminLaunchPopup {
  width: min(760px, calc(100vw - 1rem));
}

.admin-token-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.4rem;
}

.admin-token-input {
  width: 100%;
  margin-top: 0.18rem;
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  background: var(--surface-input-bg);
  color: var(--text);
  padding: 0.52rem 0.58rem;
  font: inherit;
  font-size: 1rem; /* 16px min prevents iOS Safari auto-zoom on input focus */
}

.admin-token-input::placeholder {
  color: var(--surface-placeholder);
  opacity: 1;
}

.admin-token-input:focus::placeholder {
  color: transparent;
}

.admin-actions-row {
  margin-top: 0.44rem;
  display: flex;
  gap: 0.4rem;
}

.admin-actions-wrap {
  flex-wrap: wrap;
  align-items: center;
}

.admin-options-panel {
  margin-top: 0.72rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.admin-session-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--status-pill-border);
  background: var(--status-pill-bg);
  color: var(--status-pill-text);
  font-size: 0.74rem;
  letter-spacing: 0.01em;
}

.admin-inline-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-select {
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  background: var(--surface-input-bg);
  color: var(--text);
  padding: 0.45rem 0.52rem;
  font: inherit;
  font-size: 0.84rem;
}

.admin-docs-dialog {
  width: min(1220px, calc(100vw - 1rem));
}

.admin-notify-dialog {
  width: min(960px, calc(100vw - 1rem));
}

.admin-notify-summary {
  margin-top: 0.45rem !important;
  color: var(--muted);
}

.admin-notify-users {
  margin-top: 0.35rem;
  max-height: min(34vh, 320px);
  overflow: auto;
  padding-right: 0.12rem;
}

.admin-notify-user-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.52rem;
  align-items: start;
}

.admin-notify-user-check {
  margin-top: 0.16rem;
}

.admin-notify-user-content {
  min-width: 0;
}

.admin-notify-user-email {
  display: inline-block;
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.78rem;
  word-break: break-all;
}

.admin-notify-user-email[hidden] {
  display: none !important;
}

.admin-notify-rich-wrap {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.38rem;
}

.admin-notify-rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.admin-rich-btn {
  min-height: 1.85rem;
  padding: 0.34rem 0.52rem;
  font-size: 0.78rem;
}

.admin-notify-rich-input {
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  background: var(--surface-input-bg);
  color: var(--text);
  padding: 0.52rem 0.58rem;
  min-height: 8rem;
  max-height: min(30vh, 320px);
  overflow: auto;
  font-size: 0.86rem;
  line-height: 1.42;
  white-space: pre-wrap;
}

.admin-notify-rich-input:focus {
  outline: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.admin-doc-message[data-level="error"] {
  color: var(--message-error);
}

.admin-doc-message[data-level="success"] {
  color: var(--message-success);
}

.admin-doc-search-row {
  margin-top: 0.5rem;
  gap: 0.5rem;
}

.admin-doc-search-input {
  flex: 1;
  min-width: 0;
  padding: 0.38rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
}

.admin-doc-search-input:focus {
  border-color: var(--accent);
}

.admin-doc-search-results {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0.3rem 0;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
  max-height: 10rem;
  overflow-y: auto;
}

.admin-doc-search-results li a {
  display: block;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-doc-search-results li a:hover {
  background: var(--hover-bg, rgba(128,128,128,0.1));
}

.admin-doc-search-results li .doc-search-context {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary, #888);
  padding: 0 0.9rem 0.3rem;
}

.admin-doc-viewer-wrap {
  margin-top: 0.52rem;
  width: 100%;
  height: min(68vh, 760px);
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  overflow: hidden;
  background: var(--doc-viewer-bg);
}

.admin-doc-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--doc-frame-bg);
}

.admin-requests-list {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.4rem;
}

.admin-request-item {
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  padding: 0.45rem;
  background: color-mix(in srgb, var(--card) 88%, transparent);
}

.admin-request-item .terms {
  margin: 0;
}

.admin-request-note {
  margin-top: 0.28rem !important;
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-comment-label {
  margin-top: 0.36rem;
  display: grid;
  gap: 0.24rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-comment-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  background: var(--surface-input-bg);
  color: var(--text);
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.86rem;
  resize: vertical;
}

.admin-request-actions {
  margin-top: 0.36rem;
  display: flex;
  gap: 0.32rem;
}

.admin-section-title {
  margin: 0.95rem 0 0.3rem;
  font-family: "Fraunces", serif;
  font-size: 0.94rem;
  color: var(--text);
}

.admin-users-list {
  margin-top: 0.35rem;
}

.admin-user-item {
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  padding: 0.45rem;
  background: color-mix(in srgb, var(--card) 88%, transparent);
}

.admin-user-meta {
  margin-top: 0.22rem !important;
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-media-list {
  margin-top: 0.35rem;
}

.admin-media-item {
  display: grid;
  gap: 0.3rem;
}

.admin-media-controls {
  margin-top: 0.05rem;
  display: flex;
  gap: 0.32rem;
  flex-wrap: wrap;
  align-items: center;
}

.admin-media-controls .admin-select {
  min-width: 8.2rem;
}

.admin-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-hard-delete-check {
  margin: 0;
}

.admin-media-item .zoom-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

#adminAuthMessage[data-level="error"],
#adminRequestsMessage[data-level="error"],
#adminMediaMessage[data-level="error"],
#adminNotifyMessage[data-level="error"] {
  color: var(--message-error);
}

#adminAuthMessage[data-level="success"],
#adminRequestsMessage[data-level="success"],
#adminMediaMessage[data-level="success"],
#adminNotifyMessage[data-level="success"] {
  color: var(--message-success);
}

.terms-popup.is-open {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1100;
}

.terms-popup h2 {
  margin: 0.25rem 0 0.55rem;
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
}

.terms-popup .terms {
  max-width: none;
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.terms-popup a {
  color: var(--text);
}

@media (max-width: 950px) {
  .site-header,
  main,
  .site-footer {
    padding-inline: 0.75rem;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery.webkit-grid-fallback {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .site-header,
  main,
  .site-footer {
    padding-inline: 0.5rem;
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
  }

  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    overflow-x: hidden;
  }

  .nav-actions {
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
    gap: 0.45rem;
    padding-inline: 0.2rem;
  }

  .nav-actions > .chip,
  .nav-actions > .profile-menu {
    flex: 0 0 auto;
    min-width: max-content;
    max-width: 100%;
  }

  .sort-switch-control {
    min-width: 5rem;
  }

  .sort-switch__label {
    font-size: 0.83rem;
  }

  .profile-menu {
    min-width: 0;
  }

  .profile-chip {
    width: auto;
    overflow: visible;
    text-overflow: clip;
  }

  .categories-chip {
    width: auto;
    overflow: visible;
    text-overflow: clip;
  }

  .chip {
    min-width: max-content;
    padding-inline: 0.88rem;
    font-size: 0.83rem;
  }

  .brand {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .profile-dropdown {
    right: auto;
    left: 0;
    min-width: 10rem;
  }

  .hero {
    text-align: left;
  }

  .hero-title {
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
  }

  .tag-category {
    font-size: 0.69rem;
  }

  .lead {
    max-width: 38ch;
  }

  .gallery {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    padding-bottom: 1.2rem;
  }

  .meta-row {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "engagement";
    align-items: start;
    row-gap: 0.24rem;
  }

  .meta h2 {
    grid-area: title;
    grid-column: auto;
    justify-self: start;
  }

  .card-engagement {
    grid-area: engagement;
    grid-column: auto;
    justify-self: end;
  }

  #adminLaunchPopup {
    width: min(460px, calc(100vw - 0.5rem));
    padding: 0.72rem;
  }

  #adminLaunchPopup .admin-actions-row.admin-actions-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  #adminLaunchPopup .admin-actions-row.admin-actions-wrap .zoom-btn {
    width: 100%;
    justify-content: center;
  }

  .admin-notify-dialog {
    width: min(680px, calc(100vw - 0.5rem));
  }

  .admin-notify-user-item {
    grid-template-columns: 1fr;
    gap: 0.28rem;
  }

  .admin-notify-user-check {
    margin-top: 0;
  }

  .admin-notify-rich-input {
    min-height: 7rem;
  }

  .lightbox {
    padding: 0.45rem;
    border-radius: 0.8rem;
  }

  .zoom-controls {
    gap: 0.17rem;
    margin-bottom: 0.35rem;
  }

  .zoom-btn {
    min-height: 2rem;
    padding: 0.38rem 0.58rem;
    font-size: 0.88rem;
  }

  .zoom-level {
    min-width: 1.75rem;
    font-size: 0.84rem;
  }

  .trackpad-status {
    width: 100%;
    font-size: 0.78rem;
  }

  .lightbox-media {
    max-height: min(70vh, calc(100vh - 14rem));
    max-height: min(70vh, calc(100dvh - 14rem));
  }

  .lightbox-video {
    max-height: min(70vh, calc(100vh - 14rem));
    max-height: min(70dvh, calc(100dvh - 14rem));
  }

  #lightboxCaption {
    margin-top: 0.55rem;
    font-size: 1rem;
  }

  .lightbox-meta p {
    font-size: 0.86rem;
    line-height: 1.32;
  }

  .auth-gate-overlay {
    padding: 0.5rem;
  }

  .auth-gate-card {
    width: min(460px, 100%);
    max-height: min(84vh, calc(100dvh - 0.75rem));
    padding: 0.64rem;
  }

  .auth-gate-terms-content {
    max-height: min(18vh, 118px);
  }
}

@media (pointer: coarse) {
  html,
  body {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  .lightbox-media::-webkit-scrollbar,
  .terms-popup::-webkit-scrollbar,
  .auth-gate-terms-content::-webkit-scrollbar {
    width: 0;
    height: 0;
  }
}

@supports (-webkit-touch-callout: none) {
  html,
  body {
    overflow-x: hidden !important;
  }

  @media (max-width: 700px) {
    html:not(.standalone-mode) .site-header {
      padding-top: max(0.5rem, calc(env(safe-area-inset-top) + 0.2rem));
      padding-bottom: 0.5rem;
    }
  }
}

@media (min-width: 681px) and (max-width: 1024px) {
  .brand {
    max-width: 22ch;
  }

  #adminLaunchPopup {
    width: min(560px, calc(100vw - 2rem));
  }

  .chip {
    padding-inline: 0.75rem;
  }

  .lightbox {
    width: min(960px, calc(100vw - 2rem));
  }

  .lightbox-media {
    max-height: min(68vh, calc(100vh - 15rem));
    max-height: min(68vh, calc(100dvh - 15rem));
  }

  .lightbox-video {
    max-height: min(68vh, calc(100vh - 15rem));
    max-height: min(68dvh, calc(100dvh - 15rem));
  }
}

body.original-viewer {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.original-viewer-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1rem 1.25rem;
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-left: max(1rem, env(safe-area-inset-left));
}

.original-viewer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 86%, transparent);
}

.original-viewer-title {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.original-viewer-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.original-viewer-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.88rem;
}

.original-viewer-frame {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #000;
  overflow: hidden;
  overflow: clip;
}

.photo-card:focus-visible,
.zoom-btn:focus-visible,
.close-btn:focus-visible,
.chip:focus-visible,
.terms-link:focus-visible,
.terms-action-btn:focus-visible,
.original-viewer-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.original-viewer-media {
  display: block;
  width: 100%;
  height: auto;
}

.original-viewer-media[hidden] {
  display: none !important;
}

.original-viewer-video {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(82vh, calc(100vh - 12rem));
  max-height: min(82vh, calc(100dvh - 12rem));
  object-fit: contain;
  background: #000;
}

.original-viewer-video[hidden] {
  display: none !important;
}

.original-viewer-note {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 680px) {
  .original-viewer-shell {
    padding: 0.6rem 0.5rem 1rem;
    padding-right: max(0.5rem, env(safe-area-inset-right));
    padding-left: max(0.5rem, env(safe-area-inset-left));
  }

  .original-viewer-nav {
    flex-wrap: wrap;
  }

  .original-viewer-actions {
    width: 100%;
    justify-content: space-between;
  }

}
