/* PawTag styles. Tokens from the approved mockups (see CLAUDE.md). */

/* Self-hosted variable fonts, Latin subset only (~70 KB total). `swap` shows text in a
   system font immediately on slow mobile data, then swaps when the font arrives. */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f7f3ec;
  --card: #ffffff;
  --fill: #efe8dc;
  --border: #e5ded2;
  --border-strong: #cfc6b6;

  --text: #22302c;
  --muted: #4e5b56;
  --muted-2: #56635e;

  --primary: #2f5d52;
  --primary-hover: #234840;
  --on-primary: #ffffff;

  --sage: #8fb8a8;
  --on-sage: #1f3d36;
  --sage-tint: #dcebe5;

  --terracotta: #e07b45;       /* fills and borders only */
  --terracotta-text: #a9501f;  /* when used as text (contrast) */

  --lost-text: #b85a2a;
  --lost-bg: #fbede4;
  --lost-border: #e07b45;

  --whatsapp: #0e7a3e;

  --font-heading: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --tap: 48px;
  --radius: 14px;
  --radius-sm: 10px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 12px; }

a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }

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

.page { max-width: 420px; margin: 0 auto; padding: 16px 16px 40px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* Header */
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-heading); font-weight: 600; font-size: 1.25rem;
  color: var(--text); text-decoration: none; min-height: var(--tap);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--terracotta); display: inline-block;
}

/* Panels and cards */
.hero {
  background: var(--sage); color: var(--on-sage);
  border-radius: var(--radius); padding: 20px; margin: 8px 0 16px;
}
.hero p { color: var(--on-sage); }
.chip {
  display: inline-block; background: var(--sage-tint); color: var(--on-sage);
  border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 0.875rem;
  letter-spacing: 0.04em;
}
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.note {
  background: var(--fill); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 0 0 16px; font-size: 0.9375rem;
}

/* Forms */
.field { margin-bottom: 18px; }
.field > label, .legend {
  display: block; font-weight: 600; margin-bottom: 6px;
}
.hint { display: block; color: var(--muted); font-size: 0.875rem; margin-top: 4px; }
.error-text { display: block; color: var(--terracotta-text); font-size: 0.875rem; font-weight: 600; margin-top: 6px; }

input[type="text"], input[type="email"], input[type="tel"] {
  width: 100%; min-height: var(--tap);
  font: inherit; color: var(--text);
  background: var(--card); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
input:focus { border-color: var(--primary); outline: 2px solid var(--sage); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--terracotta) !important; }
.code-input { font-size: 1.25rem; letter-spacing: 0.12em; text-transform: uppercase; }

fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.choices { display: flex; gap: 8px; }
.choice { flex: 1; position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--tap); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--card); font-weight: 600; cursor: pointer;
}
.choice input:checked + span { background: var(--sage-tint); border-color: var(--primary); color: var(--on-sage); }
.choice input:focus-visible + span { outline: 3px solid var(--terracotta); outline-offset: 2px; }

.check { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }

/* Buttons */
.button {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 52px; padding: 12px 20px; border: 0; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary);
  font: 600 1.0625rem var(--font-body); text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--primary-hover); color: var(--on-primary); }

/* Alerts */
.alert {
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px;
  background: var(--lost-bg); border: 1.5px solid var(--lost-border); color: var(--text);
}
.alert strong { color: var(--terracotta-text); }
.success { background: var(--sage-tint); border: 1.5px solid var(--sage); }

.footer { margin-top: 24px; text-align: center; }

/* Activation extras */
.eyebrow {
  display: inline-block; margin: 0 0 8px; font-size: 0.8125rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--on-sage);
}
.hero-success { text-align: center; padding: 28px 20px; }
.success-mark {
  display: block; width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--card) center / 28px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232F5D52' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.details { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.details dt { color: var(--muted); font-size: 0.875rem; align-self: center; }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* Finder page */
.center { text-align: center; }
.pre-line { white-space: pre-line; margin: 0; }
.finder-hero { text-align: center; padding: 8px 0 16px; }
.finder-hero p { color: var(--muted); }
.pet-avatar {
  width: 112px; height: 112px; margin: 0 auto 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--sage); color: var(--on-sage); border: 4px solid var(--card);
  font: 600 3rem var(--font-heading);
}
.lost-banner {
  background: var(--lost-bg); color: var(--lost-text); border: 2px solid var(--lost-border);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px;
  font-weight: 700; text-align: center;
}
.preview-banner {
  background: var(--sage-tint); border: 1.5px dashed var(--primary); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 12px; font-size: 0.9375rem;
}
.button-whatsapp { background: var(--whatsapp); }
.button-whatsapp:hover { background: #0b6332; }
.button-secondary {
  background: var(--card); color: var(--primary); border: 2px solid var(--primary);
}
.button-secondary:hover { background: var(--sage-tint); color: var(--primary-hover); }
.button[disabled] { opacity: 0.6; cursor: progress; }
.hint.center { display: block; text-align: center; margin: 8px 0 20px; }
.location-box { margin-bottom: 8px; }
.location-status { text-align: center; font-weight: 600; min-height: 1.5em; margin: 0 0 16px; }
.vet .button { margin-top: 8px; }
.lang-switch { display: flex; justify-content: center; gap: 4px; margin-top: 24px; }
.lang-switch a {
  min-height: var(--tap); display: flex; align-items: center; padding: 0 12px;
  border-radius: var(--radius-sm); color: var(--muted-2);
}
.lang-switch a[aria-current] { background: var(--fill); color: var(--text); font-weight: 600; text-decoration: none; }
.space-top { margin-top: 16px; }
.location-status:empty { display: none; }

/* Claim (check your email) */
.email { overflow-wrap: anywhere; }
.notice {
  background: var(--sage-tint); border-radius: var(--radius-sm); padding: 10px 12px; font-weight: 600;
}
.notice-error { background: var(--lost-bg); color: var(--terracotta-text); }
.fix-email { margin: 16px 0 4px; }
.fix-email summary {
  min-height: var(--tap); display: flex; align-items: center; cursor: pointer;
  color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
}
.fix-email form { margin-top: 8px; }
.outbox h2 { font-size: 1.0625rem; }
.outbox a { overflow-wrap: anywhere; }

/* Dashboard */
.dash-nav { display: flex; align-items: center; gap: 4px; margin: 0 0 12px; flex-wrap: wrap; }
.dash-nav a, .link-button {
  min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 10px;
  color: var(--primary); font: 600 0.9375rem var(--font-body); border-radius: var(--radius-sm);
}
.dash-nav form { margin-left: auto; }
.link-button { background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.pet-row { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); }
.pet-row:hover { border-color: var(--border-strong); color: var(--text); }
.pet-row.is-lost { border: 2px solid var(--lost-border); background: var(--lost-bg); }
.pet-row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pet-row-text strong { font: 600 1.125rem var(--font-heading); }
.pet-avatar.small { width: 52px; height: 52px; margin: 0; font-size: 1.5rem; border-width: 2px; flex: none; }
.badge-lost {
  background: var(--lost-text); color: #fff; border-radius: 999px; padding: 4px 10px;
  font-size: 0.8125rem; font-weight: 700;
}
.lost-card.is-lost { border: 2px solid var(--lost-border); background: var(--lost-bg); }
.lost-card.is-lost h2 { color: var(--lost-text); }
.button-lost { background: var(--lost-text); }
.button-lost:hover { background: #9a4a22; }
textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--card);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; resize: vertical;
}
textarea:focus { border-color: var(--primary); outline: 2px solid var(--sage); outline-offset: 0; }
.scan-list { list-style: none; margin: 0 0 8px; padding: 0; }
.scan-list li { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--border); }
.scan-list li:last-child { border-bottom: 0; }
.scan-time { font-weight: 600; }
.scan-map { min-height: var(--tap); display: inline-flex; align-items: center; font-weight: 600; }

/* Photos */
.pet-photo { display: block; object-fit: cover; border-radius: 50%; border: 4px solid var(--card); background: var(--fill); }
.finder-hero .pet-photo { width: 160px; height: 160px; margin: 0 auto 12px; }
.pet-photo.small { width: 52px; height: 52px; border-width: 2px; flex: none; }
.pet-photo.large { width: 140px; height: 140px; margin: 0 auto 12px; }
.photo-card { text-align: center; }
.photo-card .pet-avatar { margin: 0 auto 12px; }
.photo-card form { text-align: left; }
.file-label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="file"] {
  width: 100%; min-height: var(--tap); margin-bottom: 12px; font: inherit;
  padding: 8px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--fill);
}
.link-button.danger { color: var(--terracotta-text); }

/* Homepage */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.home-hero {
  background: var(--sage); color: var(--on-sage); border-radius: var(--radius);
  padding: 28px 20px; margin: 8px 0 24px;
}
.home-hero h1 { font-size: 2rem; }
.home-hero p { color: var(--on-sage); margin-bottom: 20px; }
.home-hero .button + .button { margin-top: 10px; }
.home-hero .button-secondary { background: transparent; border-color: var(--on-sage); color: var(--on-sage); }
.button-disabled { background: var(--fill); color: var(--muted); cursor: default; }
.button-disabled:hover { background: var(--fill); color: var(--muted); }
.home-section { margin-bottom: 24px; }
.home-section > h2 { font-size: 1.5rem; margin-bottom: 12px; }
.steps { list-style: none; padding: 0; margin: 0; }
.step { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; }
.step-num {
  flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--sage-tint); color: var(--on-sage);
  border: 2px solid var(--terracotta);
  display: flex; align-items: center; justify-content: center; font: 600 1.125rem var(--font-heading);
}
.features { display: grid; gap: 12px; }
.feature { margin-bottom: 0; padding: 16px; }
.feature h3 { font-size: 1.0625rem; margin-bottom: 4px; }
.feature p { margin: 0; }
.tag-form { display: flex; gap: 8px; margin-bottom: 12px; }
.tag-form input { flex: 1; text-transform: uppercase; letter-spacing: 0.08em; }
.tag-form .button { width: auto; min-width: 72px; }
.danger-zone { border: 1.5px solid var(--lost-border); }

/* Legal pages */
.legal h2 { font-size: 1.1875rem; margin-top: 24px; }
.legal h3 { font-size: 1rem; margin-top: 16px; }
.legal ul { padding-left: 20px; margin: 0 0 12px; }
.legal li { margin-bottom: 6px; }
mark { background: var(--lost-bg); color: var(--terracotta-text); font-weight: 600; padding: 0 2px; }

/* Admin */
.batch { padding: 12px 0; border-bottom: 1px solid var(--border); }
.batch:last-child { border-bottom: 0; }
.batch .button { margin-top: 8px; }
