/* snaganything.com: the front door that sends shoppers to the Marketplace and developers to Watcher (DESIGN.md). */

:root {
  color-scheme: only light;
  --color-bg: #ffffff;
  --color-surface: #f5f5f4;
  --color-shop: #fdf0eb;
  --color-build: #eef1f4;
  --color-text: #111111;
  --color-text-muted: #57534e;
  --color-border: #e7e5e4;
  --color-primary: #d92d0a;
  --color-on-primary: #ffffff;

  --font: 'Public Sans', ui-sans-serif, sans-serif;
  --mono: 'Chivo Mono', ui-monospace, monospace;
  --text-xs: 13px;
  --text-sm: 15px;
  --text-md: 17px;
  --text-lg: 20px;
  --text-xl: 28px;
  --text-2xl: 40px;
  --text-hero: clamp(40px, 7vw, 88px);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 120px;
  --gutter: 16px;
  --max: 1200px;

  --r-door: 28px;
  --r-card: 18px;
  --r-code: 12px;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 0.06), 0 12px 32px rgb(0 0 0 / 0.08);

  --m-fast: 150ms;
  --m-base: 240ms;
  --m-slow: 420ms;
  --m-out: cubic-bezier(0.2, 0, 0, 1);
  --m-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --m-spring: linear(0, 0.18 8%, 0.6 20%, 0.92 32%, 1.05 42%, 1.06 50%, 1.02 62%, 0.995 78%, 1);
  }
}
@media (min-width: 900px) {
  :root { --gutter: 32px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font: 400 var(--text-md) / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Nav */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  max-width: var(--max); margin: 0 auto; padding: var(--s4) var(--gutter); min-height: 72px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: var(--text-lg); letter-spacing: -0.02em; white-space: nowrap; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.nav-links { display: flex; align-items: center; gap: var(--s2); }
.nav-links a {
  text-decoration: none; font-weight: 600; font-size: var(--text-sm);
  padding: 10px 10px; border-radius: 999px; transition: background var(--m-fast) var(--m-out);
}
.nav-links a:hover { background: var(--color-surface); }
.nav-links .hide-sm { display: none; }
@media (min-width: 700px) { .nav-links a { padding: 10px 14px; } }
@media (max-width: 479px) { .brand span.word { display: none; } }
@media (min-width: 700px) { .nav-links .hide-sm { display: inline-flex; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; background: var(--color-text); color: #fff; text-decoration: none;
  font-weight: 700; font-size: var(--text-sm); white-space: nowrap;
  transition: transform var(--m-fast) var(--m-out);
}
.btn svg { width: 18px; height: 18px; transition: transform var(--m-base) var(--m-spring); }
.btn:hover svg { transform: translateX(3px); }
.btn:active { transform: scale(0.97); }
.link { font-weight: 600; font-size: var(--text-sm); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.link:hover { color: var(--color-primary); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4) var(--s5); }

/* Side labels */
.side-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--text-lg); letter-spacing: -0.01em; }
.side-icon {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--color-bg); box-shadow: inset 0 0 0 1px var(--color-border);
}
.side-icon svg { width: 20px; height: 20px; }
.shop { background: var(--color-shop); }
.build { background: var(--color-build); }

/* Headline */
.hero-title { font-size: var(--text-hero); line-height: 0.98; letter-spacing: -0.035em; font-weight: 800; margin: 0; }
.hero-title em { font-style: normal; color: var(--color-primary); }

/* Demo: Marketplace price card */
.price-demo {
  position: relative; width: 100%; max-width: 360px; background: #fff; border-radius: var(--r-card);
  box-shadow: var(--shadow-card); padding: var(--s4) var(--s4) var(--s5);
}
.price-demo .shoe { aspect-ratio: 16 / 9; object-fit: contain; width: 100%; }
.price-demo .row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.price-demo .name { font-weight: 700; font-size: var(--text-sm); }
.price-demo .size { color: var(--color-text-muted); font-size: var(--text-xs); }
.price-demo .posted { font-family: var(--mono); font-size: var(--text-sm); color: var(--color-text-muted); position: relative; }
.price-demo .posted::after {
  content: ''; position: absolute; left: -2px; right: -2px; top: 52%; height: 1.5px; background: currentColor;
  transform: scaleX(var(--strike, 1)); transform-origin: left; transition: transform var(--m-slow) var(--m-out);
}
.price-demo .answer {
  margin-top: var(--s3); display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 12px 14px; border-radius: 14px; background: var(--color-shop);
  transition: opacity var(--m-base) var(--m-out), transform var(--m-slow) var(--m-spring);
}
.price-demo .answer .who { font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.price-demo .answer .who span { display: block; color: var(--color-text-muted); font-weight: 400; }
.price-demo .big { font-family: var(--mono); font-size: var(--text-xl); font-weight: 500; color: var(--color-primary); font-variant-numeric: tabular-nums; }
.price-demo .tag {
  position: absolute; top: 12px; left: 12px; font-size: 12px; font-weight: 600; color: var(--color-text-muted);
  background: var(--color-surface); padding: 3px 9px; border-radius: 999px;
}
.price-demo[data-step='0'] { --strike: 0; }
.price-demo[data-step='0'] .answer { opacity: 0; transform: translateY(10px) scale(0.97); }

/* Demo: Watcher call and webhook */
.code-demo { width: 100%; max-width: 420px; display: grid; gap: var(--s3); }
.code {
  margin: 0; background: #fff; border-radius: var(--r-code); box-shadow: var(--shadow-card);
  font: 400 12px / 1.6 var(--mono); padding: 14px 16px; overflow-x: auto; white-space: pre; min-height: 21.4em;
}
@media (min-width: 900px) { .code { font-size: 13px; } }
.code .k { color: #8a2a0a; }
.code .m { color: var(--color-primary); font-weight: 500; }
.code .n { color: #1d4ed8; }
.code .c { color: #6b6b66; }
.code .caret { display: inline-block; width: 7px; height: 1.1em; background: var(--color-text); vertical-align: -2px; margin-left: 1px; }
.hook {
  display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-card);
  padding: 12px 14px; font-size: var(--text-xs);
  transition: opacity var(--m-base) var(--m-out), transform var(--m-slow) var(--m-spring);
}
.hook b { font-weight: 700; }
.hook .mono { color: var(--color-text-muted); }
.hook .dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--color-build); flex: none; }
.hook .dot svg { width: 18px; height: 18px; }
.code-demo[data-step='0'] .hook { opacity: 0; transform: translateY(10px) scale(0.97); }

/* Footer */
.foot {
  max-width: var(--max); margin: 0 auto; padding: var(--s6) var(--gutter) var(--s7);
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: center; justify-content: space-between;
  font-size: var(--text-xs); color: var(--color-text-muted); border-top: 1px solid var(--color-border);
}
.foot nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--color-text); text-decoration: underline; }

/* Settle-in on scroll (base.js adds .in) */
.motion [data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity var(--m-slow) var(--m-out), transform var(--m-slow) var(--m-out); transition-delay: calc(var(--i, 0) * 40ms); }
.motion [data-reveal].in { opacity: 1; transform: none; }

/* The question, the switch and the side panels. The rule: a side's name is the headline, one line under it, then
   the button (DESIGN.md §5b). */
.ask { min-height: calc(100svh - 72px - 96px); padding-top: var(--s6); padding-bottom: var(--s8); }
#q { display: grid; gap: var(--s6); align-content: center; min-height: inherit; }

/* The question's two answers */
.answers { display: grid; gap: 16px; }
@media (min-width: 900px) { .answers { grid-template-columns: 1fr 1fr; } }
.pick {
  border: 0; cursor: pointer; text-align: left; font: inherit; color: inherit;
  border-radius: var(--r-door); padding: var(--s5); display: grid; grid-template-columns: 1fr auto; gap: var(--s5);
  transition: transform var(--m-base) var(--m-spring);
}
@media (min-width: 900px) { .pick { padding: var(--s7); min-height: 260px; grid-template-rows: auto 1fr; } }
.pick:hover { transform: translateY(-4px); }
.pick:active { transform: scale(0.98); }
.pick .big-ic { width: 64px; height: 64px; border-radius: 20px; background: #fff; display: grid; place-items: center; }
.pick .big-ic svg { width: 30px; height: 30px; }
.pick .go { width: 48px; height: 48px; border-radius: 999px; background: var(--color-text); color: #fff; display: grid; place-items: center; transition: transform var(--m-base) var(--m-spring); }
.pick .go svg { width: 20px; height: 20px; }
.pick:hover .go { transform: translateX(4px); }
.pick .words { grid-column: 1 / -1; align-self: end; display: grid; gap: 4px; }
.pick b { font-size: clamp(28px, 3.5vw, 44px); line-height: 1; letter-spacing: -0.03em; font-weight: 800; }
.pick .sub { color: var(--color-text-muted); font-size: var(--text-md); }

/* The switch over the picked side */
.topbar { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.back { width: 48px; height: 48px; flex: none; border-radius: 999px; border: 0; background: var(--color-surface); display: grid; place-items: center; cursor: pointer; color: inherit; }
.back svg { width: 20px; height: 20px; }
.switch {
  position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 999px;
  background: var(--color-surface); width: min(100%, 360px);
}
.switch button {
  position: relative; z-index: 1; min-height: 44px; border: 0; background: none; border-radius: 999px; cursor: pointer;
  font: 700 var(--text-sm) var(--font); color: var(--color-text-muted); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: color var(--m-base) var(--m-out);
}
.switch button svg { width: 18px; height: 18px; }
.switch button[aria-selected='true'] { color: var(--color-text); }
.thumb {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 999px; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 4px 12px rgb(0 0 0 / .06); transition: transform var(--m-slow) var(--m-spring);
}
.switch[data-side='building'] .thumb { transform: translateX(100%); }

/* Panel parts */
.open { border-radius: var(--r-door); }
.side-h { display: flex; align-items: center; gap: 0.3em; margin: 0; font-size: clamp(44px, 6vw, 80px); line-height: 1; letter-spacing: -0.04em; font-weight: 800; }
.side-h .side-icon { width: 1em; height: 1em; border-radius: 0.28em; flex: none; }
.side-h .side-icon svg { width: 0.5em; height: 0.5em; }
.line { margin: 0; color: var(--color-text-muted); font-size: var(--text-lg); line-height: 1.45; max-width: 30ch; }
.open .demo-slot { display: grid; place-items: center; }
.peek-btn { display: none; }

/* The picked answer grows into its panel */
.pick.shop, .open.shop.is-active { view-transition-name: door-shop; }
.pick.build, .open.build.is-active { view-transition-name: door-build; }
::view-transition-group(*) { animation-duration: var(--m-slow); animation-timing-function: var(--m-out); }
::view-transition-old(root) { animation: vt-out var(--m-fast) var(--m-out) both; }
::view-transition-new(root) { animation: vt-in var(--m-base) var(--m-out) 60ms both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

.sellers { text-align: center; font-size: var(--text-sm); color: var(--color-text-muted); padding-bottom: var(--s6); }

/* After a pick, the other side stays as a slim column (a strip on phones) you can tap to swap */
.panels { display: grid; gap: 12px; }
@media (min-width: 900px) {
  #picked[data-side='shopping'] .panels { grid-template-columns: 1fr 112px; }
  #picked[data-side='building'] .panels { grid-template-columns: 112px 1fr; }
}
.open .body { display: grid; gap: var(--s6); align-items: center; padding: var(--s5); }
@media (min-width: 900px) { .open .body { grid-template-columns: 1fr 1fr; padding: var(--s8); min-height: 520px; } }
.open .text { display: grid; gap: var(--s5); justify-items: start; }
.open .side-h { font-size: clamp(44px, 5vw, 64px); }
.open:not(.is-active) .body { display: none; }
.open:not(.is-active) .peek-btn { display: flex; }
.peek-btn {
  width: 100%; height: 100%; min-height: 72px; border: 0; background: none; cursor: pointer; color: inherit; border-radius: inherit;
  font: 800 var(--text-lg) var(--font); letter-spacing: -0.01em; align-items: center; justify-content: center; gap: 12px; padding: var(--s4);
  transition: transform var(--m-base) var(--m-spring);
}
.peek-btn:hover { transform: scale(1.02); }
.peek-btn .go { width: 36px; height: 36px; border-radius: 999px; background: var(--color-text); color: #fff; display: grid; place-items: center; }
.peek-btn .go svg { width: 16px; height: 16px; }
@media (min-width: 900px) {
  .peek-btn { flex-direction: column; padding: var(--s6) 0; }
  .peek-btn .label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: var(--text-xl); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; animation-iteration-count: 1 !important; }
}
