/* Swapfume — warm, light, a little luxurious. Mobile first. */
:root {
  --bg: #FAF6F1;
  --surface: #FFFFFF;
  --surface-2: #F4ECE4;
  --ink: #2A211E;
  --muted: #6B5D57;       /* 6.0:1 on --bg */
  --line: #E7DCD2;
  --accent: #8C3B4A;      /* deep rose, 7.4:1 on white */
  --accent-ink: #FFFFFF;
  --accent-soft: #F5E6E6;
  --gold: #A0782C;        /* decoration and large text only */
  --gold-soft: #F6EEDD;
  --ok: #2F6B48;
  --ok-soft: #E4F0E8;
  --warn: #8A5A12;
  --warn-soft: #FBF0DC;
  --danger: #A2302F;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(60, 35, 25, .06), 0 6px 20px rgba(60, 35, 25, .06);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Jost", -apple-system, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--sans);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
body.signed-out { padding-bottom: 0; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: .005em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.55rem; margin-top: 1.4em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 50; border-radius: 8px; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* Top bar & navigation */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(250, 246, 241, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.wordmark::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-left: 3px; vertical-align: super; }
.topnav { display: none; gap: 4px; }
.topnav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; position: relative; }
.topnav a.active { color: var(--accent); background: var(--accent-soft); }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .75rem; padding: 4px 0; position: relative; min-height: 48px; justify-content: center; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent); font-weight: 600; }
.tabbar a.active svg { stroke-width: 2.1; }
.dot { position: absolute; top: 4px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.topnav .dot { top: 6px; right: 4px; border-color: var(--bg); }
@media (min-width: 760px) {
  .topnav { display: flex; }
  .tabbar { display: none !important; }
  body { padding-bottom: 32px; }
}

.demo-banner { background: var(--gold-soft); color: #5E4512; font-size: .85rem; padding: 8px 16px; text-align: center; border-bottom: 1px solid #EBDDBE; }
.demo-banner button { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0 2px; }

main { max-width: 980px; margin: 0 auto; padding: 20px 16px 32px; outline: none; }
main:focus, main:focus-visible { outline: none; }
.page-head { margin-bottom: 18px; }
.page-head p { color: var(--muted); margin: 0; }
.eyebrow { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 4px; }

/* Cards & layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.5); }
.empty h3 { color: var(--ink); }

/* Item tile */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); position: relative; }
.tile .art { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.tile .art img { width: 100%; height: 100%; object-fit: cover; }
.tile .art svg { width: 58%; height: 78%; }
.tile .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.brand { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.pname { font-family: var(--serif); font-size: 1.18rem; font-weight: 600; line-height: 1.15; color: var(--ink); text-decoration: none; }
a.pname:hover { color: var(--accent); }
.meta { font-size: .82rem; color: var(--muted); }
.tile .owner { margin-top: auto; padding-top: 6px; font-size: .82rem; }
.tile .owner a { color: var(--ink); font-weight: 500; text-decoration: none; }
.tile .corner { position: absolute; top: 8px; left: 8px; }
.tile .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tile.selectable { cursor: pointer; }
.tile.selectable input { position: absolute; opacity: 0; pointer-events: none; }
.tile.selectable .check { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: rgba(255,255,255,.95); display: grid; place-items: center; }
.tile.selectable.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tile.selectable.on .check { background: var(--accent); border-color: var(--accent); }
.tile.selectable.on .check::after { content: ""; width: 7px; height: 12px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.tile.selectable:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Pills & badges */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.pill.rose { background: var(--accent-soft); color: var(--accent); }
.pill.gold { background: var(--gold-soft); color: #6B4E14; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.grey { background: #EEE9E5; color: #5A4F4A; }
.trust { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.stars { color: var(--gold); letter-spacing: 1px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 1.3rem; color: #fff; flex: none; }
.avatar.lg { width: 76px; height: 76px; font-size: 2.1rem; }
.fill { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.fill > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent)); }

/* Buttons & forms */
.btn {
  appearance: none; font: 500 .95rem var(--sans); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); transition: transform .05s, background .15s;
}
.btn:hover { background: #76303E; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--accent); padding-left: 10px; padding-right: 10px; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: #E9C9C6; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
label { display: block; font-weight: 500; font-size: .92rem; margin-bottom: 6px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; font: 16px var(--sans); color: var(--ink); background: var(--surface); border: 1px solid #D9CCC1; border-radius: var(--radius-sm);
  padding: 11px 12px; min-height: 46px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field + .field { margin-top: 14px; }
.two { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg label { font: 500 .9rem var(--sans); border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 999px; cursor: pointer; margin: 0; min-height: 38px; display: inline-flex; align-items: center; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg .on, .seg button[aria-pressed=true], .seg label:has(input:checked) { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--gold); }
.switch { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }

/* Perfume picker */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 300px; overflow: auto; margin: 0; padding: 4px; list-style: none; }
.picker-list li { padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.picker-list li[aria-selected=true], .picker-list li:hover { background: var(--accent-soft); }
.picker-list .b { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.picker-list .n { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }
.picked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--accent-soft); border-radius: var(--radius-sm); }
.picked .grow { flex: 1; }

/* Hero / welcome */
.welcome { display: grid; gap: 24px; align-items: center; min-height: calc(100vh - 40px); padding-top: 12px; }
@media (min-width: 860px) { .welcome { grid-template-columns: 1.1fr 1fr; gap: 48px; } }
.hero h1 { font-size: 3rem; line-height: 1.02; }
.hero h1 em { color: var(--accent); font-style: italic; }
.hero .lead { font-size: 1.1rem; color: var(--muted); max-width: 34ch; }
.hero-art { display: flex; gap: 10px; align-items: flex-end; margin: 18px 0 8px; }
.hero-art svg { height: 120px; width: auto; }
.points { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.points li { position: relative; padding-left: 18px; }
.points li::before { content: ""; position: absolute; left: 0; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }

/* Match cards */
.match { display: grid; gap: 12px; }
.match-head { display: flex; gap: 12px; align-items: center; }
.match-head .grow { flex: 1; min-width: 0; }
.match-head a.name { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.match-sides { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .match-sides { grid-template-columns: 1fr 1fr; } }
.side { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.side h4 { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.side ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.side li { font-size: .95rem; }
.side li b { font-family: var(--serif); font-size: 1.08rem; }

/* Swap timeline */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.steps li::before { content: ""; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--line); }
.steps li:last-child::before { display: none; }
.steps .mark { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: .8rem; font-weight: 600; color: var(--muted); z-index: 1; }
.steps li.done .mark { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps li.done::before { background: var(--accent); }
.steps li.now .mark { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.steps .t { font-weight: 500; }
.steps .d { font-size: .85rem; color: var(--muted); }
.notice { border-radius: var(--radius-sm); padding: 12px 14px; font-size: .92rem; background: var(--gold-soft); color: #5E4512; }
.notice.rose { background: var(--accent-soft); color: #6E2735; }
.notice.ok { background: var(--ok-soft); color: #234F36; }
.address { white-space: pre-line; font-size: .95rem; background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.swap-row { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.swap-row .grow { flex: 1; min-width: 0; }
.swap-row .title { font-weight: 500; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Star input */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 2rem; color: #D8CBBE; cursor: pointer; margin: 0; line-height: 1; padding: 2px; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--gold); }
.star-input input:focus-visible + label { outline: 3px solid var(--gold); border-radius: 6px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { font: 500 1rem var(--sans); background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }

/* Toast & dialog */
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: .92rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
@media (min-width: 760px) { .toast { bottom: 28px; } }
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(40, 20, 15, .25); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(42, 33, 30, .45); }
dialog .dlg { padding: 20px; }
dialog .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.profile-head { display: flex; gap: 16px; align-items: center; }
.profile-head h1 { margin: 0; }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
table.admin { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.admin td, table.admin th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }

/* Scent family chip, notes */
.fam { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 500; padding: 3px 10px 3px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-transform: capitalize; white-space: nowrap; }
.fam-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.notes-line { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.pyramid { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 640px) { .pyramid { grid-template-columns: repeat(3, 1fr); } }
.layer { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.layer-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; margin-bottom: 6px; }
.layer .row { gap: 6px; }
.note { font-size: .85rem; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.perfume-hero { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 560px) { .perfume-hero { grid-template-columns: 200px 1fr; } }
.hero-pic { margin: 0; }
.hero-pic img, .hero-pic svg { width: 100%; max-width: 220px; height: 220px; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); display: block; margin: 0 auto; }
.hero-pic svg { padding: 18px; object-fit: contain; }
.hero-pic figcaption { font-size: .75rem; color: var(--muted); text-align: center; margin-top: 6px; }
table.admin th { font-weight: 500; color: var(--muted); }

/* ---- Launch: legal pages, footer, narrow forms, danger zone ---- */
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.legal { max-width: 720px; line-height: 1.6; }
.legal h2 { font-size: 1.35rem; margin: 22px 0 6px; }
.legal h3 { font-size: 1.1rem; margin: 16px 0 4px; }
.legal ul { padding-left: 20px; margin: 6px 0; }
.legal li { margin: 4px 0; }
.danger-zone { border-color: #E7C9C9; }
.site-footer { max-width: 980px; margin: 0 auto; padding: 8px 16px 24px; text-align: center; color: var(--muted); font-size: .85rem; }
.site-footer nav { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 4px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer p { margin: 0; }

/* ---- Catalog list, perfume reviews ---- */
.tablink { font: 500 1rem var(--sans); padding: 10px 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tablink[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
.mini-bottle { width: 34px; height: 52px; flex: none; }
.mini-bottle svg { width: 100%; height: 100%; }
.rating { white-space: nowrap; }
.rating-lg { font-size: 1.15rem; white-space: nowrap; }
.tagsums { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 12px; }
.tagsum .bar-row { display: grid; grid-template-columns: 96px 1fr 22px; gap: 8px; align-items: center; font-size: .9rem; margin-top: 4px; }
.tagsum .bar { height: 8px; background: #EFE6DC; border-radius: 4px; overflow: hidden; display: block; }
.tagsum .bar span { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.chk { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; min-height: 40px; }
li.is-hidden { opacity: .6; }
code { font-size: .85em; background: #F3ECE4; padding: 1px 4px; border-radius: 4px; }
