/* ==========================================================================
   Klova Mini Shop: brand stylesheet
   Tokens are lifted from klova.com (Wayback snapshot 2026-06-17) and the
   klova-sleep-quiz build. See /style-guide for the visual spec.
   ========================================================================== */

@font-face { font-family: 'Bergen Sans'; src: url('/fonts/BergenSans-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Bergen Sans'; src: url('/fonts/BergenSans-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  /* Brand */
  --plum: #1e062c;          /* primary text, solid buttons, logo */
  --plum-2: #361d45;        /* hover / secondary dark */
  --plum-3: #554360;        /* body copy on light tints */
  --purple: #9370db;        /* announcement bar (klova.com "mediumpurple") */
  --violet: #6660ab;        /* links, focus, selected states */
  --sleep-blue: #1ba6cc;    /* the "Sleep." accent word */
  --gold: #f4af29;          /* stars */
  --green: #1aae5c;         /* savings / in-stock */

  /* Product tints (cards, sheets) */
  --tint-cyan: #cef2f9;     /* Extra-Strength (blue pack) */
  --tint-peach: #f9e0d1;    /* Melatonin-Free (orange pack) */
  --tint-lavender: #e2e1ff; /* bundles */
  --tint-mint: #f3fdf8;

  /* Neutrals */
  --bg: #ffffff;
  --surface: #faf9fb;
  --border: #e8e4ee;
  --muted: #7b7b7b;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(30,6,44,.06), 0 6px 24px rgba(30,6,44,.06);
  --shadow-lg: 0 20px 60px rgba(30,6,44,.25);

  --font-heading: 'Bergen Sans', 'Montserrat', system-ui, sans-serif;
  --font-body: 'Montserrat', system-ui, -apple-system, sans-serif;

  --maxw: 1080px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--plum);
  font: 400 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
h1, h2, h3, .h { font-family: var(--font-heading); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Announcement + header ---------- */
.announce { background: var(--purple); color: #fff; text-align: center; font-size: 12.5px; font-weight: 600; padding: 8px 16px; letter-spacing: .01em; }
.header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.header .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 58px; }
.header .logo img { height: 26px; width: auto; }
.header nav { display: flex; gap: 20px; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.header nav a { text-decoration: none; padding: 12px 0; }
.header .right { justify-self: end; display: flex; gap: 14px; align-items: center; font-size: 12.5px; font-weight: 600; }
.header .right a { text-decoration: none; padding: 12px 4px; }
@media (max-width: 720px) { .header nav { display: none; } .header .wrap { grid-template-columns: auto 1fr; } .header .logo { justify-self: start; } }

/* ---------- Shop profile (IG / FB shop style) ---------- */
.profile { padding-top: 24px; padding-bottom: 8px; }
.profile .row { display: flex; gap: 16px; align-items: center; }
.avatar { flex: none; width: 76px; height: 76px; border-radius: 50%; padding: 3px; background: conic-gradient(from 200deg, var(--sleep-blue), var(--purple), #f8cdb4, var(--sleep-blue)); }
.avatar span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--plum); border: 3px solid #fff; }
.avatar img { width: 54%; filter: invert(1); }
.profile h1 { font-size: 24px; }
.profile h1 .blue { color: var(--sleep-blue); }
.profile .handle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.profile .stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12.5px; }
.profile .stats span { white-space: nowrap; }
.profile .stats b { font-weight: 700; }
.profile .bio { margin: 14px 0 0; color: var(--plum-3); max-width: 560px; font-size: 14px; }
@media (min-width: 720px) { .avatar { width: 112px; height: 112px; } .profile h1 { font-size: 32px; } }

/* Trust marquee (mirrors klova.com strip) */
.trust { margin-top: 20px; background: var(--surface); border-block: 1px solid var(--border); overflow: hidden; }
.trust .track { display: flex; gap: 28px; width: max-content; padding: 10px 0; animation: marquee 32s linear infinite; }
.trust span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; display: flex; align-items: center; gap: 28px; }
.trust span::after { content: ''; width: 7px; height: 7px; background: var(--plum-3); border-radius: 1px; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .trust .track { animation: none; } }

/* ---------- Tabs / filter chips ---------- */
.tabs { position: sticky; top: 58px; z-index: 10; background: #fff; border-bottom: 1px solid var(--border); }
.tabs .wrap { display: flex; gap: 8px; padding-top: 10px; padding-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--plum); border-color: var(--plum); color: #fff; }

/* ---------- Product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 10px; padding: 18px 0 8px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 24px 18px; } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card { text-align: left; background: none; border: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card .media { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--tint, var(--surface)); }
.card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .media img { transform: scale(1.03); }
.badge { position: absolute; top: 8px; left: 8px; background: #fff; color: var(--plum); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px; border-radius: 999px; box-shadow: var(--shadow); }
.badge.save { background: var(--plum); color: #fff; }
.card .name { font-family: var(--font-heading); font-weight: 600; font-size: 15px; line-height: 1.25; }
.card .tag { font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.price .now { font-weight: 700; font-size: 15px; }
.price .was { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.price .off { color: var(--green); font-weight: 700; font-size: 12px; }
.stars { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--plum-3); }
.stars i { font-style: normal; color: var(--gold); letter-spacing: 1px; }
[data-tint="cyan"] { --tint: var(--tint-cyan); }
[data-tint="peach"] { --tint: var(--tint-peach); }
[data-tint="lavender"] { --tint: var(--tint-lavender); }
[data-tint="sleep"] { --tint: var(--tint-lavender); }
[data-tint="performance"] { --tint: var(--tint-cyan); }
[data-tint="balance"] { --tint: var(--tint-mint); }
[data-tint="bundles"] { --tint: var(--tint-peach); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 22px; border-radius: var(--radius-sm); border: 1.5px solid var(--plum); background: var(--plum); color: #fff; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--plum-2); }
.btn.outline { background: #fff; color: var(--plum); }
.btn.outline:hover { background: var(--surface); }
.btn.block { width: 100%; }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn .sep { width: 1px; align-self: stretch; margin: 12px 0; background: currentColor; opacity: .35; }

/* ---------- Product sheet (bottom sheet on mobile, dialog on desktop) ---------- */
dialog.sheet { padding: 0; border: 0; width: 100%; max-width: 960px; max-height: 92dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; margin: auto auto 0; box-shadow: var(--shadow-lg); color: var(--plum); overflow: hidden; }
dialog.sheet::backdrop { background: rgba(30,6,44,.45); }
dialog.sheet[open] { animation: up .28s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 820px) { dialog.sheet { margin: auto; border-radius: var(--radius-lg); } }
.sheet .scroll:focus { outline: none; }
.sheet .scroll { max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 8px auto 0; }
.sheet .close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); box-shadow: var(--shadow); font-size: 20px; line-height: 1; }
.sheet .body { display: grid; gap: 0; }
@media (min-width: 820px) { .sheet .body { grid-template-columns: 1.05fr 1fr; } .sheet .grab { display: none; } }
.gallery { background: var(--tint, var(--surface)); }
.gallery .slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 1; }
.gallery .slides img { flex: none; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; }
.gallery .dots { display: flex; justify-content: center; gap: 6px; padding: 10px 0 12px; }
.gallery .dots button { width: 7px; height: 7px; border-radius: 50%; border: 0; padding: 0; background: var(--plum); opacity: .2; }
.gallery .dots button[aria-current="true"] { opacity: .85; }
.sheet .info { padding: 20px 20px 28px; display: grid; gap: 14px; align-content: start; }
.sheet h2 { font-size: 26px; }
.sheet .tagline { font-style: italic; color: var(--plum-3); margin-top: -8px; font-size: 14px; }
.sheet .desc { color: var(--plum-3); font-size: 14px; margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.facts li { font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--border); padding: 5px 10px; border-radius: 999px; }

.options { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; }
.options legend { font-weight: 700; font-size: 13px; margin-bottom: 8px; padding: 0; }
.opt { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; background: #fff; }
.opt input { accent-color: var(--plum); width: 18px; height: 18px; margin: 0; }
.opt:has(input:checked) { border-color: var(--plum); background: var(--surface); }
.opt .l b { display: block; font-size: 14px; }
.opt .l small { color: var(--green); font-weight: 600; font-size: 12px; }
.opt .r { text-align: right; }
.opt .r b { display: block; font-size: 15px; }
.opt .r s { color: var(--muted); font-size: 12px; }
.opt .flag { position: absolute; top: -9px; right: 12px; background: var(--plum); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.opt .r .each { display: block; color: var(--muted); font-size: 11.5px; }
.secure { text-align: center; font-size: 11.5px; color: var(--muted); margin: -6px 0 0; }
.ship-note { font-size: 12.5px; color: var(--plum-3); text-align: center; margin: -4px 0 0; }

.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0; margin: 0; list-style: none; }
.perks li { display: grid; justify-items: center; gap: 4px; text-align: center; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--surface); border-radius: var(--radius-sm); padding: 10px 6px; }
.perks svg { width: 22px; height: 22px; }

details.acc { border-top: 1px solid var(--border); padding: 12px 0 0; }
details.acc summary { cursor: pointer; font-weight: 700; font-size: 14px; list-style: none; display: flex; justify-content: space-between; }
details.acc summary::after { content: '+'; font-weight: 400; font-size: 18px; line-height: 1; }
details.acc[open] summary::after { content: '–'; }
details.acc dl { margin: 10px 0 0; display: grid; gap: 8px; font-size: 13.5px; }
details.acc dt { font-weight: 700; }
details.acc dd { margin: 0; color: var(--plum-3); }
details.acc p { font-size: 13.5px; color: var(--plum-3); margin: 10px 0 0; }

/* ---------- Content sections ---------- */
.section { padding-top: 44px; padding-bottom: 44px; }
.section h2 { font-size: clamp(24px, 4vw, 34px); text-align: center; }
.section .sub { text-align: center; color: var(--plum-3); margin: 8px auto 0; max-width: 560px; font-size: 14px; }
.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 24px; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; font-size: 13px; color: var(--plum-3); }
.step b { display: flex; align-items: center; gap: 8px; color: var(--plum); text-transform: uppercase; font-size: 12.5px; letter-spacing: .05em; margin-bottom: 6px; }
.step b::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--plum); }
.tinted { background: var(--surface); border-radius: var(--radius-lg); }
.reviews { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 24px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.review { flex: none; width: min(300px, 82vw); scroll-snap-align: center; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 6px; align-content: start; }
.review .who { font-size: 12.5px; color: var(--muted); }
.review .who b { color: var(--plum); }
.review h3 { font-size: 15px; }
.review p { margin: 0; font-size: 13.5px; color: var(--plum-3); }
.verified { color: var(--green); font-weight: 600; }

.guarantee { display: grid; gap: 18px; align-items: center; background: var(--tint-lavender); border-radius: var(--radius-lg); padding: 24px; }
@media (min-width: 720px) { .guarantee { grid-template-columns: auto 1fr; padding: 32px 40px; } }
.seal { width: 92px; height: 92px; border-radius: 50%; border: 3px solid var(--plum); display: grid; place-items: center; text-align: center; font-family: var(--font-heading); font-weight: 700; line-height: 1; }
.seal b { font-size: 30px; display: block; }
.seal small { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.guarantee h2 { text-align: left; font-size: 24px; }
.guarantee p { margin: 6px 0 0; color: var(--plum-3); font-size: 14px; }

/* ---------- Footer ---------- */
.footer { background: var(--plum); color: #e9e2ef; margin-top: 40px; padding: 36px 0 28px; font-size: 13px; }
.footer .cols { display: grid; gap: 22px; }
@media (min-width: 720px) { .footer .cols { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer h4 { font-family: var(--font-heading); color: #fff; margin: 0 0 8px; font-size: 15px; }
.footer a { color: #e9e2ef; text-decoration: none; display: block; padding: 3px 0; }
.footer a:hover { color: #fff; text-decoration: underline; }
.footer .logo img { height: 24px; filter: invert(1); margin-bottom: 10px; }
.footer .fine { border-top: 1px solid rgba(255,255,255,.14); margin-top: 26px; padding-top: 16px; font-size: 11.5px; color: #b9aec3; }

/* ---------- Simple text pages (legal, thank-you) ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 40px 16px 20px; }
.page h1 { font-size: 34px; margin-bottom: 8px; }
.page h2 { font-size: 20px; margin: 28px 0 8px; }
.page p, .page li { color: var(--plum-3); font-size: 15px; }
.page .updated { color: var(--muted); font-size: 13px; }

/* Sticky mobile buy bar inside sheet */
.buybar { position: sticky; bottom: 0; background: #fff; padding: 12px 0 calc(4px + env(safe-area-inset-bottom)); margin: 0 -20px; padding-inline: 20px; z-index: 1; border-top: 1px solid var(--border); }
