/* ==========================================================================
   Components — reusable UI primitives: buttons, badges, cards, phone mockup.
   ========================================================================== */

/* --- Buttons --------------------------------------------------------------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.8rem 1.4rem;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--transition), background var(--transition),
    border-color var(--transition), box-shadow var(--transition);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn--primary {
  --btn-bg: var(--color-gold);
  --btn-fg: #1a1500;
  box-shadow: 0 8px 24px -8px rgba(236, 201, 75, 0.6);
}

.btn--primary:hover {
  --btn-bg: var(--color-gold-soft);
  box-shadow: 0 12px 32px -8px rgba(236, 201, 75, 0.7);
}

.btn--ghost {
  --btn-fg: var(--color-text);
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.02);
}

.btn--ghost:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.btn--lg {
  padding: 1rem 1.8rem;
  font-size: var(--text-base);
}

.btn--block {
  width: 100%;
}

.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* --- Badges / pills (param · quant · size motif) -------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface-deep);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.badge--gold {
  color: var(--color-gold);
  border-color: rgba(236, 201, 75, 0.35);
  background: rgba(236, 201, 75, 0.08);
}

.badge--blue {
  color: var(--color-blue-light);
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.08);
}

.badge--green {
  color: var(--color-green);
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

/* --- Card ------------------------------------------------------------------ */
.card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), transform var(--transition);
}

.card--hover:hover {
  transform: translateY(-4px);
  border-color: rgba(236, 201, 75, 0.4);
}

.card__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: rgba(236, 201, 75, 0.1);
  color: var(--color-gold);
  margin-bottom: var(--space-4);
}

.card__icon svg {
  width: 24px;
  height: 24px;
}

.card h3 {
  margin-bottom: var(--space-2);
}

.card p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* --- Phone mockup ---------------------------------------------------------- */
/* The frame wraps the video exactly: its height is driven by the screen, whose
   aspect ratio matches the recording (1080:2232), so the bezel sits flush to
   the top and bottom of the video with nothing cropped. */
.phone {
  position: relative;
  width: 280px;
  border-radius: 40px;
  padding: 12px;
  background: linear-gradient(160deg, #2a2a2a, #0d0d0d);
  border: 1px solid #333;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9),
    var(--shadow-glow-gold);
}

.phone__screen {
  width: 100%;
  border-radius: 28px;
  background: #000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Fake device status bar: fills the rounded top-corner zone so the video
   starts on the straight edge below it and its top is never clipped. It also
   hosts the subtle playback-speed control on the right. */
.phone__topbar {
  position: relative;
  flex: 0 0 auto;
  height: 28px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-inline: 10px;
  z-index: 4;
}

/* Centred camera dot, positioned independently of the speed control. */
.phone__topbar::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1a1a1a;
  box-shadow: inset 0 0 0 1px #333;
}

/* The video keeps its native aspect ratio (no vertical crop) and sits below
   the status bar. Only the bottom corners are rounded to meet the screen. */
.phone__video {
  width: 100%;
  aspect-ratio: 1080 / 2232;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 0 0 28px 28px;
}

/* --- Video playback-speed control (subtle, in the status bar) ------------- */
.speed {
  position: relative;
  z-index: 5;
}

/* The trigger shows only the current speed; tapping reveals the options. */
.speed__current {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  padding: 3px 7px;
  cursor: pointer;
  transition: color var(--transition);
}

.speed__current:hover {
  color: var(--color-gold);
}

/* Options menu, hidden until opened. */
.speed__menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 46px;
  padding: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--transition), transform var(--transition),
    visibility var(--transition);
}

.speed[data-open] .speed__menu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.speed__opt {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  text-align: center;
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.speed__opt:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.06);
}

.speed__opt.is-active {
  color: #1a1500;
  background: var(--color-gold);
}

/* Mini chat UI rendered inside the phone */
.chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-size: var(--text-xs);
}

.chat__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--color-border-soft);
}

.chat__bar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-green);
}

.chat__model {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--color-text-muted);
}

.chat__body {
  flex: 1;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow: hidden;
}

.bubble {
  max-width: 85%;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-md);
  line-height: 1.45;
}

.bubble--user {
  align-self: flex-end;
  background: var(--color-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble--ai {
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-bottom-left-radius: 4px;
}

/* Blinking caret that follows streamed tokens */
.caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  vertical-align: text-bottom;
  background: var(--color-gold);
  margin-left: 1px;
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.chat__input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3);
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  color: var(--color-text-dim);
  font-size: 0.66rem;
}

.chat__send {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-gold);
  display: grid;
  place-items: center;
  color: #111;
  font-size: 0.7rem;
}
