/* GPT-172 — the voice dock, as the portfolio draws it (2026-11-18): the
   card with a heading ("Call my AI." since 2026-11-19), a line of pitch
   and a pill ("Call"). That card is this dock at rest. The design draws no
   other state, so the rest — the microphone prompt, a live conversation,
   the endings and the errors — keep the handoff's structure in the new
   type and palette. Colours are tokens.css; the meter's own geometry is
   meter.css; where a card sits on its page is that page's stylesheet.
   dock.js writes --dock-dur / --dock-ease for each change.

   Geometry, from the spec sheet and the exported frames:

   At rest — the home page's card is 400 × 234, the résumé's 360 × 206,
     a project's 480 × 178 — padding 24 inside a 1 px rule, radius 16, no
     shadow; the ask (18 / 28 Medium), the pitch (18 / 28, muted) and the
     pill, 12 apart. The pill is 48 high with 24 either side: "Talk to my
     AI" (14 / 22 Medium, white on action orange), 12, the 24 px speaker —
     170 wide.
   Live — the same card, 234 high: the speaker line (who is talking, then
     the time left) over the meter, beside End; 12; a 1 px rule; 12; the
     conversation, which takes the rest and scrolls.
   The page's own dock (.dock-page) floats above the bottom edge — on a
     phone since the handoff, on every screen since 2026-11-19 (Mike: "make
     the ai tile float in desktop mode too… like on mobile"): the heading
     and its line beside the pill at rest, 232 high live. A card inside the project view
     (no .dock-page) stays in its flow, as the design draws it. */

.dock {
  --dock-gap: 12px;         /* between the card's rows                       */
  --dock-btn-h: 48px;       /* every button: a 48 px pill                    */
  --dock-live-h: 234px;     /* the card while a conversation runs            */
  --dock-meter-w: 217px;    /* 20 segments of 8 with 19 gaps of 3            */
  --dock-dur: 180ms;        /* per change; dock.js sets it from its table   */
  --dock-ease: ease-out;

  display: flex;
  flex-direction: column;
  gap: var(--dock-gap);
  padding: var(--space-24);
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--dock-r);
  background: var(--canvas);
  color: var(--text);
  /* where the browser can animate to and from a height it works out
     itself, the card grows into the conversation; elsewhere it steps */
  interpolate-size: allow-keywords;
  transition: height var(--dock-dur) var(--dock-ease);
}
.dock[data-live="true"] { height: var(--dock-live-h); }

/* ---------- the head: the info column and the one button ----------
   Stacked at rest, as the design draws the card; a row while live, the
   speaker on the left and End on the right. */

.dock-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--dock-gap);
  flex: none;
}
.dock[data-live="true"] .dock-head {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  height: var(--dock-btn-h);
}

.dock-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--dock-gap);
}
.dock[data-live="true"] .dock-info { flex: 1 1 0; gap: var(--space-8); }

/* the speaker line: the status, and while live the countdown beside it */
.dock-line {
  display: flex;
  align-items: baseline;
  gap: var(--space-8);
  min-width: 0;
}

/* ---------- the status line (role=status, aria-live=polite) ----------
   One element for every state's line, so a change is one text swap and
   VoiceOver reads the new line once. At rest it is the card's heading,
   18 / 28 Medium; live it is the speaker — You / Mike / Listening /
   Thinking — 14 / 22 Medium on one line. Error text is prose: 14 / 22,
   wrapping, never truncated, and it stands where the pitch was. */

.dock-status {
  min-width: 0;
  margin: 0;
  font-size: var(--fs-18);
  font-weight: 500;
  line-height: var(--lh-body);
  color: var(--text);
}
.dock[data-live="true"] .dock-status {
  font-size: var(--fs-14);
  line-height: var(--lh-meta);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock-status.dock-prose {
  font-size: var(--fs-14);
  font-weight: 400;
  line-height: var(--lh-meta);
}

/* ---------- the pitch, at rest ----------
   The line under the ask: before a conversation, and again after one. */

.dock-description {
  display: none;
  margin: 0;
  font-size: var(--fs-18);
  line-height: var(--lh-body);
  color: var(--secondary);
}
.dock[data-state="idle"] .dock-description,
.dock[data-state^="ended-"] .dock-description { display: block; }

/* ---------- the privacy line ----------
   The live voice's promise, said where the pitch was while the browser
   asks for the microphone and the session opens. (The button also carries
   it as its description, so it is heard before the tap.) */

.dock-privacy {
  display: none;
  margin: 0;
  font-size: var(--fs-18);
  line-height: var(--lh-body);
  color: var(--secondary);
}
.dock[data-state="asking"] .dock-privacy,
.dock[data-state="connecting"] .dock-privacy { display: block; }

/* ---------- the countdown, beside the speaker ----------
   It takes room only while live. The words are decoration for the eye — a
   text that changes every second must not be announced. */

.dock-countdown {
  display: none;
  font-size: var(--fs-14);
  line-height: var(--lh-meta);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--secondary);
  opacity: 0;
  transition: opacity var(--dock-dur) var(--dock-ease);
}
.dock[data-live="true"] .dock-countdown,
.dock-countdown.dock-settling { display: inline; opacity: 1; }

/* anything -> ended: the countdown settles to zero and fades out over the
   same 333 ms (dock.js writes "0:00 remaining" and the .dock-settling
   class, and clears the text when the fade is over). */
.dock-countdown.dock-settling {
  animation: dock-settle var(--dock-dur) var(--dock-ease) forwards;
}
@keyframes dock-settle { from { opacity: 1; } to { opacity: 0; } }

/* ---------- the meter (GPT-171): live only, 217 px, 8 px segments ---------- */

.dock-meter {
  display: none;
  width: min(var(--dock-meter-w), 100%);
  height: 8px;
  flex: none;
}
.dock[data-live="true"] .dock-meter { display: block; }

/* ---------- the one button ----------
   The design's pill to start something — Call, Call again, Try again —
   with the speaker after its label; the same pill, outlined, to Hang up. Disabled (aria-disabled, so it keeps focus) while permission or
   the connection is pending: at half strength. Tab reaches it; Enter and
   Space are the native button's own. */

.dock-button {
  flex: none;
  height: var(--dock-btn-h);
  margin: 0;
  padding: 0 calc(var(--space-24) - 1px);   /* 24 to the pill's edge: the border is inside it */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  border: 1px solid var(--action);
  border-radius: 999px;
  background: var(--action);
  color: var(--on-action);
  font: 500 var(--fs-14)/var(--lh-meta) var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dock[data-live="true"] .dock-button {
  border-color: var(--text);
  background: transparent;
  color: var(--text);
}
.dock-button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
}
.dock-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* the speaker: a 24 px mark in the label's own colour (the shape is a
   mask, so it has no colour of its own). Gone while there is nothing to
   start: connecting, and live. */
.dock-icon {
  flex: none;
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5Z'/%3E%3Cpath d='M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5Z'/%3E%3Cpath d='M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14'/%3E%3C/svg%3E") center / contain no-repeat;
}
.dock[data-live="true"] .dock-icon,
.dock-button.dock-show-spinner .dock-icon { display: none; }

/* the spinner, shown only while connecting: a ring of the label's own
   colour, one arc open so it reads as turning. */
.dock-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  animation: dock-spin 900ms linear infinite;
}
.dock-button.dock-show-spinner .dock-spinner { display: block; }
@keyframes dock-spin { to { transform: rotate(360deg); } }

/* ---------- the conversation, live only ----------
   A 1 px rule, then a viewport that takes what is left of the card and
   scrolls: every turn as a bubble, the visitor's on the right and Mike's
   on the left, 6 px apart. The newest exchange is in ink; the earlier
   ones muted. dock.js keeps the viewport on the newest words as the
   karaoke reveals them, unless the visitor scrolls up. */

.dock-rule {
  display: none;
  flex: none;
  height: 1px;
  background: var(--rule);
}
.dock-captions {
  display: none;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;            /* no bar: touch, wheel and trackpad scroll it */
}
.dock-captions::-webkit-scrollbar { display: none; }
.dock[data-live="true"] .dock-rule,
.dock[data-live="true"] .dock-captions { display: block; }

.dock-sheet {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dock-turn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dock-turn-you { align-self: flex-end; max-width: 80%; text-align: right; }
.dock-turn-mike { align-self: flex-start; max-width: 90%; }
.dock-who {
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 16px;
  color: var(--secondary);
}
.dock-said {
  font-size: var(--fs-14);
  line-height: 20px;
  overflow-wrap: anywhere;
  color: var(--secondary);
}
.dock-turn-current .dock-said { color: var(--text); }
.dock-turn-you.dock-turn-current .dock-who { color: var(--text); }
.dock-turn-mike.dock-turn-current .dock-who { color: var(--accent); }

/* ---------- on a phone: the page's own dock floats ----------
   Fixed above the screen's edge and its home-indicator area, lifted off
   the page with a shadow; the page keeps bottom padding that clears it at
   rest. Compact: the ask beside the pill, the pitch left out. A card
   inside the project view is not this one: it stays in its flow. */
/* what the keyboard brings into view stops short of the dock */
html:has(.dock-page) { scroll-padding-bottom: calc(var(--dock-h) + var(--dock-inset) + var(--space-16)); }
.dock-page {
  position: fixed;
  left: max(var(--dock-inset), env(safe-area-inset-left, 0px));
  right: max(var(--dock-inset), env(safe-area-inset-right, 0px));
  bottom: calc(var(--dock-inset) + env(safe-area-inset-bottom, 0px));
  z-index: 1;               /* above the page that scrolls under it */
  padding: var(--space-16);
  box-shadow: var(--float-shadow);
}
.dock-page[data-live="true"] { height: var(--dock-h-live); }
.dock-page .dock-head { flex-direction: row; align-items: center; justify-content: space-between; }
.dock-page .dock-info { flex: 1 1 0; gap: var(--space-4); }
.dock-page .dock-status { font-size: var(--fs-16); line-height: var(--lh-meta); }
.dock-page[data-live="true"] .dock-status,
.dock-page .dock-status.dock-prose { font-size: var(--fs-14); }
.dock-page .dock-description { font-size: var(--fs-14); line-height: var(--lh-meta); }
.dock-page .dock-privacy { font-size: var(--fs-14); line-height: var(--lh-meta); }
.dock-page .dock-button { padding: 0 calc(var(--space-16) - 1px); gap: var(--space-8); }

/* On a wide screen the bar keeps a phone's width, centred. */
@media (min-width: 900px) {
  .dock-page { width: min(480px, calc(100% - 2 * var(--dock-inset))); margin: 0 auto; }
}

/* ---------- reduced motion ----------
   Every change still happens — the words carry the state — it just
   happens at once. dock.js writes a 1 ms duration inline for each change,
   so the value below is only the guard for the frames before it has run.
   meter.js handles the meter's reduced form. */

@media (prefers-reduced-motion: reduce) {
  .dock { --dock-dur: 1ms; }
  .dock-spinner { animation: none; }
}
