/* Studybook skin for the voice stage, in the keenable.ai kit: ruled paper,
   Stack Sans for UI, "Nothing You Could Do" handwriting in Keenable blue for
   accents, and hand-drawn blue doodles. Loaded after the inline styles in
   index.html and only overrides them. */

:root {
  --hand: "Nothing You Could Do", "Segoe Print", "Bradley Hand", cursive;
  --paper: #fffefa;
  --ink: #005cff;            /* Keenable blue ink: the mascot writes in it */
  --rule-line: rgba(0, 92, 255, .10);
  --margin-line: rgba(0, 92, 255, .28);
  --tape: rgba(255, 233, 160, .72);
  --line-h: 32px;            /* notebook rule pitch */
}
:root[data-theme="dark"] {
  --paper: #11131c;
  --ink: #7aa6ff;
  --rule-line: rgba(122, 166, 255, .09);
  --margin-line: rgba(122, 166, 255, .25);
  --tape: rgba(255, 233, 160, .28);
}

body { background: var(--paper); }

/* ── paper: rules, margin line, punched holes ───────────────────────────── */
.rules {
  opacity: 1;
  background:
    linear-gradient(var(--margin-line), var(--margin-line)) calc(50% - 236px) 0 / 1.5px 100% no-repeat,
    linear-gradient(var(--margin-line), var(--margin-line)) calc(50% - 231px) 0 / 1px 100% no-repeat,
    repeating-linear-gradient(transparent 0 calc(var(--line-h) - 1px), var(--rule-line) calc(var(--line-h) - 1px) var(--line-h));
}
.rules::before {
  /* three punched holes down the left edge of the page */
  content: ""; position: absolute; left: calc(50% - 268px); top: 0; bottom: 0; width: 18px;
  background:
    radial-gradient(circle, rgba(0,0,0,.07) 0 8px, transparent 9px) 0 18% / 18px 18px no-repeat,
    radial-gradient(circle, rgba(0,0,0,.07) 0 8px, transparent 9px) 0 50% / 18px 18px no-repeat,
    radial-gradient(circle, rgba(0,0,0,.07) 0 8px, transparent 9px) 0 82% / 18px 18px no-repeat;
}
@media (max-width: 600px) {
  .rules { background: repeating-linear-gradient(transparent 0 calc(var(--line-h) - 1px), var(--rule-line) calc(var(--line-h) - 1px) var(--line-h)); }
  .rules::before { display: none; }
}

/* ── brand: "Voice" handwritten in blue, with a swoosh under it ─────────── */
.brand .word {
  font: 400 34px/1 var(--hand); color: var(--ink);
  position: relative; top: 4px; letter-spacing: .5px;
}
.brand .word::after {
  content: ""; position: absolute; left: -4px; right: -10px; bottom: -12px; height: 12px;
  background: no-repeat center / 100% 100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M2 8 C 30 3, 60 2, 90 5 S 112 9, 118 4' fill='none' stroke='%23005cff' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  animation: draw-in .9s .2s cubic-bezier(.4, 0, .2, 1) both;
  clip-path: inset(0 100% 0 0);
}
@keyframes draw-in { to { clip-path: inset(0 0 0 0); } }

/* ── the mascot: a photo taped into the notebook ────────────────────────── */
.orb-wrap:has(.photo) { height: auto; padding: 10px 0 0; }
.photo {
  position: relative; margin: 0; padding: 10px 10px 0;
  background: #fff; border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 10px 26px -14px rgba(0,0,0,.35);
  transform: rotate(-1.6deg);
  transition: transform .5s cubic-bezier(.3, 1.4, .5, 1);
}
:root[data-theme="dark"] .photo { background: #e9e7e1; }
.stage[data-phase="speaking"] .photo { transform: rotate(-.6deg) translateY(-2px); }
.photo::before, .photo::after {
  /* washi tape on two corners */
  content: ""; position: absolute; width: 74px; height: 22px; background: var(--tape);
  box-shadow: 0 1px 1px rgba(0,0,0,.05);
  -webkit-mask: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent calc(100% - 2px));
}
.photo::before { left: -22px; top: 8px; transform: rotate(-38deg); }
.photo::after  { right: -22px; top: 8px; transform: rotate(36deg); }
.photo #avatar { border-radius: 2px; box-shadow: none; }
.photo figcaption {
  height: 34px; display: flex; align-items: center; justify-content: center;
  font: 400 20px/1 var(--hand); color: var(--ink); white-space: nowrap;
}
.photo figcaption span { display: inline-block; animation: write-in .5s cubic-bezier(.3, 0, .2, 1) both; }
@keyframes write-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 -10% 0 0); } }

/* doodles around the photo, one per phase, drawn in with a stroke animation */
.doodle {
  position: absolute; pointer-events: none; color: var(--ink); opacity: 0;
  transition: opacity .25s ease;
}
.doodle svg { display: block; overflow: visible; }
.doodle path, .doodle circle { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.doodle.search { right: -54px; top: 18%; }
.doodle.think  { right: -40px; top: -8px; }
.doodle.talk   { left: -46px;  top: 30%; }
.doodle.listen { left: -48px;  top: 26%; }
.stage[data-phase="searching"] .doodle.search,
.stage[data-phase="thinking"]  .doodle.think,
.stage[data-phase="speaking"]  .doodle.talk,
.stage[data-phase="listening"]:not([data-paused]) .doodle.listen { opacity: 1; }
.stage[data-phase="searching"] .doodle.search { animation: wobble 1.1s ease-in-out infinite; }
.stage[data-phase="thinking"]  .doodle.think  { animation: bob 1.4s ease-in-out infinite; }
.stage[data-phase="speaking"]  .doodle.talk path { animation: pulse-line 1s ease-in-out infinite; }
.stage[data-phase="speaking"]  .doodle.talk path:nth-child(2) { animation-delay: .15s; }
.stage[data-phase="speaking"]  .doodle.talk path:nth-child(3) { animation-delay: .3s; }
@keyframes wobble { 0%, 100% { transform: rotate(-8deg) translate(0, 0); } 50% { transform: rotate(8deg) translate(-4px, 3px); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-5px) rotate(4deg); } }
@keyframes pulse-line { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (max-width: 420px) { .doodle { display: none; } }

/* ── conversation: compact iMessage bubbles on the notebook page ──────────
   Plain Stack Sans (the handwriting stays for headings, the photo caption and
   the doodles): tight bubbles, more of the conversation fits on screen.
   Runs of bubbles from one side sit close together; only the last one in a
   run has a tail. */
.captions {
  margin-top: 8px; /* older bubbles fade out below the photo, not under it */
  padding: 10px 14px 10px;
  font: 400 15px/1.3 var(--stack); letter-spacing: -0.01em;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
          mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
}
@media (pointer: coarse), (max-width: 640px) { .captions { font-size: 15px; padding: 8px 10px; } }
.chat-list { gap: 2px; }
.say {
  max-width: 82%; padding: 6px 11px 7px; border-radius: 17px;
  box-shadow: none;
}
.say.user + .say.assistant, .say.assistant + .say.user { margin-top: 8px; }
.say.user { background: var(--bubble-user); color: #fff; border-bottom-right-radius: 17px; }
.say.assistant { background: var(--bubble-assistant); color: var(--text); border-bottom-left-radius: 17px; }
/* the tail, on the last bubble of a run */
.say.user:not(:has(+ .say.user)) { border-bottom-right-radius: 5px; }
.say.assistant:not(:has(+ .say.assistant)) { border-bottom-left-radius: 5px; }
.say.user:has(+ .say.user) { border-bottom-right-radius: 17px; }
.say.assistant:has(+ .say.assistant) { border-bottom-left-radius: 17px; }
/* the bubble being spoken: a soft ring, no extra space */
.say.live.user { box-shadow: 0 0 0 2px color-mix(in srgb, var(--bubble-user) 35%, transparent); }
.say.live.assistant { box-shadow: 0 0 0 2px var(--bubble-live); }
.say.cut { opacity: .5; }
.say.pending { padding: 9px 12px; }
.dots i { width: 6px; height: 6px; }
/* emotion: a small sticker on the bubble's corner */
.say[data-emo]::before { top: -8px; left: -6px; font-size: 14px; }

/* ── dock: Start as a marker-drawn pill, with a "tap to talk" arrow ─────── */
.pill {
  font: 400 24px/1 var(--hand); letter-spacing: .5px;
  border-radius: 40px 34px 44px 30px / 30px 44px 34px 40px;
}
.pill-main { box-shadow: 2px 3px 0 rgba(0, 0, 0, .12); }
.pill-gear { border: 2px solid rgba(0,0,0,.1); }
.hint-start {
  position: absolute; right: calc(50% + 70px); top: -34px;
  font: 400 19px/1 var(--hand); color: var(--ink); white-space: nowrap;
  transform: rotate(-6deg); pointer-events: none;
  transition: opacity .3s ease;
}
.hint-start svg { position: absolute; right: -40px; top: 12px; }
.hint-start path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dock:has(.pill-main:not([data-mode="start"])) .hint-start,
.stage[data-phase="connecting"] .hint-start { opacity: 0; }
@media (max-width: 420px) { .hint-start { display: none; } }

/* model switch: index tabs in handwriting, the chosen one underlined */
.model-switch {
  background: transparent; gap: 2px 4px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px);
}
.model-switch button {
  font: 400 16px/1 var(--hand); color: var(--muted); padding: 6px 7px 8px; border-radius: 0;
  position: relative; white-space: nowrap;
}
.model-switch button[aria-checked="true"] { background: transparent; box-shadow: none; color: var(--ink); }
.model-switch button[aria-checked="true"]::after {
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 1px; height: 7px;
  background: no-repeat center / 100% 100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 7'%3E%3Cpath d='M2 4 C 18 1, 40 6, 58 2' fill='none' stroke='%23005cff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ── "invite me to your meeting" (the meeting agent's inbox, app.js) ──────
   A handwritten margin note under the logo: the address copies on click,
   the envelope opens an email to it. */
.meet-cta {
  grid-row: 3; justify-self: center; align-self: start; margin-top: 26px;
  position: relative; z-index: 2;
  display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px); transform: rotate(-1.2deg);
}
.meet-cta .lbl { flex-basis: 100%; text-align: center; font: 400 18px/1.2 var(--hand); color: var(--ink); }
.meet-cta .lbl::after { content: ":"; }
.meet-cta .addr {
  font: 500 14px/1.2 var(--stack); color: var(--text); letter-spacing: -0.01em;
  background: linear-gradient(transparent 55%, rgba(0, 92, 255, .14) 55%);
  border: 0; padding: 0 2px; cursor: copy; border-radius: 2px;
}
.meet-cta .addr:hover { background: linear-gradient(transparent 40%, rgba(0, 92, 255, .22) 40%); }
.meet-cta[data-copied] .addr { color: var(--ink); }
.meet-cta .mail { align-self: center; color: var(--ink); display: inline-flex; padding: 2px; }
.meet-cta .mail svg { display: block; }
.meet-cta .mail rect, .meet-cta .mail path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.meet-cta .send-open {
  flex-basis: 100%; border: 0; background: none; padding: 2px 0 0; cursor: pointer;
  font: 400 16px/1.2 var(--hand); color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
}
/* the "Send Fox" card: floats under the note, the page doesn't move */
.meet-cta .send-card {
  position: absolute; top: calc(100% + 10px); left: 50%; z-index: 20;
  width: min(360px, calc(100vw - 32px)); transform: translateX(-50%) rotate(1.2deg);
  display: grid; gap: 10px; padding: 16px 16px 14px; text-align: left;
  background: var(--paper); border: 2px solid color-mix(in srgb, var(--ink) 70%, transparent);
  border-radius: 14px 18px 12px 16px; box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .35);
}
.meet-cta .send-card[hidden] { display: none; }
.meet-cta .send-card label { display: grid; gap: 4px; font: 500 13px/1.2 var(--stack); color: var(--text); }
.meet-cta .send-card label span { color: var(--muted); font-weight: 400; }
.meet-cta .send-card input {
  font: 400 15px/1.2 var(--stack); padding: 9px 10px; border-radius: 8px;
  border: 1.5px solid rgba(0, 0, 0, .15); background: #fff; color: #111; min-width: 0;
}
:root[data-theme="dark"] .meet-cta .send-card input { background: #1b1e2a; color: #eee; border-color: rgba(255, 255, 255, .15); }
.meet-cta .send-card input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.meet-cta .send-card .go {
  justify-self: start; border: 0; cursor: pointer; padding: 9px 18px 10px; border-radius: 22px 18px 24px 16px;
  background: var(--ink); color: #fff; font: 400 20px/1 var(--hand);
}
.meet-cta .send-card .go:disabled { opacity: .6; cursor: progress; }
.meet-cta .send-card .x {
  position: absolute; top: 4px; right: 8px; border: 0; background: none; cursor: pointer;
  font: 400 22px/1 var(--stack); color: var(--muted);
}
.meet-cta .send-card .msg { margin: 0; min-height: 1em; font: 400 13px/1.35 var(--stack); color: var(--muted); }
.meet-cta .send-card .msg[data-kind="ok"] { color: #18794e; }
.meet-cta .send-card .msg[data-kind="err"] { color: #b42318; }
@media (max-width: 420px) {
  .meet-cta { margin-top: 22px; }
  .meet-cta .lbl { font-size: 16px; }
  .meet-cta .addr { font-size: 13px; }
}
