/* Registro de Mascotas — visual language of the Manantiales site:
   teal accent, Inter, soft-teal surfaces, pill buttons, airy spacing. */
:root {
  --paper: #ffffff;
  --paper-alt: #f9fafb;
  --card: #ffffff;
  --ink: #101727;
  --muted: #495565;
  --line: rgba(16, 23, 39, 0.12);
  --line-strong: rgba(16, 23, 39, 0.45);
  --accent: #00786F;
  --accent-dark: #0F766E;
  --accent-soft: #F0FDFA;
  --accent-contrast: #ffffff;
  --chip: #CBFBF1;
  --brass: #B45309;
  --brass-ink: #92400E;
  --brass-soft: #FEF3C7;
  --alert: #B42318;
  --alert-soft: #FEE4E2;
  --footer: #101828;
  --shadow: 0 1px 10px rgba(16, 23, 39, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--ink);
}
h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; }

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* Header */
.app-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header .bar {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.app-header .brand {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.app-header .brand span { color: var(--muted); font-weight: 400; }
.app-header nav { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.app-header nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* WCAG 2.5.8 target size */
  transition: color 0.18s ease;
}
.app-header nav a:hover { color: var(--accent); }
.app-header nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.app-header nav a.btn { color: var(--accent-contrast); padding: 9px 20px; font-size: 0.9rem; }

main { padding: 44px 0 64px; }

/* Page hero */
.page-hero { text-align: center; padding: 16px 0 36px; }
.page-hero p {
  color: var(--muted);
  max-width: 56ch;
  margin: 0 auto 26px;
  font-size: 1.05rem;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
/* Two columns instead of one on a phone: the padrón fits in a single glance. */
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

/* Chips & banners */
.chip {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 50px;
  background: var(--chip);
  color: var(--accent-dark);
}
.chip.warn { background: var(--alert-soft); color: var(--alert); }
.chip.brass { background: var(--brass-soft); color: var(--brass-ink); }
.banner {
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-weight: 500;
}
.banner.ok { background: var(--accent-soft); color: var(--accent-dark); border: 1px solid var(--chip); }
.banner.alert { background: var(--alert-soft); color: var(--alert); border: 1px solid #F4B9B0; }

/* Forms */
label { display: block; font-weight: 500; font-size: 0.9rem; margin: 14px 0 5px; }
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  /* Stronger than --line: a field boundary needs 3:1 to be perceivable. */
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.18s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; margin: 8px 0; min-height: 44px; font-weight: 500; font-size: 0.95rem; }
.check input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--accent); }
.check label { margin: 0; cursor: pointer; }
fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 20px 20px;
  margin: 22px 0 0;
}
legend {
  font-weight: 600;
  color: var(--accent-dark);
  padding: 0 8px;
  font-size: 1rem;
}
.hint { font-size: 0.85rem; line-height: 1.6; color: var(--muted); margin: 5px 0 0; }

/* Buttons — pill shaped like the site */
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 50px;
  padding: 13px 28px;
  font: inherit;
  font-weight: 500;
  font-size: 0.98rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: var(--accent-soft);
  color: var(--accent-dark);
  /* The soft fill is only 1.04:1 against white; the border is what makes this
     read as a control (3.37:1). Padding compensates so heights still match. */
  border: 1px solid #3E9A91;
  padding: 12px 27px;
}
.btn.secondary:hover { background: var(--chip); border-color: var(--accent); }
.btn.danger { background: var(--alert); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; align-items: center; }
@media (max-width: 520px) {
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn { width: 100%; }
}

/* Tables */
/* Scroll shadows: the padrón hides 5 columns on narrow screens with no hint. */
.table-scroll {
  overflow-x: auto;
  background:
    linear-gradient(to right, var(--card) 30%, rgba(255, 255, 255, 0)) left center,
    linear-gradient(to left, var(--card) 30%, rgba(255, 255, 255, 0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(16, 23, 39, 0.14), rgba(16, 23, 39, 0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(16, 23, 39, 0.14), rgba(16, 23, 39, 0)) right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
tbody tr { transition: background-color 0.15s ease; }
tbody tr:hover { background: var(--accent-soft); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.mono { font-family: Consolas, "Cascadia Code", Menlo, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
}
.stat-tile .num {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--ink);
  display: block;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-tile .num.bad { color: var(--alert); }
.stat-tile .lbl { font-size: 0.8rem; color: var(--accent-dark); font-weight: 500; }

/* Dog cards */
.dog-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  display: block;
  box-shadow: var(--shadow);
}
.dog-card { transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease; }
.dog-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(16, 23, 39, 0.08);
  transform: translateY(-2px);
}
.dog-card .avatar {
  width: 64px; height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--chip);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem;
}
.dog-card .name { font-size: 1.08rem; font-weight: 600; margin: 0 0 2px; }
.dog-card .meta { font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }

.avatar-big {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--chip);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  flex-shrink: 0;
}

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 16px; font-size: 0.95rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 8px; } }

.qr-box { text-align: center; }
.qr-box svg { max-width: 180px; height: auto; }

/* Footer — dark like the site's */
footer.app-footer {
  background: var(--footer);
  color: #99A1AE;
  padding: 36px 0 44px;
  font-size: 0.85rem;
  margin-top: 40px;
}
footer.app-footer .foot-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
footer.app-footer a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
footer.app-footer a:hover { text-decoration: underline; }
footer.app-footer p { margin: 0; max-width: 72ch; }

/* On a phone the sticky header was eating 111px of 844: trim it back. */
@media (max-width: 560px) {
  .app-header .bar { padding: 8px 16px; }
  .app-header .brand span { display: none; }
  .app-header nav { gap: 14px; }
  .app-header nav a { min-height: 40px; }
  main { padding: 28px 0 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .dog-card:hover { transform: none; }
}

/* Chapita print sheet */
.chapitas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
}
.chapita {
  width: 132px; height: 132px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0 auto;
  padding: 10px;
}
/* QR at half the disc diameter: its corners then sit well inside the circle.
   At 74px they fell 2.9px outside and would be clipped when the tag is cut. */
.chapita svg { width: 66px; height: 66px; }
.chapita .code { font-family: Consolas, Menlo, monospace; font-size: 0.72rem; font-weight: 700; }
.chapita .brand-line { font-size: 0.55rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

@media print {
  .app-header, .no-print, footer.app-footer { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .card { border: none; box-shadow: none; padding: 0; }

  /* Real millimetres so the sheet reaches the engraver at 1:1 — on screen the
     disc measured 34.9 mm, not the 30 mm the page promises. */
  @page { margin: 12mm; }
  .chapitas-grid {
    grid-template-columns: repeat(auto-fill, minmax(36mm, 1fr));
    gap: 7mm;
  }
  .chapita {
    width: 30mm;
    height: 30mm;
    border-width: 0.3mm;
    padding: 1.5mm;
    gap: 0.8mm;
    break-inside: avoid;
  }
  .chapita svg { width: 15mm; height: 15mm; }
  .chapita .code { font-size: 2.4mm; }
  .chapita .brand-line { font-size: 1.7mm; }
}
