/*
 * galarie.css — Galarie shared design system
 * ============================================
 * Single source of truth for all visual design across the Galarie ecosystem.
 * Lives at packages/ui/galarie.css. Served via Apache Alias at /packages/ui/galarie.css
 * so all apps on the same VPS share one copy.
 *
 * HOW TO INCLUDE
 * --------------
 *   Always include via _theme.php — never link this file directly.
 *   _theme.php outputs the <link> tag and injects a :root override block
 *   with per-install palette tokens from settings.json.
 *
 *     Root-level page:    <?php require_once __DIR__ . '/_theme.php'; ?>
 *     Subdirectory page:  <?php require_once __DIR__ . '/../_theme.php'; ?>
 *
 *   Add <body data-theme="<?= $palette_name ?>"> to activate theme overrides.
 *   Put page-specific styles in a <style> block after _theme.php.
 *   Never duplicate or redefine components from this file in page styles.
 *
 * TOKEN REFERENCE
 * ---------------
 *   Semantic (Galarie brand names — use in new code):
 *   --parchment        Page background (#F4F1EC)
 *   --parchment-deep   Hover / alternate section background (#EDE9E1)
 *   --paper            Card / surface background (#FAFAF6)
 *   --forest           Primary text, headings (#2C3328)
 *   --fern             Primary brand color — CTAs, active states (#5C7A52)
 *   --fern-light       Secondary text, nav links (#7A8B72)
 *   --fern-muted       Tertiary text, placeholders (#A3B09B)
 *   --terracotta       Warm accent — badges, supporting details (#C2785C)
 *   --terracotta-light Hover on terracotta elements (#D4967E)
 *   --bark             Dark accent, hover on fern (#4A5744)
 *   --stone            Borders, dividers (#D4CFC3)
 *   --stone-light      Subtle borders, card edges (#E3DFD6)
 *
 *   Generic aliases (existing component code uses these — map to semantic):
 *   --bg            → --parchment
 *   --surface       → --paper
 *   --surface2      → --parchment-deep
 *   --border        → --stone
 *   --accent        → --fern
 *   --accent-dim    Transparent tint of fern (hover fills, badges)
 *   --text          → --forest
 *   --text-muted    → --fern-muted
 *   --text-dim      → --fern-light
 *   --success       Positive state (#2d5a3d)
 *   --danger        Destructive action / error state (#9b3a3a)
 *   --portfolio     Portfolio accent, blue-slate (#3a5a7a)
 *   --portfolio-dim Transparent tint of portfolio
 *
 *   Shape:
 *   --radius        Button / input / default border-radius (6px)
 *   --radius-card   Card border-radius (10px)
 *   --radius-pill   Badge / pill border-radius (100px)
 *   --border-width  Decorative border width (0.5px)
 *
 * COMPONENT INVENTORY
 * -------------------
 *   Reset & base       *, body, scrollbar
 *   Header             .header, .header-brand, .header-logo, .header-right,
 *                      .header-count, .upload-link, .logout-link, .settings-btn
 *   Tab bar            .tab-bar, .tab-btn, .tab-btn.active/.disabled,
 *                      .tab-badge, .tab-panel
 *   Buttons            .btn, .btn-danger, .btn-ghost, .btn-lb
 *                      Fuse-lighting animation on primary .btn
 *   Form fields        .field, label, input, select, textarea, .field-hint, .error
 *   Modals             .modal-backdrop, .modal, .modal-title, .modal-sub,
 *                      .modal-actions, .modal-thumb
 *   Cards & grid       .grid-wrap, .grid, .card, .card-img-wrap, .card-meta,
 *                      .card-subject, .card-detail, .card-tags
 *   Tags               .tag, .tag.wedding/engagement/elopement/proposal/
 *                      family/senior/commercial/personal/other
 *   Lightbox           .lightbox, .lightbox-inner, .lightbox-img-wrap,
 *                      .lightbox-info, .lightbox-subject, .lightbox-venue,
 *                      .info-row, .lightbox-actions, .lightbox-close,
 *                      .lightbox-nav.prev/.next
 *   Portfolio popup    .add-to-existing-popup, .ate-item, .ate-item-name,
 *                      .ate-item-count, .ate-empty
 *   Empty states       .empty, .empty-title (with ✦ ::before and underline ::after)
 *   Toast              .toast, .toast.show
 *   Loading            .loading (Galarie bloom/ivy/spine animations)
 *   Theme overrides    [data-theme="spark"], [data-theme="quantum"],
 *                      [data-theme="ink"], [data-theme="photo-club"], [data-theme="vaporwave"]
 *   Flourish           fadeUp keyframe, .grid.loaded .card stagger,
 *                      .pf-header dot-grid, empty-state decorations
 *   Responsive         @media (max-width: 600px) shared component overrides
 *
 * THEME PALETTES (data-theme on <body>)
 * --------------------------------------
 *   (default)      Warm-neutral galarie palette — client-facing library pages.
 *                  Token values injected by _theme.php from settings.json.
 *   spark          Dark tool interface — all internal Spark ecosystem tools
 *                  (broadcast, calendar, ops). Dot-grid body, Fraunces headings.
 *                  Never used on client-facing library pages.
 *   quantum        High-contrast black/white brutalist — library client option
 *   ink            Dark warm — library client option
 *   photo-club     Warm gold — library client option
 *   vaporwave      Retro grid — library client option
 *
 * APACHE ALIAS (add to VHost config on VPS before deploying)
 * -----------------------------------------------------------
 *   Alias /packages/ui/ /var/www/galarie.co/packages/ui/
 *   <Directory /var/www/galarie.co/packages/ui/>
 *       Require all granted
 *   </Directory>
 *
 * SHARED ASSETS
 * -------------
 *   Brand SVGs live at packages/ui/assets/ (see GitHub issue #3).
 *   Reference as /packages/ui/assets/spark-bolt.svg etc.
 */

/* ── FONTS ─────────────────────────────────────────────────────────────────── */
/* DM Serif Display + DM Sans are the Galarie brand fonts.                     */
/* Fraunces is loaded here for [data-theme="spark"] only — easter egg theme.   */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300;1,9..40,400&family=DM+Serif+Display:ital@0;1&family=Fraunces:ital,opsz,wght@1,9..144,700&display=swap');

/* ── TOKEN DEFAULTS ─────────────────────────────────────────────────────────── */
/* Overridden per-request by _theme.php's inline :root block */
:root {
  /* Galarie semantic palette */
  --parchment:        #F4F1EC;
  --parchment-deep:   #EDE9E1;
  --paper:            #FAFAF6;
  --forest:           #2C3328;
  --fern:             #5C7A52;
  --fern-light:       #7A8B72;
  --fern-muted:       #A3B09B;
  --terracotta:       #C2785C;
  --terracotta-light: #D4967E;
  --bark:             #4A5744;
  --stone:            #D4CFC3;
  --stone-light:      #E3DFD6;

  /* Generic aliases — existing component CSS uses these */
  --bg:           var(--parchment);
  --surface:      var(--paper);
  --surface2:     var(--parchment-deep);
  --border:       var(--stone);
  --accent:       var(--fern);
  --accent-dim:   rgba(92, 122, 82, 0.08);
  --text:         var(--forest);
  --text-muted:   var(--fern-muted);
  --text-dim:     var(--fern-light);
  --success:      #2d5a3d;
  --danger:       #9b3a3a;
  --portfolio:    #3a5a7a;
  --portfolio-dim:rgba(58, 90, 122, 0.1);

  /* Shape */
  --radius:       6px;
  --radius-card:  10px;
  --radius-pill:  100px;
  --border-width: 0.5px;
}

/* ── RESET & BASE ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 300;
  min-height: 100vh;
}

/* ── SCROLLBAR ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── HEADER ─────────────────────────────────────────────────────────────────── */
.header {
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}
.header-brand  { font-family: 'DM Serif Display', Georgia, serif; font-size: 14px; color: var(--text-dim); }
.header-bolt   { height: 22px; width: auto; display: block; flex-shrink: 0; }
.header-logo   { max-height: 28px; max-width: 120px; object-fit: contain; display: block; }
.header-right  { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.header-count  { color: var(--text-muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.header-count strong { color: var(--accent); font-weight: 500; }
.upload-link   { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); font-size: 11px; text-decoration: none; transition: all .15s; background: var(--surface); }
.upload-link:hover { border-color: var(--accent); color: var(--accent); }
.logout-link   { font-size: 11px; color: var(--text-muted); text-decoration: none; padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius); transition: all .15s; }
.logout-link:hover { border-color: var(--danger); color: var(--danger); }
.settings-btn  { font-size: 13px; color: var(--text-muted); background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 9px; cursor: pointer; transition: all .15s; line-height: 1.4; }
.settings-btn:hover { border-color: var(--accent); color: var(--accent); }
.help-btn      { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: none; color: var(--text-muted); font-size: 11px; font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s; display: flex; align-items: center; justify-content: center; line-height: 1; }
.help-btn:hover { border-color: var(--accent); color: var(--accent); }
.header-back   { font-size: 11px; color: var(--text-muted); text-decoration: none; padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius); transition: all .15s; }
.header-back:hover { border-color: var(--accent); color: var(--accent); }

/* ── TAB BAR ────────────────────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 2px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 53px; z-index: 99; overflow-x: auto; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn { padding: 12px 16px; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 400; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; transition: all .15s; letter-spacing: .02em; margin-bottom: -1px; text-decoration: none; display: inline-flex; align-items: center; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tab-btn.disabled { color: var(--border); cursor: not-allowed; font-style: italic; pointer-events: none; }
.tab-btn .tab-badge { font-size: 9px; background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); padding: 1px 5px; border-radius: 8px; margin-left: 5px; }
.tab-btn.active .tab-badge { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── RANGE SLIDER ───────────────────────────────────────────────────────────── */
input[type=range] { -webkit-appearance: none; width: 70px; height: 3px; background: var(--border); border-radius: 2px; outline: none; cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: none; cursor: pointer; }
.size-wrap { display: flex; align-items: center; gap: 7px; }
.filter-label { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }

/* ── BUTTONS ────────────────────────────────────────────────────────────────── */
.btn { position: relative; overflow: hidden; background: var(--accent); color: #fff; border: none; padding: 6px 13px; border-radius: var(--radius); cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 500; transition: opacity .12s; white-space: nowrap; }
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); opacity: 1; }

/* Fuse-lighting hover on primary buttons */
.btn:not(.btn-ghost):not(.btn-danger)::before {
  content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.18);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .38s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none; border-radius: inherit;
}
.btn:not(.btn-ghost):not(.btn-danger):hover::before { transform: scaleX(1); }
.btn:not(.btn-ghost):not(.btn-danger):hover { opacity: 1; }

/* Secondary button for use inside lightbox (always dark background — theme-immune) */
.btn-lb { background: transparent; color: rgba(255,255,255,.65); border: 1px solid rgba(255,255,255,.2); padding: 6px 13px; border-radius: var(--radius); font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 500; cursor: pointer; text-align: center; text-decoration: none; display: block; transition: all .15s; }
.btn-lb:hover { color: #fff; border-color: rgba(255,255,255,.5); }

/* ── FORM FIELDS ────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 400; }
label .req { color: var(--accent); }
input[type=text], input[type=number], input[type=password], select, textarea {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 11px; border-radius: var(--radius); font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 300; outline: none; transition: border-color .15s; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 65px; }
.field-hint { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.error { background: rgba(155,58,58,.07); border: 1px solid rgba(155,58,58,.25); color: var(--danger); font-size: 12px; padding: 9px 12px; border-radius: var(--radius); }

/* ── MODALS ─────────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(26,26,24,.55); z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 28px 32px; max-width: 380px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,.12); max-height: calc(100vh - 48px); overflow-y: auto; }
.modal-title { font-family: 'DM Serif Display', Georgia, serif; font-size: 19px; margin-bottom: 6px; }
.modal-title em { font-style: italic; color: var(--danger); }
.modal-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 22px; line-height: 1.5; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; }
.modal-thumb { width: 100%; aspect-ratio: 3/2; object-fit: cover; border-radius: 3px; margin-bottom: 14px; border: 1px solid var(--border); display: block; }

/* ── CARDS & GRID ───────────────────────────────────────────────────────────── */
.grid-wrap { padding: 20px 28px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; }
.card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(45,90,61,.08); transform: translateY(-1px); }
.card-img-wrap { position: relative; aspect-ratio: 3/2; overflow: hidden; background: var(--surface2); }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.card:hover .card-img-wrap img { transform: scale(1.04); }
.card-meta    { padding: 9px 11px; }
.card-subject { font-family: 'DM Serif Display', Georgia, serif; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.card-detail  { color: var(--text-muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-tags    { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }

/* ── TAGS ───────────────────────────────────────────────────────────────────── */
.tag { font-size: 9px; padding: 2px 5px; border-radius: 2px; letter-spacing: .06em; text-transform: uppercase; background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.tag.wedding    { color:#5a3a2a; border-color:rgba(90,58,42,.3);   background:rgba(90,58,42,.07); }
.tag.engagement { color:#2a4a5a; border-color:rgba(42,74,90,.3);   background:rgba(42,74,90,.07); }
.tag.elopement  { color:#4a2a5a; border-color:rgba(74,42,90,.3);   background:rgba(74,42,90,.07); }
.tag.proposal   { color:#5a2a3a; border-color:rgba(90,42,58,.3);   background:rgba(90,42,58,.07); }
.tag.family     { color:#2d5a3d; border-color:rgba(45,90,61,.3);   background:rgba(45,90,61,.07); }
.tag.senior     { color:#5a4a2a; border-color:rgba(90,74,42,.3);   background:rgba(90,74,42,.07); }
.tag.commercial { color:#2a3a5a; border-color:rgba(42,58,90,.3);   background:rgba(42,58,90,.07); }
.tag.personal   { color:#3a5a2a; border-color:rgba(58,90,42,.3);   background:rgba(58,90,42,.07); }
.tag.other      { color:#4a4a4a; border-color:rgba(74,74,74,.3);   background:rgba(74,74,74,.07); }

/* ── LIGHTBOX ───────────────────────────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 32px; }
.lightbox.open { display: flex; }
.lightbox-inner { max-width: 1100px; width: 100%; display: flex; gap: 32px; align-items: flex-start; }
.lightbox-img-wrap { flex: 1; min-width: 0; }
.lightbox-img-wrap img { width: 100%; max-height: 80vh; object-fit: contain; border-radius: var(--radius); display: block; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.lightbox-info    { width: 240px; flex-shrink: 0; }
.lightbox-subject { font-family: 'DM Serif Display', Georgia, serif; font-size: 20px; margin-bottom: 3px; color: #f0ede8; }
.lightbox-venue   { color: #c8a96e; font-size: 11px; margin-bottom: 14px; }
.info-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.1); font-size: 11px; }
.info-row:last-of-type { border-bottom: none; }
.info-key { color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .08em; }
.info-val { color: rgba(255,255,255,.8); text-align: right; max-width: 150px; overflow-wrap: break-word; }
.lightbox-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 7px; }
.lightbox-close { position: absolute; top: 18px; right: 22px; background: none; border: none; color: rgba(255,255,255,.5); font-size: 28px; cursor: pointer; line-height: 1; padding: 4px; }
.lightbox-close:hover { color: #fff; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.7); width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; z-index: 10; }
.lightbox-nav:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); color: #fff; }
.lightbox-nav.prev { left: 14px; }
.lightbox-nav.next { right: 14px; }
.lightbox-nav:disabled { opacity: .2; cursor: default; }

/* ── PORTFOLIO POPUP (shared by index.php + session.php) ───────────────────── */
.add-to-existing-popup { position: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 -4px 20px rgba(0,0,0,.1); min-width: 200px; max-height: 240px; overflow-y: auto; display: none; z-index: 300; }
.add-to-existing-popup.open { display: block; }
#lbPortfolioPopup { z-index: 1010; }
.ate-item { padding: 9px 14px; font-size: 12px; cursor: pointer; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; transition: background .12s; }
.ate-item:last-child { border-bottom: none; }
.ate-item:hover { background: var(--accent-dim); }
.ate-item-name { color: var(--text-dim); }
.ate-item-count { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.ate-empty { padding: 12px 14px; font-size: 12px; color: var(--text-muted); font-style: italic; }

/* ── EMPTY STATES ───────────────────────────────────────────────────────────── */
.empty { padding: 80px 28px; text-align: center; color: var(--text-muted); }
.empty-title { font-family: 'DM Serif Display', Georgia, serif; font-size: 22px; font-style: italic; margin-bottom: 8px; color: var(--text-dim); }
.empty a { color: var(--accent); }

.empty-first-session { padding-top: 32px; padding-bottom: 60px; text-align: left; padding-left: 28px; }
.empty-arrow {
  width: 52px; height: auto; display: block;
  margin-bottom: 20px;
  transform-origin: bottom left;
  animation: arrowFloat 2.2s ease-in-out infinite;
}
@keyframes arrowFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-7px) rotate(-4deg); }
}
@media (prefers-reduced-motion: reduce) { .empty-arrow { animation: none; } }

/* ── TOAST ──────────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--success); color: #fff; padding: 9px 18px; border-radius: var(--radius); font-size: 12px; opacity: 0; transition: all .2s; z-index: 2000; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── TOOL PAGES ─────────────────────────────────────────────────────────────── */
/* Layout and components for admin/tool pages: enrich.php, enrich_batch.php    */
.tool-wrap { max-width: 680px; margin: 0 auto; padding: 48px 24px 80px; }

.page-title { font-family: 'DM Serif Display', Georgia, serif; font-size: 36px; font-weight: 400; margin-bottom: 6px; line-height: 1.1; }
.page-title em { font-style: italic; color: var(--accent); }
.page-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 40px; }

.stat-row { display: flex; gap: 16px; margin-bottom: 32px; }
.stat-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.stat-num { font-family: 'DM Serif Display', Georgia, serif; font-size: 32px; line-height: 1; margin-bottom: 4px; }
.stat-num.accent  { color: var(--accent); }
.stat-num.success { color: var(--success); }
.stat-num.muted   { color: var(--text-muted); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; margin-bottom: 20px; }
.panel-title { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); margin-bottom: 14px; font-weight: 500; }
.panel-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.7; }
.panel-meta strong { color: var(--text); }

.notice { padding: 14px 18px; border-radius: var(--radius); font-size: 13px; margin-bottom: 24px; }
.notice.warn  { background: rgba(255,193,7,.1); border: 1px solid rgba(255,193,7,.3); color: #8a5c00; }
.notice.good,
.notice.info  { background: rgba(45,90,61,.06); border: 1px solid rgba(45,90,61,.25); color: var(--success); }
.notice.error { background: rgba(155,58,58,.06); border: 1px solid rgba(155,58,58,.25); color: var(--danger); }

.btn-lg { padding: 10px 26px; font-size: 13px; font-weight: 500; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.cost-note { font-size: 11px; color: var(--text-muted); margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.cost-note a { color: var(--text-muted); text-decoration: none; }
.cost-note a:hover { color: var(--accent); }
.batch-id { font-family: monospace; font-size: 11px; color: var(--text-muted); margin-top: 12px; word-break: break-all; }

.enrich-results { margin-top: 32px; }
.enrich-results-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: 14px; font-weight: 500; }
.enrich-result { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 8px; border: 1px solid; font-size: 12px; }
.enrich-result.ok  { background: rgba(45,90,61,.06); border-color: rgba(45,90,61,.25); }
.enrich-result.err { background: rgba(155,58,58,.06); border-color: rgba(155,58,58,.25); color: var(--danger); }
.enrich-thumb { width: 52px; height: 35px; object-fit: cover; border-radius: 3px; flex-shrink: 0; border: 1px solid var(--border); }
.enrich-result-body { flex: 1; min-width: 0; }
.enrich-result-filename { color: var(--text-dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 3px; }
.enrich-result-text { color: var(--text); line-height: 1.5; }
.enrich-result-text.err { color: var(--danger); }
.enrich-result-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; flex-shrink: 0; margin-top: 1px; }
.enrich-result-badge.ok  { color: var(--success); }
.enrich-result-badge.err { color: var(--danger); }

.tool-footer { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); text-align: center; letter-spacing: .04em; }
.tool-footer a { color: var(--text-muted); text-decoration: none; }
.tool-footer a:hover { color: var(--accent); }

/* ── LOADING ────────────────────────────────────────────────────────────────── */
.loading { padding: 80px 28px; text-align: center; color: var(--text-muted); }
.loading-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted); margin-top: 16px;
}

/* ── GALARIE ANIMATIONS ─────────────────────────────────────────────────────── */

/* Shared fade-in */
@keyframes gFadeIn { to { opacity: 1; } }

/* — Bloom (aperture / loader) — */
.anim-bloom { width: 80px; height: auto; display: block; margin: 0 auto 4px; }
.bloom-blade {
  animation: bloomSpin 12s linear infinite;
  transform-origin: 340px 340px;
}
.bloom-blade:nth-child(1) { --start: 0deg; }
.bloom-blade:nth-child(2) { --start: 60deg; }
.bloom-blade:nth-child(3) { --start: 120deg; }
.bloom-blade:nth-child(4) { --start: 180deg; }
.bloom-blade:nth-child(5) { --start: 240deg; }
.bloom-blade:nth-child(6) { --start: 300deg; }
@keyframes bloomSpin {
  from { transform: rotate(var(--start, 0deg)); }
  to   { transform: rotate(calc(var(--start, 0deg) + 360deg)); }
}
.bloom-cropmarks { opacity: 0; animation: gFadeIn 2s ease forwards; animation-delay: 1s; }
.bloom-pin       { opacity: 0; animation: gFadeIn 1.5s ease forwards; animation-delay: 2s; }

/* — Ivy (empty state) — */
.anim-ivy { width: 60px; height: auto; display: block; margin: 0 auto 12px; }
.ivy-vine {
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: ivyDraw 2.5s cubic-bezier(0.4,0,0.6,1) forwards;
}
@keyframes ivyDraw { to { stroke-dashoffset: 0; } }
.ivy-leaf { opacity: 0; animation: ivyLeafPop 0.4s ease forwards; }
.ivy-leaf:nth-child(2) { animation-delay: 1.2s; transform-origin: 193px 235px; }
.ivy-leaf:nth-child(3) { animation-delay: 1.4s; transform-origin: 197px 230px; }
.ivy-leaf:nth-child(4) { animation-delay: 1.8s; transform-origin: 208px 158px; }
.ivy-leaf:nth-child(5) { animation-delay: 2.0s; transform-origin: 212px 152px; }
.ivy-leaf:nth-child(6) { animation-delay: 2.3s; transform-origin: 194px 82px;  }
.ivy-leaf:nth-child(7) { animation-delay: 2.5s; transform-origin: 197px 78px;  }
@keyframes ivyLeafPop {
  0%   { opacity: 0; transform: scale(0.6); }
  60%  { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
.ivy-tendril { opacity: 0; animation: gFadeIn 0.5s ease forwards; animation-delay: 2.7s; }

/* — Spine (archive drop) — */
.anim-spine { width: 120px; height: auto; display: block; margin: 0 auto 12px; }
.spine-wrap-1 { animation: spineDropBounce 2.2s cubic-bezier(0.2,0,0.8,1) 1 forwards; animation-delay: 0s; }
.spine-wrap-2 { animation: spineDropBounce 2.2s cubic-bezier(0.2,0,0.8,1) 1 forwards; animation-delay: 0.15s; }
.spine-wrap-3 { animation: spineDropBounce 2.2s cubic-bezier(0.2,0,0.8,1) 1 forwards; animation-delay: 0.3s; }
@keyframes spineDropBounce {
  0%   { transform: translateY(-280px); animation-timing-function: cubic-bezier(0.2,0,1,1); }
  40%  { transform: translateY(0px);    animation-timing-function: cubic-bezier(0.2,0,0.4,1); }
  50%  { transform: translateY(-14px);  animation-timing-function: cubic-bezier(0.2,0,0.4,1); }
  60%  { transform: translateY(0px);    animation-timing-function: cubic-bezier(0.2,0,0.4,1); }
  67%  { transform: translateY(-5px);   animation-timing-function: cubic-bezier(0.2,0,0.4,1); }
  74%  { transform: translateY(0px); }
  100% { transform: translateY(0px); }
}
.spine-tilt { transform: rotate(-6deg); transform-origin: 168.65px 39.75px; }

@media (prefers-reduced-motion: reduce) {
  .bloom-blade, .bloom-cropmarks, .bloom-pin,
  .ivy-vine, .ivy-leaf, .ivy-tendril,
  .spine-wrap-1, .spine-wrap-2, .spine-wrap-3 {
    animation: none; opacity: 1; stroke-dashoffset: 0;
  }
}

/* ── THEME OVERRIDES ────────────────────────────────────────────────────────── */

/* Quantum */
[data-theme="quantum"] .controls-wrap { background-image: linear-gradient(45deg,#000 25%,transparent 25%),linear-gradient(-45deg,#000 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#000 75%),linear-gradient(-45deg,transparent 75%,#000 75%); background-size: 2px 2px; background-position: 0 0,0 1px,1px -1px,-1px 0; background-color: #fff; }
[data-theme="quantum"] .header,
[data-theme="quantum"] .tab-bar { border-bottom: 2px solid #000; }
[data-theme="quantum"] .card,
[data-theme="quantum"] .session-card { border-width: 2px; border-radius: 0; }
[data-theme="quantum"] .modal { border-width: 2px; border-radius: 0; box-shadow: 4px 4px 0 #000; }
[data-theme="quantum"] .btn { border-radius: 0; }
[data-theme="quantum"] .card-img-wrap img,
[data-theme="quantum"] .session-card-thumb img { image-rendering: pixelated; }

/* Spark — dot-grid on body only; chrome uses solid surface colors for contrast */
body[data-theme="spark"] {
  background-image: radial-gradient(circle, rgba(196,149,106,0.15) 1px, transparent 1px);
  background-size: 24px 24px;
}
[data-theme="spark"] .btn:not(.btn-ghost):not(.btn-danger) { color: #1c1e22; }
[data-theme="spark"] .btn-ghost { color: var(--text-dim); border-color: rgba(255,255,255,0.18); }
[data-theme="spark"] .btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.35); opacity: 1; }
[data-theme="spark"] .delete-toggle .toggle-dot::after { background: var(--bg); }
[data-theme="spark"] .delete-toggle.active .toggle-dot::after { background: #fff; }
[data-theme="spark"] .header-brand,
[data-theme="spark"] .session-card-subject,
[data-theme="spark"] .card-subject,
[data-theme="spark"] .portfolio-name-input,
[data-theme="spark"] .portfolio-empty-title,
[data-theme="spark"] .portfolio-card-name,
[data-theme="spark"] .portfolios-empty-title,
[data-theme="spark"] .pf-title,
[data-theme="spark"] .placeholder-title,
[data-theme="spark"] .empty-title,
[data-theme="spark"] .lightbox-subject,
[data-theme="spark"] .modal-title,
[data-theme="spark"] .tray-title,
[data-theme="spark"] .tray-name-input,
[data-theme="spark"] .session-hero-subject { font-family: 'Fraunces', Georgia, serif; }

/* Vaporwave — topographic contours in perspective floor projection */
body[data-theme="vaporwave"]::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 106, 210, 0.14) 0, rgba(255, 106, 210, 0.14) 1px,
      transparent 1px, transparent 40px
    ),
    repeating-linear-gradient(
      to right,
      rgba(255, 106, 210, 0.09) 0, rgba(255, 106, 210, 0.09) 1px,
      transparent 1px, transparent 40px
    );
  transform-origin: 50% 100%;
  transform: perspective(500px) rotateX(-25deg);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.75) 55%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.75) 55%);
  pointer-events: none;
  z-index: 0;
}

/* Ink — cream accent needs dark button text */
[data-theme="ink"] .btn:not(.btn-ghost):not(.btn-danger) { color: #111114; }

/* Photo Club — warm gold accent needs dark button text */
[data-theme="photo-club"] .btn:not(.btn-ghost):not(.btn-danger) { color: #0e0e0e; }

/* ── FLOURISH ───────────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}
.grid.loaded .card {
  animation: fadeUp .26s cubic-bezier(0.16,1,0.3,1) both;
  animation-delay: calc(var(--i,0) * .022s);
}

/* Dot-grid on portfolio overlay header (all themes) */
.pf-header {
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 22px 22px;
}

/* Accent spark + underline on empty states */
.empty::before {
  content: '✦'; display: block; font-size: 14px;
  color: var(--accent); opacity: .55; margin-bottom: 8px;
}
.empty-title::after {
  content: ''; display: block; width: 36px; height: 1.5px;
  background: var(--accent); opacity: .4; margin: 9px auto 0; border-radius: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .grid.loaded .card { animation: none; }
}

/* ── RESPONSIVE (shared components) ────────────────────────────────────────── */
@media (max-width: 600px) {
  .header { padding: 12px 16px; }
  .tab-bar { padding: 0 16px; }
  .grid-wrap { padding: 16px; }
  .lightbox { padding: 52px 16px 24px; overflow-y: auto; align-items: flex-start; }
  .lightbox-inner { flex-direction: column; }
  .lightbox-img-wrap img { max-height: 55vh; }
  .lightbox-info { width: 100%; }
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }
  .modal-backdrop { align-items: flex-start; padding: 16px; }
  .modal { padding: 20px 18px; max-height: calc(100dvh - 32px); }
}
