:root {
    --paper: #f6f4f0;
    --paper-deep: #e7e2d8;
    --ink: #1a1c19;
    --muted: #6d6962;
    --line: rgba(26, 28, 25, 0.12);
    --white: #ffffff;
    --terra: #c2410c;
    --terra-deep: #9a3412;
    --herb: #24362e;
    --herb-soft: #e7efe9;
    --gold: #8a7352;
    --danger: #9f2d2d;
    --shadow: 0 1px 2px rgba(26, 28, 25, 0.04);
    --serif: "Newsreader", Georgia, serif;
    --sans: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--sans);
    font-size: 1.02rem;
    line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 620; letter-spacing: -0.03em; line-height: 1.12; }
p { margin: 0 0 0.8rem; }

.wrap { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.site-header {
    position: sticky; top: 0; z-index: 20;
    background: var(--white);
    border-bottom: 1px solid var(--line);
}
.header-top {
    display: flex; align-items: center; gap: 1.25rem;
    min-height: 68px;
}
.brand {
    text-decoration: none; display: flex; flex-direction: column;
    line-height: 0.9; flex: 0 0 auto; min-width: 7.2rem;
}
.brand-word {
    font-family: var(--serif); font-size: 1.7rem; font-weight: 620;
    letter-spacing: -0.03em;
}
.brand-sub {
    color: var(--muted); font-size: 0.68rem; letter-spacing: 0.22em;
    text-transform: uppercase; margin-top: 0.28rem; font-weight: 500;
}
.nav-search { position: relative; flex: 1 1 auto; min-width: 0; }
.search-icon {
    position: absolute; left: 0.85rem; top: 50%; width: 18px; height: 18px;
    transform: translateY(-50%); color: var(--muted); pointer-events: none;
}
.nav-search input {
    width: 100%; height: 42px; border: 1px solid transparent; background: var(--paper);
    border-radius: 999px; padding: 0 1rem 0 2.55rem;
}
.nav-search input:focus {
    outline: none; background: var(--white); border-color: var(--ink);
}
.header-tools { display: flex; align-items: center; gap: 0.65rem; margin-left: auto; }
.btn-new {
    display: inline-flex; align-items: center; height: 40px; padding: 0 0.95rem;
    border-radius: 999px; background: var(--ink); color: var(--white);
    text-decoration: none; font-weight: 600; font-size: 0.92rem; white-space: nowrap;
}
.btn-new:hover { background: #000; }
.account { position: relative; }
.account summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem;
    height: 40px; padding: 0 0.35rem 0 0.2rem; border-radius: 999px;
}
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: var(--paper); }
.account-avatar {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
    background: var(--herb); color: var(--white); display: grid; place-items: center;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; flex: 0 0 auto;
}
.account-name {
    max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500; font-size: 0.92rem;
}
.account-caret { width: 12px; height: 12px; color: var(--muted); }
.account-menu {
    position: absolute; right: 0; top: calc(100% + 0.4rem);
    min-width: 210px; padding: 0.35rem; background: var(--white);
    border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 18px 40px rgba(26, 28, 25, 0.12);
}
.account-menu a, .account-menu button {
    display: block; width: 100%; text-align: left; text-decoration: none;
    background: none; border: 0; border-radius: 9px; padding: 0.55rem 0.7rem; cursor: pointer;
}
.account-menu a:hover, .account-menu button:hover { background: var(--paper); }
.menu-sep { height: 1px; background: var(--line); margin: 0.3rem 0.45rem; }
.section-nav { border-top: 1px solid var(--line); }
.section-nav .wrap {
    display: flex; align-items: stretch; gap: 1.35rem;
    min-height: 44px; overflow-x: auto;
}
.section-nav a {
    display: inline-flex; align-items: center; text-decoration: none;
    color: var(--muted); font-size: 0.94rem; font-weight: 500; white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.section-nav a:hover { color: var(--ink); }
.section-nav a.is-on { color: var(--ink); border-bottom-color: var(--ink); }

.site-footer { border-top: 1px solid var(--line); background: var(--white); margin-top: 2rem; }
.footer-bar {
    display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
    padding: 1.4rem 0; color: var(--muted); font-size: 0.92rem;
}
.footer-bar p { margin: 0; }
.footer-brand { font-family: var(--serif); color: var(--ink); font-size: 1.15rem; }
.footer-brand span { color: var(--muted); font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; margin-left: 0.35rem; }

.flash {
    margin: 1rem 0 0; padding: 0.75rem 1rem; border-radius: 12px;
    background: var(--herb-soft); color: var(--herb);
}
.flash-error { background: #f8e6e2; color: var(--danger); }

.hero-band {
    background:
        linear-gradient(90deg, rgba(246, 244, 240, 0.94) 0%, rgba(246, 244, 240, 0.82) 36%, rgba(246, 244, 240, 0.28) 68%, rgba(246, 244, 240, 0.05) 100%),
        url("../images/portada-cocina.jpg") right center / cover no-repeat;
}
.hero { padding: 2.6rem 0 2.2rem; }
.hero h1 { font-size: clamp(2.3rem, 4.5vw, 3.4rem); margin: 0.25rem 0 0.55rem; max-width: 16ch; }
.lede { font-size: 1.15rem; max-width: 42rem; color: var(--muted); }
.eyebrow { margin: 0; color: var(--terra); font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; }
.muted { color: var(--muted); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0; }
.chip {
    display: inline-flex; align-items: center; text-decoration: none;
    border: 1px solid var(--line); background: transparent; color: var(--ink);
    border-radius: 999px; padding: 0.35rem 0.75rem; font-size: 0.92rem;
}
.chip.is-on, .chip:hover { background: var(--herb); color: var(--white); border-color: var(--herb); }
.chip-soft.is-on, .chip-soft:hover { background: var(--terra); border-color: var(--terra); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.1rem; padding-bottom: 2rem; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.card-media { position: relative; aspect-ratio: 4/3; background: var(--paper-deep); text-decoration: none; }
.card-media img, .plate { width: 100%; height: 100%; object-fit: cover; }
.plate {
    display: grid; place-items: center; color: var(--herb);
    background:
        radial-gradient(circle at 50% 60%, rgba(255,253,248,0.8), transparent 42%),
        linear-gradient(160deg, #d7c4a4, #8ea396);
    font-family: var(--serif); font-size: 1.4rem;
}
.badge { position: absolute; top: 0.7rem; left: 0.7rem; background: var(--ink); color: var(--white); border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.75rem; }
.card-body { padding: 0.95rem 1rem 1.1rem; }
.card-author {
    display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.15rem 0 0.2rem;
    text-decoration: none; font-weight: 600; font-size: 0.92rem;
}
.card-author-mark {
    width: 22px; height: 22px; border-radius: 50%; background: var(--herb); color: white;
    display: grid; place-items: center; font-size: 0.62rem; letter-spacing: 0.02em;
}
.card-author:hover { color: var(--terra-deep); }
.card-body h2 { font-size: 1.45rem; margin: 0.15rem 0 0.4rem; }
.card-body h2 a { text-decoration: none; }
.meta { color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; }
.rating-line { align-items: center; margin-bottom: 0.35rem; }
.star-meter { position: relative; display: inline-block; font-size: 0.95rem; letter-spacing: 0.06em; line-height: 1; }
.star-meter-base { color: #d5d0c8; }
.star-meter-fill {
    position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap;
    width: calc(var(--score) / 5 * 100%); color: var(--terra);
}
.rating-box { display: grid; gap: 0.25rem; margin: 0.8rem 0 0.2rem; }
.rating-form { display: flex; align-items: center; gap: 0.7rem; }
.rating-stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; }
.star-btn {
    border: 0; background: transparent; color: #d5d0c8; cursor: pointer;
    font-size: 1.85rem; line-height: 1; padding: 0 0.08rem;
}
.star-btn.is-on { color: var(--terra); }
.rating-stars:hover .star-btn { color: #d5d0c8; }
.rating-stars .star-btn:hover,
.rating-stars .star-btn:hover ~ .star-btn { color: var(--terra); }
.rating-summary { display: flex; align-items: center; gap: 0.45rem; color: var(--muted); margin: 0; }
.meta a { color: var(--herb); }

.empty { padding: 2rem; background: var(--white); border: 1px solid var(--line); border-radius: 16px; }

.recipe-hero { padding-top: 1.6rem; }
.recipe-title { font-size: clamp(2.2rem, 5vw, 3.8rem); margin: 0.2rem 0 0.6rem; }
.recipe-layout { display: grid; gap: 1.2rem; padding-bottom: 3rem; }
.recipe-main, .gallery { min-width: 0; }
.gallery-main {
    width: 100%; height: auto; max-height: none; object-fit: contain;
    border-radius: 20px; background: var(--paper-deep);
}
.thumbs { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.thumbs button, .thumbs label { border: 0; padding: 0; background: none; cursor: pointer; }
.thumbs img { width: 84px; height: 64px; object-fit: cover; border-radius: 10px; border: 2px solid transparent; }
.thumbs .is-on img, .thumbs button.is-on img { border-color: var(--terra); }
.video-frame { margin-top: 1rem; border-radius: 18px; overflow: hidden; background: #111; aspect-ratio: 16/9; }
.video-frame iframe, .video-frame video { width: 100%; height: 100%; border: 0; }
.ingredients {
    background: var(--herb); color: #f6f3ec; border-radius: 20px; padding: 1.1rem 1.15rem 1.2rem;
}
.ingredients h2, .ingredients h3 { color: #fff; }
.ingredients h3 { font-size: 1.05rem; margin: 1rem 0 0.3rem; }
.ingredients ul { margin: 0; padding-left: 1.1rem; }
.ingredients li { margin: 0.28rem 0; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 0.8rem; margin: 1.1rem 0; }
.step-num { font-family: var(--serif); font-size: 1.8rem; color: var(--terra); line-height: 1; }
.step-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.5rem; margin-top: 0.6rem; }
.step-photos img { border-radius: 12px; width: 100%; height: auto; object-fit: contain; background: var(--paper-deep); }
.comments { margin-top: 2rem; }
.comment { background: var(--white); border-radius: 16px; padding: 0.9rem 1rem; margin-bottom: 0.7rem; }
.comment header { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.person { display: flex; gap: 0.7rem; align-items: center; text-decoration: none; }
.avatar, .avatar-fallback {
    width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--terra); color: white;
    display: grid; place-items: center; font-weight: 600;
}
.avatar-lg, .avatar-fallback.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }

.panel, .composer, .auth-card, .editor, .table-card {
    background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 1.15rem 1.2rem;
}
.stack { display: grid; gap: 0.9rem; }
label span, .field-label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.25rem; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="url"], textarea, select {
    width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 0.65rem 0.75rem;
}
.nav-search input[type="search"] {
    width: 100%; height: 42px; border: 1px solid transparent; background: var(--paper);
    border-radius: 999px; padding: 0 1rem 0 2.55rem;
}
.nav-search input[type="search"]:focus {
    outline: none; background: var(--white); border-color: var(--ink);
}
textarea { resize: vertical; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.btn, button.btn {
    border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
    background: var(--ink); color: white; border-radius: 999px; padding: 0.65rem 1.05rem; font-weight: 600;
}
.btn.btn-herb { background: var(--herb); }
.btn.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.btn-danger { background: transparent; color: var(--danger); border: 1px solid #e7c8c4; }
.btn-tiny { padding: 0.3rem 0.65rem; font-size: 0.85rem; }
.errors { background: #f8e6e2; color: var(--danger); border-radius: 12px; padding: 0.8rem 1rem; }
.errors ul { margin: 0.3rem 0 0; }
.tag-picks { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag-picks label { display: inline-flex; gap: 0.35rem; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.65rem; }
.line, .step-editor { border: 1px solid var(--line); border-radius: 16px; padding: 0.8rem; display: grid; gap: 0.55rem; background: #fffdf9; }
.line { grid-template-columns: 1fr 0.6fr 0.9fr 1.3fr 1fr auto; align-items: end; }
.step-editor header { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; }
.check { display: flex; gap: 0.45rem; align-items: center; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: 0.5rem 0 2rem; }
.pager a { color: var(--herb); font-weight: 600; }
.pager .is-disabled { color: var(--muted); }
.admin-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; padding: 0.85rem 0 0; border-bottom: 1px solid var(--line); }
.admin-nav a {
    text-decoration: none; padding: 0.55rem 0; color: var(--muted); font-weight: 500;
    border-bottom: 2px solid transparent;
}
.admin-nav a:hover { color: var(--ink); }
.admin-nav a.is-on { color: var(--ink); border-bottom-color: var(--ink); }
.table-card { overflow-x: auto; margin: 1rem 0 2rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.65rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.inline { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.inline input, .inline select { width: auto; min-width: 0; }
.auth-screen { min-height: calc(100vh - 180px); display: grid; place-items: center; padding: 1.4rem 0 2.4rem; }
.auth-layout {
    width: min(980px, calc(100% - 2rem));
    display: grid; grid-template-columns: 1.08fr 0.92fr;
    min-height: 560px; background: var(--white);
    border: 1px solid var(--line); border-radius: 24px; overflow: hidden;
}
.auth-photo {
    background: url("../images/portada-cocina.jpg") center 45% / cover no-repeat;
    min-height: 220px;
}
.auth-layout .auth-card {
    width: auto; border: 0; border-radius: 0; box-shadow: none;
    padding: 2rem 1.7rem; display: flex; flex-direction: column; justify-content: center;
}
.ai-import {
    border: 1px solid var(--line); border-radius: 18px; padding: 1rem 1.1rem 0.4rem;
    background: var(--herb-soft);
}
.ai-import h2 { margin: 0 0 0.35rem; }
.ai-error { color: var(--danger); }
.dropzone {
    position: relative; display: grid; gap: 0.25rem; justify-items: start;
    border: 1.5px dashed rgba(26, 28, 25, 0.28); border-radius: 16px;
    background: #f7f5f1; padding: 1.15rem 1.1rem 0.9rem; cursor: pointer;
}
.dropzone.is-over { border-color: var(--ink); background: #fff; }
.dropzone-input {
    position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.dropzone-title { font-weight: 600; }
.dropzone-hint { color: var(--muted); font-size: 0.88rem; }
.dropzone-previews { display: flex; flex-wrap: wrap; gap: 0.45rem; position: relative; z-index: 1; pointer-events: none; }
.dropzone-previews:empty { display: none; }
.drop-preview { display: grid; gap: 0.2rem; }
.drop-preview img, .drop-preview video { width: 96px; height: 72px; object-fit: cover; border-radius: 10px; background: #ddd; }
.drop-preview span { font-size: 0.75rem; color: var(--muted); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone-compact { padding: 0.8rem 0.9rem; }
.media-keep { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.media-keep label { width: 148px; display: grid; gap: 0.3rem; font-size: 0.82rem; }
.media-keep img { width: 148px; height: 104px; object-fit: cover; border-radius: 12px; }
.google-btn {
    width: 100%; display: flex; justify-content: center; gap: 0.6rem; align-items: center;
    background: white; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 0.7rem 1rem;
    text-decoration: none; font-weight: 600;
}
.profile-head { display: flex; gap: 1rem; align-items: center; padding: 1.5rem 0; }
.split { display: flex; justify-content: space-between; gap: 1rem; align-items: end; flex-wrap: wrap; }

.photo-editor {
    position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
    padding: 1rem; background: rgba(26, 28, 25, 0.62);
}
.photo-editor-card {
    width: min(860px, 100%); max-height: calc(100vh - 2rem); overflow: auto;
    background: var(--white); border-radius: 20px; padding: 1.1rem 1.15rem 1.2rem;
    display: grid; gap: 0.8rem;
}
.photo-editor-card h2 { margin: 0; }
.photo-editor-stage {
    background: #1a1c19; border-radius: 14px; display: grid; place-items: center;
    min-height: 240px;
}
.photo-editor-stage canvas { max-width: 100%; touch-action: none; cursor: crosshair; }
.photo-editor-tools { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; align-items: end; }
.photo-editor-tools label { min-width: 160px; }
.photo-editor-tools input[type="range"] { width: 100%; padding: 0; }
.link-line { grid-template-columns: 1.1fr 1.4fr auto; }
.prep-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.prep-link {
    display: grid; gap: 0.1rem; text-decoration: none; min-width: min(100%, 220px);
    background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 0.7rem 0.9rem;
}
.prep-link span { color: var(--muted); font-size: 0.82rem; }
.prep-link strong { font-family: var(--serif); font-size: 1.2rem; font-weight: 620; }
.prep-link:hover { border-color: var(--ink); }

@media (min-width: 960px) {
    .recipe-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
    .recipe-main { grid-column: 1; grid-row: 1; }
    .recipe-body { grid-column: 1; grid-row: 2; }
    .ingredients { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 128px; }
}

@media (max-width: 860px) {
    .hero-band {
        background:
            linear-gradient(180deg, rgba(246, 244, 240, 0.9) 0%, rgba(246, 244, 240, 0.72) 70%, rgba(246, 244, 240, 0.5) 100%),
            url("../images/portada-cocina.jpg") center 30% / cover no-repeat;
    }
    .header-top { flex-wrap: wrap; gap: 0.75rem; padding-top: 0.7rem; min-height: 0; }
    .nav-search { order: 3; flex: 1 1 100%; max-width: none; margin-bottom: 0.7rem; }
    .account-name, .account-caret { display: none; }
    .line { grid-template-columns: 1fr 1fr; }
    .line.link-line { grid-template-columns: 1fr; }
    .row-3, .row-2 { grid-template-columns: 1fr; }
    .footer-bar { flex-direction: column; align-items: flex-start; }
    .auth-layout { grid-template-columns: 1fr; min-height: 0; }
    .auth-photo { min-height: 190px; }
}
