/* Shared design tokens, reset, and cross-page primitives for Snappy.
   Loaded on every page. Page-specific styling lives in its own file
   (capture.css, top-picks.css, my-shots.css, settings.css, auth.css,
   legal.css) and shell.css owns the site header/bottom-nav/account chip. */

/* ---- Fredoka, bundled locally (variable 400-700) so it works offline ---- */
@font-face {
  font-family: 'Fredoka'; font-style: normal; font-weight: 400 700; font-stretch: 100%; font-display: swap;
  src: url(/fonts/fredoka-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka'; font-style: normal; font-weight: 400 700; font-stretch: 100%; font-display: swap;
  src: url(/fonts/fredoka-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --bg: #1a1512;
  --surface: rgba(42,32,24,0.78);
  --surface-strong: rgba(53,42,32,0.86);
  --accent: #f0996b;        /* peach */
  --accent2: #f3c49a;       /* soft clay */
  --good: #7ad19a;          /* mint */
  --live: #ff8a6b;          /* warm coral (not harsh red) */
  --text: #fbf3e9;
  --muted: #b6a594;
  --hair: rgba(251,243,233,0.12);
  --danger: #ff7d7d;
  --radius-pill: 999px;
  --radius-card: 28px;
  --radius-input: 18px;
  --spring: cubic-bezier(.34,1.56,.64,1);
  --font: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --content-max: 1280px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* The [hidden] attribute is meant to be an absolute "never show this"
   signal, but any class or inline style that sets `display` (flex/grid/
   block) on the same element outranks the UA stylesheet's plain
   `[hidden] { display: none }` rule -- silently un-hiding it. Force it to
   always win. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 16px/1.4 var(--font); font-weight: 500;
  background: var(--bg); color: var(--text);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* Capture-only pages (camera stage) opt into this to suppress page scroll
   and text selection over the viewfinder; ordinary pages keep normal scroll. */
body.no-scroll { overflow: hidden; -webkit-user-select: none; user-select: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

/* ---- inline SVG icon glyphs (replace emoji used as UI icons) ---- */
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex: 0 0 auto; }
.btn-ico { display: inline-flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--hair);
  background: var(--surface); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  color: var(--text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.08s var(--spring);
}
.icon-btn:active { transform: scale(0.9); }
.icon-btn:hover { border-color: rgba(251,243,233,0.28); }

/* ---- primary/ghost buttons (shared by every page's CTAs) ---- */
.btn {
  min-height: 44px; padding: 0 20px; border-radius: var(--radius-input); border: 0;
  font-size: 15px; font-weight: 700; cursor: pointer; font-family: var(--font);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; /* .btn is also used on <a> tags -- suppress the default link underline */
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--accent); color: #2a1810; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: rgba(251,243,233,0.06); color: var(--text); border: 1px solid var(--hair); }
.btn-ghost:hover { border-color: rgba(251,243,233,0.28); }
.btn-danger { background: rgba(255,125,125,0.14); color: var(--danger); border: 1px solid rgba(255,125,125,0.35); }

/* ---- full-page "sheet" layout (replaces the old modal sheets; every new
   standalone page that used to be a modal reuses this shell) ---- */
.sheet-page { min-height: 100dvh; display: flex; flex-direction: column; }
.sheet-inner {
  /* 20px horizontal, matching .shell-header-inner's own 20px, so every
     secondary page's content lines up with the header logo/nav above it. */
  flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: 16px 20px calc(env(safe-area-inset-bottom) + 96px);
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.sheet-head h1, .sheet-head h2 { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -0.01em; }
/* Back-to-Home button, placed left of the page title -- same icon/position
   on every secondary page (Settings, Manage Subscription, Profile, and the
   legal pages) for a consistent "how do I get back" affordance. No padding/
   circle/background -- just the icon, sized to its own tight viewBox so it
   lines up flush with the page content (card edges, heading) below it. */
.sheet-head-left { display: flex; align-items: center; gap: 10px; }
.page-back-btn {
  width: 18px; height: 18px; flex: 0 0 auto; padding: 0; border: 0; background: none;
  color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.page-back-btn:hover { color: var(--accent); }
.page-back-btn .ico { width: 18px; height: 18px; }
.sheet-close {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--hair); background: rgba(251,243,233,0.06);
  color: var(--text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.tabs { display: flex; gap: 6px; padding: 4px; border-radius: var(--radius-input); background: rgba(251,243,233,0.06); border: 1px solid var(--hair); margin-bottom: 14px; }
.tabs button { flex: 1; padding: 11px 8px; border-radius: 13px; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; cursor: pointer; font-family: var(--font); transition: background .18s ease, color .18s ease; }
.tabs button.active { background: var(--accent); color: #2a1810; }

/* ---- form fields (auth pages, settings) ---- */
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-group label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-group input[type=text], .field-group input[type=email], .field-group input[type=password], .field-group input[type=url] {
  min-height: 48px; padding: 0 14px; border-radius: var(--radius-input); border: 1px solid var(--hair);
  background: rgba(251,243,233,0.05); color: var(--text); font-size: 16px; font-family: var(--font);
}
/* The border-color swap below is already a clear focus indicator, so drop
   the global :focus-visible ring here -- otherwise it stacks with the
   input's own border as a distracting double outline. */
.field-group input:focus { border-color: var(--accent); outline: none; }
.field-error { color: var(--danger); font-size: 13px; font-weight: 500; }
.field-help { color: var(--muted); font-size: 12.5px; }

/* ---- checkbox / toggle switch (settings, feedback preferences) ---- */
input[type=checkbox].switch {
  -webkit-appearance: none; appearance: none;
  width: 30px; height: 30px; flex: 0 0 auto; margin: 0; cursor: pointer;
  border-radius: 9px; border: 1.5px solid rgba(240,153,107,0.28);
  background: rgba(240,153,107,0.08); position: relative;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .12s var(--spring);
}
input[type=checkbox].switch:hover { border-color: rgba(240,153,107,0.48); background: rgba(240,153,107,0.14); }
input[type=checkbox].switch:checked { background: var(--accent); border-color: var(--accent2); box-shadow: 0 2px 10px rgba(240,153,107,0.38); }
input[type=checkbox].switch:active { transform: scale(0.9); }
input[type=checkbox].switch:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(240,153,107,0.32); }
input[type=checkbox].switch::after {
  content: ''; position: absolute; top: 5px; left: 10px;
  width: 7px; height: 13px; border: solid #2a1810; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0); opacity: 0;
  transition: transform .16s var(--spring), opacity .12s ease;
}
input[type=checkbox].switch:checked::after { transform: rotate(45deg) scale(1); opacity: 1; }

/* ---- full-image lightbox (Top Picks / My Shots detail view) ---- */
.mv-lightbox {
  position: fixed; inset: 0; z-index: 2000; background: rgba(26,21,18,0.96);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px;
}
.mv-lightbox-img { max-width: 100%; max-height: 78vh; border-radius: 20px; object-fit: contain; }
.mv-lightbox-actions { display: flex; gap: 12px; margin-top: 18px; }

/* ---- paywall modal (quota-exceeded / upgrade) ---- */
.pw-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); padding: 24px; }
.pw-card { position: relative; max-width: 340px; width: 100%; background: var(--surface-strong); border: 1px solid var(--hair); border-radius: 16px; padding: 36px 24px 20px; text-align: left; }
.pw-card h2 { margin: 0 0 8px; font-size: 22px; font-weight: 700; line-height: 1.2; }

/* ---- confirm dialog (replaces window.confirm() everywhere on the site) ---- */
.cd-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); padding: 24px; }
.cd-card { max-width: 340px; width: 100%; background: var(--surface-strong); border: 1px solid var(--hair); border-radius: 16px; padding: 24px; }
.cd-message { margin: 0 0 20px; font-size: 15px; line-height: 1.5; color: var(--text); }
.cd-actions { display: flex; gap: 10px; justify-content: flex-end; }
.cd-actions .btn { min-width: 96px; }

/* ---- generic empty / loading / error state block ---- */
.state-block { text-align: center; padding: 48px 20px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.state-block.err { color: #ffb4a0; }
.state-block .spin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--hair); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- responsive content width ---- */
@media (min-width: 768px) {
  .sheet-inner { padding-top: 32px; }
}
