/* Same tokens as the app (src/theme/tokens.ts): white space, hairlines, Inter
   for text, Instrument Serif for display, blush and ink. Light only. */
:root {
  --bg: #ffffff;
  --well: #f5f3f1;
  --line: #ece7e3;
  --ink: #2a2624;
  --ink-soft: #4e4844;
  --muted: #8c8580;
  --faint: #b9b2ac;
  --blush-soft: #fbf0f4;
  --blush-ink: #9b4f74;
  --good: #5e8c6a;
  --caution: #b7862e;
  --caution-soft: #faf3e4;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 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: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

main, .top, footer {
  max-width: 680px;
  margin: 0 auto;
  padding-left: 22px;
  padding-right: 22px;
}

@media (max-width: 480px) {
  main, .top, footer { padding-left: 16px; padding-right: 16px; }
}

/* Banner: an "App coming soon" tag with the app's perks fading through one at a time.
   Each perk holds for 3.5s; calm fades only, and it holds still for reduced motion. */

.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 42px;
  padding: 0 16px;
  background: linear-gradient(90deg, var(--blush-soft), #f2eefd 50%, var(--blush-soft));
  border-bottom: 1px solid #f0e2ea;
  color: var(--ink-soft);
  font-size: 13px;
  overflow: hidden;
}

.banner-tag {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #f0dbe5;
  color: var(--blush-ink);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.banner-perks {
  position: relative;
  width: 260px;
  height: 20px;
}

.banner-perks span {
  position: absolute;
  inset: 0;
  white-space: nowrap;
  line-height: 20px;
  font-weight: 500;
  opacity: 0;
  animation: perk calc(var(--n) * 3.5s) ease-in-out infinite;
  animation-delay: calc(var(--i) * 3.5s);
}

/* Six perks: each owns 1/6 of the loop (about 16.7%) and fades out over the start of the
   next one's turn, so the two cross-fade rather than leaving a blank gap. */
@keyframes perk {
  0% { opacity: 0; transform: translateY(5px); }
  3% { opacity: 1; transform: none; }
  16.7% { opacity: 1; transform: none; }
  19.7% { opacity: 0; transform: translateY(-5px); }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .banner-perks span { animation: none; }
  .banner-perks span:first-child { opacity: 1; }
}

@media (max-width: 400px) {
  .banner { gap: 8px; justify-content: flex-start; }
  .banner-perks { width: auto; flex: 1; }
}

/* Header */

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 400 22px/1 var(--serif);
  text-decoration: none;
  flex-shrink: 0;
}

.brand img { border-radius: 7px; }

/* Search */

.search {
  display: flex;
  gap: 8px;
  width: 100%;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--well);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.search input:focus { border-color: var(--faint); background: var(--bg); }

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

.search button {
  height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: 500 15px var(--sans);
  cursor: pointer;
}

.search.compact input, .search.compact button { height: 42px; }
.search.compact input { font-size: 15px; padding: 0 16px; }
.search.compact button { padding: 0 16px; font-size: 14px; }

@media (max-width: 480px) {
  .top:has(.search) { flex-wrap: wrap; }
  .search.compact button { display: none; }
}

/* Home */

.hero { padding: 72px 0 40px; }

h1, h2 { font-family: var(--serif); font-weight: 400; margin: 0; }

.hero h1 { font-size: clamp(40px, 9vw, 58px); line-height: 1.04; letter-spacing: -0.01em; }

.hero em { color: var(--blush-ink); }

.lede { color: var(--ink-soft); font-size: 17px; max-width: 520px; margin: 18px 0 30px; }

.try { color: var(--muted); font-size: 14px; margin-top: 16px; }

.try a { color: var(--ink-soft); text-decoration-color: var(--faint); text-underline-offset: 3px; }

/* Shared bits */

.overline {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.muted { color: var(--muted); }

.flag { color: var(--caution); font-weight: 500; }

.swatch {
  flex-shrink: 0;
  overflow: hidden;
  display: block;
}

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

.swatch.sm { width: 52px; height: 52px; border-radius: 12px; }

.swatch.lg { width: 112px; height: 112px; border-radius: 24px; }

/* Results */

.count { color: var(--muted); font-size: 14px; margin: 12px 0 4px; }

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

.results li + li { border-top: 1px solid var(--line); }

.results a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  text-decoration: none;
}

.results a:hover .row-name { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }

.row-text { flex: 1; min-width: 0; }

.row-name { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-meta { flex-shrink: 0; font-size: 13px; }

.empty { padding: 64px 0; }

.empty h2 { font-size: 32px; margin-bottom: 8px; }

.empty p { color: var(--ink-soft); }

/* Product */

.product { padding-top: 16px; }

.product-head { display: flex; align-items: center; gap: 20px; }

.product-head h1 { font-size: clamp(28px, 6vw, 36px); line-height: 1.1; margin: 4px 0 6px; }

.product-head p { margin: 0; font-size: 14px; }

@media (max-width: 480px) {
  .product-head { gap: 16px; }
  .swatch.lg { width: 84px; height: 84px; border-radius: 18px; }
}

.panel {
  margin: 28px 0 36px;
  padding: 20px 22px;
  border-radius: 18px;
  background: var(--well);
}

.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

.summary { font: 400 22px/1.25 var(--serif); margin: 0 0 14px; }

.summary.good { color: var(--good); }

.groups { margin: 0; }

.groups div {
  display: flex;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.groups dt { flex: 0 0 150px; font-weight: 500; color: var(--caution); }

.groups dd { margin: 0; color: var(--ink-soft); }

@media (max-width: 480px) {
  .groups div { flex-direction: column; gap: 2px; }
  .groups dt { flex-basis: auto; }
}

.key { margin: 16px 0 0; font-size: 14px; color: var(--ink-soft); }

.key .overline { margin-bottom: 4px; }

.product h2 { font-size: 28px; }

.hint { font-size: 13px; margin: 4px 0 10px; }

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

.ings li { border-top: 1px solid var(--line); }

.ings summary, .ings .plain {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
}

.ings summary { cursor: pointer; list-style: none; }

.ings summary::-webkit-details-marker { display: none; }

.ings .n { flex: 0 0 22px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

.ings .ing-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.ings .plain .ing-name { color: var(--ink-soft); }

.ings .flags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 10px; font-size: 12px; text-align: right; }

.ings details p {
  margin: -4px 0 14px 34px;
  font-size: 14px;
  color: var(--ink-soft);
}

.ings .flagged summary .ing-name { font-weight: 500; }

/* Footer */

footer {
  margin-top: 64px;
  padding-top: 24px;
  padding-bottom: 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

footer p { margin: 0 0 6px; max-width: 520px; }

footer .footnote { font-size: 11px; line-height: 1.5; color: var(--faint); margin-bottom: 10px; }

/* Skin link in the header */

.skin-link {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--blush-ink);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--blush-soft);
  white-space: nowrap;
}

.top:not(:has(.search)) .skin-link { margin-left: auto; }

@media (max-width: 480px) {
  .top .brand { flex: 1; }
  .top .search.compact { order: 3; }
}

.skin-line { margin-top: 28px; font-size: 14px; color: var(--ink-soft); }

.skin-line a, .count a, .empty a, .match a, .skin-actions a { color: var(--blush-ink); text-underline-offset: 3px; }

.small { font-size: 13px; }

/* Verdict colours, from the app's VERDICT_COLORS */

.v-great { --v: #5e8c6a; --v-ring: #7fa88a; --v-bg: #edf4ef; }
.v-good { --v: #6d8a55; --v-ring: #a6be8f; --v-bg: #f1f5eb; }
.v-caution { --v: #b7862e; --v-ring: #d9b26a; --v-bg: #faf3e4; }
.v-avoid { --v: #b85c5c; --v-ring: #d79a98; --v-bg: #f9ecea; }

.score, .verdict { display: inline-flex; align-items: center; gap: 6px; color: var(--v); font-weight: 600; }

.score i, .verdict i { width: 6px; height: 6px; border-radius: 3px; background: var(--v-ring); }

.row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }

.row-meta .sub { font-size: 12px; }

/* Match on a product page */

.match { margin: 28px 0 0; }

.match-head { display: flex; align-items: center; gap: 20px; }

.ring { position: relative; flex-shrink: 0; }

.ring svg { position: absolute; inset: 0; }

.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

.ring-score { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }

.ring-score small { font-size: 14px; font-weight: 500; color: var(--muted); }

.ring-text .overline { font-size: 9px; }

.verdict { padding: 5px 12px; border-radius: 999px; background: var(--v-bg); font-size: 13px; }

.match-summary { font: 400 21px/1.3 var(--serif); margin: 8px 0 4px; }

.match-head p.small { margin: 0; }

.reasons { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 14px; }

.reason { display: flex; gap: 12px; }

.reason-icon { flex: 0 0 22px; width: 22px; height: 22px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }

.reason.good .reason-icon { stroke: var(--good); }
.reason.caution .reason-icon { stroke: var(--caution); }
.reason.bad .reason-icon { stroke: #b85c5c; }

.reason div { display: flex; flex-direction: column; gap: 1px; font-size: 14px; }

.reason-title { font-weight: 500; font-size: 15px; }

.reason-detail { font-style: italic; }

.match-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.match-cta:hover { border-color: var(--faint); }

.match-cta > span:first-child { display: flex; flex-direction: column; gap: 2px; }

.match-cta > span:last-child { color: var(--blush-ink); font-size: 18px; }

.ings .tone { display: inline-block; width: 6px; height: 6px; border-radius: 3px; margin: 0 8px 2px 0; vertical-align: middle; }

.ings .tone.good { background: #7fa88a; }
.ings .tone.watch { background: #d9b26a; }

@media (max-width: 480px) {
  .match-head { align-items: flex-start; gap: 16px; }
  .match-summary { font-size: 19px; }
}

/* Skin quiz */

.quiz, .skin-result { padding: 40px 0 0; }

.quiz h1, .skin-result h1 { font-size: clamp(36px, 8vw, 50px); line-height: 1.05; }

.quiz h1 em, .skin-result h1 em, .quiz legend em, .skin-result h2 em { color: var(--blush-ink); }

.notice { padding: 12px 16px; border-radius: 12px; background: var(--caution-soft); color: var(--caution); font-size: 14px; }

.q { border: 0; margin: 36px 0 0; padding: 0; min-width: 0; }

.q legend { font: 400 26px/1.2 var(--serif); padding: 0; margin-bottom: 4px; }

.opts { display: grid; gap: 8px; margin-top: 12px; }

.opts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.opts.compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.opts.row { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }

@media (max-width: 480px) {
  .opts.two { grid-template-columns: 1fr; }
  .opts.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.opt { position: relative; display: block; cursor: pointer; }

.opt input { position: absolute; opacity: 0; pointer-events: none; }

.opt-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.opts.compact .opt-body, .opts.row .opt-body { padding: 11px 14px; font-size: 14px; }

.opt:hover .opt-body { border-color: var(--faint); }

.opt input:checked + .opt-body { border-color: var(--blush-ink); background: var(--blush-soft); }

.opt input:focus-visible + .opt-body { outline: 2px solid var(--blush-ink); outline-offset: 2px; }

.opt input:disabled + .opt-body { opacity: 0.45; cursor: not-allowed; }

.opt-title { font-weight: 500; }

.opt-detail { font-size: 13px; color: var(--muted); }

.actions { margin-top: 36px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

button.primary {
  height: 50px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: 500 15px var(--sans);
  cursor: pointer;
}

/* Skin result */

.skin-result .lede { margin-bottom: 20px; }

.groups.plain dt { color: var(--ink); }

.skin-result h2 { font-size: 30px; margin-top: 36px; }

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

.loves li { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }

.love-name { font-weight: 500; font-size: 15px; }

.next-step { margin-top: 32px; }

.next-step .summary { margin-bottom: 14px; }

.next-step .search input { background: var(--bg); }

.skin-actions { display: flex; align-items: center; gap: 20px; margin-top: 20px; font-size: 14px; }

.skin-actions form { margin: 0; }

.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Search filters */

.cats {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 4px -22px 0;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}

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

.cats a {
  flex-shrink: 0;
  padding: 10px 10px 12px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.cats a.on { color: var(--ink); font-weight: 500; border-bottom-color: var(--ink); }

@media (max-width: 480px) {
  .cats { margin: 4px -16px 0; padding: 0 16px; }
}

.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.pill {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
}

.pill:hover { border-color: var(--faint); }

.pill.on { border-color: var(--good); background: #edf4ef; color: var(--good); font-weight: 500; }

.pill.on::before { content: '✓ '; }

.more { margin-top: 10px; }

.more summary { display: inline-block; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-soft); list-style: none; padding: 4px 0; }

.more summary::-webkit-details-marker { display: none; }

.more summary::after { content: ' ▾'; color: var(--muted); }

.more[open] summary::after { content: ' ▴'; }

.more form { margin-top: 8px; padding: 18px 20px; border-radius: 18px; background: var(--well); }

.more fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }

.more legend { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.more .opt-body { background: var(--bg); }

.more .opt input:checked + .opt-body { border-color: var(--good); background: #edf4ef; color: var(--good); }

.more-actions { display: flex; align-items: center; gap: 18px; font-size: 14px; }

.more-actions a { color: var(--muted); }

.more-actions button.primary { height: 42px; padding: 0 20px; font-size: 14px; }

/* Sticky header: the bar stays put while the list scrolls. The shadow and clip-path stretch its
   white across the full width, and a hairline fades in once the page has scrolled. */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  box-shadow: 0 0 0 100vmax var(--bg);
  clip-path: inset(0 -100vmax -1px);
  border-bottom: 1px solid transparent;
}

@supports (animation-timeline: scroll()) {
  .top {
    animation: header-line linear both;
    animation-timeline: scroll();
    animation-range: 0 48px;
  }

  @keyframes header-line {
    to { border-bottom-color: var(--line); box-shadow: 0 0 0 100vmax var(--bg), 0 1px 0 100vmax var(--line); }
  }
}

/* Category pills under a search box */

.browse-label { margin: 18px 0 0; }

.cat-pills { margin-top: 10px; }

.next-step .pill { background: var(--bg); }

/* Show more: a quiet full-width button under the list. Rows clear the sticky header when a
   "Show more" link jumps to them. */

.results li { scroll-margin-top: 150px; }

.show-more {
  display: block;
  margin: 8px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.show-more:hover { border-color: var(--faint); }
