:root {
  --bg: #fbf7f0; --card: #ffffff; --ink: #1f1a17; --muted: #6f655c; --line: #ebe2d4;
  --accent: #e8572a; --accent-ink: #ffffff; --accent-soft: #fde6dc; --good: #2e8b57; --warn: #b7791f; --bad: #c0392b;
  --radius: 18px; --shadow: 0 6px 24px rgba(60, 40, 20, .08);
  --head: 'Fredoka', system-ui, sans-serif; --body: 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--head); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(251, 247, 240, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-family: var(--head); font-weight: 600; font-size: 1.3rem; color: var(--ink); text-decoration: none; display: flex; gap: 8px; align-items: center; }
.logo .knot { width: 28px; height: 28px; border-radius: 50%; background: conic-gradient(#e8572a, #f6d10b, #2e9e44, #2f80ed, #7b3fb5, #f06292, #e8572a); box-shadow: inset 0 0 0 6px var(--bg); }
.basket-link { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); font-weight: 700; background: var(--card); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; }
.basket-count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 22px; height: 22px; font-size: .8rem; display: inline-grid; place-items: center; padding: 0 6px; }

.demo-banner { background: #222; color: #fff; text-align: center; font-size: .85rem; padding: 6px 12px; }

/* buttons */
.btn { appearance: none; border: 0; border-radius: 999px; padding: 14px 24px; font: 700 1rem var(--body); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* hero */
.hero { padding: 48px 0 24px; display: grid; gap: 28px; grid-template-columns: 1.1fr .9fr; align-items: center; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 32em; }
.hero-art { aspect-ratio: 1; border-radius: 32px; background: var(--card); box-shadow: var(--shadow); overflow: hidden; display: grid; place-items: center; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; }
.pill { display: inline-block; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; margin-bottom: 14px; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; padding-top: 28px; } .hero-art { order: -1; aspect-ratio: 4/3; } }

/* product cards */
.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin: 16px 0 48px; }
.product { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform .15s; }
.product:hover { transform: translateY(-3px); }
.product .ph { aspect-ratio: 4/3; background: var(--accent-soft); display: grid; place-items: center; overflow: hidden; }
.product .ph img { width: 100%; height: 100%; object-fit: cover; }
.product .body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product .price { font-family: var(--head); font-size: 1.4rem; color: var(--accent); }
.product .go { margin-top: auto; font-weight: 800; color: var(--accent); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 48px; }
.step { background: var(--card); border-radius: var(--radius); padding: 18px; border: 1px solid var(--line); }
.step b { font-family: var(--head); font-size: 1.6rem; color: var(--accent); display: block; }

/* gallery */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--card); padding: 7px 14px; border-radius: 999px; font: 700 .9rem var(--body); cursor: pointer; color: var(--ink); }
.chip .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 48px; }
.gallery button { padding: 0; border: 0; border-radius: 14px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; background: var(--line); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.empty { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); }

.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .85); z-index: 100; display: grid; place-items: center; padding: 16px; }
.lightbox img { max-height: 85vh; border-radius: 12px; }
.lightbox p { color: #fff; text-align: center; margin-top: 10px; }

footer { border-top: 1px solid var(--line); padding: 28px 0 48px; color: var(--muted); font-size: .9rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }

/* builder */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; padding: 24px 0 120px; align-items: start; }
@media (max-width: 900px) { .builder { grid-template-columns: minmax(0, 1fr); } .summary { display: none; } }
.builder > *, .section { min-width: 0; }
.section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 1.25rem; }
.section-head h2 .n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .95rem; margin-right: 8px; vertical-align: 2px; }
.req { font-size: .8rem; color: var(--muted); font-weight: 700; }
.sub { font-weight: 800; margin: 14px 0 8px; display: flex; justify-content: space-between; gap: 8px; }
.sub .extra { color: var(--accent); font-weight: 800; font-size: .9rem; }
.type-img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.sw { position: relative; border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 8px 4px 6px; text-align: center; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 96px; }
.sw .c { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .12); }
.sw .c.cord { border-radius: 10px; width: 46px; height: 28px; }
.sw img.c { object-fit: cover; }
.sw .name { font-size: .78rem; font-weight: 700; line-height: 1.15; }
.sw .left { font-size: .7rem; color: var(--muted); }
.sw .left.low { color: var(--warn); font-weight: 800; }
.sw.on { border-color: var(--ink); background: #fffaf3; }
.sw.on::after { content: '✓'; position: absolute; top: 4px; right: 6px; font-weight: 900; font-size: .8rem; }
.sw:disabled, .sw.out { opacity: .38; cursor: not-allowed; filter: grayscale(.9); }
.sw .qty { position: absolute; top: -8px; right: -6px; background: var(--ink); color: #fff; border-radius: 999px; min-width: 24px; height: 24px; font-size: .8rem; font-weight: 800; display: grid; place-items: center; }
.minus { position: absolute; top: -8px; left: -6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; font-weight: 900; cursor: pointer; line-height: 1; }
.counter { font-size: .85rem; font-weight: 800; background: var(--bg); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.counter.full { background: var(--accent-soft); color: var(--accent); }
.strand-label { font-weight: 800; margin: 10px 0 6px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-weight: 800; font-size: .92rem; }
input[type=text], input[type=email], input[type=tel], textarea, select { font: inherit; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.letters-input { font-family: var(--head); font-size: 1.6rem; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.letter-preview { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 40px; margin: 10px 0; }
.letter-preview span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--head); font-weight: 600; color: #fff; box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--accent); flex: none; }

.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.strip button { flex: none; width: 130px; height: 130px; border: 0; padding: 0; border-radius: 14px; overflow: hidden; cursor: zoom-in; }
.strip img { width: 100%; height: 100%; object-fit: cover; }

.summary { position: sticky; top: 80px; }
.summary ul { list-style: none; padding: 0; margin: 0 0 12px; font-size: .9rem; }
.summary li { padding: 6px 0; border-bottom: 1px dashed var(--line); }

.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(0, 0, 0, .06); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bar .total { font-family: var(--head); font-size: 1.6rem; }
.bar .total small { display: block; font-family: var(--body); font-size: .75rem; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 200; font-weight: 700; max-width: calc(100% - 32px); text-align: center; }
.toast.err { background: var(--bad); }

/* basket */
.basket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; padding: 24px 0 64px; align-items: start; }
@media (max-width: 900px) { .basket-grid { grid-template-columns: minmax(0, 1fr); } }
.basket-grid > * { min-width: 0; }
.item { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .swatch-stack { flex: none; width: 56px; height: 56px; border-radius: 14px; overflow: hidden; display: flex; }
.item .swatch-stack span { flex: 1; }
.item h3 { margin: 0 0 4px; font-size: 1.05rem; }
.item ul { margin: 0; padding-left: 18px; font-size: .88rem; color: var(--muted); }
.item .right { margin-left: auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.item .price { font-family: var(--head); font-size: 1.2rem; }
.link-btn { background: none; border: 0; color: var(--bad); font: 700 .85rem var(--body); cursor: pointer; padding: 0; }
.link-btn.edit { color: var(--ink); }
.totals { display: grid; gap: 6px; margin: 12px 0 16px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-family: var(--head); font-size: 1.4rem; border-top: 1px solid var(--line); padding-top: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: .82rem; color: var(--muted); }
.hint.bad { color: var(--bad); font-weight: 700; }
.hint.good { color: var(--good); font-weight: 700; }
.error-box { background: #fdecea; color: var(--bad); border-radius: 12px; padding: 12px 14px; font-weight: 700; margin-bottom: 12px; }

.pay-opt { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; background: #fff; }
.pay-opt:has(input:checked) { border-color: var(--ink); }
.pay-opt input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* text pages */
.prose { max-width: 760px; padding: 32px 16px 64px; margin: 0 auto; }
.prose h2 { margin-top: 1.6em; font-size: 1.3rem; }
.prose li { margin-bottom: .4em; }
.center-card { max-width: 520px; margin: 48px auto; background: var(--card); padding: 32px 24px; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.big-emoji { font-size: 3.5rem; }
@media (min-width: 600px) { .chips { flex-wrap: wrap; overflow: visible; } }
#themes { flex-wrap: wrap; overflow: visible; } /* show every theme without swiping */
