/* Tijuana Medica - patient guide styles. Mobile first. */
:root {
  --ink: #14262d;
  --ink-soft: #3e575f;
  --muted: #5c737a;
  --teal: #0e6a66;
  --teal-dark: #0a4f4c;
  --teal-soft: #e4f3f2;
  --sand: #f3ece2;
  --paper: #faf7f2;
  --card: #ffffff;
  --line: #e4d9cc;
  --terracotta: #b5482a;
  --terracotta-dark: #8c351c;
  --gold: #b0893a;
  --success: #1c6b48;
  --success-bg: #e5f4ec;
  --warn: #8a5a10;
  --warn-bg: #f8efd8;
  --danger: #9a1d2d;
  --danger-bg: #f8e6e8;
  --mixed: #5b457c;
  --mixed-bg: #efeaf6;
  --info: #1d4f72;
  --info-bg: #e7f0f6;
  --shadow: 0 10px 30px rgba(20, 38, 45, 0.06);
  --radius: 18px;
  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --font-sans: "Outfit", "Segoe UI", system-ui, sans-serif;
  --max: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; }
a { color: var(--teal-dark); }
a:hover { color: var(--terracotta); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

.wrap { width: min(var(--max), calc(100% - 2rem)); margin: 0 auto; }

/* Header */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.logo-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { font-family: var(--font-serif); font-size: 1.12rem; font-weight: 650; }
.logo-text span { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.02em; }

.nav-toggle {
  display: inline-flex;
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}
.nav-panel { display: none; }
.nav-panel.open {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.nav-list, .sub-list { list-style: none; margin: 0; padding: 0; }
.nav-list a, .sub-list a {
  display: block;
  text-decoration: none;
  color: var(--ink);
  padding: 0.55rem 0.2rem;
}
.nav-cta {
  display: inline-block;
  margin-top: 0.5rem;
  background: var(--terracotta);
  color: #fff !important;
  text-decoration: none;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-cta:hover { background: var(--terracotta-dark); }
.lang-toggle {
  display: inline-flex;
  gap: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem;
  margin: 0.6rem 0 0;
}
.lang-toggle button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--teal);
  color: #fff;
}

@media (min-width: 920px) {
  .nav-toggle { display: none; }
  .header-inner { min-height: 4.6rem; }
  .nav-panel {
    display: flex !important;
    position: static;
    border: 0;
    box-shadow: none;
    padding: 0;
    background: transparent;
    align-items: center;
    gap: 0.4rem 1.1rem;
  }
  .nav-list { display: flex; align-items: center; gap: 0.2rem 1.15rem; }
  .nav-list > li { position: relative; }
  .nav-list a { padding: 0.35rem 0; font-size: 0.98rem; }
  .has-sub:hover .sub-list, .has-sub:focus-within .sub-list {
    display: block;
  }
  .sub-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 15rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.45rem;
    box-shadow: var(--shadow);
  }
  .sub-list a { padding: 0.45rem 0.6rem; border-radius: 8px; }
  .sub-list a:hover { background: var(--sand); }
  .nav-cta { margin-top: 0; }
  .lang-toggle { margin: 0; }
}

/* Hero and typography */
.hero {
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(14, 106, 102, 0.16), transparent 55%),
    linear-gradient(180deg, #fff 0%, var(--sand) 100%);
  padding: 2.2rem 0 2.6rem;
  border-bottom: 1px solid var(--line);
}
.kicker {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--teal-dark);
  margin: 0 0 0.7rem;
}
h1, h2, h3, .serif { font-family: var(--font-serif); letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.35rem); line-height: 1.12; margin: 0 0 0.8rem; font-weight: 650; }
h2 { font-size: clamp(1.45rem, 3vw, 2.05rem); line-height: 1.2; margin: 0 0 0.8rem; }
h3 { font-size: 1.15rem; margin: 0 0 0.4rem; }
.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 42rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.3rem 0 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--terracotta); color: #fff; }
.btn-primary:hover { background: var(--terracotta-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--teal); color: var(--teal-dark); }
.btn-whatsapp { background: #128c7e; color: #fff; }
.btn-whatsapp:hover { background: #0e6e63; color: #fff; }

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 1.6rem 0 0;
}
.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 1rem;
}
.metric b { display: block; font-size: 1.35rem; font-family: var(--font-serif); }
.metric span { color: var(--muted); font-size: 0.88rem; }
@media (min-width: 720px) {
  .metrics { grid-template-columns: repeat(4, 1fr); }
}

/* Layout sections */
.section { padding: 2.4rem 0; }
.section + .section { padding-top: 0; }
.section-head { margin-bottom: 1.2rem; max-width: 44rem; }
.muted, .fine { color: var(--muted); font-size: 0.95rem; }
.updated { font-size: 0.9rem; color: var(--muted); }

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 700px) {
  .card-grid.cols-3, .card-grid.cols-2, .card-grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 980px) {
  .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .card-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
}

.card, .guide-card, .clinic-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
}
a.card:hover, a.guide-card:hover { border-color: var(--teal); }
.score-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.score { font-family: var(--font-serif); font-weight: 650; color: var(--teal-dark); }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--sand);
  color: var(--ink);
}
.badge-top { background: var(--success-bg); color: var(--success); }
.badge-recommended { background: var(--teal-soft); color: var(--teal-dark); }
.badge-solid { background: var(--info-bg); color: var(--info); }
.badge-mixed { background: var(--mixed-bg); color: var(--mixed); }
.badge-caution, .badge-high-caution { background: var(--warn-bg); color: var(--warn); }
.badge-avoid, .badge-red-flag { background: var(--danger-bg); color: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.rank {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 860px;
}
table.rank th, table.rank td {
  text-align: left;
  vertical-align: top;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
table.rank th {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #fcfaf7;
  position: sticky;
  top: 0;
}
table.rank tr:last-child td { border-bottom: 0; }
.clinic-cards { display: grid; gap: 1rem; }
@media (min-width: 900px) { .clinic-cards { display: none; } }
@media (max-width: 899px) { .desktop-table { display: none; } }

.list { padding-left: 1.15rem; }
.list li { margin: 0.35rem 0; }
.callout {
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
  padding: 0.9rem 1rem;
  border-radius: 0 12px 12px 0;
  margin: 1.1rem 0;
}
.callout.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.callout.danger { border-left-color: var(--danger); background: var(--danger-bg); }
.uncertain {
  font-size: 0.88rem;
  color: var(--warn);
  margin: 0.35rem 0 0;
}

/* Bands and forms */
.pickup-band {
  background: var(--ink);
  color: #f6f1ea;
  padding: 2rem 0;
}
.pickup-band h2 { color: #fff; }
.pickup-band p { color: #d7e0e3; max-width: 40rem; }
.form {
  display: grid;
  gap: 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
}
.form label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.95rem; }
.form input, .form select, .form textarea {
  font: inherit;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.form textarea { min-height: 8rem; resize: vertical; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.form-note { font-weight: 400; color: var(--muted); font-size: 0.88rem; }
.form-success {
  background: var(--success-bg);
  border: 1px solid #b7dfc6;
  padding: 1rem 1.1rem;
  border-radius: 12px;
}
.form-error { color: var(--danger); font-size: 0.95rem; }

.crumbs { font-size: 0.9rem; color: var(--muted); margin: 0 0 1rem; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.prose { max-width: 46rem; }
.prose p { margin: 0 0 1rem; }
.prose h2 { margin-top: 2rem; }
.checklist { list-style: none; padding: 0; }
.checklist li {
  padding: 0.7rem 0 0.7rem 1.8rem;
  position: relative;
  border-bottom: 1px solid var(--line);
}
.checklist li::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--teal);
  border-radius: 3px;
  position: absolute;
  left: 0;
  top: 0.95rem;
}

/* Footer and sticky CTA */
.site-footer {
  background: #102126;
  color: #d5e0e3;
  padding: 2.4rem 0 5.5rem;
  margin-top: 2rem;
}
.site-footer a { color: #fff; }
.footer-grid {
  display: grid;
  gap: 1.4rem;
}
@media (min-width: 800px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}
.legal { font-size: 0.85rem; color: #9aafb4; max-width: 46rem; }
.sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 0.55rem 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  z-index: 30;
}
.sticky-cta .btn { flex: 1; max-width: 18rem; padding: 0.65rem 0.8rem; }
@media (min-width: 920px) {
  .sticky-cta { display: none; }
  .site-footer { padding-bottom: 2.4rem; }
}

[lang="es"] .lang-en { display: none; }
[lang="en"] .lang-es { display: none; }
html[lang="es"] .en-only { display: none; }
html[lang="en"] .es-only { display: none; }

details { margin: 0.75rem 0; border-bottom: 1px solid var(--line); padding-bottom: 0.7rem; }
details summary { cursor: pointer; font-weight: 600; }
details p { margin: 0.55rem 0 0; }
