:root {
    --cream: #fbf3e4;
    --paper: #fffaf1;
    --butter: #f6e3bd;
    --gold: #d8973c;
    --gold-deep: #b5741f;
    --cocoa: #3b2314;
    --cocoa-soft: #6e4b33;
    --berry: #b8343f;
    --line: #ead8b6;
    --shadow: 0 10px 30px rgba(84, 49, 20, .12);
    --radius: 18px;
    --display: 'Fraunces', Georgia, serif;
    --body: 'Nunito Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--body);
    color: var(--cocoa);
    background: var(--cream);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
/* stop double-tap zoom on taps (pinch-zoom still works) */
html, body, button, a, .pack, .slot, .qty { touch-action: manipulation; }
button { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--cocoa-soft); }
.small { font-size: .85rem; }

/* gingham ribbon */
.gingham {
    height: 14px;
    background:
        repeating-linear-gradient(90deg, rgba(184, 52, 63, .55) 0 14px, transparent 14px 28px),
        repeating-linear-gradient(0deg, rgba(184, 52, 63, .55) 0 7px, transparent 7px 14px),
        #fff;
}

/* buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    background: var(--cocoa); color: var(--paper);
    border: 0; border-radius: 999px;
    padding: .85em 1.6em; font-weight: 800; letter-spacing: .02em;
    text-decoration: none; cursor: pointer;
    transition: transform .15s ease, background .15s ease, opacity .15s;
    box-shadow: 0 4px 0 #1e110a;
}
.btn:hover { background: #4d2e1b; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #1e110a; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: 0 4px 0 #1e110a; }
.btn-ghost { background: transparent; color: var(--cocoa); box-shadow: inset 0 0 0 2px var(--cocoa); }
.btn-ghost:hover { background: var(--butter); }
.btn-ghost:active { box-shadow: inset 0 0 0 2px var(--cocoa); }
.btn-small { padding: .55em 1.1em; font-size: .9rem; }
.btn-block { width: 100%; }
.link-btn {
    background: none; border: 0; padding: .3em 0; cursor: pointer;
    color: var(--gold-deep); font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:disabled { color: #c9b89c; cursor: not-allowed; text-decoration: none; }

/* header */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--cocoa); }
.brand-mark { width: 52px; height: 52px; display: block; border-radius: 50%; box-shadow: 0 2px 8px rgba(84, 49, 20, .18); }
.brand-name { font-family: var(--display); font-weight: 900; font-size: 1.45rem; letter-spacing: -.01em; margin: 0; }

/* hero */
.hero { padding: 56px 0 40px; overflow: hidden; }
.hero-inner { max-width: 760px; }
.hero-copy { max-width: 640px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; font-weight: 800; color: var(--gold-deep); margin: 0 0 .8rem; }
.hero h1 { font-family: var(--display); font-weight: 900; font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: 1.02; margin: 0 0 1rem; letter-spacing: -.02em; }
.hero h1 em { font-style: italic; color: var(--gold-deep); font-weight: 700; }
.lede { font-size: 1.15rem; max-width: 34em; color: var(--cocoa-soft); margin: 0 0 1.6rem; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; }

.hero-art { display: flex; justify-content: center; }
.plate {
    position: relative; width: min(420px, 90vw); aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 45%, #fff 0 58%, #f4ead7 59% 64%, #fff 65% 100%);
    box-shadow: var(--shadow), inset 0 -8px 20px rgba(84, 49, 20, .06);
}
.hc { position: absolute; width: 40%; filter: drop-shadow(0 6px 8px rgba(84, 49, 20, .25)); }
.hc1 { top: 12%; left: 10%; transform: rotate(-12deg); }
.hc2 { top: 8%; right: 12%; width: 34%; transform: rotate(18deg); }
.hc3 { bottom: 10%; left: 18%; width: 36%; transform: rotate(8deg); }
.hc4 { bottom: 14%; right: 8%; width: 38%; transform: rotate(-20deg); }
.hc5 { top: 34%; left: 33%; width: 36%; transform: rotate(4deg); z-index: 2; }

/* builder layout */
.builder { display: grid; grid-template-columns: 1fr 360px; gap: 32px; align-items: start; padding-top: 36px; padding-bottom: 80px; }
.step { margin-bottom: 44px; scroll-margin-top: 90px; }
.step h2 { font-family: var(--display); font-weight: 700; font-size: 1.8rem; margin: 0 0 1rem; display: flex; align-items: center; gap: .6rem; }
.step-num {
    display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
    background: var(--gold); color: #fff; font-family: var(--body); font-size: 1rem; font-weight: 800;
}
.step-hint { margin: -.4rem 0 1.2rem; color: var(--cocoa-soft); }

/* packs */
.packs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pack {
    background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius);
    padding: 16px 10px 14px; text-align: center; cursor: pointer;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.pack:hover { border-color: var(--gold); transform: translateY(-2px); }
.pack[aria-checked="true"] { border-color: var(--cocoa); box-shadow: 0 0 0 3px var(--butter), var(--shadow); background: #fff; }
.pack-size { font-family: var(--display); font-weight: 900; font-size: 2.2rem; line-height: 1; }
.pack-unit { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: var(--cocoa-soft); }
.pack-label { font-size: .9rem; font-weight: 700; margin-top: .45rem; }
.pack-price { margin-top: .2rem; color: var(--gold-deep); font-weight: 800; }
.pack-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; margin: 10px auto 0; max-width: 90px; }
.pack-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); opacity: .75; }

/* flavors */
.flavors { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.cookie-photo { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 50%; display: block; pointer-events: none; }
.flavor {
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px; display: flex; flex-direction: column; align-items: center; text-align: center;
    transition: box-shadow .15s, border-color .15s;
}
.flavor.in-box { border-color: var(--gold); box-shadow: 0 0 0 2px var(--butter); }
.flavor-art { width: 170px; margin: 4px 0 10px; filter: drop-shadow(0 6px 6px rgba(84, 49, 20, .2)); transition: transform .2s ease; }
.flavor:hover .flavor-art { transform: rotate(-8deg) scale(1.03); }
.flavor h3 { font-family: var(--display); font-weight: 700; font-size: 1.12rem; margin: 0 0 .25rem; line-height: 1.2; }
.flavor p { margin: 0 0 14px; font-size: .9rem; color: var(--cocoa-soft); flex: 1; }
.qty { display: flex; align-items: center; gap: 10px; }
.qty button {
    width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--cocoa);
    background: #fff; font-size: 1.3rem; font-weight: 800; line-height: 1; cursor: pointer;
    display: grid; place-items: center; transition: background .15s;
}
.qty button:hover:not(:disabled) { background: var(--butter); }
.qty button.plus { background: var(--cocoa); color: #fff; }
.qty button.plus:hover:not(:disabled) { background: #4d2e1b; }
.qty button:disabled { opacity: .3; cursor: not-allowed; }
.qty output { min-width: 1.6em; font-weight: 800; font-size: 1.15rem; }

/* side cards */
.builder-side { position: sticky; top: 88px; max-height: calc(100vh - 100px); overflow-y: auto; padding: 4px 6px 12px; margin: -4px -6px 0; display: flex; flex-direction: column; gap: 18px; scroll-margin-top: 90px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; gap: 8px; }
.card h3 { font-family: var(--display); font-weight: 700; margin: 0; font-size: 1.3rem; }
.pill { background: var(--butter); border-radius: 999px; padding: .15em .7em; font-weight: 800; font-size: .9rem; white-space: nowrap; }
.pill.full { background: #d9ecc9; color: #2f5a1d; }

.tray {
    background: linear-gradient(#f3e3c4, #ecd6ae);
    border-radius: 12px; padding: 12px; min-height: 90px;
    display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr);
    box-shadow: inset 0 2px 6px rgba(84, 49, 20, .18);
}
.tray[data-cols="6"] { grid-template-columns: repeat(6, 1fr); gap: 5px; }
.tray-empty { grid-column: 1 / -1; margin: auto; color: var(--cocoa-soft); font-size: .9rem; text-align: center; }
.slot {
    aspect-ratio: 1; border-radius: 50%; border: 2px dashed rgba(110, 75, 51, .35);
    background: rgba(255, 255, 255, .35); padding: 0; cursor: default;
}
.slot.filled { border: 0; background: none; cursor: pointer; filter: drop-shadow(0 2px 2px rgba(84, 49, 20, .3)); animation: drop .25s ease-out; }
.slot.filled:hover { opacity: .75; }
@keyframes drop { from { transform: translateY(-10px) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.box-actions { display: flex; justify-content: space-between; margin: 10px 0 14px; }

.order-total { font-family: var(--display); font-weight: 900; font-size: 1.4rem; color: var(--gold-deep); }
.order-list { list-style: none; padding: 0; margin: 0 0 6px; }
.order-list li { padding: 10px 0; border-top: 1px dashed var(--line); }
.order-list li:first-child { border-top: 0; }
.order-item { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.order-item strong { display: block; }
.order-item .muted { font-size: .85rem; }
.order-item .right { text-align: right; white-space: nowrap; }
.remove { background: none; border: 0; color: var(--berry); font-size: .8rem; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }

.checkout { border-top: 2px solid var(--butter); margin-top: 12px; padding-top: 14px; }
.checkout h4, .success h4 { font-family: var(--display); font-size: 1.15rem; margin: 0 0 .2rem; }
.checkout label { display: block; font-weight: 700; font-size: .9rem; margin-top: 12px; }
.checkout input, .checkout select, .checkout textarea {
    display: block; width: 100%; margin-top: 4px; padding: .65em .8em;
    border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); font-weight: 400;
    font-size: 16px; /* iOS zooms in on focus when inputs are under 16px */
}
.checkout select { font-family: inherit; color: inherit; }
/* iOS Safari gives date inputs a native min-width/height that ignores width:100% */
.checkout input[type="date"] {
    -webkit-appearance: none; appearance: none;
    min-width: 0; max-width: 100%; font-family: inherit; color: inherit;
}
.checkout input[type="date"]::-webkit-date-and-time-value { text-align: left; min-height: 1.2em; }
.checkout input:focus, .checkout select:focus, .checkout textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--butter); }
.checkout input.invalid, .checkout select.invalid { border-color: var(--berry); }
.checkout .btn { margin-top: 16px; }
.req { color: var(--berry); }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.form-error { color: var(--berry); font-weight: 700; font-size: .9rem; margin: 12px 0 0; }

.success { text-align: center; padding: 10px 0 4px; }
.success-cookie { width: 90px; margin: 0 auto 10px; animation: spin 1.2s ease-out; }
@keyframes spin { from { transform: rotate(-180deg) scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }

/* toast + mobile bar */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
    background: var(--cocoa); color: var(--paper); padding: .7em 1.2em; border-radius: 999px;
    font-weight: 700; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-bar { display: none; }

/* footer */
.site-footer { background: var(--paper); border-top: 1px solid var(--line); }
.footer-inner { padding: 30px 20px; text-align: center; }
.footer-inner p { margin: .2rem 0; }

/* responsive */
@media (max-width: 960px) {
    .builder { grid-template-columns: 1fr; }
    .builder-side { position: static; max-height: none; overflow: visible; }
    .mobile-bar:not([hidden]) {
        display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30;
        justify-content: space-between; align-items: center;
        background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 8px 8px 20px;
        box-shadow: var(--shadow); font-weight: 800;
    }
    .toast { bottom: 84px; }
}
@media (max-width: 720px) {
    .hero { padding: 28px 0 20px; }

    .hero-art { order: -1; }
    .plate { width: min(300px, 80vw); }
    .packs { grid-template-columns: repeat(2, 1fr); }
    .flavors { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .flavor { padding: 12px 10px; }
    .flavor-art { width: 120px; }
    .flavor p { font-size: .82rem; }
    .wrap { padding: 0 16px; }
}

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