:root {
  --bg: #0a0806;
  --bg-2: #14110c;
  --paper: #efe4d0;
  --paper-dim: rgba(239, 228, 208, 0.62);
  --paper-faint: rgba(239, 228, 208, 0.34);
  --filament: #e3944a;
  --filament-hot: #ffc37a;
  --ember: #c45c2a;
  --line: rgba(239, 228, 208, 0.12);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --display: "Syne", ui-sans-serif, sans-serif;
  --serif: "Fraunces", ui-serif, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background: var(--bg);
}

body {
  color: var(--paper);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 320;
  line-height: 1.45;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(196, 92, 42, 0.16), transparent 55%),
    radial-gradient(900px 500px at -10% 110%, rgba(227, 148, 74, 0.08), transparent 50%),
    var(--bg);
  display: grid;
  grid-template-columns: minmax(4.5rem, 1fr) minmax(18rem, 34rem) minmax(16rem, 22rem) minmax(1.5rem, 1fr);
  grid-template-rows: auto 1fr auto;
  column-gap: clamp(1.25rem, 3vw, 3rem);
  row-gap: 0;
  padding:
    calc(1.4rem + env(safe-area-inset-top))
    calc(1.4rem + env(safe-area-inset-right))
    calc(1.1rem + env(safe-area-inset-bottom))
    calc(1.4rem + env(safe-area-inset-left));
}

::selection {
  background: rgba(227, 148, 74, 0.35);
  color: var(--paper);
}

.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.skip:focus-within {
  position: fixed;
  z-index: 20;
  clip: auto;
  width: auto;
  height: auto;
  top: 0.6rem;
  left: 0.6rem;
  padding: 0.4rem 0.7rem;
  background: var(--bg-2);
  color: var(--paper);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.grain,
.wash {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.grain {
  z-index: 8;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.9'/></svg>");
}

.wash {
  z-index: 7;
  background: radial-gradient(closest-side at 50% 48%, transparent 40%, rgba(10, 8, 6, 0.55) 100%);
}

.mast {
  grid-column: 2 / 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.2rem;
  animation: rise 900ms var(--ease) both;
}

.callsign,
.domain,
.hint,
.pipeline,
.vita,
.type-prompt,
.type button,
.type input::placeholder {
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.callsign,
.domain {
  margin: 0;
  font-size: 0.68rem;
  color: var(--paper-faint);
}

.name {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.seal {
  grid-column: 1;
  grid-row: 1 / 3;
  margin: 0;
  justify-self: end;
  align-self: stretch;
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-weight: 320;
  font-size: 0.95rem;
  letter-spacing: 0.55em;
  color: var(--paper-faint);
  padding-top: 0.35rem;
  animation: rise 1100ms var(--ease) both;
}

.stage {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 0;
  padding: 0.6rem 0 0.8rem;
}

.tagline {
  margin: 0 0 1.6rem;
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  font-style: italic;
  font-weight: 320;
  font-variation-settings: "opsz" 72;
  color: var(--paper-dim);
  animation: rise 1000ms var(--ease) 80ms both;
}

.capsule {
  --glow: 0.18;
  --spin: 1;
  appearance: none;
  position: relative;
  width: min(58vw, 22rem);
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: #1a120c;
  cursor: pointer;
  isolation: isolate;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  animation: rise 1100ms var(--ease) 140ms both, breathe 5.6s ease-in-out 1.2s infinite;
  box-shadow:
    0 0 0 1px rgba(239, 228, 208, 0.08),
    0 18px 50px rgba(0, 0, 0, 0.45),
    0 0 calc(90px + var(--glow) * 80px) calc(12px + var(--glow) * 24px)
      rgba(227, 148, 74, calc(0.12 + var(--glow) * 0.35));
  transition: box-shadow 180ms var(--ease), transform 180ms var(--ease);
}

.capsule:hover,
.capsule:focus-visible {
  --glow: 0.34;
  transform: scale(1.015);
}

.capsule:focus-visible {
  outline: 2px solid var(--filament);
  outline-offset: 8px;
}

.capsule.is-listening,
.capsule.is-speaking {
  animation: rise 1100ms var(--ease) 140ms both;
  --glow: 0.62;
}

.capsule.is-listening {
  transform: scale(1.03);
}

.capsule-photo,
.capsule-wave,
.capsule-glow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.capsule-photo {
  object-fit: cover;
  object-position: 50% 46%;
  z-index: 1;
  filter: saturate(1.05) contrast(1.08);
}

.capsule-wave {
  z-index: 2;
  pointer-events: none;
}

.capsule-glow {
  z-index: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 195, 122, 0.28), transparent 62%);
  opacity: var(--glow);
  transform: scale(1.18);
}

.hint,
.live,
.reply {
  margin: 0;
}

.live:empty,
.reply:empty {
  display: none;
}

.hint {
  margin-top: 1.35rem;
  font-size: 0.68rem;
  color: var(--paper-faint);
  animation: rise 1100ms var(--ease) 220ms both;
}

.live {
  margin-top: 0.7rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--filament-hot);
  min-height: 1.2em;
}

.reply {
  margin-top: 0.55rem;
  max-width: 28rem;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  font-style: italic;
  font-variation-settings: "opsz" 48;
  color: var(--paper);
  min-height: 1.5em;
}

.pipeline {
  display: flex;
  gap: 0.85rem;
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  font-size: 0.62rem;
  color: var(--paper-faint);
  animation: rise 1100ms var(--ease) 280ms both;
}

.pipeline li {
  position: relative;
  padding-left: 0.85rem;
}

.pipeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.28em;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: rgba(239, 228, 208, 0.18);
  box-shadow: 0 0 0 0 transparent;
  transition: background 160ms var(--ease), box-shadow 160ms var(--ease);
}

.pipeline li.on::before {
  background: var(--filament);
  box-shadow: 0 0 10px var(--filament);
}

.pipeline li.hot::before {
  background: var(--filament-hot);
  box-shadow: 0 0 12px var(--filament-hot);
}

.notes {
  grid-column: 3;
  grid-row: 2;
  align-self: center;
  max-width: 22rem;
  color: var(--paper-dim);
  font-size: 0.98rem;
  font-variation-settings: "opsz" 18;
  animation: rise 1200ms var(--ease) 180ms both;
}

.notes p {
  margin: 0 0 0.9rem;
}

.notes-foot {
  color: var(--paper-faint);
  font-size: 0.86rem;
}

.dock {
  grid-column: 2 / 4;
  grid-row: 3;
  display: grid;
  grid-template-columns: 1fr minmax(16rem, 22rem);
  gap: 1rem 2rem;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  animation: rise 1200ms var(--ease) 260ms both;
}

.vita {
  margin: 0;
  font-size: 0.64rem;
  color: var(--paper-faint);
  line-height: 1.7;
  letter-spacing: 0.1em;
}

.vita-sep {
  margin: 0 0.35rem;
}

.type {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
}

.type-prompt {
  color: var(--filament);
  font-size: 0.85rem;
  letter-spacing: 0;
}

.type input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 0.98rem;
  font-style: italic;
  padding: 0.2rem 0;
  outline: none;
}

.type input::placeholder {
  color: var(--paper-faint);
  letter-spacing: 0.08em;
  font-style: normal;
  font-size: 0.62rem;
}

.type button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--paper-faint);
  font-size: 0.62rem;
  padding: 0.2rem 0;
  cursor: pointer;
}

.type button:hover,
.type input:focus + button {
  color: var(--filament);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.018);
  }
}

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto auto;
    padding: calc(1rem + env(safe-area-inset-top)) 1.1rem calc(0.8rem + env(safe-area-inset-bottom));
  }

  .seal {
    grid-column: 1;
    grid-row: 1;
    writing-mode: horizontal-tb;
    letter-spacing: 0.48em;
    justify-self: start;
    align-self: start;
    font-size: 0.78rem;
    padding: 0 0 0.35rem;
  }

  .mast {
    grid-column: 1;
    grid-row: 2;
  }

  .stage {
    grid-column: 1;
    grid-row: 3;
    padding: 1.2rem 0;
  }

  .capsule {
    width: min(72vw, 18.5rem);
  }

  .notes,
  .dock {
    grid-column: 1;
  }

  .notes {
    grid-row: 4;
    max-width: none;
    padding: 0 0.2rem 1rem;
  }

  .dock {
    grid-row: 5;
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
