@font-face {
    font-family: "Fraunces";
    src: url("fonts/fraunces-latin-full-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Satoshi";
    src: url("fonts/satoshi-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Satoshi";
    src: url("fonts/satoshi-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: "Satoshi";
    src: url("fonts/satoshi-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --text: #2e271f;
    --muted: #6f665d;
    --line: #e8e4dd;
    --line-strong: #cfc8bd;
    --pill: #eeebe5;
    --green: #445a45;
    --green-text: #445a45;
    --on-green: #f6f5f2;
    --gold: #fbbc05;
    --on-gold: #2e271f;
    --danger: #a3302a;
    --glass: rgb(255 255 255 / .9);
    --glass-dark: rgb(28 24 20 / .45);
    --bar: rgb(255 255 255 / .92);
    --shadow: 0 1px 2px rgb(46 39 31 / .04), 0 8px 24px rgb(46 39 31 / .07);
    --shadow-lift: 0 2px 4px rgb(46 39 31 / .05), 0 14px 34px rgb(46 39 31 / .1);

    --red-soft: #f4dfd5;
    --red: #a4533a;
    --berry-soft: #f0dcdf;
    --berry: #94495a;
    --yellow-soft: #f7ebc8;
    --yellow: #86661a;
    --orange-soft: #f6e3cf;
    --orange: #985a24;
    --leaf-soft: #e4e9d6;
    --leaf: #59693a;
    --blue-soft: #dfe7ed;
    --blue: #44647d;
    --sand-soft: #ebe6dd;
    --sand: #6f665d;

    --display: "Fraunces", Georgia, serif;
    --sans: "Satoshi", system-ui, -apple-system, "Segoe UI", sans-serif;
    --spring: linear(0, .3 9%, .66 19%, .95 31%, 1.07 42%, 1.05 54%, 1.01 68%, 1);
    --gutter: 20px;
    color-scheme: light;
}

/* theme.js sets data-theme before first paint, from the saved choice or the system setting */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1c1814;
    --surface: #27211c;
    --text: #f2ede5;
    --muted: #b0a699;
    --line: #362e27;
    --line-strong: #5a4e44;
    --pill: #332b24;
    --green: #4a6a4c;
    --green-text: #a3c0a1;
    --on-green: #f6f5f2;
    --danger: #f0958a;
    --glass: rgb(28 24 20 / .78);
    --glass-dark: rgb(12 10 8 / .5);
    --bar: rgb(30 26 22 / .92);
    --shadow: 0 1px 2px rgb(0 0 0 / .2);
    --shadow-lift: 0 10px 30px rgb(0 0 0 / .35);

    --red-soft: #3e2a23;
    --red: #eba78d;
    --berry-soft: #3c262c;
    --berry: #e3a0b0;
    --yellow-soft: #3a3220;
    --yellow: #e9c96c;
    --orange-soft: #3d2d20;
    --orange: #eaae79;
    --leaf-soft: #2c3324;
    --leaf: #b3c78f;
    --blue-soft: #243039;
    --blue: #a2bfd6;
    --sand-soft: #2f2923;
    --sand: #b0a699;
}

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

html.lenis {
    height: auto;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.5 var(--sans);
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: var(--text);
    opacity: .05;
    -webkit-mask: url(kitchen-pattern.svg) 0 0 / 240px;
    mask: url(kitchen-pattern.svg) 0 0 / 240px;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 max(var(--gutter), env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}

main[data-view="list"] {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

main[data-view="detail"] {
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

h1, h2, h3 {
    margin: 0;
    font-weight: 650;
    line-height: 1.1;
}

h1, h2 {
    font-family: var(--display);
    font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
    letter-spacing: -.022em;
    word-spacing: .06em;
}

h1 {
    font-size: 2.15rem;
    line-height: 1.02;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.6rem;
}

a {
    color: inherit;
}

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

button, label {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

svg {
    width: 24px;
    height: 24px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

svg.solid {
    fill: currentColor;
    stroke: none;
}

.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.hint {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: .88rem;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 50px;
    padding: 0 22px;
    border: 1.5px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    transition: transform .2s var(--spring), background-color .2s;
}

.btn:active {
    transform: scale(.97);
}

.btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}

.btn.primary {
    border-color: var(--green);
    background: var(--green);
    color: var(--on-green);
}

.btn.gold {
    border-color: var(--gold);
    background: var(--gold);
    color: var(--on-gold);
}

.btn.ghost {
    border-color: transparent;
    background: transparent;
}

.btn.small {
    min-height: 44px;
    padding: 0 14px 0 18px;
    font-size: .95rem;
}

.btn.wide {
    width: 100%;
}

.link {
    min-height: 44px;
    padding: 0 2px;
    border: 0;
    background: none;
    color: var(--text);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 4px;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    transition: transform .2s var(--spring), background-color .2s;
}

.icon-btn:hover {
    background: var(--pill);
}

.icon-btn:active {
    transform: scale(.92);
}

/* Pills and chips */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 13px;
    border: 0;
    border-radius: 999px;
    background: var(--pill);
    color: var(--text);
    font-size: .92rem;
    font-weight: 500;
    white-space: nowrap;
}

.pill svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.pill.glass {
    min-height: 28px;
    padding: 0 10px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: .82rem;
}

.pill.glass svg {
    width: 14px;
    height: 14px;
}

.pill-btn {
    min-height: 44px;
    border: 1.5px dashed var(--line-strong);
    background: transparent;
}

.chips {
    display: flex;
    gap: 8px;
}

.chips.wrap {
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 16px;
    border: 1.5px solid transparent;
    border-radius: 999px;
    background: var(--pill);
    color: var(--text);
    font-size: .95rem;
    font-weight: 500;
    white-space: nowrap;
}

.chip.small {
    padding: 0 14px;
    font-size: .9rem;
}

.chip[aria-pressed="true"] {
    background: var(--green);
    color: var(--on-green);
}

.suggest .chip {
    border: 1.5px dashed var(--line-strong);
    background: transparent;
}

/* Illustrated placeholders */

.art {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--cat-soft), #fff 45%), var(--cat-soft) 70%);
    color: var(--cat);
}

[data-theme="dark"] .art {
    background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--cat-soft), #fff 8%), var(--cat-soft) 70%);
}

.art svg {
    width: 50%;
    height: auto;
    stroke-width: 1.6;
}

.art .fill {
    fill: currentColor;
}

.cat-pasta { --cat-soft: var(--red-soft); --cat: var(--red); }
.cat-pan, .cat-vlees { --cat-soft: var(--berry-soft); --cat: var(--berry); }
.cat-taart { --cat-soft: var(--berry-soft); --cat: var(--berry); }
.cat-kip, .cat-ontbijt { --cat-soft: var(--yellow-soft); --cat: var(--yellow); }
.cat-soep, .cat-rijst { --cat-soft: var(--orange-soft); --cat: var(--orange); }
.cat-salade, .cat-groente { --cat-soft: var(--leaf-soft); --cat: var(--leaf); }
.cat-vis { --cat-soft: var(--blue-soft); --cat: var(--blue); }
.cat-kom { --cat-soft: var(--sand-soft); --cat: var(--sand); }

/* Overview */

.intro {
    padding: calc(28px + env(safe-area-inset-top)) 0 0;
}

.intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.intro h1 {
    font-size: clamp(2rem, 8.4vw, 3rem);
}

.theme-toggle {
    margin: -4px -8px 0 0;
}

.theme-toggle .sun,
[data-theme="dark"] .theme-toggle .moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun {
    display: block;
}

.search {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 0;
    padding: 0 20px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--muted);
    cursor: text;
}

.search:focus-within {
    box-shadow: var(--shadow), 0 0 0 2px var(--green);
}

.search input {
    flex: 1;
    min-width: 0;
    min-height: 56px;
    border: 0;
    background: none;
    color: var(--text);
    outline: none;
}

.search input::placeholder {
    color: var(--muted);
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.active-filters:empty {
    display: none;
}

.active-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 12px 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--green);
    color: var(--on-green);
    font-size: .9rem;
    font-weight: 500;
}

.active-pill span[aria-hidden] {
    font-size: 1.15rem;
    line-height: 1;
}

.tonight {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 10px 12px 10px 10px;
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.tonight-main {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 14px;
    min-width: 0;
    text-decoration: none;
}

.tonight-img {
    flex: none;
    width: 60px;
    height: 60px;
    overflow: hidden;
    border-radius: 16px;
}

.tonight-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tonight-img .art svg {
    width: 58%;
}

.tonight-text {
    display: grid;
    min-width: 0;
}

.eyebrow {
    overflow: hidden;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.tonight-title {
    overflow: hidden;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tonight-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: .88rem;
}

.tonight-meta svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.2;
}

.tonight-other {
    margin: 2px 4px 0 0;
    text-align: right;
}

.tonight-other .link {
    font-size: .92rem;
}

.section {
    margin-top: 30px;
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}

.count {
    color: var(--muted);
    font-size: .95rem;
    font-weight: 500;
}

.cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
}

@media (min-width: 640px) {
    .cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px 16px;
    }
}

.carousel {
    display: flex;
    gap: 12px;
    margin: 0 calc(var(--gutter) * -1);
    padding: 2px var(--gutter) 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 var(--gutter);
    scrollbar-width: none;
}

.carousel::-webkit-scrollbar {
    display: none;
}

.carousel .card {
    flex: none;
    width: min(66vw, 250px);
    scroll-snap-align: start;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: transform .25s var(--spring), box-shadow .25s;
}

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

.card:active {
    transform: scale(.97);
}

.card-img {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.carousel .card-img {
    aspect-ratio: 5 / 4;
}

.card-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-pills {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
}

.card-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--glass-dark);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--gold);
}

.card-fav svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.card-title {
    display: -webkit-box;
    margin: 12px 14px 0;
    overflow: hidden;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.card-sub {
    margin: 3px 14px 0;
    overflow: hidden;
    color: var(--muted);
    font-size: .84rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card > :last-child {
    margin-bottom: 14px;
}

.examples-note {
    margin: 28px 0 0;
    color: var(--muted);
    font-size: .92rem;
    text-align: center;
}

.examples-note .link {
    color: var(--text);
}

.empty {
    padding: 48px 12px 24px;
    color: var(--muted);
    text-align: center;
}

.empty .art {
    width: 120px;
    height: 120px;
    margin: 0 auto 18px;
    border-radius: 32px;
}

.empty-title {
    margin: 0 0 4px;
    color: var(--text);
    font-family: var(--display);
    font-size: 1.6rem;
    font-weight: 650;
    font-variation-settings: "opsz" 144, "SOFT" 30;
    letter-spacing: -.03em;
}

.empty .btn {
    margin-top: 18px;
}

/* Tab bar */

.tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    max-width: 720px;
    margin: 0 auto;
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: var(--bar);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

@media (min-width: 720px) {
    .tabbar {
        bottom: 16px;
        border: 1px solid var(--line);
        border-radius: 24px;
        box-shadow: var(--shadow-lift);
    }
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 54px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 500;
    text-decoration: none;
}

.tab[aria-current="page"] {
    color: var(--text);
    font-weight: 700;
}

.tab[aria-current="page"] svg {
    stroke-width: 2.2;
}

.tab-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 30px;
}

.tab-new {
    color: var(--text);
}

.tab-new .tab-icon {
    width: 40px;
    height: 32px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--on-gold);
}

.tab-new svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.4;
}

.badge {
    position: absolute;
    top: -3px;
    right: -1px;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--green);
    color: var(--on-green);
    font-size: .68rem;
    font-weight: 700;
}

.badge[hidden] {
    display: none;
}

/* Sheets and dialogs */

dialog {
    width: min(420px, calc(100% - 32px));
    padding: 24px;
    border: 0;
    border-radius: 26px;
    background: var(--surface);
    box-shadow: var(--shadow-lift);
    color: var(--text);
}

dialog::backdrop {
    background: rgb(20 15 10 / .4);
}

dialog h2 {
    font-size: 1.7rem;
}

dialog p {
    margin: 10px 0 18px;
    color: var(--muted);
}

dialog form {
    margin: 0;
}

.stack {
    display: grid;
    gap: 10px;
}

.sheet {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: 560px;
    max-height: 90dvh;
    margin: 0 auto;
    padding: 12px var(--gutter) calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-radius: 28px 28px 0 0;
}

.sheet::before {
    content: "";
    display: block;
    width: 40px;
    height: 5px;
    margin: 0 auto 14px;
    border-radius: 999px;
    background: var(--line-strong);
}

.sheet[open] {
    animation: sheet-in .4s var(--spring);
}

@keyframes sheet-in {
    from { transform: translateY(40px); opacity: 0; }
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.sheet-group {
    min-width: 0;
    margin: 0 0 22px;
    padding: 0;
    border: 0;
}

.sheet-group legend, .form legend {
    margin-bottom: 10px;
    padding: 0;
    font-weight: 700;
}

.sheet-foot {
    position: sticky;
    bottom: calc(-20px - env(safe-area-inset-bottom));
    display: grid;
    justify-items: center;
    gap: 2px;
    margin: 0 calc(var(--gutter) * -1) calc(-20px - env(safe-area-inset-bottom));
    padding: 12px var(--gutter) calc(14px + env(safe-area-inset-bottom));
    background: var(--surface);
    box-shadow: 0 -1px 0 var(--line);
}

/* Shopping list */

.shop-btn {
    margin-top: 18px;
}

.shop .top h1 {
    font-size: 1.5rem;
}

.shop-group {
    margin: 18px 0 8px;
}

.shop-group .section-head {
    justify-content: space-between;
    margin-bottom: 0;
}

.shop-group h2 {
    font-size: 1.3rem;
}

.shop-group h2 a {
    color: inherit;
    text-decoration: none;
}

.shop-group .link {
    color: var(--muted);
    font-size: .92rem;
}

.shop-new {
    display: flex;
    gap: 8px;
    margin: 22px 0 0;
}

.shop-new input {
    flex: 1;
    min-width: 0;
    min-height: 50px;
    padding: 12px 15px;
    border: 1.5px solid transparent;
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
}

.shop-new input:focus {
    border-color: var(--green);
    outline: none;
}

.shop-new .btn {
    min-height: 50px;
    padding: 0 18px;
}

.shop-foot {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 28px 0 0;
}

.shop-foot .link {
    color: var(--muted);
}

.checklist.pick:not(.cook-steps) input:checked + span {
    color: inherit;
    opacity: 1;
    text-decoration: none;
}

.checklist.pick input:not(:checked) + span {
    color: var(--muted);
}

#shop-sheet .hint {
    margin: -6px 0 4px;
}

/* New recipe: choice and link import */

#new-dialog [hidden] {
    display: none;
}

.choice {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
    transition: transform .2s var(--spring), border-color .2s;
}

.choice:active {
    transform: scale(.98);
}

.choice:hover {
    border-color: var(--line-strong);
}

.choice svg {
    flex: none;
    width: 44px;
    height: 44px;
    padding: 11px;
    border-radius: 14px;
    background: var(--leaf-soft);
    color: var(--green-text);
}

.choice span {
    display: grid;
    gap: 2px;
}

.choice small {
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.4;
}

.url-input {
    width: 100%;
    min-height: 52px;
    padding: 13px 15px;
    border: 1.5px solid transparent;
    border-radius: 14px;
    background: var(--bg);
    color: var(--text);
}

.url-input:focus {
    border-color: var(--green);
    background: var(--surface);
    outline: none;
}

#new-url .paste {
    margin-top: 4px;
}

.field-error {
    margin: 8px 0 0 !important;
    color: var(--danger) !important;
    font-size: .92rem;
}

.field-error:empty {
    display: none;
}

/* Option pills: radio and checkbox */

.segmented, .tag-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.segmented label, .tag-check {
    position: relative;
}

.segmented input, .tag-check input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.segmented span, .tag-check span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px 0 12px;
    border: 1.5px solid var(--line-strong);
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 500;
    transition: background-color .15s, border-color .15s, color .15s;
}

.segmented span::before, .tag-check span::before {
    content: "";
    flex: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    transition: box-shadow .2s var(--spring);
}

.segmented span svg {
    width: 18px;
    height: 18px;
    margin-right: -2px;
}

.segmented small {
    color: var(--muted);
    font-size: .85rem;
}

.segmented input:checked + span, .tag-check input:checked + span {
    border-color: var(--green);
    background: var(--green);
    color: var(--on-green);
}

.segmented input:checked + span small {
    color: inherit;
    opacity: .85;
}

.segmented input:checked + span::before, .tag-check input:checked + span::before {
    border-color: var(--on-green);
    background: var(--on-green);
    box-shadow: inset 0 0 0 4px var(--green);
}

.segmented input:focus-visible + span, .tag-check input:focus-visible + span {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    margin: 0 0 22px;
    font-weight: 500;
}

.switch-row span {
    flex: 1;
}

.switch-row input {
    position: relative;
    flex: none;
    width: 52px;
    height: 32px;
    margin: 0;
    border-radius: 999px;
    background: var(--line-strong);
    appearance: none;
    transition: background-color .2s;
}

.switch-row input::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgb(0 0 0 / .2);
    transition: transform .3s var(--spring);
}

.switch-row input:checked {
    background: var(--green);
}

.switch-row input:checked::before {
    transform: translateX(20px);
}

/* Recipe */

.hero-bar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    max-width: 720px;
    margin: 0 auto;
    padding: calc(12px + env(safe-area-inset-top)) 16px 0;
    pointer-events: none;
}

.hero-bar > *, .top-actions > * {
    pointer-events: auto;
}

.top-actions {
    display: flex;
    gap: 8px;
}

.icon-btn.float {
    background: var(--glass-dark);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #fff;
}

.icon-btn.float svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

.fav[aria-pressed="true"] {
    color: var(--gold);
}

.fav[aria-pressed="true"] svg {
    fill: currentColor;
}

.fav.pop svg {
    animation: pop .45s var(--spring);
}

@keyframes pop {
    40% { transform: scale(1.35); }
}

.hero {
    height: min(48vh, 380px);
    margin: 0 calc(var(--gutter) * -1);
    overflow: hidden;
}

.hero img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero .art svg {
    width: min(38%, 180px);
    margin-top: env(safe-area-inset-top);
}

@media (min-width: 720px) {
    .hero {
        margin: 16px 0 0;
        border-radius: 28px;
    }
}

.recipe-head {
    padding-top: 24px;
}

.recipe-head h1 {
    font-size: clamp(2rem, 8.6vw, 2.75rem);
}

.lead {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.55;
}

.pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.recipe-body section {
    margin-top: 34px;
}

.recipe-body h2 {
    margin-bottom: 8px;
}

.portions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 12px;
    border-bottom: 1px solid var(--line);
}

.portions-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.portions-label svg {
    color: var(--muted);
}

.stepper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stepper button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--text);
    color: var(--bg);
    transition: transform .2s var(--spring);
}

.stepper button:active {
    transform: scale(.9);
}

.stepper button svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.4;
}

.stepper output {
    min-width: 32px;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
}

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

.ingredients li {
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.steps {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps li {
    display: grid;
    grid-template-columns: 40px 1fr;
    padding: 12px 0;
    counter-increment: step;
}

.steps li::before {
    content: counter(step);
    color: var(--green-text);
    font-family: var(--display);
    font-size: 1.6rem;
    font-weight: 650;
    font-variation-settings: "opsz" 144, "SOFT" 30;
    line-height: 1.1;
}

.link.danger {
    display: block;
    margin: 40px auto 0;
    color: var(--danger);
}

.cook-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    max-width: 720px;
    margin: 0 auto;
    padding: 24px var(--gutter) calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 55%, transparent);
    pointer-events: none;
}

.cook-bar .btn {
    min-height: 58px;
    font-size: 1.05rem;
    box-shadow: 0 8px 22px rgb(251 188 5 / .35);
    pointer-events: auto;
}

/* Shared top bar for form and cook mode */

.top {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 calc(var(--gutter) * -1);
    padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
    background: var(--bg);
}

.top h1 {
    flex: 1;
    min-width: 0;
    font-size: 1.45rem;
}

/* Cook mode */

.cook {
    font-size: 1.2rem;
}

.cook .top h1 {
    order: -1;
}

.progress {
    display: grid;
    gap: 6px;
    width: 100%;
    padding-top: 4px;
}

.progress-track {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--line);
}

.progress-fill {
    display: block;
    width: calc(var(--done, 0) * 100%);
    height: 100%;
    border-radius: inherit;
    background: var(--gold);
    transition: width .5s var(--spring);
}

.progress-text {
    margin: 0;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 500;
}

.cook section {
    margin-top: 26px;
}

.cook h2 {
    margin-bottom: 6px;
}

.cook h2 small {
    color: var(--muted);
    font-family: var(--sans);
    font-size: .95rem;
    font-weight: 400;
    letter-spacing: 0;
}

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

.checklist label {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.checklist input {
    flex: none;
    width: 26px;
    height: 26px;
    margin: 3px 0 0;
    accent-color: var(--green);
}

.checklist input:checked + span {
    color: var(--muted);
    opacity: .7;
}

.checklist:not(.cook-steps) input:checked + span {
    text-decoration: line-through;
}

.cook-steps label {
    margin: 10px 0;
    padding: 16px;
    border: 2px solid transparent;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: border-color .2s, opacity .2s;
}

.cook-steps .current label {
    border-color: var(--green);
}

.cook-steps strong {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    color: var(--green-text);
    font-family: var(--display);
    font-size: .95rem;
    font-weight: 650;
}

.now {
    display: none;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--on-gold);
    font-family: var(--sans);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.current .now {
    display: inline-block;
}

.notes {
    margin: 0;
    padding: 16px 18px;
    border-radius: 18px;
    background: var(--surface);
    white-space: pre-line;
}

/* Form */

.form .top {
    flex-wrap: nowrap;
}

.note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
    margin: 6px 0 14px;
    padding: 8px 16px;
    border-radius: 16px;
    background: var(--yellow-soft);
    font-size: .95rem;
}

.form-card {
    margin: 0 0 14px;
    padding: 20px 18px 4px;
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.form-card h2 {
    margin-bottom: 16px;
    font-size: 1.35rem;
}

.field {
    min-width: 0;
    margin: 0 0 20px;
    padding: 0;
    border: 0;
}

.field > label, .field > .label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: .95rem;
}

.form :is(input:not([type]), input[type="number"], input[type="email"], textarea) {
    width: 100%;
    min-height: 52px;
    padding: 13px 15px;
    border: 1.5px solid transparent;
    border-radius: 14px;
    background: var(--bg);
    transition: border-color .15s, background-color .15s;
}

.form :is(input, textarea):focus {
    border-color: var(--green);
    background: var(--surface);
    outline: none;
}

.form input.short {
    width: 120px;
}

textarea {
    resize: vertical;
    line-height: 1.5;
}

.quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.photo-zone {
    display: grid;
    gap: 10px;
}

#f-preview {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 18px;
    object-fit: cover;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.file-input:focus-visible + label {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.photo-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 24px 16px;
    border: 1.5px dashed var(--line-strong);
    border-radius: 18px;
    background: var(--bg);
    font-weight: 700;
    text-align: center;
}

.photo-pick svg {
    box-sizing: content-box;
    width: 26px;
    height: 26px;
    margin-bottom: 6px;
    padding: 12px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow);
}

#f-preview:not([hidden]) ~ .photo-pick {
    flex-direction: row;
    justify-content: center;
    padding: 6px 16px;
}

#f-preview:not([hidden]) ~ .photo-pick svg {
    margin: 0;
    padding: 6px;
    box-shadow: none;
}

#f-preview:not([hidden]) ~ .photo-pick .photo-hint {
    display: none;
}

.photo-hint {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 400;
}

.photo-remove {
    justify-self: center;
    min-height: 44px;
    border: 0;
    background: none;
    color: var(--danger);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.photo-remove[hidden] {
    display: none;
}

#f-tags:not(:empty) {
    margin-bottom: 10px;
}

#f-tags .chip span[aria-hidden] {
    font-size: 1.2rem;
    line-height: 1;
}

.suggest:not(:empty) {
    margin-top: 10px;
}

.form > .btn.wide {
    margin-top: 8px;
}

/* Toast */

.toast {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: 50%;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 4px 6px 4px 18px;
    border-radius: 999px;
    background: var(--text);
    box-shadow: var(--shadow-lift);
    color: var(--bg);
    font-size: .95rem;
    transform: translate(-50%, 20px);
    opacity: 0;
    visibility: hidden;
    transition: transform .35s var(--spring), opacity .2s, visibility .2s;
}

main[data-view="list"] ~ .toast {
    bottom: calc(86px + env(safe-area-inset-bottom));
}

main[data-view="detail"] ~ .toast {
    bottom: calc(96px + env(safe-area-inset-bottom));
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
}

.toast span {
    padding: 10px 0;
}

.toast button {
    flex: none;
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--gold);
    font-weight: 700;
}

/* Motion */

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: .22s;
}

.art-choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
    gap: 10px;
}

.art-choice {
    position: relative;
    cursor: pointer;
}

.art-choice input {
    position: absolute;
    opacity: 0;
}

.art-choice .art {
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 18px;
    transition: transform .2s var(--spring), border-color .15s;
}

.art-choice .art svg {
    width: 64%;
}

.art-choice .art-auto {
    border: 1.5px dashed var(--line-strong);
    background: none;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 700;
}

.art-choice input:checked + .art {
    border: 2px solid var(--green-text);
    transform: scale(.94);
}

.art-choice input:focus-visible + .art {
    outline: 2px solid var(--green-text);
    outline-offset: 3px;
}

/* Onboarding */

.welcome {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
    padding: calc(16px + env(safe-area-inset-top)) 0 calc(28px + env(safe-area-inset-bottom));
}

.welcome-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    margin-bottom: 28px;
}

.dots {
    display: flex;
    gap: 6px;
}

.dots span {
    width: 7px;
    height: 7px;
    border-radius: 4px;
    background: var(--line-strong);
    transition: width .3s var(--spring), background-color .3s;
}

.dots .on {
    width: 22px;
    background: var(--green-text);
}

.welcome h1 {
    font-size: clamp(2.2rem, 10vw, 3.2rem);
}

.form.welcome input {
    background: var(--surface);
    box-shadow: var(--shadow);
}

.welcome .lead {
    margin: 14px 0 28px;
}

.welcome .paste {
    align-self: flex-start;
    margin: -8px 0 20px;
}

.welcome .btn.wide {
    margin-top: 4px;
}

.welcome-art .art {
    display: grid;
    width: 132px;
    height: 132px;
    margin: 4vh 0 28px;
    border-radius: 36px;
    transform: rotate(-4deg);
}

.welcome-points {
    display: grid;
    gap: 16px;
    margin: 28px 0 32px;
    padding: 0;
    list-style: none;
}

.welcome-points li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 1.02rem;
    line-height: 1.45;
}

.welcome-points svg {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 9px;
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--green-text);
}

.welcome-actions {
    display: grid;
    justify-items: center;
    gap: 16px;
    margin-top: auto;
}

.menu-section {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

#account-box .btn {
    margin-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
