/* PawCam base (fe-shell): design tokens + shared components.
   fe-cam reads these tokens (with fallbacks) — keep the names stable:
   --bg --bg-2 --fg --muted --faint --card --card-2 --line --line-strong --chip --chip-fg
   --accent --accent-strong --accent-ink --accent-soft --on-accent --live --ok --danger
   --radius --radius-sm --radius-lg --radius-pill --font --font-display --font-rounded
   --font-mono --ease --shadow-1 --shadow-2 --safe-top/right/bottom/left --bar-h --glass */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* Warm (shelter / adoption / album) is the default palette. */
  --bg: #fbf6ef;
  --bg-2: #f5ede2;
  --fg: #2a211c;
  --muted: #6f6259;
  --faint: #9a8b80;
  --card: #ffffff;
  --card-2: #fffaf4;
  --line: rgba(42, 33, 28, 0.1);
  --line-strong: rgba(42, 33, 28, 0.18);
  --chip: #f2e8dc;
  --chip-fg: #4d3f35;
  --glass: rgba(251, 246, 239, 0.82);

  --accent: #ff5a36; /* brand coral: REC / LIVE / highlights */
  --accent-strong: #d4441f; /* button fill (white text ≥ 4.5:1) */
  --accent-ink: #c43b1a; /* accent-coloured text on light backgrounds */
  --accent-soft: rgba(255, 90, 54, 0.12);
  --on-accent: #ffffff;
  --live: #ff3b30;
  --ok: #2f9e6a;
  --danger: #c7362b;

  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-1: 0 1px 2px rgba(80, 50, 20, 0.05), 0 6px 20px -8px rgba(80, 50, 20, 0.16);
  --shadow-2: 0 2px 6px rgba(80, 50, 20, 0.06), 0 24px 48px -20px rgba(80, 50, 20, 0.35);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --bar-h: 56px;
  --page-max: 1120px;

  color-scheme: light;
}

/* Camera screens: dark, glassy "real device" palette. */
[data-theme="cam"] {
  --bg: #0b0c0e;
  --bg-2: #131518;
  --fg: #f3f4f6;
  --muted: rgba(243, 244, 246, 0.66);
  --faint: rgba(243, 244, 246, 0.44);
  --card: #17191d;
  --card-2: #1c1f24;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --chip: rgba(255, 255, 255, 0.08);
  --chip-fg: #f3f4f6;
  --glass: rgba(18, 20, 24, 0.7);
  --accent-ink: #ff8a6b;
  --accent-soft: rgba(255, 90, 54, 0.16);
  --danger: #ff6b5e;
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-2: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

/* ---- Reset ------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  color: var(--fg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 16px/1.5 var(--font);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background-color 0.35s var(--ease);
}

html.no-scroll,
html.no-scroll body,
html.has-dialog body {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
}

[hidden] {
  display: none !important;
}

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

[tabindex="-1"]:focus {
  outline: none;
}

::selection {
  background: rgba(255, 90, 54, 0.25);
}

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

.offscreen {
  position: fixed;
  top: -1000px;
  left: -1000px;
  width: 10px;
  height: 10px;
  opacity: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  left: 12px;
  top: -80px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--fg);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: calc(var(--safe-top) + 8px);
}

/* ---- Type -------------------------------------------------------------- */

.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 8.6vw, 56px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.lede {
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker--warm {
  color: var(--accent-ink);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.fineprint {
  font-size: 13px;
  line-height: 1.45;
  color: var(--faint);
  text-wrap: pretty;
}

/* ---- Wordmark ---------------------------------------------------------- */

.wordmark,
.boot-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 20px/1 var(--font-rounded);
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}

.wordmark {
  height: 44px;
  padding-right: 6px;
  border-radius: 12px;
}

.wordmark b,
.boot-mark b {
  font-weight: 800;
}

.wordmark-rec {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 54, 0.18), 0 0 12px rgba(255, 90, 54, 0.55);
  flex: none;
}

.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

.boot-mark {
  font-size: 22px;
  animation: breathe 1.8s ease-in-out infinite;
}

.noscript {
  max-width: 420px;
  margin: 20vh auto 0;
  padding: 0 24px;
  text-align: center;
}

.noscript h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

/* ---- Buttons ----------------------------------------------------------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.15s var(--ease), background-color 0.2s, box-shadow 0.25s, opacity 0.2s, filter 0.2s;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-lg {
  min-height: 56px;
  padding: 0 26px;
  font-size: 17px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background: var(--accent-strong);
  color: var(--on-accent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 10px 24px -10px rgba(212, 68, 31, 0.7);
}

.btn-secondary {
  background: var(--card);
  color: var(--fg);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
}

.btn-glass--danger {
  color: #ff8a7e;
}

.btn-quiet {
  background: transparent;
  color: var(--muted);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-glow:not(:disabled) {
  animation: glow 2.6s ease-in-out infinite;
}

@media (hover: hover) {
  .btn-primary:hover:not(:disabled) {
    filter: brightness(1.06);
  }
  .btn-secondary:hover:not(:disabled) {
    border-color: var(--faint);
  }
  .btn-glass:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.16);
  }
  .btn-quiet:hover:not(:disabled) {
    color: var(--fg);
  }
}

.icon-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--fg);
  transition: background-color 0.2s;
}

.icon-btn:hover {
  background: var(--chip);
}

/* ---- Chips & badges ---------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--chip);
  color: var(--chip-fg);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

button.chip {
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.15s var(--ease);
}

button.chip:active {
  transform: scale(0.96);
}

.chip[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

.chip--trait {
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 600;
  background: var(--chip);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--home {
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-ink);
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.25);
}

.badge--soon {
  background: rgba(42, 33, 28, 0.72);
  color: #fff;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.badge--live {
  background: rgba(255, 59, 48, 0.14);
  color: #ff7a70;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--live);
  animation: live-pulse 2s ease-out infinite;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* ---- Cards, photos, thumbs --------------------------------------------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.photo {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #efe3d3 0%, #e7d6c2 100%);
}

[data-theme="cam"] .photo {
  background: linear-gradient(135deg, #1c1e22 0%, #15171a 100%);
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease), filter 0.4s;
}

.photo.is-loaded img {
  opacity: 1;
}

.photo-missing {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 8px;
  text-align: center;
  color: rgba(111, 98, 89, 0.55);
  font-size: 12.5px;
  font-weight: 600;
}

[data-theme="cam"] .photo-missing {
  color: rgba(255, 255, 255, 0.3);
}

.thumb {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--chip);
  color: var(--muted);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Portraits are full-body sitting shots with the face in the upper third.
   For small round crops, zoom so the face lands in the middle of the circle:
   with object-position 50% 0 the face centre sits ~0.36 of the box down; scale
   1.6 about y = 12.7% moves it to 0.5 while the top edge stays out of view. */
.thumb img,
.face-zoom img {
  object-position: 50% 0%;
  transform: scale(1.6);
  transform-origin: 50% 12.7%;
}

.thumb--lg {
  width: 48px;
  height: 48px;
}

.thumb--xl {
  width: 64px;
  height: 64px;
}

/* ---- Forms ------------------------------------------------------------- */

.field-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--fg);
  font-size: 17px; /* ≥16px: iOS won't zoom on focus */
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-input:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field-hint {
  min-height: 1.4em;
  font-size: 13px;
  color: var(--muted);
}

.field-hint.is-error {
  color: var(--danger);
}

/* ---- Meter & spinner --------------------------------------------------- */

.meter {
  height: 8px;
  border-radius: 99px;
  background: var(--chip);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb36b, var(--accent));
}

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.16);
  border-top-color: rgba(255, 255, 255, 0.9);
  animation: spin 0.9s linear infinite;
}

/* ---- Dialogs & sheets (native <dialog>) -------------------------------- */

dialog {
  padding: 0;
  border: 0;
  color: var(--fg);
  background: transparent;
}

dialog::backdrop {
  background: rgba(12, 10, 8, 0.52);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sheet {
  margin: auto 0 0;
  width: 100%;
  max-width: 100%;
  max-height: min(90dvh, 760px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--card);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
  padding-bottom: var(--safe-bottom);
}

[data-theme="cam"] .sheet {
  background: #16181c;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 -12px 50px rgba(0, 0, 0, 0.6);
}

.sheet[open] {
  animation: sheet-in 0.34s var(--ease-out);
}

.dialog-body {
  position: relative;
  padding: 10px 20px 20px;
}

.sheet .dialog-body::before {
  content: "";
  display: block;
  width: 38px;
  height: 5px;
  margin: 0 auto 6px;
  border-radius: 3px;
  background: var(--line-strong);
}

@media (min-width: 640px) {
  .sheet {
    margin: auto;
    width: min(520px, calc(100vw - 48px));
    border-radius: 26px;
    padding-bottom: 0;
  }
  .sheet[open] {
    animation: pop-in 0.24s var(--ease-out);
  }
  .sheet .dialog-body::before {
    display: none;
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 10px;
}

.sheet-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.sheet--confirm .dialog-body {
  padding: 14px 22px 22px;
}

.sheet--confirm .sheet-title {
  margin-top: 8px;
}

.sheet-text {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.sheet-actions {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

/* ---- Toasts ------------------------------------------------------------ */

.toasts {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 20px);
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  justify-items: center;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(24, 26, 30, 0.94);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 14px 34px -10px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.25s var(--ease), transform 0.3s var(--ease-out);
}

.toast.is-in {
  opacity: 1;
  transform: none;
}

.toast.is-out {
  opacity: 0;
  transform: translateY(6px);
}

.toast--in-dialog {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 20px);
  max-width: calc(100vw - 32px);
  translate: -50% 0;
  pointer-events: none;
}

.toast--error {
  background: rgba(150, 30, 20, 0.95);
}

/* ---- Keyframes --------------------------------------------------------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.55);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(255, 59, 48, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
  }
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 10px 24px -10px rgba(212, 68, 31, 0.7);
  }
  50% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 12px 36px -6px rgba(212, 68, 31, 0.75);
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes pop-in {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-mark,
  .live-dot,
  .btn-glow,
  .spinner {
    animation: none !important;
  }
  .sheet[open] {
    animation: none;
  }
  .toast {
    transition: opacity 0.2s;
    transform: none;
  }
}
