/* Recetario. Identidad del libro (brief de diseño): fondo crema #F6F1EA,
   verde oliva #5A7A48 como único acento, texto carbón. Títulos en DM Serif
   Display y texto en Jost, como la asesoría y /empieza. */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #F6F1EA;
  --card: #FFFDF9;
  --ph: #ECE4D7;
  --text: #1F1F1F;
  --soft: #5C5A54;
  --faint: #8E8A80;
  --accent: #5A7A48;
  --accent-soft: #E9EEE2;
  --line: #E3DACB;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'Jost', system-ui, sans-serif;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); font-weight: 400; font-size: 16px; line-height: 1.55;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
strong { font-weight: 500; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.8rem 1rem; background: rgba(246, 241, 234, 0.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--serif); font-size: 1.25rem; color: var(--text); text-decoration: none; }
.brand-dot {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: Georgia, serif; font-style: italic; font-size: 0.95rem; font-weight: 600;
}
.topnav { display: flex; gap: 1.1rem; font-size: 0.9rem; }
.topnav a { color: var(--soft); text-decoration: none; }
.topnav a:hover { color: var(--accent); }

#app { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }

/* Inicio */
.hero { padding: 2.2rem 0 1.4rem; max-width: 40rem; }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 6vw, 2.9rem); line-height: 1.08; letter-spacing: -0.01em; }
.hero p { margin-top: 0.8rem; color: var(--soft); font-size: 1.02rem; }
.guide-link { display: inline-block; margin-top: 0.9rem; font-size: 0.95rem; font-weight: 500; }

.tools {
  position: sticky; top: 53px; z-index: 5;
  margin: 0 -1rem; padding: 0.7rem 1rem 0; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.search input {
  width: 100%; padding: 0.75rem 1rem; font: inherit; font-size: 16px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.search input:focus { border-color: var(--accent); }
.tabs { display: flex; gap: 1.3rem; overflow-x: auto; padding-top: 0.55rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 0.35rem 0 0.6rem; font-size: 0.93rem; color: var(--soft);
  text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a.on { color: var(--text); font-weight: 500; border-bottom-color: var(--accent); }

.chapter { padding-top: 1.8rem; }
.chapter h2 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1.15; }
.chapter-range { margin-top: 0.15rem; font-size: 0.9rem; color: var(--faint); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem 0.8rem; margin-top: 1rem; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.6rem 1rem; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { display: block; color: inherit; text-decoration: none; }
.card .ph { border-radius: 12px; transition: opacity 0.15s ease; }
.card:hover .ph { opacity: 0.85; }
.card h3 { margin-top: 0.55rem; font-family: var(--serif); font-weight: 400; font-size: 1.05rem; line-height: 1.2; }
.card-time { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.3rem; font-size: 0.85rem; color: var(--text); }
.card-time svg { flex: none; width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; }
.card-kcal { margin-top: 0.1rem; font-size: 0.85rem; color: var(--soft); }
.card-p { font-size: 0.85rem; color: var(--accent); font-weight: 500; }

/* Espacio reservado para la foto, con la proporción definitiva (3:2) */
.ph {
  aspect-ratio: 3 / 2; background: var(--ph);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
  color: #B4AA98; font-size: 0.85rem;
}
.ph svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.photo { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--ph); }
.card .photo { border-radius: 12px; transition: opacity 0.15s ease; }
.card:hover .photo { opacity: 0.9; }
.ph.big, .photo.big { border-radius: 16px; margin-top: 1.2rem; }
.ph.big svg { width: 40px; height: 40px; }

.empty { padding: 2.5rem 0; color: var(--soft); }

/* Receta */
.recipe, .page { max-width: 760px; margin: 0 auto; padding: 1.4rem 0 1rem; }
.page.wide { max-width: 900px; }
.back { display: inline-block; font-size: 0.92rem; text-decoration: none; }
.recipe h1, .page h1 { margin-top: 0.7rem; font-family: var(--serif); font-weight: 400; font-size: clamp(1.9rem, 6vw, 2.6rem); line-height: 1.1; letter-spacing: -0.01em; }
.meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin-top: 0.6rem; font-size: 0.93rem; color: var(--soft); }
.meta span { display: inline-flex; align-items: center; gap: 0.35rem; }
.meta svg { width: 17px; height: 17px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.intro { margin-top: 1rem; color: var(--soft); }

.switch {
  position: sticky; top: 53px; z-index: 4;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
  margin-top: 1.2rem; padding: 0.5rem 0; background: var(--bg);
}
.switch button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.05rem;
  padding: 0.65rem 0.9rem; text-align: left; cursor: pointer; font: inherit;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
}
.switch button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.sw-title { font-weight: 500; font-size: 0.98rem; }
.sw-sub { font-size: 0.82rem; color: var(--soft); }

.macros { margin-top: 0.6rem; }
.macros p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 1.1rem; font-size: 0.95rem; color: var(--soft); }
.macro-label { font-size: 0.85rem !important; color: var(--faint) !important; margin-bottom: 0.15rem; }
.kcal { flex-basis: 100%; font-family: var(--serif); font-size: 1.55rem; color: var(--text); line-height: 1.1; }
.prot { color: var(--accent); font-weight: 500; }

.two-col, .stack { margin-top: 0.6rem; }
@media (min-width: 820px) {
  .two-col { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 2.6rem; align-items: start; }
}
.sec { padding-top: 1.6rem; }
.sec h3 { font-family: var(--serif); font-weight: 400; font-size: 1.4rem; line-height: 1.2; padding-bottom: 0.45rem; border-bottom: 1px solid var(--line); }
.stack .sec .macros { margin-top: 0.7rem; }
.sec h4 { margin-top: 1.1rem; font-size: 0.95rem; font-weight: 500; color: var(--accent); }
.para { margin-top: 0.8rem; color: var(--soft); }

.ings { list-style: none; margin-top: 0.4rem; }
.ings li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.ings li:last-child { border-bottom: 0; }
.qty { flex: none; max-width: 45%; text-align: right; font-weight: 500; color: var(--accent); }
.note { color: var(--faint); }

.steps { list-style: none; counter-reset: paso; margin-top: 0.6rem; }
.steps li { position: relative; counter-increment: paso; padding: 0.5rem 0 0.5rem 2.1rem; }
.steps li::before {
  content: counter(paso); position: absolute; left: 0; top: 0.42rem;
  font-family: var(--serif); font-size: 1.25rem; color: var(--accent); line-height: 1.3;
}
.tip { margin-top: 1rem; padding: 0.9rem 1rem; background: var(--accent-soft); border-radius: 12px; font-size: 0.95rem; }
.tip strong { color: var(--accent); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.6rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.pager a { color: var(--text); text-decoration: none; font-family: var(--serif); font-size: 1.05rem; line-height: 1.25; }
.pager a span { display: block; font-family: var(--sans); font-size: 0.82rem; color: var(--faint); margin-bottom: 0.15rem; }
.pager .next { text-align: right; }

/* Guía y tabla */
.page h2 { margin-top: 1.9rem; font-family: var(--serif); font-weight: 400; font-size: 1.4rem; }
.page p { margin-top: 0.6rem; }
.page .small { font-size: 0.9rem; color: var(--soft); }
.plain { margin: 0.5rem 0 0 1.2rem; }
.plain li { margin-top: 0.3rem; }
.tbl-wrap { overflow-x: auto; margin-top: 0.8rem; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 0.9rem; font-size: 0.92rem; background: var(--card); border-radius: 12px; overflow: hidden; }
.tbl-wrap .tbl { margin-top: 0; }
.tbl th, .tbl td { padding: 0.55rem 0.7rem; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th { font-weight: 500; color: var(--soft); background: #F1EADF; }
.macro-tbl { min-width: 640px; }
.macro-tbl td:not(:first-child), .macro-tbl th:not(:first-child) { text-align: right; white-space: nowrap; }
.macro-tbl thead th[colspan] { text-align: center; }
.macro-tbl td a { color: var(--text); text-decoration: none; }
.macro-tbl td a:hover { color: var(--accent); }

/* Pie */
.foot { max-width: 1080px; margin: 3rem auto 0; padding: 1.6rem 1rem 2.4rem; border-top: 1px solid var(--line); text-align: center; }
.foot p { font-family: var(--serif); font-size: 1.1rem; }
.foot .foot-small { font-family: var(--sans); font-size: 0.85rem; color: var(--faint); margin-top: 0.3rem; }

@media (max-width: 420px) {
  .topnav { gap: 0.8rem; font-size: 0.82rem; }
  .brand { font-size: 1.1rem; }
}

/* Entrar */
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--soft); cursor: pointer; }
.link-btn:hover { color: var(--accent); }
.auth { max-width: 420px; margin: 3rem auto 1rem; padding: 2rem 1.5rem; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.auth h1 { font-family: var(--serif); font-weight: 400; font-size: 1.9rem; line-height: 1.15; }
.auth > p { margin-top: 0.6rem; color: var(--soft); }
.auth form { display: grid; gap: 0.9rem; margin-top: 1.3rem; }
.auth label { display: grid; gap: 0.3rem; font-size: 0.92rem; font-weight: 500; }
.auth input { padding: 0.75rem 0.9rem; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; outline: none; }
.auth input:focus { border-color: var(--accent); }
.auth-btn { display: block; width: 100%; margin-top: 0.4rem; padding: 0.85rem; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: inherit; font-weight: 500; text-align: center; text-decoration: none; cursor: pointer; }
.auth-btn:disabled { opacity: 0.7; }
.auth .link-btn { display: block; margin: 1rem auto 0; font-size: 0.92rem; }
.auth-small { margin-top: 1.2rem; font-size: 0.9rem; color: var(--faint); text-align: center; }
.auth-error, .auth-ok { margin-top: 0.9rem; padding: 0.7rem 0.9rem; border-radius: 10px; font-size: 0.92rem; }
.auth-error { background: #F6E6E0; color: #8A3B26; }
.auth-ok { background: var(--accent-soft); color: var(--accent); }
body[data-view="entrar"] .topnav a { display: none; }
