:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-alt: #eef1f3;
  --text: #131a20;
  --text-muted: #5a6672;
  --primary: #0e6e5f;
  --primary-dark: #0a4f44;
  --primary-light: #e2f2ef;
  --border: #dde3e7;
  --note-bg: #fbf7ea;
  --note-border: #e6dcb8;
  --note-text: #6b5511;
  --shadow-xs: 0 1px 2px rgba(15, 23, 30, 0.05);
  --shadow-sm: 0 2px 6px rgba(15, 23, 30, 0.06);
  --shadow-md: 0 8px 20px rgba(15, 23, 30, 0.08);
  --shadow-lg: 0 16px 36px rgba(15, 23, 30, 0.10);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-display: "Plus Jakarta Sans", "Manrope", system-ui, -apple-system, sans-serif;
  --font-body: "Manrope", "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

a {
  color: inherit;
}

button, input {
  font-family: inherit;
}

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(244, 246, 247, 0.6);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-xs);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 14px;
  padding: 14px 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--text);
}

.logo-img {
  height: 28px;
  width: auto;
  display: block;
}

.logo-tagline {
  display: none;
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--text-muted);
}

@media (min-width: 860px) {
  .logo-tagline {
    display: block;
  }
}

/* Pill navigation */
.pill-nav {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow-xs);
  gap: 2px;
}

.pill-nav::-webkit-scrollbar {
  display: none;
}

.pill-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1), width 0.35s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 0;
}

.pill-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border: none;
  background: transparent;
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.3s ease;
}

.pill-icon {
  font-size: 0.95rem;
}

.pill-btn.active {
  color: #fff;
}

/* Sections */
.page {
  display: none;
  padding: 32px 0 56px;
  animation: fadeIn 0.4s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.section-title {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.subsection-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 34px 0 2px;
}

.section-subtitle {
  color: var(--text-muted);
  margin: 0 0 24px;
}

/* Card grid (Supermercado) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.card-grid > *,
.rank-list > * {
  animation: cardIn 0.5s ease both;
}

.card-grid > *:nth-child(1) { animation-delay: 0.02s; }
.card-grid > *:nth-child(2) { animation-delay: 0.05s; }
.card-grid > *:nth-child(3) { animation-delay: 0.08s; }
.card-grid > *:nth-child(4) { animation-delay: 0.11s; }
.card-grid > *:nth-child(5) { animation-delay: 0.14s; }
.card-grid > *:nth-child(6) { animation-delay: 0.17s; }
.card-grid > *:nth-child(n+7) { animation-delay: 0.2s; }

.rank-list > *:nth-child(1) { animation-delay: 0.02s; }
.rank-list > *:nth-child(2) { animation-delay: 0.05s; }
.rank-list > *:nth-child(3) { animation-delay: 0.08s; }
.rank-list > *:nth-child(4) { animation-delay: 0.11s; }
.rank-list > *:nth-child(5) { animation-delay: 0.14s; }
.rank-list > *:nth-child(n+6) { animation-delay: 0.17s; }

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  margin-bottom: 14px;
  background: var(--primary-light);
  border: 1px solid var(--border);
}

.icon-1, .icon-2, .icon-3, .icon-4, .icon-5, .icon-6,
.icon-7, .icon-8, .icon-9, .icon-10, .icon-11, .icon-12 {
  background: var(--primary-light);
}

.info-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
}

.info-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.info-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary-dark);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.info-toggle .chevron {
  transition: transform 0.3s ease;
  color: var(--primary-dark);
}

.info-card.open .info-toggle .chevron {
  transform: rotate(180deg);
}

.info-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, margin-top 0.35s ease;
}

.info-card.open .info-content {
  max-height: 1000px;
  margin-top: 12px;
}

.info-product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-product-list li {
  font-size: 0.83rem;
  color: var(--text-muted);
  padding: 7px 10px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}

/* Search box */
.search-box {
  position: relative;
  margin-bottom: 18px;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 18px;
  transform: translateY(-50%);
  font-size: 0.95rem;
  opacity: 0.6;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 13px 18px 13px 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font: inherit;
  color: var(--text);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* Filter chips */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 20px;
}

.filter-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 9px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.filter-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: transparent;
  color: #fff;
}

.diet-block + .diet-block {
  margin-top: 8px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

/* Recipe / diet cards */
.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.recipe-card:hover {
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

.recipe-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
  transition: background 0.2s ease;
}

.recipe-toggle:hover {
  background: var(--surface-alt);
}

.recipe-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.recipe-title {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.recipe-title strong {
  font-family: var(--font-display);
  font-weight: 700;
}

.recipe-title small {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.chevron {
  flex-shrink: 0;
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.recipe-card.open .chevron {
  transform: rotate(180deg);
}

.recipe-content {
  max-height: 0;
  overflow: hidden;
  padding: 0 20px;
  transition: max-height 0.35s ease, padding 0.35s ease;
}

.recipe-card.open .recipe-content {
  max-height: 900px;
  padding: 0 20px 22px;
}

.recipe-content h4 {
  margin: 12px 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--primary-dark);
}

.recipe-content ul,
.recipe-content ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.recipe-content li {
  margin-bottom: 4px;
}

.meal-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.meal-list li {
  padding: 8px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.meal-list li:first-child {
  border-top: none;
}

.meal-list strong {
  color: var(--text);
}

.diet-card .recipe-icon {
  background: linear-gradient(135deg, #d3f9d8, var(--primary));
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-radius: var(--radius-md);
  color: var(--note-text);
  font-size: 0.85rem;
}

.disclaimer-icon {
  flex-shrink: 0;
}

/* Restaurant ranking */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.rank-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 18px 20px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.rank-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

.rank-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-number.rank-top-1 {
  background: linear-gradient(135deg, #d4a94a, #a97e1f);
}

.rank-number.rank-top-2 {
  background: linear-gradient(135deg, #b7bfc7, #838d97);
}

.rank-number.rank-top-3 {
  background: linear-gradient(135deg, #b8895f, #8a5f3c);
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rank-header h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}

.rank-rating {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.9rem;
}

.rank-meta {
  margin: 4px 0 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.rank-desc {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.rank-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
  text-decoration: none;
}

.rank-link:hover {
  text-decoration: underline;
}

/* Specialized shops */
.shop-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.shop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 18px 20px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.shop-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

.shop-noweb {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Scanner */
.scanner-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 28px 24px;
  text-align: center;
}

.scanner-camera {
  position: relative;
  max-width: 420px;
  margin: 0 auto 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-frame {
  position: absolute;
  inset: 15% 10%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25);
}

.scanner-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.scanner-status {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.scanner-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 20px 0;
}

.scanner-divider::before,
.scanner-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.scanner-manual {
  max-width: 420px;
  margin: 0 auto;
  text-align: left;
}

.scanner-manual label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.scanner-manual-row {
  display: flex;
  gap: 8px;
}

.scanner-manual-row input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font: inherit;
  color: var(--text);
  min-width: 0;
}

.scanner-manual-row input:focus {
  outline: none;
  border-color: var(--primary);
}

.scanner-result {
  margin-top: 18px;
}

.scanner-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  border-left: 6px solid var(--border);
}

.scanner-card-loading {
  text-align: center;
  color: var(--text-muted);
}

.scanner-verdict-sin-gluten {
  border-left-color: var(--primary);
}

.scanner-verdict-con-gluten {
  border-left-color: #e03131;
}

.scanner-verdict-trazas {
  border-left-color: #f08c00;
}

.scanner-verdict-desconocido {
  border-left-color: var(--text-muted);
}

.scanner-product {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.scanner-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--bg);
  flex-shrink: 0;
}

.scanner-product h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.scanner-brand {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.scanner-verdict {
  font-weight: 700;
  font-size: 1rem;
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scanner-icon {
  font-size: 1.2rem;
}

.scanner-ingredients {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 10px;
}

/* Footer */
.site-footer {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
  padding: 40px 20px 28px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.footer-logo-icon {
  height: 22px;
  width: auto;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
  max-width: 320px;
}

.footer-links-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 12px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  width: fit-content;
}

.footer-links a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.footer-legal p {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 0;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  text-align: center;
}

.footer-bottom p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .pill-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .section-title {
    font-size: 1.35rem;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
