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

:root {
    /* WARM COOKBOOK PALETTE */
    --bg: #faf6f0;
    --bg-warm: #f5ede0;
    --bg-card: #ffffff;
    --bg-card-hover: #fdf9f3;
    --bg-soft: #f0e8d8;
    --bg-recipe: #fffdf8;
    --bg-dark: #2d1b0e;
    --bg-input: #faf6f0;

    --text: #2d1b0e;
    --text-body: #5c4a3a;
    --text-muted: #8a7866;
    --text-dim: #b3a394;
    --text-faint: #d4c9b8;
    --text-inverse: #faf6f0;

    --terra: #c2410c;
    --terra-hover: #9a3412;
    --terra-soft: rgba(194, 65, 12, 0.08);
    --terra-glow: rgba(194, 65, 12, 0.15);

    --sage: #6b8e4e;
    --sage-hover: #557a3d;
    --sage-soft: rgba(107, 142, 78, 0.08);
    --sage-glow: rgba(107, 142, 78, 0.15);

    --paprika: #dc2626;
    --paprika-soft: rgba(220, 38, 38, 0.08);

    --mustard: #ca8a04;
    --mustard-soft: rgba(202, 138, 4, 0.08);

    --plum: #9333ea;
    --plum-soft: rgba(147, 51, 234, 0.08);

    --berry: #be185d;
    --berry-soft: rgba(190, 24, 93, 0.08);

    --ocean: #0e7490;
    --ocean-soft: rgba(14, 116, 144, 0.08);

    --olive: #65a30d;
    --olive-soft: rgba(101, 163, 13, 0.08);

    --cinnamon: #b45309;
    --cinnamon-soft: rgba(180, 83, 9, 0.08);

    --border: #e7dcc8;
    --border-hover: #d4c5a8;
    --border-bright: #b3a394;

    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow-xs: 0 1px 3px rgba(45, 27, 14, 0.04);
    --shadow-sm: 0 2px 8px rgba(45, 27, 14, 0.06);
    --shadow: 0 4px 24px rgba(45, 27, 14, 0.08);
    --shadow-lg: 0 12px 48px rgba(45, 27, 14, 0.12);
    --max-width: 1200px;
    --max-width-tool: 900px;

    --font-serif: 'Lora', 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* WARM PAPER TEXTURE */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse 600px 400px at 15% 0%, rgba(194, 65, 12, 0.04), transparent 60%),
        radial-gradient(ellipse 500px 350px at 85% 20%, rgba(107, 142, 78, 0.04), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* SUBTLE PAPER GRAIN */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--terra-soft); color: var(--terra-hover); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ HEADER ============ */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 246, 240, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
    color: var(--text);
}

.logo-icon {
    font-size: 1.5rem;
}

.logo em {
    font-style: italic;
    color: var(--terra);
    font-weight: 500;
}

.header-search {
    flex: 1;
    max-width: 380px;
    position: relative;
}

.header-search input {
    width: 100%;
    padding: 9px 16px 9px 38px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text);
    font-size: 0.88rem;
    font-family: var(--font-sans);
    transition: all 0.2s;
}

.header-search input::placeholder { color: var(--text-dim); }

.header-search input:focus {
    outline: none;
    border-color: var(--terra);
    box-shadow: 0 0 0 3px var(--terra-soft);
}

.header-search svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--text-dim);
    fill: none;
    stroke-width: 2;
}

.header-nav { display: flex; gap: 24px; font-size: 0.88rem; }
.menu-toggle { display: none; }

.header-nav a {
    color: var(--text-muted);
    transition: color 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

.header-nav a:hover { color: var(--terra); }

/* ============ MAIN CONTAINERS ============ */
.container {
    max-width: var(--max-width-tool);
    margin: 0 auto;
    padding: 32px 28px 60px;
    position: relative;
    z-index: 1;
}

.container-wide {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 28px 60px;
    position: relative;
    z-index: 1;
}

/* ============ BREADCRUMB ============ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-bottom: 24px;
}

.breadcrumb a { color: var(--text-dim); transition: color 0.2s; }
.breadcrumb a:hover { color: var(--terra); }
.breadcrumb span { color: var(--text-faint); }

/* ============ HERO SECTION ============ */
.hero {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 64px 28px 48px;
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 56px;
    align-items: center;
}

.hero-left .hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 24px;
    letter-spacing: 0.3px;
    box-shadow: var(--shadow-xs);
}

.hero-eyebrow .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sage);
    box-shadow: 0 0 8px var(--sage-glow);
    animation: steam 2s infinite;
}

@keyframes steam {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(-3px); opacity: 0.6; }
}

.hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.1;
    margin-bottom: 20px;
    color: var(--text);
}

.hero h1 em {
    font-style: italic;
    font-weight: 500;
    color: var(--terra);
}

.hero p {
    color: var(--text-body);
    font-size: 1.08rem;
    max-width: 480px;
    margin-bottom: 28px;
    line-height: 1.7;
}

.hero-stats {
    display: flex;
    gap: 36px;
    flex-wrap: wrap;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hero-stat-num {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--terra);
    letter-spacing: -0.5px;
}

.hero-stat-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ============ RECIPE CARD ============ */
.recipe-card {
    background: var(--bg-recipe);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    transform: rotate(1.5deg);
    transition: transform 0.4s;
}

.recipe-card:hover {
    transform: rotate(0deg);
}

.recipe-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--terra), var(--mustard), var(--sage));
}

.recipe-header {
    padding: 24px 28px 16px;
    border-bottom: 1px dashed var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.recipe-title {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.recipe-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.recipe-yield {
    text-align: right;
}

.recipe-yield-num {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--terra);
}

.recipe-yield-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recipe-body {
    padding: 20px 28px;
}

.recipe-section-label {
    font-family: var(--font-serif);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.recipe-ingredients {
    list-style: none;
}

.recipe-ingredient {
    display: flex;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px dotted var(--border);
    font-size: 0.88rem;
}

.recipe-ingredient:last-child { border-bottom: none; }

.recipe-ingredient-name {
    flex: 1;
    color: var(--text-body);
}

.recipe-ingredient-volume {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-right: 12px;
    min-width: 70px;
    text-align: right;
}

.recipe-ingredient-weight {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--terra);
    min-width: 60px;
    text-align: right;
}

.recipe-ingredient-arrow {
    color: var(--text-faint);
    margin: 0 6px;
    font-size: 0.8rem;
}

.recipe-footer {
    padding: 14px 28px;
    background: var(--bg-soft);
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.recipe-footer-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
}

.recipe-footer-badge.sage { color: var(--sage); border-color: var(--sage-soft); }
.recipe-footer-badge.terra { color: var(--terra); border-color: var(--terra-soft); }

/* ============ SEARCH SECTION ============ */
.search-section {
    max-width: 640px;
    margin: 0 auto 64px;
    padding: 0 28px;
    position: relative;
    z-index: 1;
}

.search-bar {
    width: 100%;
    padding: 18px 24px 18px 56px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1.05rem;
    font-family: var(--font-sans);
    transition: all 0.25s;
    box-shadow: var(--shadow-sm);
}

.search-bar::placeholder { color: var(--text-dim); }

.search-bar:focus {
    outline: none;
    border-color: var(--terra);
    box-shadow: 0 0 0 4px var(--terra-soft), var(--shadow);
}

.search-section > svg {
    position: absolute;
    left: 46px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    stroke: var(--text-dim);
    fill: none;
    stroke-width: 2;
}

.search-hint {
    position: absolute;
    right: 42px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    pointer-events: none;
}

.search-results-info {
    text-align: center;
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: none;
}

.search-results-info.visible { display: block; }

/* ============ FEATURED BANNER ============ */
.featured-banner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 28px 64px;
    position: relative;
    z-index: 1;
}

.featured-inner {
    background: linear-gradient(135deg, var(--bg-recipe), var(--bg-warm));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 44px;
    display: flex;
    align-items: center;
    gap: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.featured-inner::before {
    content: '🥄';
    position: absolute;
    right: -20px; top: -30px;
    font-size: 14rem;
    opacity: 0.04;
    line-height: 1;
    pointer-events: none;
}

.featured-content { flex: 1; position: relative; z-index: 1; }

.featured-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: var(--terra);
    color: #fff;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 18px;
}

.featured-content h3 {
    font-family: var(--font-serif);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.featured-content p {
    color: var(--text-body);
    font-size: 0.96rem;
    line-height: 1.7;
    margin-bottom: 24px;
    max-width: 520px;
}

.featured-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--terra);
    color: #fff;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 16px var(--terra-glow);
}

.featured-link:hover {
    background: var(--terra-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--terra-glow);
}

/* ============ CATEGORIES & CARDS ============ */
.categories {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 28px 80px;
    position: relative;
    z-index: 1;
}

.category {
    margin-bottom: 56px;
    scroll-margin-top: 80px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.category-icon-wrap {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.3rem;
    flex-shrink: 0;
}

.category-header h2 {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.category-desc {
    font-size: 0.84rem;
    color: var(--text-dim);
    font-style: italic;
    font-family: var(--font-serif);
    margin-left: 4px;
}

.category-count {
    margin-left: auto;
    font-size: 0.76rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 4px 14px;
    border-radius: 100px;
    border: 1px solid var(--border);
    font-weight: 600;
    font-family: var(--font-mono);
    box-shadow: var(--shadow-xs);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.tool-card.featured {
    grid-column: span 2;
    grid-row: span 2;
}

.tool-card.wide {
    grid-column: span 2;
}

.tool-card {
    display: flex;
    flex-direction: column;
    padding: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 0%, var(--card-glow, var(--terra-glow)), transparent 50%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.tool-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--card-accent, var(--terra)), transparent 80%);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: var(--radius) var(--radius) 0 0;
}

.tool-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tool-card:hover::before { opacity: 1; }
.tool-card:hover::after { opacity: 1; }

.tool-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.tool-card-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg-soft, var(--terra-soft));
    border-radius: var(--radius-xs);
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.3s;
}

.tool-card:hover .tool-card-icon {
    transform: scale(1.1) rotate(-5deg);
}

.tool-card-title {
    font-family: var(--font-serif);
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.tool-card-desc {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.tool-card.featured .tool-card-desc {
    font-size: 0.92rem;
    line-height: 1.75;
}

.tool-card.featured .tool-card-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.tool-card.featured .tool-card-icon {
    width: 50px;
    height: 50px;
    font-size: 1.6rem;
}

.tool-card-arrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--card-accent, var(--terra));
    text-transform: uppercase;
    letter-spacing: 0.6px;
    position: relative;
    z-index: 1;
}

.tool-card-arrow svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    transition: transform 0.2s;
}

.tool-card:hover .tool-card-arrow svg {
    transform: translateX(4px);
}

.tool-card.hidden { display: none; }

.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-dim);
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-style: italic;
    display: none;
}

.no-results.visible { display: block; }

/* ============ TOOL BOX WIDGET ============ */
.tool-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    margin-bottom: 48px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.tool-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--terra), var(--mustard), var(--sage));
}

.tool-header { margin-bottom: 28px; position: relative; z-index: 1; }

.tool-header h1 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.8px;
    line-height: 1.15;
    margin-bottom: 8px;
}

.tool-header p { color: var(--text-muted); font-size: 1rem; }

.tool-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.tool-badge .dot { width: 7px; height: 7px; border-radius: 50%; }

/* INPUT GROUPS & CONTROLS */
.input-row, .yield-row {
    display: flex; gap: 16px; flex-wrap: wrap;
    margin-bottom: 24px; position: relative; z-index: 1;
}

.input-group, .yield-group {
    flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 6px;
}

.input-group label, .yield-group label {
    font-size: 0.76rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}

.input-wrap, .yield-input-wrap {
    position: relative;
    display: flex; align-items: center;
}

.input-wrap input, .input-wrap select, .yield-input-wrap input, .yield-input-wrap select {
    width: 100%; padding: 14px 16px;
    background: var(--bg-input); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 1.05rem; font-family: var(--font-mono); font-weight: 500;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap select, .yield-input-wrap select {
    font-family: var(--font-sans);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232d1b0e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.input-wrap input:focus, .input-wrap select:focus, .yield-input-wrap input:focus, .yield-input-wrap select:focus {
    outline: none; border-color: var(--terra);
    box-shadow: 0 0 0 3px var(--terra-soft);
}

/* MODE TOGGLE / SWITCH TAB BUTTONS */
.mode-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    position: relative;
    z-index: 1;
}

.mode-btn {
    flex: 1 1 auto;
    min-width: max-content;
    padding: 10px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
    text-align: center;
    white-space: nowrap;
}

.mode-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.4);
    border-color: var(--border);
}

.mode-btn.active {
    background: var(--terra);
    color: #ffffff;
    border-color: var(--terra);
    box-shadow: 0 2px 8px var(--terra-glow);
}

/* INGREDIENT & TEXTAREA INPUT */
.ingredient-section {
    position: relative; z-index: 1; margin-bottom: 24px;
}

.ingredient-label {
    font-size: 0.76rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
    display: flex; align-items: center; justify-content: space-between;
}

.ingredient-label-hint { font-size: 0.72rem; color: var(--text-dim); font-weight: 400; text-transform: none; letter-spacing: 0; }

.ingredient-input, .textarea-input {
    width: 100%; min-height: 200px; padding: 16px;
    background: var(--bg-input); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.8;
    resize: vertical; transition: border-color 0.2s, box-shadow 0.2s;
}

.ingredient-input::placeholder, .textarea-input::placeholder { color: var(--text-faint); }
.ingredient-input:focus, .textarea-input:focus { outline: none; border-color: var(--terra); box-shadow: 0 0 0 3px var(--terra-soft); }

/* DISPLAY CARDS / STAT CARDS */
.stat-display-box {
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 16px 20px;
    margin-bottom: 24px; position: relative; z-index: 1;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}

.stat-display-label {
    font-size: 0.76rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}

.stat-display-value {
    font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700;
    color: var(--terra);
}

.stat-display-formula {
    font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-dim);
    margin-left: auto;
}

/* RESULTS SECTION & TABLES */
.results-section {
    position: relative; z-index: 1; margin-bottom: 24px;
}

.results-label {
    font-size: 0.76rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}

.results-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-recipe); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
}

.results-table th {
    padding: 10px 16px; text-align: left;
    background: var(--bg-soft); border-bottom: 1px solid var(--border);
    font-family: var(--font-serif); font-size: 0.82rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}

.results-table td {
    padding: 10px 16px; border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.results-table tr:last-child td { border-bottom: none; }
.results-table .ingredient-name { color: var(--text); font-weight: 500; }
.results-table .original-qty { font-family: var(--font-mono); color: var(--text-muted); }
.results-table .arrow { color: var(--text-faint); text-align: center; }
.results-table .scaled-qty { font-family: var(--font-mono); font-weight: 600; color: var(--terra); }
.results-empty { color: var(--text-faint); font-style: italic; font-size: 0.9rem; text-align: center; padding: 24px; }

/* BUTTONS */
.tool-buttons { display: flex; gap: 10px; position: relative; z-index: 1; flex-wrap: wrap; }

.btn {
    padding: 12px 24px; border: none; border-radius: 100px;
    font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 6px; font-family: var(--font-sans);
}

.btn-primary { background: var(--terra); color: #fff; box-shadow: 0 4px 16px var(--terra-glow); }
.btn-primary:hover { background: var(--terra-hover); transform: translateY(-1px); box-shadow: 0 8px 24px var(--terra-glow); }
.btn-secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ============ SEO & ARTICLE CONTENT ============ */
.seo-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 80px 28px;
    position: relative;
    z-index: 1;
}

.seo-content h2 {
    font-family: var(--font-serif);
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
    color: var(--text);
}

.seo-content h3 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 36px 0 14px;
    color: var(--text);
}

.seo-content p {
    color: var(--text-body);
    margin-bottom: 18px;
    font-size: 0.97rem;
    line-height: 1.85;
}

.seo-content strong { color: var(--text); font-weight: 600; }

.seo-content a {
    color: var(--terra);
    text-decoration: underline;
    text-decoration-color: var(--terra-soft);
    text-underline-offset: 2px;
}

.seo-content a:hover { text-decoration-color: var(--terra); }

.seo-content ul {
    margin: 14px 0 22px 20px;
    color: var(--text-body);
}

.seo-content li {
    margin-bottom: 10px;
    font-size: 0.94rem;
    line-height: 1.7;
}

.seo-content code {
    background: var(--terra-soft);
    color: var(--terra-hover);
    padding: 2px 7px;
    border-radius: var(--radius-xs);
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.article {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 44px;
    box-shadow: var(--shadow-sm);
    position: relative; z-index: 1;
}

.article h1 {
    font-family: var(--font-serif); font-size: 2.1rem; font-weight: 700;
    margin-bottom: 20px; letter-spacing: -0.8px; color: var(--text);
}

.article h2 {
    font-family: var(--font-serif); font-size: 1.55rem; font-weight: 700;
    margin: 40px 0 16px; letter-spacing: -0.5px; color: var(--text);
    scroll-margin-top: 80px;
}

.article h2:first-child { margin-top: 0; }
.article h3 { font-family: var(--font-sans); font-size: 1.1rem; font-weight: 700; margin: 28px 0 12px; color: var(--text); }
.article p { color: var(--text-body); margin-bottom: 16px; line-height: 1.8; font-size: 0.96rem; }
.article p strong { color: var(--text); font-weight: 600; }
.article p em { font-style: italic; color: var(--text); }

.article code {
    background: var(--terra-soft); color: var(--terra-hover);
    padding: 2px 7px; border-radius: var(--radius-xs);
    font-family: var(--font-mono); font-size: 0.85em;
}

.article pre {
    background: var(--bg-dark); border-radius: var(--radius-sm);
    padding: 20px 24px; margin: 16px 0; overflow-x: auto;
}

.article pre code { background: none; color: #f5ede0; padding: 0; font-size: 0.88rem; line-height: 1.7; font-family: var(--font-mono); }
.article pre code .comment { color: #8a7866; font-style: italic; }
.article pre code .key { color: #e9b384; }
.article pre code .string { color: #a4c3a2; }
.article pre code .number { color: #fbbf24; }
.article pre code .func { color: #c084fc; }

.article blockquote {
    border-left: 4px solid var(--mustard);
    background: var(--mustard-soft);
    padding: 14px 20px; margin: 16px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article blockquote p { margin: 0; color: var(--text); }
.article blockquote strong { color: var(--mustard); }

.article table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.9rem; }
.article th, .article td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.article th { background: var(--bg-soft); font-weight: 700; color: var(--text); font-family: var(--font-serif); }
.article td { color: var(--text-body); }
.article ul { margin: 12px 0 20px 20px; color: var(--text-body); }
.article li { margin-bottom: 8px; font-size: 0.93rem; line-height: 1.65; }
.article a { color: var(--terra); text-decoration: underline; text-decoration-color: var(--terra-soft); text-underline-offset: 2px; }
.article a:hover { text-decoration-color: var(--terra); }

.article .toc {
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 20px 24px; margin-bottom: 32px;
}

.article .toc-title { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.article .toc ol { margin: 0; padding-left: 20px; }
.article .toc li { margin-bottom: 6px; }
.article .toc a { color: var(--text-body); text-decoration: none; }
.article .toc a:hover { color: var(--terra); }

.article img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.article figure {
    margin: 1.5rem 0;
    text-align: center;
}

.article figure img {
    margin: 0 0 0.5rem 0;
}

.article figcaption {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.article .meta-block { background: var(--bg-dark); border-radius: var(--radius-sm); padding: 20px; margin-top: 36px; }
.article .meta-block code { background: none; color: #f5ede0; font-size: 0.82rem; line-height: 1.8; font-family: var(--font-mono); }

/* ============ FOOTER ============ */
footer {
    background: var(--bg-dark);
    padding: 64px 28px 36px;
    position: relative;
    z-index: 1;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

.footer-brand .logo {
    margin-bottom: 16px;
    font-size: 1.3rem;
    color: var(--text-inverse);
}

.footer-brand .logo em { color: var(--terra); }

.footer-brand p {
    color: #b3a394;
    font-size: 0.88rem;
    line-height: 1.7;
    max-width: 280px;
}

.footer-col h4 {
    font-family: var(--font-serif);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #8a7866;
    margin-bottom: 16px;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }

.footer-col a {
    color: #d4c9b8;
    font-size: 0.88rem;
    transition: color 0.2s;
}

.footer-col a:hover { color: var(--terra); }

.footer-bottom {
    max-width: var(--max-width);
    margin: 40px auto 0;
    padding-top: 28px;
    border-top: 1px solid #5c4a3a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-bottom p {
    color: #8a7866;
    font-size: 0.8rem;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .tool-grid { grid-template-columns: repeat(3, 1fr); }
    .tool-card.featured { grid-column: span 2; grid-row: span 1; }
    .tool-card.wide { grid-column: span 2; }
    .hero { grid-template-columns: 1fr; gap: 40px; }
    .recipe-card { max-width: 480px; margin: 0 auto; }
    .featured-inner { flex-direction: column; text-align: center; padding: 36px; }
    .featured-content p { margin: 0 auto 24px; }
}

@media (max-width: 768px) {
    /* Hide search box in header on mobile */
    .header-search { display: none !important; }
    
    /* Hide category section description text on mobile */
    .category-desc { display: none; }

    /* Enable Hamburger Toggle Button */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 24px;
        height: 18px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 120;
    }

    .menu-toggle .bar {
        width: 100%;
        height: 2px;
        background-color: var(--text);
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Transform Hamburger to Close X state */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Mobile Nav Drawer Style */
    .header-nav {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        background: rgba(250, 246, 240, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: -10px 0 30px rgba(45, 27, 14, 0.08);
        padding: 100px 32px;
        gap: 24px;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        border-left: 1px solid var(--border);
    }

    .header-nav.active {
        transform: translateX(0);
    }

    .header-nav a {
        font-family: var(--font-serif);
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text);
        border-bottom: 1px dashed var(--border);
        padding-bottom: 12px;
        width: 100%;
    }

    .header-nav a:hover {
        color: var(--terra);
        border-bottom-color: var(--terra);
    }

    .footer-inner { grid-template-columns: 1fr 1fr; }
    .tool-grid { grid-template-columns: repeat(2, 1fr); }
    .tool-card.featured, .tool-card.wide { grid-column: span 2; }
    .hero-stats { gap: 24px; }
    .search-hint { display: none; }
    .tool-box { padding: 24px 20px; }
    .tool-header h1 { font-size: 1.5rem; }
    .article { padding: 28px 20px; }
    .article h2 { font-size: 1.3rem; }
    .input-row, .yield-row { flex-direction: column; }
    .stat-display-box { flex-direction: column; align-items: flex-start; gap: 8px; }
    .stat-display-formula { margin-left: 0; }
    
    /* Responsive scrolling tables on mobile devices */
    .article table, .results-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .article table th, .article table td {
        min-width: 130px;
    }
    .results-table th, .results-table td {
        min-width: 90px;
    }
}

@media (max-width: 480px) {
    .header-inner { padding: 12px 16px; gap: 10px; }
    .header-search { max-width: 140px; }
    .hero { padding: 48px 16px 32px; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 0.95rem; }
    .search-section { padding: 0 16px; margin-bottom: 40px; }
    .categories { padding: 0 16px 40px; }
    .tool-grid { grid-template-columns: 1fr; }
    .tool-card.featured, .tool-card.wide { grid-column: span 1; }
    .footer-inner { grid-template-columns: 1fr; gap: 28px; }
    .seo-content { padding: 48px 16px; }
    .featured-banner { padding: 0 16px 32px; }
    .featured-inner { padding: 28px 20px; }
    .recipe-card { transform: rotate(0deg); }
    .container, .container-wide { padding: 20px 16px 40px; }
    .results-table { font-size: 0.82rem; }
    .results-table th, .results-table td { padding: 8px 10px; }
}
