/* The playable sketches on product pages ("Try it"). One per product, markup in src/demos/<slug>.html,
   behaviour in /assets/js/demos.js. Each demo has a short prefix: v- vault, t- TubeFocus, s- ShopGrade,
   n- Nicked, c- CSS, k- Keeptake, sp- speaker, cp- compass, q- quotes. */
.y-try { --r: 34px; --pop: cubic-bezier(.34, 1.56, .64, 1); display: flex; flex-direction: column; gap: 14px; max-width: 880px; margin-inline: auto; padding: clamp(14px, 1.8vw, 24px); border-radius: var(--r); background: var(--tint); color: var(--tint-ink); }
.y-try.is-narrow { max-width: 460px; }
.y-mini { height: 40px; padding: 0 16px; border-radius: 999px; background: var(--ink); color: #fff; font: 600 .9rem/1 var(--body); white-space: nowrap; transition: transform .4s var(--pop), opacity .2s, background-color .2s; }
.y-mini:hover { transform: scale(1.06); }
.y-mini:active { transform: scale(.93); }
.y-mini.is-quiet { background: rgba(19, 19, 22, .08); color: var(--ink); }
.y-mini[disabled] { opacity: .35; pointer-events: none; }
.y-demo { position: relative; flex: 1; min-height: 250px; padding: 16px; border-radius: calc(var(--r) - 10px); background: #fff; color: var(--ink); overflow: hidden; }
.y-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.y-hint { margin: 0; font-size: .9rem; line-height: 1.4; }
.y-hint kbd { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; margin: 0 2px; border-radius: 7px; background: rgba(255, 255, 255, .8); box-shadow: 0 2px 0 rgba(19, 19, 22, .2); font: 700 .86em/1 var(--body); }
.y-sw { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px 0 8px; border-radius: 999px; background: rgba(255, 255, 255, .7); font-weight: 600; font-size: .9rem; cursor: pointer; user-select: none; }
.y-sw input { appearance: none; position: relative; width: 38px; height: 24px; margin: 0; border-radius: 999px; background: rgba(19, 19, 22, .2); cursor: pointer; transition: background-color .25s; }
.y-sw input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .35s var(--pop); }
.y-sw input:checked { background: var(--ink); }
.y-sw input:checked::after { transform: translateX(14px); }

/* ---------- Vault: a calculator that opens ---------- */
.d-vault { display: grid; padding: 0; min-height: 420px; }
.v-calc { display: grid; grid-template-rows: auto 1fr; gap: 12px; padding: 16px; }
.v-out { display: block; min-height: 1.3em; padding: 18px 8px 4px; text-align: right; font: 900 clamp(2.4rem, 4vw, 3.6rem)/1 var(--display); letter-spacing: -.04em; overflow: hidden; white-space: nowrap; }
.v-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.v-keys button { min-height: 54px; border-radius: 18px; background: #f1f1ee; font: 700 1.3rem/1 var(--display); text-align: center; transition: transform .3s var(--pop), background-color .15s; }
.v-keys button:hover { background: #e6e6e1; }
.v-keys button:active { transform: scale(.88); }
.v-keys .is-op { background: color-mix(in srgb, var(--accent) 16%, #fff); color: var(--tint-ink); }
.v-keys .is-eq { background: var(--accent); color: #fff; }
.v-safe { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 22px; background: var(--accent); color: #fff; clip-path: circle(0 at 62% 88%); transition: clip-path .8s cubic-bezier(.7, 0, .2, 1); }
.d-vault.is-open .v-safe { clip-path: circle(150% at 62% 88%); }
.d-vault.is-wrong .v-out { animation: dm-shake .4s; }
.v-safe-h { display: flex; align-items: center; gap: 10px; margin: 0; font: 900 1.7rem/1 var(--display); letter-spacing: -.03em; }
.v-safe ul { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; }
.v-safe li { display: grid; padding: 14px 12px; border-radius: 16px; background: rgba(255, 255, 255, .2); font-size: .86rem; }
.v-safe li b { font: 900 1.8rem/1 var(--display); }
.v-safe p { margin: 0; font-size: .95rem; }
.v-safe .y-mini { align-self: flex-start; background: #fff; color: var(--ink); }
@keyframes dm-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- TubeFocus: switch parts of a video page off ---------- */
.d-tube { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .44fr); grid-template-rows: 1fr auto; gap: 0 14px; transition: grid-template-columns .6s cubic-bezier(.7, 0, .2, 1), gap .6s; }
.t-main { display: grid; gap: 8px; align-content: start; min-width: 0; }
.t-video { display: grid; place-items: center; aspect-ratio: 16 / 7; border-radius: 14px; background: #17171a; color: #fff; }
.t-video .ic { width: 34px; height: 34px; }
.t-line { display: block; height: 9px; border-radius: 9px; background: #e7e7e3; }
.t-line.w70 { width: 70%; } .t-line.w40 { width: 40%; }
.t-tag { display: block; margin-bottom: 8px; font-size: .74rem; font-weight: 600; color: var(--muted); }
.t-block { min-width: 0; overflow: hidden; transition: opacity .4s, max-height .6s cubic-bezier(.7, 0, .2, 1), margin .6s, filter .4s; }
.t-comments { display: grid; gap: 8px; max-height: 80px; margin-top: 6px; }
.t-recs { display: grid; gap: 8px; align-content: start; }
.t-recs > div { display: grid; grid-template-columns: 46% 1fr; gap: 8px; align-items: center; }
.t-recs b { aspect-ratio: 16 / 10; border-radius: 8px; background: #ffd9d2; }
.t-shorts { grid-column: 1 / -1; max-height: 130px; margin-top: 12px; }
.t-shorts > div { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.t-shorts b { aspect-ratio: 9 / 13; border-radius: 10px; background: linear-gradient(160deg, #ffc9c0, #ff8c7a); }
.d-tube.no-recs { grid-template-columns: minmax(0, 1fr) minmax(0, 0fr); gap: 0; }
.d-tube.no-recs .t-recs, .d-tube.no-shorts .t-shorts, .d-tube.no-comments .t-comments { opacity: 0; filter: blur(6px); }
.d-tube.no-shorts .t-shorts, .d-tube.no-comments .t-comments { max-height: 0; margin-top: 0; }

/* ---------- ShopGrade: run an audit ---------- */
.d-shop { display: grid; grid-template-rows: auto 1fr auto; gap: 14px; }
.s-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 999px; background: #f1f1ee; font-size: .9rem; }
.s-bar span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-body { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.s-ring { --v: 0; display: grid; place-content: center; justify-items: center; width: clamp(104px, 9vw, 132px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(#fff 61%, transparent 62%), conic-gradient(var(--accent) calc(var(--v) * 1%), #eeeeea 0); }
.s-ring b { font: 900 2.5rem/1 var(--display); letter-spacing: -.04em; }
.s-ring small { font-size: .7rem; color: var(--muted); }
.s-checks { list-style: none; display: grid; gap: 9px; margin: 0; padding: 0; font-size: .93rem; }
.s-checks li { display: flex; align-items: center; gap: 9px; color: var(--muted); transition: color .3s; }
.s-checks .ic { padding: 3px; border-radius: 50%; background: #eeeeea; color: transparent; transition: background-color .3s, color .3s, transform .5s var(--pop); }
.s-checks li.is-done { color: var(--ink); }
.s-checks li.is-done .ic { background: var(--accent); color: #fff; transform: scale(1.2); }
.s-verdict { margin: 0; font-size: .92rem; line-height: 1.35; font-weight: 600; }

/* ---------- Nicked: six clues ---------- */
.d-nick { display: grid; gap: 12px; align-content: start; }
.n-clues { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; padding: 0; }
.n-clues li { position: relative; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 10px; border-radius: 12px; background: #f1f1ee; font-size: .82rem; line-height: 1.2; transition: background-color .4s, transform .6s var(--pop); }
.n-clues span { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; background: rgba(19, 19, 22, .1); font-weight: 700; font-size: .72rem; }
.n-clues b { font-weight: 600; opacity: 0; filter: blur(6px); transition: opacity .4s, filter .4s; }
.n-clues li.is-on { background: var(--tint); transform: rotate(-1deg); }
.n-clues li.is-on:nth-child(even) { transform: rotate(1deg); }
.n-clues li.is-on b { opacity: 1; filter: none; }
.n-guess { display: flex; flex-wrap: wrap; gap: 6px; }
.n-guess .y-mini { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.n-guess .is-no { opacity: .35; text-decoration: line-through; pointer-events: none; animation: dm-shake .4s; }
.n-guess .is-yes { background: var(--accent); color: #fff; box-shadow: none; }
.n-msg { margin: 0; font-size: .9rem; font-weight: 600; line-height: 1.35; }

/* ---------- CSS Class Highlighter: point at things ---------- */
.d-css { display: grid; grid-template-rows: 1fr auto; gap: 12px; }
.c-page { display: grid; gap: 10px; align-content: start; padding: 14px; border-radius: 14px; background: #fafaf8; box-shadow: inset 0 0 0 1px var(--line); }
.c-page p { margin: 0; }
.c-el { position: relative; border-radius: 8px; outline: 2px solid transparent; outline-offset: 2px; cursor: crosshair; transition: outline-color .15s, background-color .15s; }
.c-el[data-c="navbar"] { display: flex; align-items: center; gap: 14px; padding: 8px 10px; background: #fff; box-shadow: 0 0 0 1px var(--line); font-size: .82rem; }
.c-el[data-c="logo"] { margin-right: auto; font: 900 .95rem/1 var(--display); }
.c-el[data-c="hero-title"] { justify-self: start; font: 900 clamp(1.5rem, 2.6vw, 2.3rem)/1 var(--display); letter-spacing: -.04em; }
.c-el[data-c="lede"] { justify-self: start; font-size: .9rem; color: var(--muted); }
.c-row { display: flex; gap: 8px; }
.c-el[data-c="btn-primary"], .c-el[data-c="btn-ghost"] { padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .82rem; }
.c-el[data-c="btn-primary"] { background: var(--ink); color: #fff; }
.c-el[data-c="btn-ghost"] { box-shadow: inset 0 0 0 1.5px var(--line-2); }
.c-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.c-el[data-c="card"] { height: 46px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.c-el.is-hit { outline-color: var(--accent); background-color: color-mix(in srgb, var(--accent) 14%, transparent); }
.c-el.is-kept { outline-color: var(--accent); outline-style: dashed; }
.c-tip { display: block; padding: 9px 13px; border-radius: 10px; background: var(--ink); color: #fff; font: 500 .84rem/1.3 ui-monospace, 'SF Mono', Menlo, monospace; }
.c-chips button { height: 34px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, .7); font: 500 .8rem/1 ui-monospace, 'SF Mono', Menlo, monospace; transition: transform .35s var(--pop), background-color .2s, color .2s; }
.c-chips button:hover { transform: scale(1.06); }
.c-chips button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* ---------- Keeptake: record, crash, recover ---------- */
.d-keep { display: grid; grid-template-rows: 1fr auto; gap: 12px; }
.k-screen { position: relative; display: grid; place-content: center; justify-items: center; gap: 6px; min-height: 170px; border-radius: 14px; background: #f1f1ee; transition: background-color .3s; }
.k-cam { position: absolute; left: 12px; bottom: 12px; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 3px #fff; }
.k-cam img { width: 100%; height: 100%; object-fit: cover; }
.k-time { font: 900 clamp(2.4rem, 4vw, 3.4rem)/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.k-state { margin: 0; padding: 0 70px; text-align: center; font-size: .9rem; font-weight: 600; line-height: 1.3; }
.d-keep.is-rec .k-screen { background: color-mix(in srgb, #ff3b30 12%, #fff); }
.d-keep.is-rec .k-time { color: #d92c22; }
.d-keep.is-crashed .k-screen { background: #2a2a2e; color: #fff; animation: dm-shake .4s; }
.k-chunks { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 14px; }
.k-chunks i { border-radius: 5px; background: #eeeeea; transition: background-color .3s, transform .5s var(--pop); }
.k-chunks i.is-saved { background: var(--accent); transform: scaleY(1.25); }

/* ---------- Speaker Cleaner: press and hold ---------- */
.d-spk { display: grid; place-items: center; }
.sp-btn { position: relative; display: grid; place-items: center; width: clamp(120px, 11vw, 150px); aspect-ratio: 1; border-radius: 50%; background: var(--accent); color: #fff; text-align: center; touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .4s var(--pop); }
.sp-btn b { position: relative; font: 900 1.7rem/1 var(--display); letter-spacing: -.03em; }
.sp-rings i { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent); opacity: 0; }
.d-spk.is-on .sp-btn { transform: scale(.92); }
.d-spk.is-on .sp-rings i { animation: sp-ring 1.1s linear infinite; }
.d-spk.is-on .sp-rings i:nth-child(2) { animation-delay: .36s; }
.d-spk.is-on .sp-rings i:nth-child(3) { animation-delay: .72s; }
@keyframes sp-ring { from { transform: scale(1); opacity: .7; } to { transform: scale(2.1); opacity: 0; } }
.sp-drops i { position: absolute; left: 50%; top: 50%; width: 12px; height: 16px; margin: -8px 0 0 -6px; border-radius: 60% 60% 60% 60% / 70% 70% 45% 45%; background: var(--accent); opacity: 0; }
.d-spk.is-on .sp-drops i { animation: sp-drop .9s ease-out infinite; }
.sp-drops i:nth-child(1) { --dx: -120px; --dy: -70px; } .sp-drops i:nth-child(2) { --dx: 118px; --dy: -64px; animation-delay: .15s !important; }
.sp-drops i:nth-child(3) { --dx: -96px; --dy: 80px; animation-delay: .3s !important; } .sp-drops i:nth-child(4) { --dx: 104px; --dy: 76px; animation-delay: .45s !important; }
.sp-drops i:nth-child(5) { --dx: 0px; --dy: -112px; animation-delay: .6s !important; } .sp-drops i:nth-child(6) { --dx: 10px; --dy: 110px; animation-delay: .75s !important; }
@keyframes sp-drop { 0% { transform: translate(0, 0) scale(.4); opacity: 0; } 25% { opacity: .9; } 100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; } }
.d-spk.is-done .sp-btn { background: #1f9d55; }

/* ---------- Compass: follows the pointer ---------- */
.d-comp { display: grid; place-items: center; align-content: center; gap: 10px; touch-action: none; }
.cp-dial { position: relative; width: clamp(130px, 12vw, 164px); aspect-ratio: 1; border-radius: 50%; background: #f1f1ee; box-shadow: inset 0 0 0 8px #fff, 0 0 0 1px var(--line); }
.cp-rose { position: absolute; inset: 0; border-radius: 50%; transition: transform .25s ease-out; }
.cp-rose b { position: absolute; left: 50%; top: 50%; width: 1.4em; margin: -.7em; text-align: center; font: 900 .95rem/1.4 var(--display); }
.cp-rose b:nth-child(1) { transform: translateY(-58px); color: var(--accent); }
.cp-rose b:nth-child(2) { transform: translateX(58px); } .cp-rose b:nth-child(3) { transform: translateY(58px); } .cp-rose b:nth-child(4) { transform: translateX(-58px); }
.cp-needle { position: absolute; left: 50%; top: 50%; width: 10px; height: 74px; margin: -37px 0 0 -5px; border-radius: 10px; background: linear-gradient(var(--accent) 50%, #c9c9c4 0); }
.cp-deg { font: 900 1.7rem/1 var(--display); letter-spacing: -.03em; }
.cp-warn { min-height: 2.6em; margin: 0; max-width: 24ch; text-align: center; font-size: .86rem; font-weight: 600; line-height: 1.3; color: #b22935; }
.d-comp.is-pulled .cp-rose { animation: cp-wob .5s ease-in-out infinite alternate; }
@keyframes cp-wob { from { rotate: -14deg; } to { rotate: 17deg; } }

/* ---------- Companion AI: a thought and a colour ---------- */
.d-quote { --c: #d9e6ff; --k: #0e1f45; display: grid; align-content: space-between; gap: 16px; background: var(--c); color: var(--k); transition: background-color .5s, color .5s; }
.d-quote blockquote { margin: 0; font: 900 clamp(1.5rem, 2.3vw, 2.1rem)/1.08 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.d-quote blockquote.is-swap { animation: q-in .6s var(--pop); }
@keyframes q-in { from { opacity: 0; transform: translateY(16px) rotate(-2deg); } }
.q-themes { display: flex; gap: 8px; }
.q-themes button { width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line-2); transition: transform .4s var(--pop); }
.q-themes button:hover { transform: scale(1.15); }
.q-themes button[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--k); }

@media (prefers-reduced-motion: reduce) { .d-spk.is-on .sp-rings i, .d-spk.is-on .sp-drops i, .d-comp.is-pulled .cp-rose { animation: none !important; } }
