/* ==========================================================
   The call: Vera's feed, captions, composer, shared screen.
   Used by the homepage hero (.call--home) and /app (.call--app).
   ========================================================== */

.call {
  position: relative;
  isolation: isolate;
  background: var(--black);
  color: var(--white);
  --lower-h: 260px;
}

/* ---------- Feed ---------- */
.call__feed {
  position: absolute;
  inset: 0 0 auto 0;
  height: 100svh;
  min-height: 560px;
  z-index: -2;
  overflow: hidden;
}
.call__feed img,
.call__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 30%;
}
.call__video { opacity: 0; transition: opacity 1.2s ease; }
.call__video.is-ready { opacity: 1; }
.call__talk { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 70% 30%; opacity: 0; transition: opacity .4s ease; }
.call__talk.is-on { opacity: 1; }

/* Hear Vera button */
.talkbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  height: 34px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(0,0,0,.55);
  color: var(--white);
  font: 600 14px/1 var(--sans);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.talkbtn:hover { border-color: rgba(255,255,255,.6); }
.talkbtn svg { width: 16px; height: 16px; }
.talkbtn[aria-pressed="true"] { background: var(--white); color: #000; border-color: var(--white); }

.call__shade {
  position: absolute;
  inset: 0 0 auto 0;
  height: 100svh;
  min-height: 560px;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.42) 34%, rgba(0,0,0,0) 58%),
    linear-gradient(0deg, rgba(0,0,0,.92) 0%, rgba(0,0,0,.6) 22%, rgba(0,0,0,0) 46%),
    linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 16%);
}

.call__screen {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 var(--pad) clamp(28px, 4vh, 44px);
}

/* ---------- Title card (home) ---------- */
.call__title {
  position: absolute;
  left: var(--pad);
  top: 50%;
  transform: translateY(-58%);
  max-width: 470px;
  transition: opacity .5s ease, transform .5s ease;
}
.call__title-tag {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(52px, 6.2vw, 96px);
  line-height: 1;
  letter-spacing: -.035em;
  margin: 0 0 22px;
}
.call__title-lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--soft);
  margin: 0;
  max-width: 34ch;
}
.call__title-lede strong { color: var(--white); font-weight: 600; }
.call__title-lede a { color: var(--white); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.call.has-read .call__title { opacity: 0; transform: translateY(-54%); pointer-events: none; visibility: hidden; transition: opacity .3s ease, transform .3s ease, visibility 0s .3s; }

/* ---------- Status (top-left in /app, under nav on home) ---------- */
.call__status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--soft);
  margin: 0;
}
.call__status b { color: var(--white); font-weight: 600; }

/* ---------- Self view tile ---------- */
.selfview {
  position: absolute;
  right: var(--pad);
  top: 92px;
  width: 168px;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  background: #0d0d0d;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: var(--dim);
  font-size: 13px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.selfview svg { width: 34px; height: 34px; }

/* ---------- Lower third ---------- */
.call__lower {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
}

/* Closed captions */
.captions { width: min(100%, 980px); min-height: 7.6em; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 10px; }
.captions__who {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
}
.captions__text {
  margin: 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(22px, 2.35vw, 34px);
  line-height: 1.42;
  letter-spacing: .002em;
  text-wrap: balance;
}
.captions__text span {
  background: rgba(0,0,0,.8);
  padding: .06em .32em .1em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  border-radius: 4px;
}

/* Speaking wave */
.wave { display: inline-flex; align-items: center; gap: 3px; height: 16px; }
.wave i { width: 3px; height: 100%; border-radius: 2px; background: var(--go); transform-origin: center; animation: wave 1s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: .12s; }
.wave i:nth-child(3) { animation-delay: .24s; }
.wave i:nth-child(4) { animation-delay: .36s; }
.wave.is-idle i { animation: none; transform: scaleY(.25); background: var(--dim); }
@keyframes wave { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* Composer */
.composer {
  display: flex;
  gap: 8px;
  width: min(100%, 660px);
  padding: 6px;
  border-radius: 999px;
  background: rgba(20,19,18,.82);
  border: 1px solid var(--line-strong);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.composer:focus-within { border-color: rgba(255,255,255,.5); }
.composer__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--white);
  font: 500 17px/1 var(--mono);
  padding: 0 14px 0 18px;
  outline: none;
}
.composer__input::placeholder { color: var(--dim); font-family: var(--sans); }
.composer .btn { flex: none; }
.composer__try {
  margin: 0;
  font-size: 15px;
  color: var(--soft);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 4px;
}
.composer__try button {
  font: 500 15px/1 var(--mono);
  color: var(--white);
  background: none;
  border: 0;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.composer__try button:hover { background: rgba(255,255,255,.08); }

/* Controls (app) */
.controls { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.ctrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  color: var(--soft);
  font: 500 13px/1.2 var(--sans);
  cursor: pointer;
  padding: 0 4px;
  min-width: 72px;
}
.ctrl__icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.12);
  color: var(--white);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background .2s ease;
}
.ctrl:hover .ctrl__icon { background: rgba(255,255,255,.2); }
.ctrl--go .ctrl__icon { background: var(--go); color: #000; }
.ctrl--go:hover .ctrl__icon { background: #4ade72; }
.ctrl--stop .ctrl__icon { background: var(--stop); color: #fff; }
.ctrl--stop:hover .ctrl__icon { background: #ff6259; }
.ctrl:focus-visible { outline: none; }
.ctrl:focus-visible .ctrl__icon { outline: 2px solid var(--white); outline-offset: 3px; }

.beta-note { margin: 0; font-size: 14px; color: var(--soft); max-width: 60ch; }

/* ---------- Shared screen (Vera's read) ---------- */
.share {
  position: absolute;
  left: var(--pad);
  top: 92px;
  bottom: calc(var(--lower-h) + 28px);
  width: min(440px, calc(100% - 2 * var(--pad)));
  display: flex;
  flex-direction: column;
  background: rgba(14,13,12,.9);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  overflow: hidden;
  animation: share-in .35s cubic-bezier(.2,.8,.2,1);
}
.share[hidden] { display: none; }
@keyframes share-in { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.share__bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--soft);
}
.share__bar b { color: var(--white); font-weight: 600; }
.share__icon { color: var(--go); display: inline-flex; }
.share__close {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,.08);
  color: var(--white);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.share__close:hover { background: rgba(255,255,255,.16); }
.share__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }

/* Loading checklist */
.checking { list-style: none; margin: 0; padding: 4px 0; display: grid; gap: 14px; }
.checking li { display: flex; align-items: center; gap: 12px; font-size: 16px; color: var(--dim); transition: color .2s ease; }
.checking li i {
  width: 18px; height: 18px; flex: none;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  position: relative;
}
.checking li.is-active { color: var(--white); }
.checking li.is-active i { border-color: var(--white); border-right-color: transparent; animation: spin .8s linear infinite; }
.checking li.is-done { color: var(--soft); }
.checking li.is-done i { border-color: var(--go); background: var(--go); }
.checking li.is-done i::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #000; border-width: 0 2px 2px 0; transform: rotate(45deg); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Read card ---------- */
.read { display: grid; gap: 18px; }
.read__head { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; }
.read__img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #222; }
.read__img--blank { display: grid; place-items: center; font: 600 16px/1 var(--sans); color: var(--soft); }
.read__name { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.read__sym { margin: 3px 0 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font: 500 14px/1.3 var(--mono); color: var(--soft); }
.read__copy {
  font: 500 13px/1 var(--mono);
  color: var(--soft);
  background: rgba(255,255,255,.07);
  border: 0;
  border-radius: 6px;
  padding: 5px 7px;
  cursor: pointer;
}
.read__copy:hover { color: var(--white); background: rgba(255,255,255,.14); }

.risk {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  padding: 7px 12px 7px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.risk i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.risk--high { color: var(--stop); background: rgba(255,69,58,.14); }
.risk--mixed { color: var(--warn); background: rgba(255,179,64,.14); }
.risk--low { color: var(--go); background: rgba(48,209,88,.14); }

.read__grid { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.read__cell { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.read__cell:nth-child(odd) { border-right: 1px solid var(--line); }
.read__cell:nth-last-child(-n+2) { border-bottom: 0; }
.read__k { margin: 0 0 4px; font-size: 13px; color: var(--soft); }
.read__v { margin: 0; font: 500 18px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.read__v.up { color: var(--go); }
.read__v.down { color: var(--stop); }

.curve { display: grid; gap: 8px; }
.curve__k { margin: 0; font-size: 14px; color: var(--soft); display: flex; justify-content: space-between; }
.curve__k b { color: var(--white); font-weight: 600; font-family: var(--mono); }
.curve__bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.curve__bar span { display: block; height: 100%; background: var(--go); border-radius: 3px; }

.flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.flags li { display: grid; grid-template-columns: 10px 1fr; gap: 12px; align-items: baseline; font-size: 15px; line-height: 1.45; color: var(--soft); }
.flags li i { width: 8px; height: 8px; border-radius: 50%; transform: translateY(-1px); }
.flags .f-high { color: var(--white); }
.flags .f-high i { background: var(--stop); }
.flags .f-med i { background: var(--warn); }
.flags .f-good i { background: var(--go); }

.read__links { display: flex; flex-wrap: wrap; gap: 8px; }
.read__links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
}
.read__links a:hover { background: rgba(255,255,255,.08); }
.read__links a.read__share { background: var(--white); color: #000; border-color: var(--white); }
.read__note { margin: 0; font-size: 13px; color: var(--dim); }

.read-error { margin: 0; font-size: 16px; color: var(--soft); line-height: 1.5; }

/* Wide screens: once Vera shares her read, it takes the left column and the call moves right */
@media (min-width: 1200px) {
  .call.has-read .share { bottom: clamp(28px, 4vh, 44px); }
  .call.has-read .call__lower { padding-left: calc(min(440px, 34vw) + 40px); }
  .call.has-read .captions__text { font-size: clamp(22px, 2.1vw, 30px); }
}

/* ---------- App variant ---------- */
.call--app .call__shade {
  background:
    linear-gradient(90deg, rgba(0,0,0,.7) 0%, rgba(0,0,0,.25) 36%, rgba(0,0,0,0) 56%),
    linear-gradient(0deg, rgba(0,0,0,.95) 0%, rgba(0,0,0,.7) 26%, rgba(0,0,0,0) 52%),
    linear-gradient(180deg, rgba(0,0,0,.6) 0%, rgba(0,0,0,0) 14%);
}
.call--app .share { top: 84px; }
.call--app .selfview { top: 84px; }
.call--app .call__lower { gap: 16px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 960px) {
  .call__feed, .call__shade { height: 66svh; min-height: 420px; }
  .call__feed img, .call__video { object-position: 50% 22%; }
  .call__talk { object-position: 72% 30%; }
  .call__shade, .call--app .call__shade {
    background:
      linear-gradient(0deg, #000 0%, rgba(0,0,0,.86) 20%, rgba(0,0,0,0) 52%),
      linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 18%);
  }
  .call__screen { min-height: 100svh; padding-bottom: 28px; }
  .call__title { position: static; transform: none; max-width: 34rem; margin: 30px auto 0; text-align: center; order: 3; }
  .call__title-tag { font-size: clamp(38px, 10vw, 52px); margin-bottom: 14px; }
  .call__title-lede { font-size: 16px; max-width: none; margin-inline: auto; }
  .call__status { justify-content: center; text-align: left; font-size: 14px; }
  .call.has-read .call__title { display: none; }
  .selfview { display: none; }
  .captions { min-height: 0; }
  .captions__text { font-size: clamp(20px, 5.4vw, 26px); }
  .composer__input { font-size: 16px; padding-left: 14px; }

  .share {
    position: relative;
    left: auto; top: auto; bottom: auto;
    width: auto;
    margin: 0 var(--pad) 28px;
    max-height: none;
    animation: none;
  }
  .call--app .share { top: auto; }
  .share__body { overflow: visible; }

  .controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; width: 100%; max-width: 420px; }
  .ctrl { min-width: 0; font-size: 12px; gap: 6px; }
  .ctrl__icon { width: 50px; height: 50px; }
}

@media (max-width: 420px) {
  .composer .btn { padding: 0 16px; }
  .read__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .wave i, .checking li.is-active i { animation: none; }
  .share { animation: none; }
}

.call__title .call__status { margin-top: 26px; }
@media (max-width: 960px) { .call__title .call__status { margin-top: 18px; } }

/* Vera's chapter on the homepage: on phones the heading sits over her portrait */
@media (max-width: 960px) {
  .call--chapter .call__title-tag { position: absolute; top: 34px; left: var(--pad); right: var(--pad); margin: 0; text-align: left; font-size: clamp(40px, 11vw, 58px); text-shadow: 0 2px 28px rgba(0,0,0,.7); }
  .call--chapter .call__title { margin-top: 22px; }
}
