@layer reset, font-embedding, base, layout, components, utilities;

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

    /* https://kilianvalkhof.com/2022/css-html/your-css-reset-needs-text-size-adjust-probably/ */
    html {
        -moz-text-size-adjust: none;
        -webkit-text-size-adjust: none;
        text-size-adjust: none;
    }

    body,
    h1,
    h2,
    h3,
    h4,
    p,
    figure,
    blockquote,
    dl,
    dd {
        margin: 0;
    }

    /* https://www.scottohara.me/blog/2019/01/12/lists-and-safari.html */
    [role="list"] {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    body {
        min-block-size: 100vh;
        line-height: 1.6;
    }

    h1,
    h2,
    h3,
    button,
    input,
    label {
        line-height: 1.1;
    }

    p,
    li {
        text-wrap: pretty;
    }

    img,
    picture {
        max-inline-size: 100%;
        display: block;
    }

    input,
    button,
    textarea,
    select {
        font: inherit;
    }
}

@layer font-embedding {

    @font-face {
        font-family: "Young Serif";
        src: local("Young Serif"),
        url("assets/fonts/young-serif/YoungSerif-Regular.ttf") format("truetype");
        font-weight: 400;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: "Outfit";
        /* local() intentionally omitted: an installed static version could match but lack the full weight range */
        src: url("assets/fonts/outfit/Outfit-VariableFont_wght.ttf") format("truetype");
        font-weight: 100 900;
        font-style: normal;
        font-display: swap;
    }
}

@layer base {

    /* Primitive Properties */
    :root {

        --color-white: hsl(0, 0%, 100%);
        --color-rose-50: hsl(330, 100%, 98%);
        --color-rose-800: hsl(332, 51%, 32%);
        --color-brown-800: hsl(14, 45%, 36%);
        --color-stone-100: hsl(30, 54%, 90%);
        --color-stone-150: hsl(30, 18%, 87%);
        --color-stone-600: hsl(30, 10%, 34%);
        --color-stone-900: hsl(24, 5%, 18%);

        --font-family-young-serif: "Young Serif", serif;
        --font-family-outfit: "Outfit", sans-serif;

        --font-size-200: 1rem;
        --font-size-250: 1.25rem;
        --font-size-350: 1.75rem;
        --font-size-450: 2.25rem;
        --font-size-500: 2.5rem;

        --font-weight-regular: 400;
        --font-weight-semibold: 600;
        --font-weight-bold: 700;

        --line-height-tight: 1;
        --line-height-relaxed: 1.5;

        --space-100: 0.5rem;
        --space-150: 0.75rem;
        --space-200: 1rem;
        --space-300: 1.5rem;
        --space-400: 2rem;
        --space-500: 2.5rem;
        --space-600: 3rem;
        --space-1600: 8rem;

        --border-radius-150: 0.75rem;
        --border-radius-300: 1.5rem;

    }

    /* Semantic Properties */
    :root {

        --color-bg-body: var(--color-stone-100);
        --color-bg-card: var(--color-white);
        --color-bg-card-highlight: var(--color-rose-50);

        --color-text-heading: var(--color-stone-900);
        --color-text-heading-section: var(--color-brown-800);
        --color-text-heading-highlight: var(--color-rose-800);

        --color-text-base: var(--color-stone-600);
        --color-text-base-emphasis: var(--color-brown-800);

        --color-list-marker: var(--color-brown-800);

        --color-table-second-column: var(--color-brown-800);
        --color-table-row-divider: var(--color-stone-150);

        --color-section-divider: var(--color-stone-150);

        --font-family-heading: var(--font-family-young-serif);
        --font-family-heading-highlight: var(--font-family-outfit);
        --font-family-base: var(--font-family-outfit);

        --font-size-heading: var(--font-size-450);
        --font-size-heading-section: var(--font-size-350);
        --font-size-heading-highlight: var(--font-size-250);

        --font-size-base: var(--font-size-200);
        --font-size-base-emphasis: var(--font-size-200);

        --font-weight-heading: var(--font-weight-regular);
        --font-weight-heading-highlight: var(--font-weight-semibold);
        --font-weight-base: var(--font-weight-regular);
        --font-weight-base-emphasis: var(--font-weight-bold);

        --line-height-heading: var(--line-height-tight);
        --line-height-base: var(--line-height-relaxed);

        --border-radius-card: 0;
        --border-radius-image: 0;
        --border-radius-card-highlight: var(--border-radius-150);

        --space-body-padding-block: 0;
        --space-body-inline-block: 0;
        --space-card-padding: 0;
        --space-card-gap: 0;
        --space-card-content-padding-inline: var(--space-400);
        --space-card-content-padding-block: var(--space-500);

        @media (width > 37.5em) {
            --font-size-heading: var(--font-size-500);

            --border-radius-card: var(--border-radius-300);
            --border-radius-image: var(--border-radius-150);

            --space-body-padding-block: var(--space-1600);
            --space-body-inline-block: var(--space-600);
            --space-card-padding: var(--space-500);
            --space-card-gap: var(--space-500);
            --space-card-content-padding-inline: 0;
            --space-card-content-padding-block: 0;
        }
    }

    body {
        font-family: var(--font-family-outfit), sans-serif;
        font-size: var(--font-size-base);
        font-weight: var(--font-weight-regular);
        color: var(--color-text-base);
        line-height: var(--line-height-base);
        background-color: var(--color-bg-body);
        padding-block: var(--space-body-padding-block);
        padding-inline: var(--space-body-inline-block);
        display: flex;
        justify-content: center;
        align-items: center;
        letter-spacing: 0;
    }
}

@layer layout {

    .content-wrapper,
    .section-wrapper,
    .highlight-wrapper,
    .recipe-list {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
    }

    .content-wrapper {
        padding: var(--space-card-content-padding-block) var(--space-card-content-padding-inline);
        gap: var(--space-400);
    }

    .section-wrapper {
        gap: var(--space-300);
    }

    .section-ruler {
        border: 1px solid var(--color-section-divider);
        inline-size: 100%;
    }

    .highlight-wrapper {
        padding: var(--space-300);
        border-radius: var(--border-radius-card-highlight);
        background-color: var(--color-bg-card-highlight);
        inline-size: 100%;
        gap: var(--space-200);
    }

    .recipe-image {
        border-radius: var(--border-radius-image);
    }

    .recipe-title,
    .recipe-section-title {
        font-family: var(--font-family-young-serif), serif;
    }

    .recipe-title {
        font-weight: var(--font-weight-regular);
        font-size: var(--font-size-heading);
        color: var(--color-text-heading);
    }

    .recipe-section-title {
        font-weight: var(--font-weight-regular);
        font-size: var(--font-size-heading-section);
        color: var(--color-text-heading-section);
    }

    .highlight-title {
        font-size: var(--font-size-heading-highlight);
        color: var(--color-text-heading-highlight);
        font-weight: var(--font-weight-heading-highlight);
    }

    .recipe-list {
        gap: var(--space-100);
        padding-inline-start: var(--space-100);
        list-style-position: outside;
        margin-block: 0;
        margin-inline-start: var(--space-200);
    }

    li {
        padding-inline-start: var(--space-200);
    }

    li::marker {
        color: var(--color-list-marker);
        font-weight: var(--font-weight-bold);
    }

    .list-topic {
        font-weight: var(--font-weight-bold);
    }

    .recipe-table {
        table-layout: fixed;
        inline-size: 100%;
        border-collapse: collapse;
    }

    tr:not(:last-child) {
        border-bottom: 1px solid var(--color-table-row-divider);
    }

    th, td {
        padding-block: var(--space-150);
    }

    th {
        text-align: left;
        font-weight: var(--font-weight-regular);
        padding-inline-start: var(--space-400);
    }

    td:last-child {
        padding-inline-start: var(--space-200);
        font-weight: var(--font-weight-bold);
        color: var(--color-table-second-column);
    }
}

@layer components {

    .card {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        gap: var(--space-card-gap);
        background-color: var(--color-bg-card);
        padding: var(--space-card-padding);
        max-inline-size: 736px;
        border-radius: var(--border-radius-card);
    }
}