/* Let's Talk drawer (phase 3 §3; behaviour in js/core/talk.js). Persistent shell outside the
   Barba container: above the dock (800) and scrollbar (850), below the wipe (900) and splash. */

.talk {
  position: fixed;
  inset: 0;
  z-index: 880;
  --talk-bg: #0E0E12;
  --talk-text: #EDEBE6;
  --talk-muted: #8C8A85;
  --talk-accent: #8EA2F0;
  --talk-err: #FF8A8A;
}

.talk[hidden] { display: none; }

.talk__scrim {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 15, .45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* the panel plus its liquid edge move together */
.talk__track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: max(50vw, 560px);
  will-change: transform;
}

.talk__edge {
  position: absolute;
  top: 0;
  left: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--talk-bg);
  pointer-events: none;
}

.talk__panel {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--talk-bg);
  color: var(--talk-text);
  scrollbar-width: thin;
  scrollbar-color: rgba(237, 235, 230, .25) transparent;
}

.talk__panel:focus { outline: none; }

.talk__content {
  position: relative;
  min-height: 100%;
  max-width: 720px;
  padding: max(clamp(64px, 11vh, 112px), env(safe-area-inset-top)) clamp(24px, 5vw, 72px) max(48px, env(safe-area-inset-bottom));
}

.talk__content > :not(.talk__ink) { position: relative; z-index: 1; }

/* the ink line sits behind the content (it loops behind the heading) */
.talk__ink {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
  stroke: var(--talk-accent);
  stroke-linecap: round;
}

.talk__pen { fill: var(--talk-accent); stroke: none; }

.talk__close {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  right: 20px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(237, 235, 230, .25);
  border-radius: 50%;
  background: transparent;
  color: var(--talk-text);
  cursor: pointer;
  transition: border-color .3s, background-color .3s;
}

.talk__content > .talk__close { position: absolute; }
.talk__close:hover { border-color: var(--talk-text); background: rgba(237, 235, 230, .06); }

.talk__eyebrow {
  margin: 0 0 20px;
  font-weight: 500;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--talk-accent);
}

.talk__title {
  max-width: 16ch;
  margin: 0;
  font-weight: 400;
  font-size: clamp(2rem, 3.2vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -.02em;
}

.talk__sub {
  margin: 18px 0 0;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.5;
  color: var(--talk-muted);
}

/* ---------- form ---------- */

.talk__form {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-top: 48px;
}

.talk__form[hidden] { display: none; }

.talk__field { position: relative; display: flex; flex-direction: column; }

.talk__label,
.talk__chips legend {
  margin: 0 0 6px;
  padding: 0;
  font-weight: 500;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--talk-muted);
}

.talk__hint { text-transform: none; letter-spacing: 0; font-weight: 400; }

.talk__input {
  width: 100%;
  padding: 10px 0 12px;
  border: 0;
  border-bottom: 1px solid rgba(237, 235, 230, .25);
  border-radius: 0;
  background: transparent;
  color: var(--talk-text);
  font: 400 18px/1.4 var(--font-sans);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

textarea.talk__input {
  min-height: calc(4 * 1.4em + 22px);
  resize: none;
  overflow: hidden;
}

.talk__input::placeholder { color: rgba(237, 235, 230, .35); }

/* animated underline growing from the left on focus */
.talk__line {
  display: block;
  height: 2px;
  margin-top: -2px;
  background: var(--talk-text);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .5s var(--ease-out);
  pointer-events: none;
}

.talk__field:focus-within .talk__line { transform: scaleX(1); }
.talk__field.is-invalid .talk__input { border-bottom-color: var(--talk-err); }
.talk__field.is-invalid .talk__line { background: var(--talk-err); }

.talk__error {
  min-height: 0;
  margin: 6px 0 0;
  font-weight: 400;
  font-size: 13px;
  line-height: 1.4;
  color: var(--talk-err);
}

.talk__error:empty { display: none; }

.talk__chips {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.talk__chips[hidden] { display: none; }

.talk__chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.talk__chip-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.talk__chip {
  padding: 8px 16px;
  border: 1px solid rgba(237, 235, 230, .3);
  border-radius: 999px;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.3;
  color: var(--talk-text);
  cursor: pointer;
  user-select: none;
  transition: background-color .3s, border-color .3s, color .3s;
}

.talk__chip:hover { border-color: var(--talk-text); }
.talk__chip-input:checked + .talk__chip { border-color: var(--blue); background: var(--blue); color: #fff; }
.talk__chip-input:focus-visible + .talk__chip { outline: 2px solid var(--talk-text); outline-offset: 2px; }

.talk__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* submit: full-width blue pill, label rolls to SENDING…, arrow slides on hover */
.talk__submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 6px;
  padding: 19px 24px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font: 500 14px/1.4 var(--font-sans);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .4s var(--ease-out), opacity .3s;
}

.talk__submit:hover { background: var(--blue-ink); }
.talk__submit:disabled { cursor: default; opacity: .6; }
.talk__submit.is-sending { opacity: 1; }

.talk__submit-roll {
  display: grid;
  height: 1.4em;
  overflow: hidden;
}

.talk__submit-a,
.talk__submit-b {
  grid-area: 1 / 1;
  transition: translate .45s var(--ease-out);
}

.talk__submit-b { translate: 0 100%; }
.talk__submit.is-sending .talk__submit-a { translate: 0 -100%; }
.talk__submit.is-sending .talk__submit-b { translate: 0 0; }

.talk__submit-arrow { flex: none; transition: translate .45s var(--ease-out); }
.talk__submit:hover:not(:disabled) .talk__submit-arrow { translate: 5px 0; }
.talk__submit.is-sending .talk__submit-arrow { opacity: 0; }

.talk__progress {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 10px;
  height: 1px;
  background: rgba(255, 255, 255, .7);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0;
}

.talk__submit.is-sending .talk__progress { opacity: 1; animation: talk-progress 1.2s var(--ease-in-out) infinite; }

@keyframes talk-progress {
  0% { transform: scaleX(0); transform-origin: 0 50%; }
  50% { transform: scaleX(1); transform-origin: 0 50%; }
  51% { transform-origin: 100% 50%; }
  100% { transform: scaleX(0); transform-origin: 100% 50%; }
}

.talk__submit:focus-visible,
.talk__close:focus-visible,
.talk__copy:focus-visible,
.talk__done-close:focus-visible,
.talk__direct a:focus-visible,
.talk__fail a:focus-visible {
  outline: 2px solid var(--talk-text);
  outline-offset: 3px;
}

.talk__status {
  margin: -14px 0 0;
  font-weight: 400;
  font-size: 13px;
  line-height: 1.4;
  color: var(--talk-muted);
}

.talk__status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* ---------- success / failure ---------- */

.talk__done {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  margin-top: 150px;
}

.talk__done[hidden],
.talk__fail[hidden] { display: none; }

.talk__done-text {
  margin: 0;
  font-weight: 400;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  line-height: 1.2;
  outline: none;
}

.talk__done-close,
.talk__copy {
  padding: 8px 16px;
  border: 1px solid rgba(237, 235, 230, .35);
  border-radius: 999px;
  background: transparent;
  color: var(--talk-text);
  font: 500 12px/1.4 var(--font-sans);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .3s, background-color .3s;
}

.talk__done-close:hover,
.talk__copy:hover { border-color: var(--talk-text); background: rgba(237, 235, 230, .06); }

.talk__fail {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 138, 138, .35);
  border-radius: 12px;
}

.talk__fail-text {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--talk-err);
}

/* ---------- direct contacts ---------- */

.talk__direct {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid rgba(237, 235, 230, .12);
}

.talk__direct-h {
  margin: 0;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--talk-muted);
}

.talk__direct-row,
.talk__direct-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0;
}

.talk__direct a {
  color: var(--talk-text);
  font-size: 16px;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .45s var(--ease-out);
}

.talk__fail a { color: var(--talk-text); font-size: 16px; }

.talk__direct a:hover,
.talk__direct a:focus-visible { background-size: 100% 1px; }

/* ---------- phones: full width, full height ---------- */

@media (max-width: 760px) {
  .talk__track { width: 100vw; }
  .talk__close { right: 14px; }
  .talk__content { padding-left: 22px; padding-right: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .talk__track { will-change: auto; }

  .talk__line,
  .talk__chip,
  .talk__submit-a,
  .talk__submit-b,
  .talk__submit-arrow,
  .talk__direct a { transition: none; }

  .talk__submit.is-sending .talk__progress { animation: none; transform: scaleX(1); }
}

/* ---------- phase 3.1 §8: mobile number (country code + national number) ---------- */

.talk__phone-row {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.talk__cc {
  flex: none;
  max-width: 44%;
  padding: 10px 26px 12px 0;
  border: 0;
  border-bottom: 1px solid rgba(237, 235, 230, .25);
  border-radius: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23EDEBE6' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 4px center / 10px 6px no-repeat;
  color: var(--talk-text);
  font: 400 18px/1.4 var(--font-sans);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.talk__cc option { background: #16161B; color: var(--talk-text); }
.talk__cc:focus-visible { outline: 2px solid var(--talk-text); outline-offset: 2px; }
.talk__phone-row .talk__input { flex: 1; min-width: 0; }
.talk__field.is-invalid .talk__cc { border-bottom-color: var(--talk-err); }

.talk__chips .talk__error { margin-top: 8px; }
.talk__chips.is-invalid .talk__chip { border-color: rgba(255, 138, 138, .55); }

.talk__fail-reason {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--talk-text);
}
