/* ============================================================
   ColrShade — styles
   The whole site is themed through CSS custom properties that
   app.js sets in real time. :root holds the default theme
   (Sage Quartz) so the first paint is already correct.
   ============================================================ */

:root {
  /* default theme: Sage Quartz (hardcoded for first paint) */
  --bg: #DFDEDC;
  --bg-soft: #D2D1C8;
  --surface: #95A19D;
  --surface-2: #9795A2;
  --ink: #141412;
  --muted: #56554E;
  --primary: #141412;
  --on-primary: #EFEDE6;
  --accent: #7C8F7F;
  --pop: #9C8F97;

  /* derived (fallback first, then color-mix) */
  --line: rgba(120, 120, 110, .35);
  --line: color-mix(in srgb, var(--ink) 16%, transparent);
  --line-strong: rgba(120, 120, 110, .55);
  --line-strong: color-mix(in srgb, var(--ink) 30%, transparent);
  --veil: rgba(20, 20, 18, .18);
  --veil: color-mix(in srgb, var(--ink) 18%, transparent);

  /* shape language (overridden by [data-shape]) */
  --r: 22px;
  --r-s: 14px;

  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  transition: background-color .45s ease, color .45s ease;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Space Grotesk", "Inter", system-ui, sans-serif; }
img, svg { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
::selection { background: var(--primary); color: var(--on-primary); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
/* studio goes fluid — near edge-to-edge */
section.studio { max-width: none; padding-left: clamp(12px, 2vw, 24px); padding-right: clamp(12px, 2vw, 24px); }

/* pages (hash router) */
main > section[data-page] { animation: pageIn .32s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background-color .45s ease, border-color .45s ease;
}
.brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700; font-size: 19px; letter-spacing: -.02em;
  text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
}
.brand b { color: var(--primary); transition: color .45s ease; }
.brand-mark { width: 20px; height: 20px; display: block; }
.brand-mark circle { transition: fill .45s ease, stroke .45s ease; }
.topnav { display: flex; gap: 22px; margin-right: auto; }
.topnav a {
  text-decoration: none; font-size: 14px; font-weight: 500;
  color: var(--muted); transition: color .2s ease;
}
.topnav a:hover { color: var(--ink); }
.topnav a.active { color: var(--ink); font-weight: 600; }

.top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.theme-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 10px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-weight: 600; font-size: 14px;
  transition: background-color .45s ease, color .45s ease, transform .15s ease, border-color .45s ease;
}
.theme-btn:hover { transform: translateY(-1px); }
.theme-btn:active { transform: scale(.97); }
.tb-chips { display: inline-flex; }
.tb-chips i {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--bg);
  margin-left: -6px;
  transition: background-color .45s ease;
}
.tb-chips i:first-child { margin-left: 0; }
.tb-caret { font-size: 11px; color: var(--muted); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line-strong);
  transition: background-color .2s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--bg-soft); transform: translateY(-1px); }

/* ---------- theme panel ---------- */
.theme-panel {
  position: fixed; z-index: 60;
  top: 66px; right: clamp(12px, 3vw, 40px);
  width: min(560px, calc(100vw - 24px));
  max-height: min(480px, calc(100vh - 100px));
  overflow: auto;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: 0 24px 60px var(--veil);
  animation: panelIn .22s ease both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.tp-title {
  margin: 2px 4px 12px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
.tp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tp-head .tp-title { margin: 0; }
.seg.seg-mini button { padding: 5px 12px; font-size: 12.5px; }
.tp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tp-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  text-align: left;
  transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}
.tp-card:hover { background: var(--bg-soft); transform: translateY(-1px); }
.tp-card.current { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.tp-swatches { display: flex; }
.tp-swatches i {
  width: 14px; height: 26px; border-radius: 4px;
  margin-right: -5px;
  border: 1px solid var(--veil);
}
.tp-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.tp-vibe { font-size: 12px; color: var(--muted); }

/* ---------- hero ---------- */
.hero { position: relative; padding: clamp(48px, 7vw, 88px) clamp(16px, 4vw, 40px) clamp(36px, 5vw, 60px); }
.kicker {
  font-size: 12px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 18px;
}
.hero h1 {
  margin: 0 0 18px;
  max-width: 640px;
  font-size: clamp(36px, 5.2vw, 58px);
  line-height: 1.04; letter-spacing: -.03em; font-weight: 700;
}
.hero h1 em {
  font-style: normal;
  color: var(--primary);
  transition: color .45s ease;
}
.lede { max-width: 560px; color: var(--muted); font-size: 17px; margin: 0 0 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600; font-size: 15px; text-decoration: none;
  transition: transform .15s ease, background-color .3s ease, color .3s ease, border-color .3s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--bg-soft); }

.hero-strip {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: clamp(36px, 5vw, 56px);
}
.hs-chip {
  --i: 0;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 108px; flex: 1;
  padding: 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  transition: border-color .3s ease;
}
.hs-chip:hover { border-color: var(--line-strong); }
.hs-chip .sw { height: 44px; border-radius: var(--r-sw); }
.hs-chip code { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.hs-chip .role { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.hero-strip.breathe .hs-chip { animation: pop .45s both; animation-delay: calc(var(--i) * 55ms); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.96); } }

/* hero ornaments — a little kit of real app components, themed live */
.hero-kit {
  position: absolute;
  right: clamp(8px, 6vw, 90px);
  top: 42%;
  width: 240px; height: 350px;
  transform: translateY(-50%);
  pointer-events: none;
}
.hk { position: absolute; display: flex; align-items: center; animation: drift 9s ease-in-out infinite; }

.hk-search {
  right: 16px; top: 4px;
  width: 196px; height: 42px;
  padding: 0 14px; gap: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  color: var(--muted); font-size: 12.5px; font-weight: 500;
  transition: background-color .45s ease, border-color .45s ease, color .45s ease;
}
.hk-search svg { width: 15px; height: 15px; flex: none; }

.hk-toggle {
  right: 158px; top: 86px;
  width: 48px; height: 27px;
  background: var(--primary);
  border-radius: 999px;
  animation-delay: -2s;
  transition: background-color .45s ease;
}
.hk-toggle i {
  position: absolute; right: 4px; top: 4px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--on-primary);
  transition: background-color .45s ease;
}

.hk-btn {
  right: 24px; top: 94px;
  padding: 10px 20px;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--r-s);
  font-size: 12.5px; font-weight: 600;
  box-shadow: 0 12px 26px var(--veil);
  animation-delay: -3.6s;
  transition: background-color .45s ease, color .45s ease, border-radius .35s ease;
}

.hk-check { right: 96px; top: 160px; gap: 10px; animation-delay: -5s; }
.hk-check svg {
  width: 22px; height: 22px; flex: none;
  padding: 4px; box-sizing: border-box;
  background: var(--primary); color: var(--on-primary);
  border-radius: calc(var(--r-s) * .55);
  transition: background-color .45s ease, color .45s ease;
}
.hk-check .bar { width: 96px; height: 9px; border-radius: 999px; background: var(--veil); }

.hk-slider {
  right: 36px; top: 210px;
  width: 172px; height: 6px;
  background: var(--veil); border-radius: 999px;
  animation-delay: -6.4s;
}
.hk-slider .fill {
  position: absolute; left: 0; top: 0; height: 100%; width: 58%;
  background: var(--accent); border-radius: 999px;
  transition: background-color .45s ease;
}
.hk-slider b {
  position: absolute; left: 58%; top: 50%;
  width: 16px; height: 16px; margin: -8px;
  border-radius: 50%;
  background: var(--ink); border: 3px solid var(--bg);
  box-sizing: border-box;
  transition: background-color .45s ease, border-color .45s ease;
}

.hk-stat {
  right: 24px; top: 248px;
  padding: 10px 16px;
  background: var(--surface-2); color: var(--ink);
  border-radius: var(--r-s);
  animation-delay: -7.6s;
  transition: background-color .45s ease, color .45s ease;
}
.hk-stat b { font-family: "Space Grotesk", sans-serif; font-size: 17px; font-weight: 700; }
.hk-stat small {
  margin-left: 8px;
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
}

.hk-avatars { right: 64px; top: 308px; gap: 0; animation-delay: -4.2s; }
.hk-avatars i {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--bg);
  font-size: 12px; font-weight: 700;
  transition: background-color .45s ease, color .45s ease, border-color .45s ease;
}
.hk-avatars .a1 { background: var(--pop); color: var(--bg); }
.hk-avatars .a2 { background: var(--ink); color: var(--bg); margin-left: -10px; }
.hk-avatars .nd {
  margin-left: -8px; margin-top: -22px;
  width: 17px; height: 17px;
  background: var(--primary); color: var(--on-primary);
  font-size: 9px;
}
@keyframes drift { 50% { transform: translateY(-12px); } }
@media (max-width: 1080px) { .hero-kit { display: none; } }

/* ---------- section scaffolding ---------- */
.section-head { margin-bottom: 26px; }
.section-head h2 {
  margin: 0 0 8px;
  font-size: clamp(26px, 3.6vw, 40px);
  letter-spacing: -.02em;
}
.section-head p { margin: 0; color: var(--muted); max-width: 640px; }
section { padding-bottom: clamp(56px, 8vw, 96px); }

/* ---------- studio controls ---------- */
.controls {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 26px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: background-color .45s ease;
}
.ctrl-group { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-width: 0; }
.ctrl-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted);
}
.seg {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.seg button {
  flex: 1 1 auto;
  padding: 7px 16px;
  border: none; border-radius: 999px;
  background: transparent;
  font-size: 13.5px; font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color .25s ease, color .25s ease;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--primary); color: var(--on-primary); }

.remix-row { display: flex; gap: 8px; align-items: center; }
.remix-row select {
  font: inherit; font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--ink);
}
.mini-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 13px; font-weight: 500;
  transition: background-color .2s ease;
}
.mini-btn:hover { background: var(--bg-soft); }

/* ---------- stage + layouts ---------- */
.stage-outer { position: relative; overflow: hidden; transition: height .3s ease; }
/* split view: natural desktop on the left, two layout previews on the right */
.stage-split { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
#stageOuter { flex: 1 1 560px; min-width: 0; }
.mobile-col { flex: 0 0 660px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.phone { width: 100%; display: flex; flex-direction: column; gap: 6px; }
/* two portrait phones side by side, each with its own layout order */
/* mobile view: the real phone-width layout, scaled to fit and centered */
.mobile-view { min-width: 0; }
#mobileOuter { margin: 0 auto; }
.stage.stage-mobile { max-width: none; }
.frame-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); padding-left: 2px;
}
.stage.stage-mobile { grid-template-columns: 1fr 1fr; }
.stage.stage-mobile[data-layout="mobile-bento"]   { grid-template-areas: "stat  bars"  "donut dots"  "line  pills"; }
.stage.stage-mobile[data-layout="mobile-rail"]    { grid-template-areas: "bars  bars"  "stat  pills" "donut line"  "dots  dots"; }
.stage.stage-mobile[data-layout="mobile-columns"] { grid-template-areas: "donut bars"  "stat  dots"  "pills line"; }
.stage.stage-mobile[data-layout="mobile-focus"]   { grid-template-areas: "bars  bars"  "stat  donut" "line  dots"  "pills pills"; }
.stage {
  display: grid; gap: 14px;
  grid-template-columns: repeat(3, 1fr);
  padding: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transform-origin: top left;
  transition: background-color .45s ease;
}
/* rows are content-sized (auto) so widgets never stretch into huge empty tracks;
   tall widgets fill their span via their own flexible internals */
.stage[data-layout="bento"] {
  grid-template-areas:
    "stat  stat  bars"
    "donut dots  bars"
    "donut dots  bars"
    "line  pills pills";
}
.stage[data-layout="columns"] {
  grid-template-areas:
    "bars  stat  donut"
    "bars  dots  donut"
    "line  dots  pills";
}
/* rail: genuine narrow sidebar + wide main area, desktop only */
@media (min-width: 981px) {
  .stage[data-layout="rail"] {
    grid-template-columns: 280px 1fr 1fr;
    grid-template-areas:
      "stat  bars  bars"
      "pills bars  bars"
      "donut line  dots";
  }
}
.stage[data-layout="focus"] {
  grid-template-areas:
    "bars  bars  bars"
    "bars  bars  bars"
    "donut stat  dots"
    "donut line  pills";
}
.stage[data-layout="focus"] .w-bars { min-height: 300px; }

.widget {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px;
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
  transition: background-color .45s ease, color .45s ease, border-radius .35s ease;
}
.widget:nth-child(even) { background: var(--surface-2); }
.w-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.w-head h3 {
  margin: 0; font-size: 13px; font-weight: 600;
  text-transform: capitalize; letter-spacing: -.01em;
}
.chev { font-size: 12px; opacity: .55; }
.w-val { font-family: "Space Grotesk"; font-size: 15px; }
.w-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted);
}
.w-foot b { color: var(--ink); font-size: 14px; font-family: "Space Grotesk"; }
.chip {
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
}
.big {
  font-family: "Space Grotesk"; font-weight: 700;
  font-size: clamp(34px, 4.6vw, 52px); letter-spacing: -.02em; line-height: 1;
}
.track {
  height: 10px; border-radius: 999px;
  background: var(--veil); overflow: hidden;
}
.track i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--primary);
  transition: width .5s cubic-bezier(.2, .8, .2, 1), background-color .45s ease;
}
.w-note { margin: 0; font-size: 12.5px; color: var(--muted); }
/* when a widget's track is taller than its content, distribute instead of gaping */
.w-stat .track { margin-top: auto; }
.w-stat .w-note { margin-top: auto; }

/* bars widget */
.bars {
  flex: 1; display: flex; align-items: flex-end; gap: 10px;
  min-height: 110px; padding-top: 6px;
}
.bar {
  flex: 1; height: var(--h);
  background: var(--ink);
  border-radius: 6px;
  transform-origin: bottom;
  transition: height .5s cubic-bezier(.2, .8, .2, 1), background-color .45s ease, border-radius .35s ease;
  transition-delay: calc(var(--i) * 45ms);
}
.bar.striped {
  background: repeating-linear-gradient(
    -45deg,
    var(--ink) 0 5px,
    transparent 5px 11px
  );
}
.breathe .bar { animation: barGrow .55s both; animation-delay: calc(var(--i) * 45ms); }
@keyframes barGrow { from { transform: scaleY(.12); } }
.w-days {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted);
}

/* dots widget */
.dots-stage { flex: 1; position: relative; min-height: 130px; }
.dots-ring { position: absolute; inset: 0; }
.dots-ring span {
  position: absolute; left: 50%; top: 50%;
  width: 24px; height: 24px; margin: -12px;
  border-radius: 50%;
  background: var(--veil);
}
.dots-core {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.dots-row { display: flex; gap: 4px; }
.dots-row span {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--ink);
  transition: background-color .45s ease;
}
.breathe .dots-core { animation: pop .5s both; animation-delay: .15s; }

/* donut widget */
.donut-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px 0; }
.donut {
  width: min(150px, 100%); aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(var(--primary) 0 70%, var(--veil) 70% 100%);
  display: flex; align-items: center; justify-content: center;
  transition: background .45s ease;
  animation: donutIn .6s both;
}
.breathe .donut { animation: donutIn .6s both; }
@keyframes donutIn { from { transform: scale(.86) rotate(-14deg); opacity: .4; } }
.donut b {
  width: 58%; aspect-ratio: 1; border-radius: 50%;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-family: "Space Grotesk"; font-size: 21px;
  transition: background-color .45s ease;
}
.widget:nth-child(even) .donut b { background: var(--surface-2); }

/* line widget */
.line-svg { flex: 1; width: 100%; min-height: 90px; max-height: 220px; }
.line-svg .area { fill: var(--primary); fill-opacity: .18; transition: fill .45s ease; }
.line-svg .stroke { fill: none; stroke: var(--primary); stroke-width: 2.5; transition: stroke .45s ease; }
.line-svg .end-dot { fill: var(--accent); transition: fill .45s ease; }

/* pills widget */
.pill-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
  flex: 1; justify-content: space-evenly;
}
.pill-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--veil);
  font-size: 13px;
}
.pill-list li:last-child { border-bottom: none; }
.pill-list .nm { flex: 1; font-weight: 500; }
.pill-list b { font-family: "Space Grotesk"; font-size: 13.5px; }
.tri { font-size: 10px; }
.tri.up { color: var(--primary); }
.tri.dn { color: var(--pop); }

/* shape languages */
html[data-shape="soft"] { --r: 22px; --r-s: 14px; --r-sw: 12px; }
html[data-shape="sharp"] { --r: 2px;  --r-s: 3px;  --r-sw: 2px; }
html[data-shape="pill"]  { --r: 34px; --r-s: 999px; --r-sw: 16px; }
html[data-shape="pill"] .bar { border-radius: 999px; }
html[data-shape="sharp"] .bar { border-radius: 0; }

/* ---------- library ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filters button {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 13.5px; font-weight: 500;
  color: var(--muted);
  transition: all .2s ease;
}
.filters button:hover { color: var(--ink); background: var(--bg-soft); }
.filters button.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

.palette-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr));
}
.pcard {
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .18s ease, box-shadow .25s ease, border-color .25s ease, opacity .25s ease;
}
.pcard:hover { transform: translateY(-3px); box-shadow: 0 16px 40px var(--veil); }
.pcard.current { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.pcard.hide { display: none; }
.pcard-head { display: flex; align-items: center; gap: 10px; }
.pcard-head h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; flex: 1; }
.vibe-tag {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.aa-badge {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 10.5px; color: var(--muted);
  border: 1px dashed var(--line-strong);
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}
.swatch-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatch {
  --i: 0;
  flex: 1; min-width: 0;
  border: none; padding: 0;
  border-radius: var(--r-sw);
  overflow: hidden;
  transition: transform .15s ease;
}
.swatch:hover { transform: translateY(-3px); }
.sw { display: block; }
.swatch .sw { height: 58px; }
.swatch code {
  display: block;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 9.5px; letter-spacing: .03em;
  padding: 5px 2px; text-align: center;
  background: var(--bg-soft); color: var(--muted);
  border-top: 1px solid var(--veil);
}

/* copy icon inline, right next to each hex code */
.copy-inline {
  width: 13px; height: 13px;
  display: inline-block; vertical-align: -2px;
  margin-left: 5px;
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}
.swatch:hover .copy-inline, .hs-chip:hover .copy-inline,
.swatch:focus-visible .copy-inline, .hs-chip:focus-visible .copy-inline { opacity: 1; }
.pcard p.blurb { margin: 0; font-size: 13.5px; color: var(--muted); }
.pcard-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.pcard-meta b { color: var(--ink); font-weight: 600; }
.pcard-actions { display: flex; gap: 8px; margin-top: 2px; }
.pcard-actions .btn { padding: 9px 16px; font-size: 13.5px; }

/* ---------- harmony lab ---------- */
.lab-panel {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 18px;
  padding: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: background-color .45s ease;
}
.lab-left { display: flex; flex-direction: column; gap: 16px; }
.lab-base > span:first-child {
  display: block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  margin-bottom: 8px;
}
.lab-base-row { display: flex; align-items: center; gap: 12px; }
.lab-base-row input[type="color"] {
  width: 58px; height: 42px;
  padding: 0; border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  background: none; cursor: pointer;
}
.lab-base-row code {
  font-family: ui-monospace, Consolas, monospace; font-size: 14px; color: var(--muted);
}
.lab-modes { display: flex; flex-wrap: wrap; gap: 8px; }
.lab-modes button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 13px; font-weight: 500; color: var(--muted);
  transition: all .2s ease;
}
.lab-modes button:hover { color: var(--ink); background: var(--bg); }
.lab-modes button.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.lab-note { margin: 0; font-size: 13.5px; color: var(--muted); min-height: 2.6em; }

.lab-out {
  display: flex; gap: 8px;
  min-height: 130px;
}
.lab-out .swatch .sw { height: 84px; }
.lab-out .swatch code { font-size: 10.5px; padding: 7px 2px; }
.lab-actions { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- theory ---------- */
.theory-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.tcard {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-soft);
  transition: background-color .45s ease;
}
.tcard.wide { grid-column: 1 / -1; }
.tviz { display: flex; gap: 8px; margin-bottom: 14px; }
.tviz i { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--veil); }
.tviz.bar i { height: 26px; border-radius: 6px; }
.tviz.bar i:first-child { border: 1px solid var(--line-strong); }
.tcard h3 { margin: 0 0 6px; font-size: 17px; }
.tcard p { margin: 0; font-size: 13.5px; color: var(--muted); }

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line);
  padding: 34px 0 44px;
  background: var(--bg-soft);
  transition: background-color .45s ease;
}
.foot-inner p { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.foot-inner b { color: var(--ink); }
.foot-links a { color: var(--ink); text-decoration-color: var(--line-strong); }
kbd {
  font-family: ui-monospace, Consolas, monospace; font-size: 11px;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg);
}

/* ---------- toast ---------- */
/* like button → GitHub */
.like-btn {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 52px; height: 52px; border-radius: 999px;
  background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  box-shadow: 0 14px 34px var(--veil);
  transition: transform .15s ease;
}
.like-btn:hover { transform: scale(1.08); }
.like-btn:active { transform: scale(.96); }
.like-btn.liked { background: #e0245e; color: #fff; }
.like-btn.liked svg { animation: heartPop .35s ease; }
@keyframes heartPop { 40% { transform: scale(1.45); } }
.like-count {
  position: absolute; top: -7px; right: -5px;
  background: #e0245e; color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.like-float {
  position: absolute; bottom: 22px; left: 18px;
  color: #e0245e; font-size: 15px;
  pointer-events: none;
  animation: floatUp 1.1s ease-out both;
}
@keyframes floatUp {
  from { opacity: 1; transform: translate(0, 0) scale(1); }
  to { opacity: 0; transform: translate(var(--dx, 0), -72px) scale(1.3); }
}
.like-pop {
  position: fixed; right: 20px; bottom: 86px; z-index: 91;
  width: 250px; padding: 14px 16px 12px;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 18px 50px var(--veil);
  animation: panelIn .25s ease both;
}
.like-pop::after {
  content: ""; position: absolute; bottom: -9px; right: 28px;
  width: 16px; height: 16px; background: var(--bg);
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  transform: rotate(45deg);
}
.like-close {
  position: absolute; top: 6px; right: 8px;
  border: none; background: none; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 4px;
}
.like-title { margin: 0 0 4px; font-weight: 700; font-family: "Space Grotesk", sans-serif; }
.like-text { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.like-go {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px; border: none;
  background: var(--primary); color: var(--on-primary);
  font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: transform .15s ease;
}
.like-go:hover { transform: translateY(-1px); }
.like-star {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink);
  font-weight: 600; font-size: 13.5px;
  transition: background-color .2s ease, transform .15s ease;
}
.like-star:hover { background: var(--bg-soft); transform: translateY(-1px); }
.like-star.starred { background: #f5b301; border-color: #f5b301; color: #3a2c00; }
.float-stack {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.star-btn.starred { background: #f5b301; color: #3a2c00; }
.star-btn.starred svg { animation: heartPop .35s ease; }

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 100;
  transform: translate(-50%, 16px);
  padding: 11px 20px;
  max-width: min(92vw, 560px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--primary); color: var(--on-primary);
  border-radius: 999px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 12px 34px var(--veil);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- view transitions (theme crossfade) ---------- */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .42s; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  /* tablet: stage reflows to two columns, whichever layout is active */
  .stage { grid-template-columns: repeat(2, 1fr); }
  .stage[data-layout] {
    grid-template-areas:
      "bars  bars"
      "stat  donut"
      "dots  line"
      "pills pills";
  }
  .hero-strip .hs-chip { min-width: 96px; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topnav {
    order: 3; width: 100%;
    overflow-x: auto; gap: 18px; padding-bottom: 2px;
    scrollbar-width: none;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .theme-panel { top: 108px; }
  .lab-panel { grid-template-columns: 1fr; }
  .tp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .stage { grid-template-columns: 1fr; }
  .stage[data-layout] {
    grid-template-areas: "bars" "stat" "donut" "dots" "line" "pills";
    grid-template-rows: none;
    grid-auto-rows: auto;
  }
  .ctrl-group { width: 100%; }
  .seg { width: 100%; }
  .remix-row { flex-wrap: nowrap; }
  .remix-row select { flex: 1; min-width: 0; }
  .tb-label { display: none; }
  .theme-btn { padding: 8px 12px 8px 10px; }
}
@media (max-width: 560px) {
  .hero-strip .hs-chip { min-width: 84px; }
  .controls { gap: 14px 16px; padding: 14px; }
  .stage { padding: 12px; gap: 10px; }
  .widget { padding: 14px; }
  .lab-out { flex-wrap: wrap; }
  .lab-out .swatch { flex: 1 1 30%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}
