* { box-sizing: border-box; }
/* The browser's own `[hidden] { display: none }` is a user-agent rule, so ANY author rule that
   sets `display` beats it -- `form input[type=file]` further down set `display: block`, which
   made the hidden camera input on the item form render as a second, stray file picker. This
   makes the attribute win wherever it's used. (The handful of `.thing[hidden]` rules further
   down predate this and are now redundant, but harmless.) */
[hidden] { display: none !important; }
html { height: 100%; overflow-x: hidden; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font-body, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
  background: var(--c5, #f5f5f0);
  color: var(--on-page-bg, #22201d);
  line-height: 1.6;
  font-size: 15px;
}
/* Themes with a photo background (e.g. Orange/Mint Record Shop) render it on a dedicated
   fixed-viewport layer (.page-bg-photo, see below) rather than directly on `body` -- putting
   `background-size: cover` on `body` itself sizes relative to the *whole scrollable page*, not
   the viewport, so on any page taller than one screen the photo gets stretched hugely and a
   flat, washed-out patch (looking like a stray semi-transparent layer) is all that's left to see
   by the time you scroll near the bottom. A `position: fixed` element sized to the viewport
   doesn't have that problem, and plain `position: fixed` (unlike `background-attachment: fixed`)
   doesn't have the repaint/jank issues that property has historically had in mobile Safari. */
.page-bg-photo {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.35)), var(--page-bg-photo);
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
}
/* Vintage Entertainment Center's subject (the CRT TV) sits well below the top of its photo --
   on a wide/short desktop viewport `cover` is width-driven and crops vertically, so the default
   top-aligned position was cutting the TV off at the bottom of the frame. */
body.theme-vintage_entertainment_center .page-bg-photo { background-position: center 90%; }
h1, h2, h3 { font-family: var(--font-heading, 'Space Grotesk', 'Inter', sans-serif); font-weight: 700; line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--accent-text, #6B4A2F); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  position: relative;
  background: var(--c1, #1A1410);
  color: #fff;
  border-radius: 0 0 20px 20px;
}
/* The wavy edge used to be a separately-painted SVG patch filled with a flat color chosen to
   match the (flat) page background -- that only ever worked by coincidence, since a flat SVG
   fill can never reproduce a photo background sitting behind it. clip-path instead cuts a
   background layer into the wave shape, so whatever's really behind it (photo or flat color,
   doesn't matter) shows through directly with no separate color to keep in sync.
   Points are sampled from the original bezier curve (viewBox 0 0 1200 120,
   "M0,40 C300,150 900,-50 1200,50 L1200,120 L0,120 Z"), each remapped to
   calc(100% - Npx) so the wave always sits in a fixed ~56px band at the very bottom of the
   header regardless of the header's own (variable, content-driven) total height.
   The clip-path lives on a ::before pseudo-element, NOT .site-header itself -- clip-path clips
   an element's entire rendered box, content included, and the mobile nav dropdown (position:
   absolute, dropping down from .site-header-bar) extends past the header's own bottom edge.
   Clipping .site-header directly cut the dropdown off along with the background, which looked
   like the mobile menu had vanished/rendered "behind" the page. */
body.theme-swoopy .site-header {
  border-radius: 0;
  padding-bottom: 55px;
  background: none;
}
body.theme-swoopy .site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--c1, #1A1410);
  clip-path: polygon(
    0% 0%, 100% 0%,
    100% calc(100% - 39.7px),
    91.8% calc(100% - 51.9px),
    82.4% calc(100% - 56.0px),
    72.1% calc(100% - 54.1px),
    61.2% calc(100% - 48.2px),
    50% calc(100% - 40.4px),
    38.8% calc(100% - 32.7px),
    27.9% calc(100% - 27.3px),
    17.6% calc(100% - 26.3px),
    8.2% calc(100% - 31.6px),
    0% calc(100% - 45.3px)
  );
}
.site-header-bar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.75rem;
  flex-wrap: wrap;
}
.site-header .brand {
  color: var(--brand-text, #fff);
  font-family: var(--font-heading, 'Space Grotesk', sans-serif);
  font-weight: 700;
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* All-caps is a Video Store Night-specific styling choice (it suits Signwood's blocky look),
   not a general rule -- every other theme shows the library name/title in whatever case it was
   actually entered, same as `.brand-preview` below on the Account page. */
body.theme-video_store_night .site-header .brand,
body.theme-video_store_night .brand-preview { text-transform: uppercase; }
.site-header nav { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.site-header nav a {
  color: var(--on-c1, #fff);
  opacity: 0.85;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: 20px;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.site-header nav a:hover { opacity: 1; background: rgba(255,255,255,0.14); text-decoration: none; }

.nav-search {
  display: flex;
  align-items: center;
  position: relative;
  margin-right: 0.35rem;
}
/* The textbox itself is the pill (rounded fully on both ends, like the site's other buttons) --
   .nav-search is just an unstyled positioning wrapper now, not a separate visible "frame". A
   fixed height (rather than relying on padding + the button's height to agree) is what actually
   guarantees the box centers correctly in the nav row instead of drifting to one edge. */
/* [type=text] bumps specificity above the site-wide "form input[type=text]" rule (which also
   sets background/border-radius/padding/margin-top/width) -- without it, that rule's attribute
   selector out-specifies a plain ".nav-search input" and silently wins regardless of source
   order, leaving the pill styling below completely ignored. */
.nav-search input[type=text] {
  background: rgba(255,255,255,0.14);
  border: none;
  outline: none;
  color: var(--on-c1, #fff);
  font-family: inherit;
  font-size: 0.85rem;
  width: 150px;
  flex: 1 1 auto;
  min-width: 0;
  height: 2.25rem;
  line-height: 2.25rem;
  box-sizing: border-box;
  margin-top: 0;
  padding: 0 2.35rem 0 1rem;
  border-radius: 999px;
}
.nav-search input[type=text]:focus { background: rgba(255,255,255,0.22); }
.nav-search input[type=text]::placeholder { color: var(--on-c1, #fff); opacity: 0.7; }
.nav-search button {
  position: absolute;
  top: 50%;
  right: 0.15rem;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--on-c1, #fff);
  opacity: 0.85;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.95rem;
  height: 1.95rem;
  border-radius: 50%;
  font-size: 1rem;
  flex-shrink: 0;
}
.nav-search button:hover { opacity: 1; background: rgba(255,255,255,0.18); }


.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--on-c1, #fff);
  font-size: 1.3rem;
  cursor: pointer;
}
.nav-toggle:hover { background: rgba(255,255,255,0.14); }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .site-header nav {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--c1, #1A1410);
    padding: 0.5rem 1rem 1rem;
    border-radius: 0 0 16px 16px;
    gap: 0.15rem;
    z-index: 5;
  }
  .site-header-bar { position: relative; }
  .site-header nav.nav-open { display: flex; }
  .site-header nav a { padding: 0.7rem 1rem; }
}

.container { position: relative; z-index: 1; flex: 1 0 auto; width: 100%; max-width: 1100px; margin: 0 auto; padding: 2.25rem 1.5rem; }

.site-footer {
  position: relative;
  text-align: center;
  margin-top: 2rem;
}
.site-footer-content {
  position: relative;
  z-index: 2;
  padding: 2rem 1.5rem 1.5rem;
  font-size: 0.82rem;
  color: #8a8a80;
}
/* Mirror of the header's clip-path above -- footer's curve keeps the LOWER region solid (its
   own content) and clips away the upper ~50-56px band, revealing whatever's really behind it.
   Sampled from "M0,80 C300,-50 900,150 1200,70 L1200,0 L0,0 Z" (same viewBox), remapped to
   plain px-from-top since the flat region here is at the BOTTOM (100%), not the top. */
body.theme-swoopy .site-footer {
  background: var(--c1, #1A1410);
  padding-top: 55px;
  overflow: hidden;
  clip-path: polygon(
    0% 45.3px,
    8.2% 28.5px,
    17.6% 20.8px,
    27.9% 20.2px,
    38.8% 24.6px,
    50% 31.9px,
    61.2% 40.0px,
    72.1% 47.0px,
    82.4% 50.6px,
    91.8% 48.9px,
    100% 39.7px,
    100% 100%, 0% 100%
  );
}
body.theme-swoopy .site-footer-content { color: var(--on-c1, #22201d); }
body.theme-swoopy .site-footer-content a { color: var(--on-c1, #22201d); font-weight: 600; }

.card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 18px;
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.25rem;
  color: #22201d;
}

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.4rem;
}

.item-card {
  position: relative;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 14px;
  overflow: hidden;
  color: #22201d;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.item-card:hover { border-color: var(--c4, #2E5339); transform: translateY(-2px); }
.item-card-link { display: block; color: inherit; text-decoration: none; }
.item-card-link:hover { text-decoration: none; }
.item-card-edit-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  z-index: 2;
  transition: background 0.15s ease;
}
.item-card-edit-btn:hover { background: rgba(0,0,0,0.8); text-decoration: none; }
.item-card-cover {
  aspect-ratio: 2 / 3;
  background: var(--light-tint, #eef0ea);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent-text, #6B4A2F);
  overflow: hidden;
}
.item-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.item-card-body { padding: 0.7rem 0.85rem; }
.item-card-title { font-weight: 600; font-size: 0.9rem; margin: 0 0 0.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-card-meta { font-size: 0.78rem; color: #8a8a80; }
.item-card-location { font-size: 0.78rem; color: #8a8a80; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Wraps rather than ellipsing like .item-card-location above it: on a narrow gallery card the
   truncation fell on the date itself, which is the whole point of the line. */
.item-card-consumed { font-size: 0.78rem; color: #8a8a80; font-style: italic; }

.category-filter { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.category-filter a {
  padding: 0.45rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(0,0,0,0.12);
  color: var(--on-page-bg, #22201d);
  font-size: 0.88rem;
  font-weight: 500;
}
.category-filter a.active { background: var(--c2, #2E5339); color: var(--on-c2, #fff); border-color: transparent; }
.category-filter a.active::before { content: '\2605'; margin-right: 0.35rem; }
.category-filter a:hover { text-decoration: none; border-color: var(--c2, #2E5339); }
/* Inside a white .card (e.g. the search page filters), var(--on-page-bg) is tuned for the
   page/panel background and can end up unreadable on white -- use the on-white-safe accent
   color there instead. */
.card .category-filter a { color: var(--accent-text, #22201d); }
.card .category-filter a.active { color: var(--on-c2, #fff); }

.af-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  margin-top: 0.3rem;
  max-height: 260px;
  overflow-y: auto;
}
.af-dropdown-item {
  padding: 0.6rem 0.9rem;
  font-size: 0.88rem;
  font-weight: normal;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.af-dropdown-item:last-child { border-bottom: none; }
.af-dropdown-item:hover { background: var(--light-tint, #eef0ea); }

.notice {
  background: var(--light-tint, #eef0ea);
  color: #22201d;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 1rem 1.25rem;
  border-radius: 14px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}
.error {
  background: #fdecea;
  border: 1px solid #f3c7c2;
  color: #922;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
}

form label { display: block; margin-bottom: 1rem; font-weight: 600; font-size: 0.88rem; }
form input[type=text], form input[type=email], form input[type=password],
form input[type=number], form input[type=date], form input[type=url],
form input[type=file], form select, form textarea {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid #ddd;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: normal;
  background: #fff;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--c2, #2E5339);
}
form .row { display: flex; gap: 1rem; flex-wrap: wrap; }
form .row label { flex: 1; min-width: 160px; }
form .row .field-group { flex: 1; min-width: 160px; }
form fieldset { border: 1px solid #e6e6e0; border-radius: 14px; padding: 1.1rem; margin-bottom: 1.25rem; }
form legend { font-family: var(--font-heading, 'Space Grotesk', sans-serif); font-weight: 700; padding: 0 0.4rem; }

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: 24px;
  border: none;
  font-family: var(--font-heading, 'Space Grotesk', sans-serif);
  font-weight: 500;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-small { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-primary { background: linear-gradient(180deg, var(--c2, #2E5339), var(--c2-gradient, #1e3a25)); color: var(--on-c2, #fff); border: 1px solid rgba(0,0,0,0.06); }
.btn-primary:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--accent-text, #6B4A2F); border: 1px solid var(--accent-text, #6B4A2F); }
.btn-secondary:hover { background: var(--light-tint, #eef0ea); text-decoration: none; }
.btn-danger { background: #c0392b; color: #fff; }
/* .page-head sits directly on the page background (--c5), not a white .card -- var(--accent-text)
   is deliberately tuned to read on white (see accent_text_color()) and can land dark-on-dark
   there instead (e.g. item_view.php's "Edit" button). Use the page-bg-safe contrast color
   instead. :not(.btn-danger) leaves the solid-red Delete button's own colors alone. */
.page-head .btn-secondary:not(.btn-danger),
.category-tools .btn-secondary:not(.btn-danger) { color: var(--on-page-bg, #22201d); border-color: var(--on-page-bg, #22201d); }
.page-head .btn-secondary:not(.btn-danger):hover,
.category-tools .btn-secondary:not(.btn-danger):hover { background: rgba(255,255,255,0.15); }

.muted { color: #8a8a80; font-size: 0.86rem; }

.auth-split { display: flex; gap: 2.5rem; align-items: center; flex-wrap: wrap; }
.auth-intro { flex: 1; min-width: 260px; }
.auth-card { flex: 1; min-width: 300px; max-width: 420px; }
.auth-divider { text-align: center; margin: 1rem 0; color: #8a8a80; font-size: 0.85rem; }
.member-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.member-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.member-list li:last-child { border-bottom: none; }
.member-list .muted { display: block; font-size: 0.8rem; }
.btn-google { width: 100%; justify-content: center; box-sizing: border-box; }

.item-detail { display: flex; gap: 1.75rem; flex-wrap: wrap; }
.item-detail-cover { width: 220px; flex-shrink: 0; }
.item-detail-cover .item-card-cover { border-radius: 14px; }
.item-detail-fields { flex: 1; min-width: 260px; }
.item-detail-fields dt { font-weight: 600; font-size: 0.82rem; color: #8a8a80; margin-top: 0.75rem; }
.item-detail-fields dd { margin: 0.1rem 0 0; }

@media (max-width: 600px) {
  .container { padding: 1.5rem 1rem; }
  .card { padding: 1.1rem 1.2rem; }
}

/* ---------------------------------------------------------------------------
 * Homepage controls + carousel/gallery (theme-driven: colors/fonts come from
 * CSS vars set in header.php, so this same markup and CSS works for every
 * theme -- a theme only needs to change the vars, its font faces, and swoopy)
 * ------------------------------------------------------------------------- */

.home-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.home-controls .category-filter { margin-bottom: 0; }

.category-tools { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.category-tools .muted { font-size: 0.85rem; }

.mass-edit-scroll { overflow-x: auto; margin-bottom: 1rem; }
.mass-edit-table { border-collapse: collapse; width: 100%; }
.mass-edit-table th, .mass-edit-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid rgba(0,0,0,0.08); white-space: nowrap; }
.mass-edit-table th { text-align: left; font-size: 0.78rem; color: #8a8a80; font-weight: 600; }
.mass-edit-table input, .mass-edit-table select {
  width: auto;
  min-width: 110px;
  margin-top: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}
.mass-edit-table input[type=number] { min-width: 80px; }
.mass-edit-table input[type=date] { min-width: 140px; }
.mass-edit-table td[data-col=title] input,
.mass-edit-table td[data-col=physical_location] input,
.mass-edit-table td[data-col=genre] input { min-width: 220px; }
.mass-edit-hint { margin-bottom: 0.5rem; }

.view-toggle { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; font-weight: 600; color: var(--on-page-bg, #22201d); cursor: pointer; user-select: none; }
.view-toggle .switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.view-toggle .switch input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.view-toggle .switch-track { position: absolute; inset: 0; background: rgba(0,0,0,0.25); border-radius: 999px; transition: background 0.2s ease; }
.view-toggle .switch-track::before { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s ease; }
.view-toggle input:checked + .switch-track { background: var(--c2, #2E5339); }
.view-toggle input:checked + .switch-track::before { transform: translateX(18px); }

.home-carousel-wrap { position: relative; display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 1.5rem 0 2.5rem; overflow: hidden; }
.home-carousel-wrap[hidden] { display: none; }
.carousel-track { position: relative; height: 320px; width: 100%; max-width: 720px; touch-action: pan-y; }
.carousel-card {
  position: absolute;
  top: 0;
  left: 50%;
  width: 190px;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: var(--light-tint, #eef0ea);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.carousel-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-card .carousel-card-icon { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: var(--accent-text, #6B4A2F); }
@media (min-width: 721px) {
  .carousel-track { height: 400px; max-width: 900px; }
  .carousel-card { width: 238px; }
}
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.88), rgba(0,0,0,0.2) 65%, transparent);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
/* The front card's overlay/link is always interactive, even while invisible (opacity 0) --
   clicking the magnifier icon must not depend on a mouseenter having fired first to unlock it. */
.carousel-card.is-front .card-overlay { pointer-events: auto; }
.card-overlay .overlay-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.15rem; }
.card-overlay .overlay-meta { font-size: 0.78rem; opacity: 0.85; margin: 0; }
.card-overlay .overlay-consumed { font-style: italic; opacity: 0.75; }
.card-overlay .overlay-link {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: #22201d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.carousel-arrow {
  background: var(--c2, #2E5339);
  color: var(--on-c2, #fff);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.carousel-arrow:hover { opacity: 0.9; }
.carousel-arrow:disabled, .carousel-random-spinning .carousel-arrow { opacity: 0.5; cursor: default; }

.carousel-actions { display: flex; justify-content: center; margin-top: 0.5rem; margin-bottom: 1.5rem; }
.carousel-actions[hidden] { display: none; }
#carousel-random-btn {
  background: var(--c2, #2E5339);
  color: var(--on-c2, #fff);
  border: none;
  padding: 0.6rem 1.4rem;
}
#carousel-random-btn:hover { opacity: 0.9; }
#carousel-random-btn:disabled { opacity: 0.6; cursor: default; }

.home-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.2rem; }
.home-gallery-grid[hidden] { display: none; }

@media (max-width: 720px) {
  .carousel-arrow { display: none; }
  .home-carousel-wrap { padding: 1rem 0 2rem; }
}
@media (max-width: 600px) {
  .home-gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
  .home-gallery-grid .item-card-body { padding: 0.4rem 0.5rem; }
  .home-gallery-grid .item-card-title { font-size: 0.78rem; }
  .home-gallery-grid .item-card-meta { font-size: 0.68rem; }
  .home-gallery-grid .item-card-location { font-size: 0.68rem; }
  .home-gallery-grid .item-card-consumed { font-size: 0.68rem; }
}

/* ---------------------------------------------------------------------------
 * Report a Problem modal
 * ------------------------------------------------------------------------- */

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.modal-backdrop[hidden] { display: none; }
.modal { background: #fff; color: #22201d; border-radius: 16px; padding: 1.75rem; max-width: 420px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: 0.75rem; right: 0.75rem; width: 32px; height: 32px; border: none; background: transparent; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #666; font-size: 1rem; }
.modal-close:hover { background: rgba(0,0,0,0.06); }

.site-footer-links { margin: 0.15rem 0 0.85rem; }

.theme-swatch { display: inline-flex; gap: 2px; }
.theme-swatch i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,0.12); }

/* ---------------------------------------------------------------------------
 * Scan page: freeze-frame + scan-line overlay shown while a captured photo is
 * being identified, so there's a clear "something is happening" signal.
 * ------------------------------------------------------------------------- */

#scan-viewport { position: relative; overflow: hidden; }
/* Quagga (used for comics, since only it can read the issue-number add-on) injects its OWN
   <video> and overlay <canvas> into this container and styles neither -- so the video rendered
   at the camera's native resolution, blowing well past the container and pushing the Scan with
   AI button off-screen. The native BarcodeDetector path doesn't hit this because the code sets
   video.style.width itself. Constrain whatever either path injects. */
#scan-viewport video,
#scan-viewport canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}
/* Quagga's detection overlay has to sit ON the video rather than stacking beneath it, which
   would otherwise double the container's height. */
#scan-viewport canvas.drawingBuffer,
#scan-viewport canvas.drawing {
  position: absolute;
  top: 0;
  left: 0;
}
.scan-freeze-overlay {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  overflow: hidden;
  z-index: 5;
}
.scan-freeze-overlay img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-freeze-overlay::after {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  height: 3px;
  border-radius: 2px;
  background: var(--c2, #2E5339);
  box-shadow: 0 0 14px 3px var(--c2, #2E5339);
  animation: scan-sweep 1.6s ease-in-out infinite;
}
.scan-freeze-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.6rem 0.9rem;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}
@keyframes scan-sweep {
  0% { top: 3%; }
  50% { top: 95%; }
  100% { top: 3%; }
}
