/* Choose your orb: Basit A. Khan's white vortex page, measured from his post's video, with Kairos' orbs.
   Everything here is scoped to #choose-orb; the theme comes from the page's tokens in site.css. */

@scope (#choose-orb) {
  /* The page's tokens under the names this section was measured with. */
  :scope {
    --soft: var(--ink-soft);
    --chip: color-mix(in oklab, var(--ink) 7%, var(--surface));
    --chip-press: color-mix(in oklab, var(--ink) 11%, var(--surface));
    --hero: clamp(120px, 15vh, 164px);
  }

  /* ---- centre column ---- */
  :scope {
    position: relative;
    isolation: isolate;
    overflow: clip;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: max(100svh, 640px);
    padding: 96px 20px 64px;
    background: var(--ground);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
  }

  /* The white vortex fills the section behind the column; the column sits above it. */
  .vortex {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* The spiral fades out at the section's top and bottom edges instead of being cut by them. */
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  }

  :scope > :not(.vortex) {
    position: relative;
    z-index: 1;
  }

  button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .hero {
    position: relative;
    width: var(--hero);
    height: var(--hero);
    margin-bottom: 18px;
  }

  .hero .orb-motion {
    --orb-diameter: var(--hero);
    --orb-motion-distance: -6px;
    contain: layout style;
  }

  .hero .orb-shell {
    transition: transform 180ms var(--ease-out);
    transform: scale(var(--level-scale, 1));
  }

  .hero::before {
    /* the orb's own soft shadow on the white ground (MatchLab orbShadow, offset down) */
    content: "";
    position: absolute;
    inset: 12% 10% -8%;
    border-radius: 50%;
    background: radial-gradient(closest-side, color-mix(in oklab, var(--accent) 30%, transparent), transparent);
    filter: blur(18px);
    opacity: 0.55;
    transform: translateY(14%);
    transition: opacity 240ms ease;
  }

  .hero.swapping .orb-shell {
    animation: orbs-swap 360ms var(--ease-out);
  }

  /* thinking ring, ported from MatchLab agent-trace/orbs/orbs.module.css (.thinking::after) */
  .ring {
    position: absolute;
    inset: -6px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
  }

  .hero[data-state="thinking"] .ring { animation: orbs-ring 1600ms var(--ease-out) infinite; }
  .hero[data-state="success"] .ring { animation: orbs-ring 900ms var(--ease-out) 1; }

  .headline {
    max-width: 330px;
    margin: 0;
    font-size: 21px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.018em;
    text-wrap: balance;
  }

  .soft { color: var(--soft); }

  /* ---- the three orbs ---- */
  .choices {
    display: flex;
    gap: 22px;
    margin-top: 22px;
  }

  .choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 0;
    border-radius: 14px;
    background: none;
  }

  .choice-orb {
    --orb-diameter: 64px;
    border-radius: 50%;
    box-shadow: 0 6px 16px -6px rgba(10, 10, 10, 0.35);
    transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
  }

  .choice[aria-checked="true"] .choice-orb {
    box-shadow: 0 0 0 3px var(--ground), 0 0 0 4.5px var(--ink), 0 8px 20px -6px rgba(10, 10, 10, 0.4);
  }

  .choice:active .choice-orb { transform: scale(0.95); }

  @media (hover: hover) and (pointer: fine) {
    .choice:hover:not(:active) .choice-orb { transform: scale(1.05); }
  }

  .choice-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--soft);
    transition: color 160ms ease;
  }

  .choice[aria-checked="true"] .choice-name { color: var(--ink); }

  /* ---- type or talk ---- */
  .talk {
    position: relative;
    width: min(300px, 100%);
    margin-top: 18px;
  }

  .talk-input {
    width: 100%;
    height: 40px;
    padding: 0 46px 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--chip);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    caret-color: var(--accent);
  }

  .talk-input::placeholder { color: var(--ink-soft); }

  .talk-input:focus-visible { outline-offset: 2px; }

  .mic {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    transition: background-color 160ms ease, transform 120ms var(--ease-out);
  }

  .mic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

  .mic:active { transform: scale(0.92); }

  .mic[aria-pressed="true"] { background: var(--accent); color: #fff; }

  .status {
    min-height: 36px;
    margin: 10px 0 0;
    max-width: 320px;
    font-size: 13px;
    color: var(--soft);
  }

  /* ---- the black button (the reference's "Let's Talk") ---- */
  .cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 7px;
    background: var(--ink);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: transform 120ms var(--ease-out), background-color 200ms ease;
  }

  .cta:active { transform: scale(0.97); }

  .cta-check {
    display: none;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .cta[data-confirmed="true"] { background: var(--accent); }
  .cta[data-confirmed="true"] .cta-check { display: block; }

  /* ---- entrance: the column materialises while the vortex builds (one authored moment) ---- */
  :scope > :not(.vortex) {
    animation: orbs-reveal 700ms var(--ease-out) both;
    animation-delay: var(--at, 0ms);
  }

  .headline { --at: 120ms; }
  .choices { --at: 220ms; }
  .talk, .status { --at: 300ms; }
  .cta { --at: 360ms; }

  @media (max-height: 700px) {
    :scope { --hero: 112px; padding-top: 80px; }
    .choices { margin-top: 14px; }
    .choice-orb { --orb-diameter: 52px; }
  }

  @media (max-width: 520px) {
    .choices { gap: 12px; }
  }

  @media (prefers-reduced-motion: reduce) {
    :scope > :not(.vortex) { animation: orbs-reveal-fade 200ms ease both; }
    .hero.swapping .orb-shell { animation: none; }
    .hero[data-state] .ring { animation: none; }
    .hero .orb-motion { transition: none; }
  }
}

@keyframes orbs-swap {
  0% { filter: blur(0); transform: scale(1); }
  38% { filter: blur(10px); transform: scale(0.94); opacity: 0.5; }
  100% { filter: blur(0); transform: scale(1); opacity: 1; }
}

@keyframes orbs-ring {
  0% { opacity: 0.55; transform: scale(0.85); }
  70%, 100% { opacity: 0; transform: scale(1.45); }
}

@keyframes orbs-reveal {
  from { opacity: 0; filter: blur(8px); transform: translateY(10px); }
  to { opacity: 1; filter: blur(0); transform: none; }
}

@keyframes orbs-reveal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
