/* Retake Voice: the recorder's screens and the landing picture.
   Every class is `rv-` so nothing here meets the page system's names.
   Colours, sizes and type are the system's tokens; the one addition is
   the recording red, which is not the system's error red (--miss). */

:root,.theme-light{--rec:#C2362B;--rec-wash:#F4DEDA}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){--rec:#F07467;--rec-wash:#4A2A26}
}
:root[data-theme="dark"]{--rec:#F07467;--rec-wash:#4A2A26}
.theme-light{--rec:#C2362B;--rec-wash:#F4DEDA}

/* The recorder shows and hides its pieces with `hidden`; a component's
   own display (a panel is flex) must not bring one back. */
.rv-studio [hidden],#projects-app [hidden]{display:none !important}

.rv-row{display:flex;flex-wrap:wrap;gap:var(--s3);align-items:center}
.rv-failed{font-family:var(--f-ui);font-size:var(--t-ui);color:var(--miss);padding:var(--s3) 0}
.rv-keycap{display:inline-grid;place-items:center;min-width:26px;height:24px;padding:0 6px;
  border-radius:var(--r-sm);background:var(--well);box-shadow:inset 0 -2px 0 var(--rule-firm);
  font-family:var(--f-ui);font-size:12px;font-weight:600;color:var(--ink);line-height:1;white-space:nowrap}
.rv-check{display:inline-flex;align-items:center;gap:var(--s2);font-family:var(--f-ui);font-size:var(--t-ui);cursor:pointer}
.rv-check input{width:18px;height:18px;accent-color:var(--mark)}

/* ---------- the project list ---------- */

.rv-new .textarea{min-height:200px;font-family:var(--f-body);font-size:var(--t-read)}
.rv-new{gap:var(--s4)}
.rv-projects{display:grid;gap:var(--s2)}
.rv-projects:empty{display:none}
.rv-project{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:var(--s5);align-items:center;
  background:var(--surface);border-radius:var(--r-md);padding:var(--s4) var(--s5)}
.rv-project-name{font-family:var(--f-display);font-size:20px;font-weight:600;text-decoration:none;color:var(--ink);
  display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rv-project-name:hover{text-decoration:underline;text-underline-offset:3px}
.rv-project-meta{font-family:var(--f-ui);font-size:var(--t-small);color:var(--muted);margin-top:2px}
.rv-project-actions{display:flex;gap:var(--s2)}
.btn.rv-danger{background:var(--miss);color:#fff}
.rv-error{font-family:var(--f-ui);font-size:var(--t-ui);color:var(--miss)}

/* ---------- the studio ---------- */

/* The page is the screen: the script scrolls inside, the dock stays put
   (the chat pages hold still the same way, see body.is-chat). */
body.rv-studio-page{display:flex;flex-direction:column;height:100vh;height:100dvh;overflow:hidden}
body.rv-studio-page main{flex:1;min-height:0;display:flex}
.rv-studio{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;width:100%;
  max-width:var(--measure-page);margin:0 auto;padding:0 var(--s6)}
.rv-head{display:flex;align-items:center;justify-content:space-between;gap:var(--s4);padding:var(--s3) 0}
.rv-title{font-family:var(--f-display);font-size:26px;font-weight:600;letter-spacing:-.012em;
  background:transparent;border:0;border-radius:var(--r-sm);padding:2px 6px;margin-left:-6px;
  flex:1 1 16ch;min-width:0;max-width:36ch;color:var(--ink)}
.rv-title:hover,.rv-title:focus{background:var(--well);outline:none}
.rv-tools{display:flex;gap:var(--s2);align-items:center;flex:none;justify-content:flex-end}
.rv-tools .btn{white-space:nowrap}
.rv-status{display:inline-flex;align-items:center;gap:var(--s2);font-family:var(--f-ui);
  font-size:var(--t-small);color:var(--muted);white-space:nowrap}
.rv-status-dot{width:8px;height:8px;border-radius:50%;background:var(--rule-firm)}
.rv-status[data-state="recording"]{color:var(--rec);font-weight:600}
.rv-status[data-state="recording"] .rv-status-dot{background:var(--rec);animation:rv-blink 1.2s steps(2,start) infinite}
.rv-status[data-state="preroll"] .rv-status-dot{background:var(--accent)}
@keyframes rv-blink{to{visibility:hidden}}
.rv-track{display:inline-flex;align-items:center;gap:var(--s2);padding:5px 10px;border:1px solid var(--rule);
  border-radius:var(--r-pill);background:transparent;color:var(--muted);font-family:var(--f-ui);
  font-size:var(--t-small);white-space:nowrap;cursor:pointer}
.rv-track:hover{border-color:var(--rule-firm);color:var(--ink)}
.rv-track[hidden]{display:none}
.rv-track-dot{width:7px;height:7px;border-radius:50%;background:var(--accent)}
.rv-track[data-state="loading"] .rv-track-dot{background:var(--rule-firm);animation:rv-pulse 1.1s ease-in-out infinite}
.rv-track[data-state="language"] .rv-track-dot,.rv-track[data-state="error"] .rv-track-dot{background:var(--rule-firm)}
@keyframes rv-pulse{50%{opacity:.3}}

.rv-stage{flex:1;min-height:0;overflow-y:auto;scroll-behavior:smooth;padding:var(--s5) 0 calc(var(--s9) * 2)}
.rv-script{max-width:34em;margin:0 auto;font-family:var(--f-display);font-size:var(--script-size,30px);
  line-height:1.6;letter-spacing:-.003em}
.rv-script p{margin:0 0 .8em}
/* word tracking: read words dim, the next one marked, a thin line before the cursor's word */
.rv-script .w{border-radius:4px;transition:color .2s var(--ease),background-color .2s var(--ease),box-shadow .2s var(--ease)}
.rv-script .w.is-read{color:var(--muted)}
.rv-script .w.is-next{background:color-mix(in srgb,var(--accent) 14%,transparent);
  box-shadow:0 0 0 .1em color-mix(in srgb,var(--accent) 14%,transparent);color:var(--ink)}
.rv-script.is-live .w.is-next{background:color-mix(in srgb,var(--accent) 24%,transparent);
  box-shadow:0 0 0 .1em color-mix(in srgb,var(--accent) 24%,transparent)}
.rv-script .w.is-link{cursor:pointer}
.rv-script .w.is-link:hover{background:var(--well-hover);box-shadow:0 0 0 .1em var(--well-hover);color:var(--ink)}
.rv-script .w.is-cursor{position:relative;color:var(--ink)}
.rv-script .w.is-cursor::before{content:"";position:absolute;left:-.17em;top:.18em;bottom:.06em;width:3px;
  border-radius:2px;background:var(--accent)}
.rv-script-empty{max-width:40rem;margin:0 auto;background:var(--surface);border-radius:var(--r-lg);
  padding:var(--s6);display:flex;flex-direction:column;align-items:flex-start;gap:var(--s3)}
.rv-editor{max-width:40rem;margin:0 auto;display:grid;gap:var(--s3)}
.rv-editor .textarea{min-height:50vh;font-family:var(--f-body);font-size:18px}

.rv-dock{background:var(--surface);box-shadow:var(--shadow-lift);border-radius:var(--r-xl) var(--r-xl) 0 0;
  padding:var(--s4) var(--s5);position:relative;z-index:3}
.rv-wave-wrap{position:relative}
.rv-wave{display:block;width:100%;height:112px;background:var(--well);border-radius:var(--r-md);cursor:grab;touch-action:none}
.rv-wave.is-panning{cursor:grabbing}
.rv-wave.on-cursor{cursor:ew-resize}
.rv-wave.is-live{cursor:default}
.rv-overview{display:block;width:100%;height:22px;margin-top:6px;background:var(--well);border-radius:var(--r-sm);
  cursor:pointer;touch-action:none}
.rv-wave-legend{position:absolute;right:var(--s3);top:var(--s2);font-family:var(--f-ui);font-size:11px;
  color:var(--muted);pointer-events:none}
.rv-controls{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:var(--s5);align-items:center;margin-top:var(--s4)}
.rv-transport{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
.rv-rec{width:64px;height:64px;border-radius:50%;border:0;background:var(--mark);display:grid;place-items:center;
  cursor:pointer;flex:none;transition:transform var(--dur) var(--ease),background-color var(--dur) var(--ease)}
.rv-rec:hover{background:var(--mark-hover)}
.rv-rec:active{transform:scale(.96)}
.rv-rec-icon{width:22px;height:22px;border-radius:50%;background:var(--rec);transition:border-radius var(--dur) var(--ease)}
.rv-rec[data-state="recording"] .rv-rec-icon,.rv-rec[data-state="preroll"] .rv-rec-icon{border-radius:4px;width:18px;height:18px;background:var(--on-mark)}
.rv-rec[data-state="recording"]{box-shadow:0 0 0 4px var(--rec-wash),0 0 0 6px var(--rec)}
.rv-ctl{display:inline-flex;align-items:center;gap:var(--s2);background:var(--well);border:0;border-radius:var(--r-md);
  padding:10px 14px;font-family:var(--f-ui);font-size:var(--t-ui);font-weight:600;color:var(--ink);cursor:pointer}
.rv-ctl:hover{background:var(--well-hover)}
.rv-ctl[disabled]{opacity:.4;cursor:default}
.rv-ctl .rv-keycap{background:var(--surface);height:22px;min-width:24px}
.rv-readout{display:flex;align-items:center;gap:var(--s5);justify-content:center;min-width:0}
.rv-time{font-family:var(--f-ui);font-size:26px;font-weight:600;font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.rv-hint{font-family:var(--f-ui);font-size:var(--t-small);line-height:1.35;color:var(--muted);min-width:0;max-width:34em;
  overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2}
.rv-meter{width:140px;display:grid;gap:4px}
.rv-meter-track{height:6px;border-radius:var(--r-pill);background:var(--well);overflow:hidden}
.rv-meter-fill{height:100%;width:0;background:var(--accent);border-radius:var(--r-pill);transition:width 60ms linear}
.rv-meter[data-clip="1"] .rv-meter-fill{background:var(--rec)}
.rv-meter-label{font-family:var(--f-ui);font-size:11px;color:var(--muted)}

.rv-toast{position:fixed;left:50%;bottom:280px;transform:translateX(-50%);background:var(--mark);color:var(--on-mark);
  font-family:var(--f-ui);font-size:var(--t-ui);font-weight:600;padding:10px 16px;border-radius:var(--r-pill);
  box-shadow:var(--shadow-lift);z-index:30;opacity:0;pointer-events:none;max-width:calc(100vw - 32px);
  transition:opacity var(--dur) var(--ease),transform var(--dur) var(--ease)}
.rv-toast.is-on{opacity:1;transform:translateX(-50%) translateY(-4px)}

.rv-gate{position:fixed;inset:0;background:var(--veil);display:grid;place-items:center;z-index:40;padding:var(--s5)}
.rv-gate[hidden]{display:none}
.rv-gate-card{background:var(--surface);border-radius:var(--r-lg);padding:var(--s6);max-width:440px;display:grid;
  gap:var(--s3);box-shadow:var(--shadow-lift)}
.rv-gate-card .btn{justify-self:start;margin-top:var(--s2)}

.rv-drawer{position:fixed;top:0;right:0;bottom:0;width:min(380px,100vw);background:var(--surface);box-shadow:var(--shadow-lift);
  z-index:35;padding:var(--s5);overflow-y:auto;transform:translateX(100%);visibility:hidden;
  transition:transform var(--dur) var(--ease),visibility 0s linear var(--dur)}
.rv-drawer.is-open{transform:none;visibility:visible;transition:transform var(--dur) var(--ease)}
.rv-drawer-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--s5)}
.rv-setting{display:flex;flex-direction:column;gap:var(--s2);margin-bottom:var(--s5)}
.rv-setting-row{display:flex;justify-content:space-between;align-items:baseline;gap:var(--s3);font-family:var(--f-ui);font-size:var(--t-small)}
.rv-setting input[type="range"]{width:100%;accent-color:var(--mark)}
.rv-key-list{display:grid;gap:6px}
.rv-key-row{display:flex;align-items:center;justify-content:space-between;gap:var(--s3);font-family:var(--f-ui);font-size:var(--t-small)}
.rv-key-btn{min-width:64px;padding:5px 10px;border:1px solid var(--rule-firm);border-radius:var(--r-sm);background:var(--surface);
  color:var(--ink);font-family:var(--f-ui);font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap}
.rv-key-btn:hover{border-color:var(--ink)}
.rv-key-btn.is-capturing{border-color:var(--accent);color:var(--accent);background:color-mix(in srgb,var(--accent) 10%,var(--surface))}

.rv-formats{display:flex;gap:var(--s2);margin:var(--s4) 0}
.rv-formats label{flex:1;cursor:pointer;position:relative}
.rv-formats input{position:absolute;opacity:0}
.rv-formats span{display:grid;gap:2px;background:var(--well);border-radius:var(--r-md);padding:var(--s3) var(--s4);
  font-family:var(--f-ui);font-size:var(--t-ui)}
.rv-formats small{color:var(--muted);font-size:12px}
.rv-formats input:checked + span{box-shadow:inset 0 0 0 var(--ring-w) var(--ink);background:var(--surface)}
.rv-formats input:focus-visible + span{outline:var(--ring-w) solid var(--ink);outline-offset:2px}
.rv-progress{height:6px;background:var(--well);border-radius:var(--r-pill);overflow:hidden;margin-top:var(--s4)}
.rv-progress-fill{height:100%;width:0;background:var(--accent);transition:width .2s linear}
.rv-offers{display:grid;gap:var(--s2);margin-top:var(--s4)}
.rv-offer{display:flex;justify-content:space-between;align-items:center;gap:var(--s3);padding:var(--s3) var(--s4);
  border-radius:var(--r-md);background:var(--well);color:var(--ink);text-decoration:none;font-family:var(--f-ui);font-size:var(--t-ui)}
.rv-offer:hover{background:var(--well-hover)}
.rv-offer.is-best{background:var(--mark);color:var(--on-mark)}
.rv-offer.is-best:hover{background:var(--mark-hover)}

@media (max-width:980px){
  .rv-controls{grid-template-columns:1fr;gap:var(--s3)}
  .rv-readout{justify-content:flex-start}
  .rv-head{flex-wrap:wrap}
  .rv-tools{flex-wrap:wrap}
  #track-text{display:none}
  .rv-track{padding:8px}
}
@media (max-width:680px){
  .rv-studio{padding:0 var(--s4)}
  .rv-project{grid-template-columns:1fr;gap:var(--s2)}
  .rv-meter{display:none}
  .rv-ctl .rv-keycap{display:none}
}

/* ---------- the landing picture (and the auth pages', standing still) ---------- */

.rv-hero-demo{margin:0;background:var(--well);border-radius:var(--r-xl);padding:var(--s6);
  background-image:radial-gradient(var(--rule-firm) 1px,transparent 1px);background-size:20px 20px}
.rv-demo{background:var(--surface);border-radius:var(--r-lg);padding:var(--s5);box-shadow:var(--shadow-card, var(--shadow-lift))}
.auth-preview .rv-demo{box-shadow:var(--shadow-lift)}
.rv-demo-script{font-family:var(--f-display);font-size:21px;line-height:1.55;color:var(--ink)}
.rv-demo-done{color:var(--muted)}
.rv-demo-redo{border-radius:4px;padding:0 3px;background:var(--rec-wash)}
.rv-demo-wave{margin-top:var(--s5);display:block;width:100%;height:auto}
.rv-w-bar{fill:var(--ink)}
.rv-w-cut{fill:var(--rec);opacity:.55}
.rv-w-wash{fill:var(--rec-wash)}
.rv-w-pause{fill:var(--well)}
.rv-w-mark{stroke:var(--accent);stroke-width:2}
.rv-w-arrow{stroke:var(--accent);stroke-width:2.5;fill:none;stroke-linecap:round;stroke-linejoin:round}
.rv-demo-caption{display:flex;justify-content:space-between;align-items:center;gap:var(--s3);margin-top:var(--s3);
  font-family:var(--f-ui);font-size:var(--t-small);color:var(--muted)}
.rv-demo-caption .rv-keycap{margin-left:4px}

/* One loop, about nine seconds: the bars come in as the sentences are
   read, the last sentence is cut (red) and the arrow takes the take back
   to the pause, it holds, then all of it clears and starts again. The
   last frame is the still picture: reduced motion and the auth pages
   show only that. */
@media (prefers-reduced-motion:no-preference){
  .rv-demo:not(.is-still) .rv-w-bar{animation:rv-bar 9s calc(var(--i) * 70ms) infinite both}
  .rv-demo:not(.is-still) .rv-demo-cut{animation:rv-cut 9s infinite both}
  .rv-demo:not(.is-still) .rv-demo-arrow{animation:rv-arrow 9s infinite both}
  .rv-demo:not(.is-still) .rv-demo-redo{animation:rv-redo 9s infinite both}
  .rv-demo:not(.is-still) .rv-demo-caption{animation:rv-caption 9s infinite both}
}
@keyframes rv-bar{0%{opacity:0;transform:scaleY(.2)}3%,90%{opacity:1;transform:none}97%,100%{opacity:0}}
@keyframes rv-cut{0%,52%{opacity:0}58%,90%{opacity:1}97%,100%{opacity:0}}
@keyframes rv-arrow{0%,58%{opacity:0;transform:translateX(16px)}64%,90%{opacity:1;transform:none}97%,100%{opacity:0}}
@keyframes rv-redo{0%,52%{background:transparent}58%,90%{background:var(--rec-wash)}97%,100%{background:transparent}}
@keyframes rv-caption{0%,60%{opacity:0}66%,90%{opacity:1}97%,100%{opacity:0}}
.rv-w-bar{transform-box:fill-box;transform-origin:center}

/* ---------- the landing's own sections ---------- */

.rv-steps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--s6);counter-reset:step;list-style:none;padding:0}
.rv-steps li{counter-increment:step}
.rv-steps li::before{content:counter(step);display:block;font-family:var(--f-display);font-weight:var(--w-light,300);
  font-size:56px;line-height:1;color:var(--accent);margin-bottom:var(--s3)}
.rv-steps h3,.rv-keys h3{font-family:var(--f-display);font-size:var(--t-h3);font-weight:600;line-height:1.25;margin-bottom:var(--s2)}
.rv-steps p,.rv-keys p{color:var(--muted);font-size:var(--t-read);line-height:1.55}
.rv-keys{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:var(--s3);list-style:none;padding:0}
.rv-keys li{background:var(--surface);border-radius:var(--r-lg);padding:var(--s5)}
.rv-keys .rv-keycap{min-width:44px;height:38px;font-size:16px;margin-bottom:var(--s4)}
.rv-private{max-width:46rem;margin:0 auto;text-align:center;display:grid;gap:var(--s3)}
.rv-private p{color:var(--muted);font-size:var(--t-read);line-height:1.6}

@media (max-width:860px){
  .rv-steps{grid-template-columns:1fr}
}
