/* ==========================================================
   GroceryList.io — hoja de estilos de las páginas de contenido
   Comparte la paleta de la app pero con un diseño de artículo.
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --primary: #2c3e50;
    --primary-light: #34495e;
    --accent: #27ae60;
    --accent-hover: #229954;
    --accent-soft: rgba(39, 174, 96, 0.1);
    --info: #3498db;
    --warning: #f39c12;
    --bg-main: #ecf0f1;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --text-primary: #22313f;
    --text-secondary: #5f6f7c;
    --text-light: #8a9aa6;
    --border: #dfe6e9;
    --border-light: #e8ecef;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --max: 760px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #16202b;
        --primary-light: #1e2b38;
        --accent: #2ecc71;
        --accent-hover: #27ae60;
        --accent-soft: rgba(46, 204, 113, 0.12);
        --bg-main: #0e1418;
        --bg-white: #161e24;
        --bg-light: #1b242b;
        --text-primary: #e6edf3;
        --text-secondary: #9fb0bd;
        --text-light: #7d8f9c;
        --border: #2a353f;
        --border-light: #232e37;
        color-scheme: dark;
    }
}

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.68;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
}

/* ---------- cabecera ---------- */
.site-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    padding: 0.875rem 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-md);
}
.site-header-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.site-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}
.site-logo svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.header-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background 0.2s;
}
.header-cta:hover { background: var(--accent-hover); }

/* ---------- contenido ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.125rem; }
main { padding: 1.5rem 0 3rem; }

.breadcrumb {
    font-size: 0.813rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

h1 {
    font-size: clamp(1.75rem, 5vw, 2.4rem);
    line-height: 1.2;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
}
h2 {
    font-size: clamp(1.3rem, 3.6vw, 1.65rem);
    line-height: 1.28;
    margin: 2.5rem 0 0.75rem;
    letter-spacing: -0.01em;
}
h3 {
    font-size: 1.125rem;
    margin: 1.75rem 0 0.5rem;
    color: var(--text-primary);
}
p { margin: 0 0 1.1rem; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

.lede {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

ul, ol { margin: 0 0 1.2rem; padding-left: 1.35rem; }
li { margin-bottom: 0.45rem; }

hr { border: none; border-top: 1px solid var(--border-light); margin: 2.5rem 0; }

code {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    padding: 0.1em 0.35em;
    font-size: 0.9em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- respuesta rápida (lo que citan los buscadores con IA) ---------- */
.answer-box {
    background: var(--accent-soft);
    border: 1px solid rgba(39, 174, 96, 0.32);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    margin: 0 0 1.75rem;
}
.answer-box p:last-child { margin-bottom: 0; }
.answer-box strong { color: var(--text-primary); }
.answer-label {
    display: block;
    font-size: 0.688rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.35rem;
}

.callout {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--info);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.1rem;
    margin: 1.5rem 0;
    font-size: 0.938rem;
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; -webkit-overflow-scrolling: touch; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.938rem;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
th, td {
    text-align: left;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}
th {
    background: var(--bg-light);
    font-weight: 700;
    font-size: 0.844rem;
    color: var(--text-primary);
    white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* ---------- pasos ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 1.5rem 0; }
.steps > li {
    counter-increment: step;
    position: relative;
    padding-left: 2.85rem;
    margin-bottom: 1.15rem;
}
.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0.05rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.938rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.steps strong { display: block; }

/* ---------- llamada a la acción ---------- */
.cta-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    margin: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow-md);
}
.cta-card h2, .cta-card h3 { margin-top: 0; }
.cta-card p { color: var(--text-secondary); font-size: 0.938rem; }
.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-xl);
    font-size: 1rem;
    transition: background 0.2s, transform 0.15s;
}
.btn-cta:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }
.btn-cta svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- FAQ ---------- */
.faq details {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.1rem;
    margin-bottom: 0.7rem;
}
.faq summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
}
.faq details[open] summary { margin-bottom: 0.6rem; }
.faq p:last-child { margin-bottom: 0; }

/* ---------- lista por pasillos ---------- */
.aisle-block {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}
.aisle-block h3 {
    margin: 0 0 0.15rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 1.063rem;
}
.aisle-block h3 .count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
}
.aisle-block .hint {
    font-size: 0.844rem;
    color: var(--text-secondary);
    margin: 0 0 0.7rem;
}
.item-grid {
    columns: 2 190px;
    column-gap: 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}
.item-grid li {
    margin-bottom: 0.28rem;
    break-inside: avoid;
    color: var(--text-secondary);
    padding-left: 1.1rem;
    position: relative;
}
.item-grid li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 9px;
    height: 9px;
    border: 1.5px solid var(--border);
    border-radius: 2px;
}

/* ---------- plantilla imprimible ---------- */
.print-sheet {
    background: #fff;
    color: #111;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 1.5rem 0;
}
.print-sheet h3 { color: #111; margin-top: 0; }
.print-sheet .cols { columns: 2 200px; column-gap: 2rem; }
.print-sheet ul { list-style: none; padding: 0; }
.print-sheet li {
    border-bottom: 1px dotted #bbb;
    padding: 0.42rem 0 0.42rem 1.5rem;
    position: relative;
    break-inside: avoid;
    font-size: 0.9rem;
}
.print-sheet li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.62rem;
    width: 12px;
    height: 12px;
    border: 1.5px solid #555;
    border-radius: 2px;
}
.print-sheet .sheet-head {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #111;
    padding-bottom: 0.5rem;
    margin-bottom: 0.9rem;
    font-size: 0.875rem;
}
.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem 1.1rem;
    font-size: 0.938rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.btn-print:hover { border-color: var(--accent); color: var(--accent); }
.btn-print svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- pie ---------- */
.site-footer {
    background: var(--primary);
    color: #fff;
    padding: 2rem 1.125rem;
    font-size: 0.875rem;
}
.site-footer .wrap { padding: 0; }
.site-footer h4 {
    margin: 0 0 0.6rem;
    font-size: 0.719rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.6;
}
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.15rem;
    padding: 0;
    margin: 0 0 1.25rem;
    list-style: none;
}
.footer-nav a { color: #fff; opacity: 0.85; text-decoration: none; }
.footer-nav a:hover { opacity: 1; text-decoration: underline; }
.footer-meta { opacity: 0.6; font-size: 0.781rem; line-height: 1.6; }
.footer-meta a { color: #fff; }

/* ---------- utilidades ---------- */
.muted { color: var(--text-secondary); }
.small { font-size: 0.875rem; }
.sources { font-size: 0.844rem; color: var(--text-secondary); }
.sources li { margin-bottom: 0.3rem; }
.updated {
    font-size: 0.781rem;
    color: var(--text-light);
    margin-bottom: 1.25rem;
}

/* ---------- impresión ---------- */
@media print {
    .site-header, .site-footer, .cta-card, .btn-print, .breadcrumb,
    .answer-box, .callout, .faq, .no-print { display: none !important; }
    body { background: #fff; color: #000; font-size: 12pt; }
    .print-sheet { border: none; padding: 0; page-break-inside: avoid; }
    .print-sheet li { border-bottom: 1px solid #ccc; }
    h1 { font-size: 20pt; }
    h2 { font-size: 15pt; page-break-after: avoid; }
    .aisle-block { border: none; padding: 0 0 0.5rem; page-break-inside: avoid; }
    a { color: #000; text-decoration: none; }
    .wrap { max-width: none; padding: 0; }
}
