/* ============================================================================
   shell-guest.css -- the wedding guest's surface, layered on tokens.css.

   This is a phone-first, photograph-heavy surface shown to someone who has
   never used the product, once, on a borrowed phone, at a wedding. It gets
   the per-studio brand colour and a serif display face; the dashboard's
   cyan and Manrope would be wrong here.
   ========================================================================== */

:root {
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --main-max: 520px;

  /* Per-studio, injected by the template AFTER this file so it wins the
     cascade. The default matches what templates/base.html shipped. */
  --brand: #e8b84b;
  /* The ink that sits ON the brand button. Dark in both themes, because
     --brand is a warm gold either way and white on gold is ~1.6:1. */
  --on-brand: #201400;

  /* ------------------------------------------------------------------
     COMPATIBILITY ALIASES.

     templates/guests/* uses --paper / --line / --ink / --muted in 46
     inline style="" attributes and across its own <style> blocks. These
     nine lines mean not one of those call sites has to be touched.

     Deprecated from birth: pure var() indirection, never a duplicated
     value, so there is exactly one source of truth per colour. They are
     deliberately NOT defined for the dashboard -- that is what lets the
     token lint keep catching strays like the --ink and --brand leaks
     found in dashboard/overview.html and event_plans.html.
     ------------------------------------------------------------------ */
  --paper:   var(--surface-2);
  --paper-2: var(--surface-raised);
  --line:    var(--border);
  --ink:     var(--text);
  --muted:   var(--text-muted);
  --muted-2: var(--text-faint);

  /* The second glow in the body gradient. A fixed violet in the original;
     --accent-2 carries the same role and follows the theme. */
  --guest-glow-2: rgb(var(--accent-2-rgb) / .12);
  --accent-2-rgb: 129 92 246;
}

/* --------------------------------------------------------------------------
   THE LIGHT PHOTO GALLERY.

   This is the part that is genuinely new design, not a token flip. A grid
   of wedding photographs on near-white behaves nothing like the same grid
   on near-black:

   * On dark, a photo's own edge IS the separation -- the image is lighter
     than everything around it, so no border is needed and a shadow would
     be invisible anyway.
   * On light, a photo bleeds into the page. Bright skies, white lehengas
     and pale walls run straight off the edge of the tile and the grid
     reads as one smeared block.

   So in light mode every tile gets a hairline border and a real shadow to
   lift it off the paper, and the gradient glow behind the page is pulled
   right down -- at dark-mode strength it tints white paper visibly pink.
   -------------------------------------------------------------------------- */
:root {
  --tile-ring: 1px solid rgb(23 21 18 / .10);
  --tile-shadow: 0 1px 2px rgb(23 21 18 / .06), 0 6px 16px -10px rgb(23 21 18 / .22);
  --glow-strength: 7%;
  --card-sheen: rgb(23 21 18 / .02);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tile-ring: 1px solid transparent;
    --tile-shadow: none;
    --glow-strength: 14%;
    --card-sheen: rgb(255 255 255 / .02);
    --accent-2-rgb: 129 92 246;
  }
}
:root[data-theme="dark"] {
  --tile-ring: 1px solid transparent;
  --tile-shadow: none;
  --glow-strength: 14%;
  --card-sheen: rgb(255 255 255 / .02);
  --accent-2-rgb: 129 92 246;
}

/* --------------------------------------------------------------------------
   The appearance control. Deliberately small and in the footer.

   A one-session guest on a borrowed phone will never curate a theme, and
   on a 520px capture-then-search flow every control competes with the
   primary action. Their phone already told us what they want; this is the
   escape hatch for the one in a hundred who disagrees.
   -------------------------------------------------------------------------- */
.theme-mini {
  display: inline-flex; gap: .15rem; vertical-align: middle;
  margin-left: .35rem; padding: .1rem;
  border: 1px solid var(--line); border-radius: 999px;
}
.theme-mini button {
  all: unset; cursor: pointer; width: 26px; height: 22px; min-height: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; color: var(--muted-2);
}
.theme-mini button[aria-pressed="true"] { background: var(--paper); color: var(--brand); }
.theme-mini button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.theme-mini svg { width: 13px; height: 13px; display: block; }

/* Card lift. The inset hairline and the drop shadow both have to invert:
   on dark a card is lifted by a bright top edge and a deep black shadow,
   on light by a soft neutral shadow and no inset at all (a white inset on
   white paper is invisible, and a dark one reads as a crease). */
:root {
  --card-inset: 0 1px 0 rgb(255 255 255 / .6) inset;
  --card-shadow: 0 1px 2px rgb(23 21 18 / .05), 0 16px 34px -24px rgb(23 21 18 / .18);
  --card-shadow-hover: 0 2px 4px rgb(23 21 18 / .06), 0 22px 40px -22px rgb(23 21 18 / .26);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --card-inset: 0 1px 0 rgb(255 255 255 / .03) inset;
    --card-shadow: 0 16px 34px -22px rgb(0 0 0 / .7);
    --card-shadow-hover: 0 22px 40px -20px rgb(0 0 0 / .8);
  }
}
:root[data-theme="dark"] {
  --card-inset: 0 1px 0 rgb(255 255 255 / .03) inset;
  --card-shadow: 0 16px 34px -22px rgb(0 0 0 / .7);
  --card-shadow-hover: 0 22px 40px -20px rgb(0 0 0 / .8);
}

/* Feature-category accents, used on guests/search.html's three option
   cards ("Find My Photos" / "Browse All Photos" / "Select Photos for
   Album"). Browse All Photos reuses tokens.css's existing --processing
   family as-is (its violet already fits "AI magic"); these two are new
   because nothing in tokens.css already carried a teal or a cyan. Light
   values are WCAG-legible on near-white paper; dark values are the
   saturated originals that page shipped with when the guest shell was
   dark-only. --cat-album's light value is deliberately the same #0e7490
   the dashboard's light --accent uses -- same colour, same reason: raw
   #22d3ee is ~1.9:1 on white. */
:root {
  --cat-selfie: #0f766e; --cat-selfie-rgb: 15 118 110;
  --cat-album:  #0e7490; --cat-album-rgb:  14 116 144;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cat-selfie: #2dd4bf; --cat-selfie-rgb: 45 212 191;
    --cat-album:  #22d3ee; --cat-album-rgb:  34 211 238;
  }
}
:root[data-theme="dark"] {
  --cat-selfie: #2dd4bf; --cat-selfie-rgb: 45 212 191;
  --cat-album:  #22d3ee; --cat-album-rgb:  34 211 238;
}


/* ---- Guest photo viewer (templates/guests/_lightbox.html) ----------------
   Sits over a photograph, so only the theme-invariant media tokens are used
   for its chrome (plus --brand on the one primary action). Explicit resets:
   the shell's global button rule (full-width, brand fill) must not leak in.
   The translate on .lb-bar/.lb-nav is safe -- no fixed descendants. */
.lb { position: fixed; inset: 0; z-index: 200; background: var(--lightbox-bg);
      align-items: center; justify-content: center; overflow: hidden; }
.lb-viewport { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
               overflow: hidden; touch-action: none; }
.lb-img { max-width: min(92vw, 1600px); max-height: calc(100dvh - 9.5rem); border-radius: 10px;
          box-shadow: var(--media-shadow-lg); cursor: grab; user-select: none; transform-origin: center center; }
.lb-btn { appearance: none; -webkit-appearance: none; display: inline-flex; align-items: center; justify-content: center;
          gap: .45rem; width: 44px; height: 44px; min-width: 44px; margin: 0; padding: 0; border: 0; border-radius: 999px;
          background: transparent; color: var(--media-chip-fg); box-shadow: none; text-decoration: none;
          font: 600 .9rem/1 var(--font-body); letter-spacing: .01em; cursor: pointer;
          transition: background-color .15s ease, transform .1s ease, color .15s ease;
          -webkit-tap-highlight-color: transparent; }
.lb-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.lb-btn:hover { background: color-mix(in srgb, var(--media-chip-fg) 14%, transparent); }
.lb-btn:active { transform: scale(.93); }
.lb-btn:focus-visible { outline: 2px solid var(--media-chip-fg); outline-offset: 2px; }
.lb-glass { background: var(--lightbox-control-bg); border: 1px solid color-mix(in srgb, var(--media-chip-fg) 14%, transparent);
            -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.lb-glass:hover { background: color-mix(in srgb, var(--lightbox-control-bg) 70%, var(--media-chip-fg)); }

.lb-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center;
          justify-content: space-between; padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 1rem
          max(1rem, env(safe-area-inset-left)); pointer-events: none; }
.lb-top > * { pointer-events: auto; }
.lb-counter { color: var(--media-chip-fg); font: 600 .85rem/1 var(--font-body); letter-spacing: .06em;
              padding: .55rem .9rem; border-radius: 999px; background: var(--lightbox-control-bg);
              border: 1px solid color-mix(in srgb, var(--media-chip-fg) 14%, transparent);
              -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); font-variant-numeric: tabular-nums; }
.lb-counter:empty { visibility: hidden; }

.lb-nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 3; width: 52px; height: 52px; }
.lb-nav svg { width: 24px; height: 24px; }
.lb-prev { left: max(1rem, env(safe-area-inset-left)); }
.lb-next { right: max(1rem, env(safe-area-inset-right)); }

.lb-bar { position: absolute; left: 50%; bottom: max(1.1rem, env(safe-area-inset-bottom)); translate: -50% 0; z-index: 3;
          display: flex; align-items: center; gap: .2rem; padding: .35rem; border-radius: 999px;
          background: var(--lightbox-control-bg); border: 1px solid color-mix(in srgb, var(--media-chip-fg) 14%, transparent);
          -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
          box-shadow: var(--media-shadow-lg); }
.lb-sep { width: 1px; height: 24px; margin: 0 .3rem; background: color-mix(in srgb, var(--media-chip-fg) 24%, transparent); }
.lb-dl { position: relative; width: auto; padding: 0 1.15rem 0 1rem; margin-left: .7rem;
         background: var(--brand); color: var(--on-brand); }
.lb-dl:hover { background: color-mix(in srgb, var(--brand) 86%, var(--media-chip-fg)); }
.lb-dl::before { content: ""; position: absolute; left: -.5rem; top: 10px; bottom: 10px; width: 1px;
                 background: color-mix(in srgb, var(--media-chip-fg) 24%, transparent); }
@media (max-width: 480px) {
  .lb-img { max-width: 100vw; border-radius: 0; max-height: calc(100dvh - 10rem); }
  .lb-nav { width: 44px; height: 44px; }
  .lb-dl { width: 44px; padding: 0; margin-left: .7rem; }
  .lb-dl span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .lb-btn { transition: none; } }


/* ---- Guest gallery pages: guests/all_photos.html + guests/gallery.html ---
   Header (.ap-head), Slideshow/Sort buttons (.ap-btn, .ap-sort), sticky
   filter bar (.ap-bar, .ap-row, .ap-chip), masonry tiles (.ap-grid ...),
   empty states (.ap-empty). Tile rules are scoped to .ap-grid so other
   pages' .photo-tile (album_select) are untouched. */
/* ---- header */
.ap-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
           padding: .4rem .2rem 1.1rem; }
.ap-back { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: .7rem; font-size: .85rem;
           font-weight: 600; color: var(--muted); text-decoration: none; }
.ap-back:hover { color: var(--ink); }
.ap-eyebrow { margin: 0 0 .25rem; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
              color: var(--muted); font-weight: 600; }
.ap-title { margin: 0; font-family: var(--font-display); font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.1;
            color: var(--ink); overflow-wrap: anywhere; }
.ap-sub { margin: .35rem 0 0; color: var(--muted); font-size: .92rem; }
.ap-actions { display: flex; gap: .5rem; align-items: center; }
.ap-btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; width: auto; height: 42px;
          margin: 0; padding: 0 1rem; border-radius: 999px; font-size: .9rem; font-weight: 600; line-height: 1;
          cursor: pointer; text-decoration: none; white-space: nowrap; list-style: none;
          background: var(--paper); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--card-shadow);
          transition: border-color .15s, background .15s; }
.ap-btn:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); }
.ap-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.ap-btn.is-primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.ap-btn.is-primary:hover { filter: brightness(1.05); }

/* custom sort menu (<details>, no JS needed to open) */
.ap-sort { position: relative; }
.ap-sort summary::-webkit-details-marker { display: none; }
.ap-sort summary .lbl { color: var(--muted); font-weight: 500; }
.ap-sort[open] summary { border-color: var(--brand); }
.ap-sort-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 190px; padding: .35rem;
                background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--card-shadow-hover); }
.ap-sort-menu a { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .6rem .75rem;
                  border-radius: 9px; color: var(--ink); text-decoration: none; font-size: .92rem; }
.ap-sort-menu a:hover { background: var(--paper-2); }
.ap-sort-menu a[aria-current="true"] { font-weight: 700; }
.ap-sort-menu a svg { width: 16px; height: 16px; visibility: hidden; color: var(--brand); }
.ap-sort-menu a[aria-current="true"] svg { visibility: visible; }

/* ---- sticky filter bar */
.ap-bar { position: sticky; top: 0; z-index: 20; margin: 0 0 1rem; padding: .65rem .7rem; border-radius: var(--radius-md, 16px);
          background: color-mix(in srgb, var(--paper) 88%, transparent); border: 1px solid var(--line);
          -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
          box-shadow: var(--card-shadow); display: flex; flex-direction: column; gap: .55rem; }
.ap-row { display: flex; align-items: center; gap: .45rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
          padding: 1px; }
.ap-row::-webkit-scrollbar { display: none; }
.ap-row-label { flex-shrink: 0; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2, var(--muted));
                font-weight: 700; margin-right: .2rem; }
.ap-bar .folder-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0; }
.ap-bar .folder-chips::-webkit-scrollbar { display: none; }
.ap-chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: .35rem; width: auto; height: 34px; margin: 0;
           padding: 0 .9rem; border-radius: 999px; font-size: .86rem; font-weight: 600; line-height: 1; cursor: pointer;
           background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none;
           transition: background .15s, color .15s, border-color .15s; }
.ap-chip:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); }
.ap-chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ap-chip svg { width: 14px; height: 14px; }
.ap-info { flex-shrink: 0; display: inline-flex; color: var(--muted-2, var(--muted)); cursor: help; margin-left: .1rem; }
.ap-info svg { width: 16px; height: 16px; }

/* ---- grid tiles */
.ap-grid-wrap { padding: 0; }
.ap-grid .photo-tile { border-radius: 10px; overflow: hidden; background: var(--paper-2); cursor: zoom-in; }
.ap-grid .photo-tile img { display: block; width: 100%; border-radius: 0; transition: transform .35s ease, filter .35s ease; }
.ap-grid .photo-tile:hover img { transform: scale(1.03); }
.ap-grid .photo-tile .fav-btn { position: absolute; top: .45rem; right: .45rem; z-index: 2; width: 34px; height: 34px; min-width: 0;
           margin: 0; padding: 0; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--media-chip-fg) 18%, transparent);
           background: var(--media-chip-bg); color: var(--media-chip-fg); display: flex; align-items: center; justify-content: center;
           -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: none; cursor: pointer;
           transition: transform .1s; }
.ap-grid .photo-tile .fav-btn:active { transform: scale(.9); }
.ap-grid .photo-tile .fav-btn svg { width: 16px; height: 16px; }
.ap-grid .tile-actions { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; align-items: center;
                justify-content: flex-end; gap: .35rem; padding: 1.6rem .45rem .45rem;
                background: linear-gradient(transparent, var(--media-scrim)); opacity: 0; transition: opacity .2s; pointer-events: none; }
.ap-grid .photo-tile:hover .tile-actions, .ap-grid .photo-tile:focus-within .tile-actions { opacity: 1; }
.ap-grid .tile-actions a, .ap-grid .tile-actions button { pointer-events: auto; width: 34px; height: 34px; min-width: 0; margin: 0; padding: 0;
           border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--media-chip-fg);
           background: color-mix(in srgb, var(--media-chip-fg) 16%, transparent); border: 0; box-shadow: none; text-decoration: none; cursor: pointer; }
.ap-grid .tile-actions a:hover, .ap-grid .tile-actions button:hover { background: color-mix(in srgb, var(--media-chip-fg) 28%, transparent); }
.ap-grid .tile-actions svg { width: 17px; height: 17px; }
@media (hover: none) { .ap-grid .tile-actions { opacity: 1; padding-top: 1.2rem; } .ap-grid .photo-tile:hover img { transform: none; } }

.ap-empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.ap-empty svg { width: 40px; height: 40px; color: var(--muted-2, var(--muted)); margin-bottom: .6rem; }
.ap-empty b { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: .25rem; }
@media (max-width: 560px) {
  .ap-head { align-items: flex-start; }
  .ap-actions { width: 100%; flex-wrap: wrap; }
  .ap-actions > * { flex: 1 1 auto; }
  .ap-actions .ap-btn { padding: 0 .75rem; font-size: .85rem; gap: .35rem; }
  .ap-sort > summary.ap-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .ap-grid .photo-tile img, .ap-grid .tile-actions { transition: none; } }
