/* File: src/styles/base.css */
:root {
  --bg: #f6fbf7;
  --text: #0a0f0c;
  --muted: #5b6b61;
  --border: #d1fae5;
  --ring: #86efac;
  --brand: #16a34a;      /* verde principal */
  --brand-dark: #15803d; /* hover */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f0c;
    --text: #e6f4ea;
    --muted: #b6c7bb;
    --border: #1f2937;
    --ring: #14532d;
    --brand: #22c55e;
    --brand-dark: #16a34a;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
  text-rendering: optimizeLegibility;
}

.container { max-width: 880px; margin: 0 auto; padding: 0 16px; }
.main { padding: 32px 0 48px; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(6px);
}
.site-header .container { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.nav { margin-left: auto; display: flex; gap: 12px; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.nav a:hover, .nav a:focus-visible { color: var(--text); background: color-mix(in oklab, var(--brand) 10%, transparent); outline: none; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0 48px;
  color: var(--muted);
}
.site-footer a { color: inherit; }

h1, h2, h3 { line-height: 1.2; margin: 0.6em 0 0.4em; }
p { margin: 0.6em 0; color: var(--text); }
small { color: var(--muted); }

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

.input, .select, .btn {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
}
.input:focus-visible, .select:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn.primary {
  background: var(--brand);
  color: white;
  border-color: color-mix(in oklab, var(--brand) 70%, black);
}
.btn.primary:hover { background: var(--brand-dark); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

/* === Utilities === */
.row { display: grid; gap: 12px; }
.row.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .row.cols-2 { grid-template-columns: 1fr; } }

.row.cards-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.center { display: flex; justify-content: center; align-items: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.maxw-560 { max-width: 560px; }

/* status messages */
.status { color: var(--muted); min-height: 1.25em; }

/* lists */
ul, ol { padding-left: 1.25rem; }

/* breadcrumbs */
.breadcrumbs{ font-size:.9rem; color:var(--muted); margin:8px 0 12px; }
.breadcrumbs ol{ list-style:none; display:flex; gap:6px; padding:0; margin:0; flex-wrap:wrap; }
.breadcrumbs li{ display:flex; align-items:center; }
.breadcrumbs li::after{ content:"›"; margin:0 6px; color:var(--muted); }
.breadcrumbs li:last-child::after{ content:""; margin:0; }
.breadcrumbs a{ color:inherit; text-decoration:none; }
.breadcrumbs a:hover, .breadcrumbs a:focus-visible{ text-decoration:underline; outline:none; }

/* Card look */
:root {
  --card-bg: #ffffff;
  --shadow: 0 10px 30px rgba(22,163,74,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --card-bg: #0f172a;
    --shadow: 0 10px 30px rgba(16,185,129,.16);
  }
}
.card { background: var(--card-bg); box-shadow: var(--shadow); }

/* cuando la tarjeta es un <a> */
a.card { display:block; color: inherit; text-decoration: none;
  transition: border-color .2s, box-shadow .2s, transform .06s; }
a.card:hover { border-color: color-mix(in oklab, var(--brand) 35%, var(--border));
  box-shadow: 0 12px 32px rgba(22,163,74,.12); }
a.card:active { transform: translateY(1px); }

/* Tarjeta de receta (lista Latest/Explore) */
.recipe-card { position: relative; min-height: 132px; padding-bottom: 38px; }
.recipe-card h3 { margin: .2rem 0; }
.card-footer {
  position: absolute; left: 12px; right: 12px; bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.card-footer .cta { color: inherit; }
.card-footer .cta:hover { text-decoration: underline; }

/* nav activo */
.nav a[aria-current="page"] {
  color: var(--text); font-weight: 600;
  background: color-mix(in oklab, var(--brand) 10%, transparent);
}

/* (opcional) títulos un poco más grandes */
h1 { font-size: clamp(28px, 4.6vw, 40px); }

/* a11y helper */
.sr-only {
  position:absolute!important;
  width:1px!important; height:1px!important;
  padding:0!important; margin:-1px!important;
  overflow:hidden!important; clip:rect(0,0,0,0)!important;
  white-space:nowrap!important; border:0!important;
}

/* loading state for primary button */
.btn.primary.loading {
  position: relative;
  opacity: 0.85;
}
.btn.primary.loading::after {
  content: "";
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.6);
  border-top-color: rgba(255,255,255,1);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

/* === Permalink / Recipe page helpers === */
.wrap { max-width: 740px; margin: 0 auto; padding: 0 16px; }

.muted { color: var(--muted); opacity: .85; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 1rem; }
.chip { padding: .25rem .55rem; border-radius: .6rem;
  background: color-mix(in oklab, var(--brand) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--brand) 35%, var(--border));
}

.hero { aspect-ratio: 1200/630; border-radius: 16px; overflow: hidden;
  background: var(--card-bg); display: grid; place-items: center; margin: 1rem 0;
}
.hero img { max-width: 100%; height: auto; display: block; }

.section { border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  margin-top: 16px; background: var(--card-bg);
}

/* Share buttons */
.share { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.share-btn { display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .8rem; border-radius: .75rem; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); text-decoration: none;
}
.share-btn:hover { filter: brightness(0.98); }
.share-btn .emoji { font-size: 1.05em; line-height: 1; }

/* === Dark mode override via .dark class (toggle) === */
.dark {
  --bg: #0a0f0c;
  --text: #e6f4ea;
  --muted: #b6c7bb;
  --border: #1f2937;
  --ring: #14532d;
  --brand: #22c55e;
  --brand-dark: #16a34a;

  --card-bg: #0f172a;
  --shadow: 0 10px 30px rgba(16,185,129,.16);
}

/* === Shopping list (ingredients checklist) === */
.checklist { list-style: none; padding: 0; margin: .2rem 0; }
.checklist li { display: flex; align-items: center; gap: .6rem; padding: .28rem 0; border-bottom: 1px dashed color-mix(in oklab, var(--border) 80%, transparent); }
.checklist li:last-child { border-bottom: none; }
.checklist input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--brand); }
.checklist label { flex: 1; cursor: pointer; }
.tools { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 .8rem; }

@media print {
  .site-header, .share, .tools, .btn, a { display: none !important; }
  .section { box-shadow: none; }
}

/* === Explore filters layout === */
.filters {
  display: grid;
  grid-template-columns: repeat( auto-fit, minmax(140px, 1fr) );
  gap: 8px;
}
