:root {
    --page-background: #f9f9f7;
    --background: #ffffff;
    --foreground: #1a1a18;
    --accent: #e8571a;
    --muted: #6b6b63;
    --border: #e4e4e0;
    --nav: #6b6b63;
    --original-title: #6b6b63;
    --icons-separator: #e4e4e0;
    --search-bar: #f0f0ed;
    --search-bar-outline: #d0d0cc;
    --search-results-separator: #e4e4e0;
    --highlighted-search-result: #f5f5f2;
    --h2: #6b6b63;
    --link: #e8571a;
    --attention: #e8571a;
    --horizontal-rule: #e4e4e0;
    --footer: #a0a099;

    --sans: Barlow, Fabrikat, Helvetica, sans-serif;
    --serif: Lora, Georgia, serif;

    --card-radius: 0.75rem;
    --transition: 0.18s ease;

    --step-number-column-width: 3em;
    --ingredient-quantity-column-width: 5em;
    --ingredient-name-column-width: 10em;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page-background: #111110;
        --background: #1c1c1a;
        --foreground: #efefec;
        --muted: #8a8a7e;
        --border: #2a2a28;
        --nav: #8a8a7e;
        --original-title: #8a8a7e;
        --icons-separator: #2a2a28;
        --search-bar: #252523;
        --search-bar-outline: #3a3a38;
        --search-results-separator: #2a2a28;
        --highlighted-search-result: #222220;
        --h2: #8a8a7e;
        --footer: #4a4a45;
    }

    .hero-nav .logo,
    .recipe-nav .logo,
    header ul li img,
    h3 .icons img,
    .card-tags img {
        filter: invert() hue-rotate(180deg);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    font-size: 18px;
    line-height: 1.5;
    font-family: var(--sans);
}
body {
    background-color: var(--page-background);
    color: var(--foreground);
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
    counter-reset: step;
}

/* ─── Hero (index page) ─── */
.hero {
    text-align: center;
    padding: 4rem 1.5rem 2.5rem;
    max-width: 48em;
    margin: 0 auto;
}
.hero-nav {
    margin-bottom: 2rem;
}
.hero-nav .logo {
    height: 1.6rem;
}

/* Keep the site logo pinned to the top-left corner on all pages. */
.hero-nav > a:first-child,
.recipe-nav > a:first-child,
.category-nav > a:first-child {
    position: fixed;
    top: 0.75rem;
    left: 1rem;
    z-index: 1000;
}
.hero h1 {
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 0.6rem;
}
.hero h1 sup {
    font-size: 0.4em;
    color: var(--accent);
    vertical-align: super;
}
.hero .hero-desc {
    font-family: var(--serif);
    color: var(--muted);
    font-size: 1.05rem;
    margin-bottom: 2rem;
    max-width: 36em;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Search ─── */
.search {
    max-width: 36em;
    margin: 0 auto;
    position: relative;
}
.search input {
    width: 100%;
    padding: 0.7em 1.2rem;
    font-size: 1rem;
    font-family: var(--sans);
    background-color: var(--search-bar);
    color: inherit;
    border: 2px solid var(--search-bar);
    border-radius: 2em;
    -webkit-appearance: none;
    transition: border-color var(--transition);
}
.search input:focus {
    border-color: var(--search-bar-outline);
    outline: none;
}
.search input[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
}
.search .error {
    color: darkred;
    font-size: 0.75em;
    margin-top: 0.5em;
}
.search .results {
    position: absolute;
    width: 100%;
    z-index: 10;
    margin-top: 0.3rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.search .results a {
    text-decoration: none;
    color: inherit;
    display: block;
}
.search .results h3 {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--search-results-separator);
    font-size: 0.9rem;
    font-weight: 500;
}
.search .results a:last-child h3 {
    border-bottom: none;
}
.search .results a.selected h3,
.search .results a:hover h3 {
    background-color: var(--highlighted-search-result);
}

/* ─── Filter pills ─── */
.filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0 1.5rem;
    max-width: 48em;
    margin: 0 auto 2rem;
    justify-content: center;
}
.filter-pill {
    background: var(--background);
    border: 1.5px solid var(--border);
    color: var(--muted);
    padding: 0.3em 1em;
    border-radius: 2em;
    font-family: var(--sans);
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition);
}
.filter-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.filter-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ─── Recipe cards grid (index) ─── */
.index section {
    max-width: 48em;
    margin: 0 auto 2.5rem;
    padding: 0 1.5rem;
    background: none;
}
.index section h2 {
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--h2);
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}
.index section h2 a {
    text-decoration: none;
    color: inherit;
}
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 1rem;
}
.recipe-card {
    background: var(--background);
    border-radius: var(--card-radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.08);
}
.recipe-card > a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.card-image {
    width: 100%;
    aspect-ratio: 4/3;
    background-size: cover;
    background-position: center;
    background-color: var(--border);
    background-image: url(placeholder.png);
}
.card-body {
    padding: 0.9rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.card-body h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.3rem;
    line-height: 1.3;
}
.card-body h3 .star {
    color: var(--accent);
    font-size: 0.75em;
    vertical-align: super;
    margin-left: 0.1em;
}
.card-body h3 em {
    color: var(--original-title);
    font-size: 0.85em;
    font-weight: 400;
    font-style: normal;
    display: block;
    margin-top: 0.1em;
}
.card-body p {
    font-family: var(--serif);
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0 0 auto;
    line-height: 1.5;
    padding-bottom: 0.75rem;
}
.card-tags {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
}
.card-tags img {
    height: 0.95em;
    opacity: 0.65;
}

/* ─── Recipe nav & header ─── */
.recipe-nav,
.category-nav {
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: 1.2rem 1.5rem 0;
    max-width: 50em;
    margin: 0 auto;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.recipe-nav a,
.category-nav a {
    text-decoration: none;
    color: inherit;
}
.recipe-nav a:hover,
.category-nav a:hover {
    color: var(--accent);
}
.recipe-nav .logo,
.category-nav .logo {
    height: 0.9em;
    margin-right: 0.2em;
}
.recipe-nav i,
.category-nav i {
    font-style: normal;
    opacity: 0.4;
}

/* ─── Recipe page header ─── */
.recipe > header {
    max-width: 50em;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem 1.5rem;
}
.recipe > header h1 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0.6rem 0 0.4rem;
}
.recipe > header h1 sup {
    font-size: 0.4em;
    color: var(--accent);
    vertical-align: super;
    margin-left: 0.1em;
}
.recipe > header h1 em {
    color: var(--original-title);
    font-size: 0.55em;
    font-weight: 400;
    font-style: normal;
    display: block;
    letter-spacing: 0;
    margin-top: 0.2rem;
}
.recipe > header ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}
.recipe > header ul li {
    display: flex;
    align-items: center;
    gap: 0.4em;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--page-background);
    border: 1px solid var(--border);
    border-radius: 2em;
    padding: 0.3em 0.9em;
    color: var(--muted);
}
.recipe > header ul li img {
    height: 1em;
}
.recipe > header ul li a {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 0.4em;
}
.recipe > header p {
    font-family: var(--serif);
    margin: 0.5rem 0;
    max-width: 36em;
}
.recipe > header .nutrition {
    font-size: 0.78em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.4em;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}
.recipe > header .nutrition img {
    height: 1em;
}

/* ─── Recipe image ─── */
.servingsuggestion {
    width: 48em;
    max-width: 100%;
    margin: 0 auto 1rem;
    border-radius: 0;
    overflow: hidden;
}
.servingsuggestion img {
    display: block;
    width: 100%;
}
.servingsuggestion a {
    text-decoration: none;
    color: inherit;
}
.servingsuggestion .attribution {
    font-size: 0.6em;
    line-height: 1;
    padding: 0 0.5em 0.5em 0;
    margin-top: -1.4em;
    text-align: right;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ─── Recipe body ─── */
section {
    padding: 0.01em 1.5em;
    max-width: 50em;
    background-color: var(--background);
    margin: 0 auto 1em;
    overflow: auto;
}
h2 {
    margin: 0.8rem 0;
    color: var(--h2);
    text-transform: uppercase;
    font-size: 0.75em;
    letter-spacing: 0.12em;
    font-weight: 600;
    counter-reset: step;
    clear: both;
}
h3 {
    margin: 0.5rem 0 1rem;
    font-size: 1.2rem;
}
h2 a,
h3 a {
    text-decoration: none;
    color: inherit;
}
h3 em {
    color: var(--original-title);
    font-size: 0.9rem;
    font-weight: 400;
    font-style: normal;
    display: inline-block;
}
h3 .icons {
    font-size: 0.9em;
    margin-left: 0.5em;
    float: right;
    line-height: 1.8;
}
h3 .icons img {
    height: 1em;
}
h3 + p {
    margin-top: -0.5rem;
    font-family: var(--serif);
}
h3 + h3 {
    margin-top: -0.5rem;
}

ul, p {
    margin: 1rem 0;
}
hr {
    border: 0;
    width: 100%;
    border-top: 1px solid var(--horizontal-rule);
}
.recipe hr {
    counter-increment: step;
    margin-bottom: -2.4em;
    clear: right;
}
.recipe hr + hr {
    display: none;
}
.recipe hr:first-child {
    border-color: transparent;
}
.recipe hr::after {
    content: counter(step);
    display: inline-block;
    color: white;
    background-color: var(--accent);
    min-width: 1.5em;
    padding: 0.15em 0.2em 0.2em;
    text-align: center;
    border-radius: 0.3em;
    font-size: 0.78em;
    margin-top: 1.1rem;
    font-weight: 700;
}
.recipe hr + ul {
    display: inline-block;
    margin-left: var(--step-number-column-width);
    width: calc(var(--ingredient-quantity-column-width) + var(--ingredient-name-column-width));
    vertical-align: top;
}
.recipe hr + ul + blockquote {
    display: inline-block;
    width: calc(100% - var(--step-number-column-width) - var(--ingredient-name-column-width) - var(--ingredient-quantity-column-width));
    vertical-align: top;
    float: right;
}
.recipe hr + blockquote {
    display: inline-block;
    margin-left: var(--step-number-column-width);
    width: calc(100% - var(--step-number-column-width));
}
@media screen and (max-width: 700px) {
    .recipe hr + ul {
        margin-bottom: 0;
        width: auto;
    }
    .recipe hr + ul + blockquote,
    .recipe hr + blockquote {
        display: block !important;
        width: calc(100% - var(--step-number-column-width));
        margin-left: var(--step-number-column-width);
    }
}
.recipe hr + ul li {
    list-style-type: none;
    text-indent: calc(-1 * var(--ingredient-quantity-column-width));
    padding-left: var(--ingredient-quantity-column-width);
    padding-right: 1em;
}
.recipe hr + ul li > code:first-child {
    display: inline-block;
    margin-left: var(--ingredient-quantity-column-width);
    margin-right: calc(-1 * var(--ingredient-quantity-column-width) - .2em);
    min-width: var(--ingredient-quantity-column-width);
}
code {
    font-family: var(--sans);
}
blockquote {
    font-family: var(--serif);
}
blockquote img {
    max-width: 100%;
}
blockquote blockquote blockquote {
    background-image: url("tabler-icons/tabler-icon-flag.svg");
    background-size: 1.2em;
    background-position: -0.2em 0.1em;
    background-repeat: no-repeat;
    padding-left: 1.3em;
    font-style: italic;
    color: var(--attention);
}
blockquote blockquote blockquote em {
    font-style: normal;
}
a {
    color: var(--link);
}
a:hover {
    opacity: 0.7;
}

/* ─── Category page ─── */
.category-header {
    max-width: 48em;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem 1.5rem;
}
.category-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 0.5rem;
}

/* ─── Footer ─── */
footer {
    text-align: center;
    color: var(--footer);
    margin: 3em 0 2em;
}
footer .updatededit {
    font-size: 0.6em;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 0.4em;
}
footer .updatededit a {
    color: inherit;
    text-decoration: none;
}

/* ─── Responsive ─── */
@media screen and (max-width: 600px) {
    .hero h1 {
        font-size: 2.4rem;
    }
    .recipes-grid {
        grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    }
    .recipe > header h1 {
        font-size: 1.8rem;
    }
    .recipe > header ul li {
        font-size: 0.72em;
    }
}

/* ─── Print ─── */
@media print {
    html { font-size: 10pt; }
    body { background-color: initial; }
    .servingsuggestion { width: auto; max-width: 50%; }
    .recipe hr::after { color: var(--foreground); background-color: transparent; border: 0.1em solid var(--foreground); }
    .search, .filter-pills, .recipe-nav, .category-nav { display: none; }
    section { max-width: 100%; }
    footer { display: none; }
}
