/* ==========================================================================
   Nana's Recipes — mockup stylesheet (v2)
   ========================================================================== */

:root {
    --bg: #faf7f2;
    --bg-card: #ffffff;
    --ink: #2a2622;
    --ink-soft: #6b6359;
    --ink-faint: #a39c93;
    --accent: #8b3a3a;
    --accent-soft: #d4a5a5;
    --rule: #e8e1d6;
    --badge-printed-bg: #e8e3d6;
    --badge-printed-ink: #5a4f3e;
    --badge-handwritten-bg: #d6e0e8;
    --badge-handwritten-ink: #3e4f5a;
    --highlight: #f4e4a8;
    --shadow: 0 1px 3px rgba(42, 38, 34, 0.08);
    --shadow-lift: 0 4px 16px rgba(42, 38, 34, 0.12);
    --radius: 6px;
    --content-max: 1100px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
    font-size: 17px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Header & footer
   -------------------------------------------------------------------------- */

.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--rule);
    padding: 18px 24px;
    box-shadow: var(--shadow);
}

.site-header-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.site-title {
    font-size: 24px;
    font-weight: normal;
    margin: 0;
    letter-spacing: 0.02em;
}

.site-title a { color: var(--ink); }
.site-title a:hover { text-decoration: none; color: var(--accent); }

.site-search {
    flex: 1;
    min-width: 240px;
    position: relative;
}

.site-search input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    font-size: 16px;
    font-family: inherit;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--ink);
    transition: border-color 120ms, background 120ms;
}

.site-search input:focus {
    outline: none;
    border-color: var(--accent-soft);
    background: var(--bg-card);
}

.site-search::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid var(--ink-faint);
    border-radius: 50%;
    pointer-events: none;
}

.site-search::after {
    content: "";
    position: absolute;
    left: 23px;
    top: 22px;
    width: 7px;
    height: 2px;
    background: var(--ink-faint);
    transform: rotate(45deg);
    pointer-events: none;
}

.site-footer {
    margin-top: auto;
    background: var(--bg-card);
    border-top: 1px solid var(--rule);
    padding: 24px;
    color: var(--ink-soft);
    font-size: 14px;
}

.site-footer-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.site-footer nav a {
    color: var(--ink-soft);
    margin-left: 18px;
}

.site-footer nav a:first-child { margin-left: 0; }
.site-footer nav a:hover { color: var(--accent); }

.site-footer .colophon {
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.page {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 32px 24px 64px;
    width: 100%;
    flex: 1;
}

.breadcrumb {
    font-size: 14px;
    color: var(--ink-soft);
    margin-bottom: 20px;
}

.breadcrumb a { color: var(--ink-soft); }
.breadcrumb .sep { margin: 0 8px; color: var(--ink-faint); }

.page-title {
    font-size: 32px;
    font-weight: normal;
    margin: 0 0 8px;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 15px;
    color: var(--ink-soft);
    margin: 0 0 32px;
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Entry page
   -------------------------------------------------------------------------- */

body.entry {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background: #1a1612;
}

.entry-hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: white;
    text-align: center;
    padding: 24px;
}

.entry-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(20, 18, 16, 0.55) 0%, rgba(20, 18, 16, 0.75) 100%),
        url('entry-placeholder.svg') center/cover no-repeat;
    z-index: 0;
}

.entry-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.entry-content h1 {
    font-size: 64px;
    font-weight: normal;
    margin: 0 0 16px;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    font-style: italic;
}

.entry-content p {
    font-size: 19px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 40px;
    font-style: italic;
}

.entry-button {
    display: inline-block;
    padding: 14px 36px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--ink);
    border-radius: var(--radius);
    font-size: 17px;
    font-family: inherit;
    transition: background 150ms, transform 150ms;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
}

.entry-button:hover {
    background: white;
    text-decoration: none;
    transform: translateY(-1px);
}

@media (max-width: 720px) {
    .entry-content h1 { font-size: 44px; }
    .entry-content p { font-size: 16px; margin-bottom: 28px; }
}

/* --------------------------------------------------------------------------
   Landing — hero search + category list
   -------------------------------------------------------------------------- */

.hero {
    text-align: center;
    padding: 24px 0 48px;
}

.hero h1 {
    font-size: 36px;
    font-weight: normal;
    margin: 0 0 12px;
    font-style: italic;
}

.hero p {
    color: var(--ink-soft);
    margin: 0 0 28px;
    font-style: italic;
}

.hero-search {
    max-width: 520px;
    margin: 0 auto;
    position: relative;
}

.hero-search input {
    width: 100%;
    padding: 14px 18px 14px 44px;
    font-size: 18px;
    font-family: inherit;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.hero-search input:focus {
    outline: none;
    border-color: var(--accent-soft);
    box-shadow: var(--shadow-lift);
}

.hero-search::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--ink-faint);
    border-radius: 50%;
    pointer-events: none;
}

.hero-search::after {
    content: "";
    position: absolute;
    left: 29px;
    top: 30px;
    width: 8px;
    height: 2px;
    background: var(--ink-faint);
    transform: rotate(45deg);
    pointer-events: none;
}

.section-heading {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rule);
    font-weight: normal;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 4px 32px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.category-grid li {
    border-bottom: 1px dotted var(--rule);
    padding: 10px 0;
}

.category-grid a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    color: var(--ink);
    font-size: 17px;
    gap: 12px;
}

.category-grid a:hover {
    color: var(--accent);
    text-decoration: none;
}

.category-grid .count {
    color: var(--ink-faint);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Recipe list (category + search)
   -------------------------------------------------------------------------- */

.recipe-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.recipe-list li {
    border-bottom: 1px solid var(--rule);
}

.recipe-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 4px;
    color: var(--ink);
    gap: 16px;
}

.recipe-list a:hover {
    color: var(--accent);
    background: rgba(139, 58, 58, 0.03);
    text-decoration: none;
}

.recipe-list .recipe-title { font-size: 18px; }

.recipe-list .recipe-meta {
    font-size: 13px;
    color: var(--ink-soft);
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Search results
   -------------------------------------------------------------------------- */

.search-results {
    list-style: none;
    margin: 0;
    padding: 0;
}

.search-results li {
    border-bottom: 1px solid var(--rule);
    padding: 18px 4px;
}

.search-results li:last-child { border-bottom: none; }

.search-result-title {
    font-size: 19px;
    margin: 0 0 4px;
}

.search-result-title a { color: var(--ink); }
.search-result-title a:hover { color: var(--accent); }

.search-result-meta {
    font-size: 13px;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.search-result-meta .match-where {
    color: var(--ink-faint);
    font-style: italic;
}

.search-result-snippet {
    font-size: 15px;
    color: var(--ink-soft);
    margin: 0;
    line-height: 1.5;
}

mark.hl {
    background: var(--highlight);
    color: var(--ink);
    padding: 0 2px;
    border-radius: 2px;
}

.search-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--ink-soft);
    font-style: italic;
}

.search-results-group + .search-results-group {
    margin-top: 32px;
}

.search-results-group h2 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
    margin: 0 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--rule);
    font-weight: normal;
}

.search-results-group .group-count {
    color: var(--ink-faint);
    font-weight: normal;
    margin-left: 6px;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
    display: inline-block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 9px;
    border-radius: 999px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 500;
}

.badge-printed { background: var(--badge-printed-bg); color: var(--badge-printed-ink); }
.badge-handwritten { background: var(--badge-handwritten-bg); color: var(--badge-handwritten-ink); }

.badge-category {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent-soft);
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
}

.badge-category:hover {
    background: var(--accent);
    color: white;
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   Recipe detail — landscape-friendly two column
   -------------------------------------------------------------------------- */

.recipe-header { margin-bottom: 28px; }

.recipe-header .badges {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.recipe-header h1 {
    font-size: 36px;
    font-weight: normal;
    margin: 0 0 12px;
    line-height: 1.15;
}

.recipe-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    color: var(--ink-soft);
    font-size: 15px;
}

.recipe-meta-line .meta-item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.recipe-meta-line .meta-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.recipe-meta-line .meta-value { color: var(--ink); }

/* Landscape scans: narrower scan column, wider content column */
.recipe-body {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: 36px;
    align-items: start;
}

.scans {
    position: sticky;
    top: 24px;
}

.scan-image {
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    cursor: zoom-in;
    transition: box-shadow 150ms;
}

.scan-image:hover { box-shadow: var(--shadow-lift); }

.scan-image img,
.scan-image svg {
    display: block;
    width: 100%;
    height: auto;
}

.scan-caption {
    text-align: center;
    font-size: 13px;
    color: var(--ink-faint);
    margin-bottom: 16px;
    font-style: italic;
}

.recipe-content h2 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
    margin: 0 0 14px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--rule);
    font-weight: normal;
}

.recipe-content section + section { margin-top: 32px; }

.ingredients {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ingredients li {
    padding: 7px 0;
    border-bottom: 1px dotted var(--rule);
    display: grid;
    grid-template-columns: minmax(80px, auto) 1fr;
    gap: 14px;
    align-items: baseline;
}

.ingredients li:last-child { border-bottom: none; }

.ingredients .qty {
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    white-space: nowrap;
}

.ingredients .name { color: var(--ink); }

.ingredients .prep {
    color: var(--ink-soft);
    font-style: italic;
    font-size: 15px;
}

.method {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step;
}

.method li {
    counter-increment: step;
    position: relative;
    padding: 10px 0 14px 44px;
    border-bottom: 1px dotted var(--rule);
}

.method li:last-child { border-bottom: none; }

.method li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 8px;
    width: 30px;
    height: 30px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
}

.notes {
    background: var(--bg-card);
    border-left: 3px solid var(--accent-soft);
    padding: 14px 18px;
    color: var(--ink);
    font-style: italic;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.print-button-row {
    margin-top: 28px;
    text-align: right;
}

.print-button {
    background: transparent;
    border: 1px solid var(--rule);
    color: var(--ink-soft);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.print-button:hover {
    border-color: var(--accent-soft);
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 18, 16, 0.92);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}

.lightbox.open { display: flex; }

.lightbox-content {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-image img,
.lightbox-image svg {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 100px);
    width: auto;
    height: auto;
}

.lightbox-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
}

.lightbox-controls button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    min-width: 44px;
    min-height: 44px;
}

.lightbox-controls button:hover { background: rgba(255, 255, 255, 0.25); }
.lightbox-controls button:disabled { opacity: 0.3; cursor: not-allowed; }

.lightbox-counter {
    min-width: 60px;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
    body { font-size: 16px; }

    .site-header { padding: 14px 16px; }
    .site-header-inner { gap: 14px; }
    .site-title { font-size: 20px; width: 100%; }
    .site-search { width: 100%; min-width: 0; }

    .page { padding: 20px 16px 48px; }
    .hero { padding: 8px 0 32px; }
    .hero h1 { font-size: 28px; }
    .page-title, .recipe-header h1 { font-size: 26px; }

    .category-grid { grid-template-columns: 1fr; gap: 0; }

    .recipe-body { grid-template-columns: 1fr; gap: 28px; }
    .scans { position: static; }

    .recipe-list a { padding: 16px 4px; }
    .recipe-list .recipe-title { font-size: 17px; }

    .ingredients li { grid-template-columns: minmax(70px, auto) 1fr; gap: 10px; }
    .method li { padding-left: 40px; }

    .site-footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .site-footer nav a { margin-left: 0; margin-right: 14px; }
}

@media (pointer: coarse) {
    .category-grid a, .recipe-list a { min-height: 44px; }
}

/* --------------------------------------------------------------------------
   Print — recipe page only, content-focused
   -------------------------------------------------------------------------- */

@media print {
    body { background: white; color: black; font-size: 12pt; }
    .site-header, .site-footer, .breadcrumb, .scans, .scan-caption,
    .lightbox, .print-button-row, .site-search { display: none !important; }
    .page { max-width: 100%; padding: 0; margin: 0; }
    .recipe-body { display: block; }
    .recipe-header h1 { font-size: 22pt; margin-bottom: 8pt; }
    .recipe-content section + section { margin-top: 18pt; page-break-inside: avoid; }
    .recipe-content h2 { font-size: 11pt; margin-bottom: 6pt; }
    .badges, .recipe-header .badges { display: none; }
    .method li::before { background: black; }
    .notes { border-left: 2px solid black; background: transparent; }
    a { color: black; text-decoration: none; }
}
