@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=JetBrains+Mono:wght@500&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --ink: #1f1f1c;
  --muted: rgba(31, 31, 28, 0.7);
  --accent: #1f4f45;
  --accent-strong: var(--accent);
  --panel: rgba(253, 247, 236, 0.82);
  --panel-strong: rgba(253, 247, 236, 0.96);
  --border: rgba(31, 31, 28, 0.12);
  --shadow: 0 24px 60px rgba(31, 31, 28, 0.16);
  --chat-accent: #1f4f45;
  --chat-panel: #fdf7ec;
  --chat-shadow: 0 20px 50px rgba(31, 31, 28, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: radial-gradient(circle at top, #fff6e6 0%, #f3efe6 45%, #efe7d6 100%);
  color: var(--ink);
  min-height: 100vh;
  display: grid;
  place-items: center;
}

body.is-detail {
  align-items: start;
  padding: 32px 16px 24px;
}

/* Stage layout */

.stage {
  width: min(92vw, 900px);
  display: grid;
  place-items: center;
  text-align: center;
}

.stage.is-detail {
  place-items: start center;
  padding-top: 0;
}

.stage.is-detail .typewriter,
.stage.is-detail .subtext {
  display: none;
}

/* Intro typewriter */

.typewriter {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
  font-size: clamp(1.3rem, 2.6vw, 2.1rem);
  letter-spacing: 0.01em;
  text-align: left;
  align-items: start;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.subtext {
  margin-top: 26px;
  font-size: clamp(0.82rem, 1.2vw, 0.98rem);
  color: rgba(31, 31, 28, 0.7);
  display: grid;
  gap: 0.2rem;
  justify-items: start;
  text-align: left;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.subtext-line {
  opacity: 0;
  transform: translateY(4px);
}

.subtext-line-1 {
  animation: fade-in 0.6s ease 5.1s forwards;
}

.subtext-line-2 {
  animation: fade-in 0.6s ease 5.8s forwards;
}

.stage-fade-out {
  opacity: 0;
  transform: translateY(-6px);
}

.typewriter-line {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  border-right: 2px solid transparent;
  width: 0;
  animation: typing var(--t) steps(var(--ch), end) var(--d) forwards,
    caret var(--t) linear var(--d) forwards;
}

.typewriter-line.tl-1 {
  --d: 200ms;
  --t: 1.2s;
  --ch: 20;
}

.typewriter-line.tl-2 {
  --d: 1500ms;
  --t: 0.7s;
  --ch: 9;
}

.typewriter-line.tl-3 {
  --d: 2300ms;
  --t: 0.7s;
  --ch: 9;
}

.typewriter-line.tl-4 {
  --d: 3750ms;
  --t: 0.9s;
  --ch: 15;
}

.ai-accent {
  background: linear-gradient(
    110deg,
    #145043 0%,
    #2a6f61 35%,
    #a8c3b8 50%,
    #2a6f61 65%,
    #145043 100%
  );
  background-size: 200% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: ai-shine 20s ease-in-out infinite;
  text-shadow: 0 0 1px rgba(73, 181, 155, 0.04);
}

.project-detail {
  margin-top: 0;
  align-self: start;
  justify-self: center;
  max-width: 560px;
  font-size: clamp(0.95rem, 1.35vw, 1.05rem);
  color: rgba(31, 31, 28, 0.78);
  line-height: 1.5;
  opacity: 0;
  animation: fade-in 0.6s ease forwards;
  text-align: left;
}

.project-detail .stage-header {
  justify-content: flex-start;
}

/* Reveal helpers */

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  animation: none;
}

[data-reveal="left"] {
  transform: translateX(-18px);
}

[data-reveal="right"] {
  transform: translateX(18px);
}

.reveal-bottom {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left,
.reveal-right {
  opacity: 1;
  transform: translateX(0);
}

/* Stage panels */

.stage-panel {
  width: min(92vw, 880px);
  background: var(--panel);
  border-radius: 28px;
  padding: 24px 48px 44px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  margin-top: -32px;
  text-align: left;
}

.stage-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(31, 79, 69, 0.14), transparent 60%);
  pointer-events: none;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.stage-header .stage-tag {
  margin-left: auto;
}

.stage-title {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  text-align: left;
}

.stage-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-strong);
  background: rgba(31, 79, 69, 0.14);
  padding: 10px 16px;
  border-radius: 999px;
}

.stage-copy {
  position: relative;
  z-index: 1;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--muted);
  margin: 0 0 22px;
  text-align: left;
}

.stage-link {
  color: var(--accent-strong);
  text-decoration: none;
  border-bottom: 1px solid rgba(31, 79, 69, 0.3);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.stage-link:hover {
  color: var(--ink);
  border-bottom-color: rgba(31, 79, 69, 0.6);
}

.subtle-highlight {
  background: linear-gradient(120deg, rgba(31, 79, 69, 0.14), rgba(31, 79, 69, 0.05));
  border-radius: 8px;
  padding: 0 6px;
  color: var(--ink);
}

.stage-subtitle {
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(31, 31, 28, 0.55);
  margin: 8px 0 12px;
  position: relative;
  z-index: 1;
  text-align: left;
}

.stage-section {
  margin-top: 22px;
}

/* Architecture diagram */

.architecture-stack {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  margin: 28px 0 24px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(31, 79, 69, 0.08);
  border: 1px solid rgba(31, 79, 69, 0.12);
}

.architecture-banner {
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--accent-strong);
  background: rgba(31, 79, 69, 0.16);
  padding: 10px 14px;
  border-radius: 999px;
  text-align: center;
}

.architecture-node {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(31, 31, 28, 0.12);
  border-radius: 16px;
  padding: 16px 18px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

.architecture-arrow {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 38px;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: rgba(31, 31, 28, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  animation: arrowPulse 3.6s ease-in-out infinite;
}

.architecture-arrow::before {
  content: "";
  width: 2px;
  height: 26px;
  background: linear-gradient(180deg, rgba(31, 79, 69, 0.1), rgba(31, 79, 69, 0.55));
  border-radius: 999px;
}

.architecture-arrow::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid rgba(31, 79, 69, 0.55);
}

.architecture-arrow span {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(31, 31, 28, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

@keyframes arrowPulse {
  0% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.7;
  }
}


.stage-panel.is-experiments .stage-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.stage-panel.is-experiments .stage-copy {
  font-size: 1.03rem;
  margin-bottom: 18px;
}

.stage-panel.is-experiments .stage-subtitle {
  font-size: 0.95rem;
  margin: 10px 0 10px;
}

.stage-image {
  display: block;
  width: min(100%, 560px);
  margin: 8px auto 22px;
  border-radius: 18px;
  border: 1px solid rgba(31, 31, 28, 0.12);
  box-shadow: 0 18px 36px rgba(31, 31, 28, 0.16);
  object-fit: cover;
  opacity: 1;
}

.stage-note {
  margin-top: 18px;
  font-size: 0.95rem;
  color: rgba(31, 31, 28, 0.6);
  position: relative;
  z-index: 1;
}

.focus-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 10px 0 0;
  position: relative;
  z-index: 1;
}

.focus-card {
  background: var(--panel-strong);
  border: 1px solid rgba(31, 31, 28, 0.12);
  border-radius: 18px;
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  opacity: 1;
}

.focus-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(31, 31, 28, 0.55);
}

.focus-card p {
  margin: 0;
  color: rgba(31, 31, 28, 0.75);
  line-height: 1.5;
  font-size: 0.96rem;
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.stage-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--accent-strong);
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stage-cta.primary {
  background: linear-gradient(135deg, #1f4f45, #145043);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 14px 26px rgba(31, 79, 69, 0.28);
}

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

.experiment-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 10px;
  position: relative;
  z-index: 1;
}

.experiment-card {
  background: var(--panel-strong);
  border: 1px solid rgba(31, 31, 28, 0.12);
  border-radius: 18px;
  padding: 16px 18px;
  display: grid;
  gap: 8px;
  min-height: 140px;
}

.experiment-card h3 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--ink);
}

.experiment-card p {
  margin: 0;
  color: rgba(31, 31, 28, 0.7);
  line-height: 1.6;
  font-size: 0.95rem;
}

.experiment-card .meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(31, 31, 28, 0.5);
}

/* Origin panel (legacy section) */

.origin-panel {
  --origin-ink: #1f1f1c;
  --origin-muted: rgba(31, 31, 28, 0.7);
  --origin-panel: rgba(253, 247, 236, 0.82);
  --origin-panel-strong: rgba(253, 247, 236, 0.96);
  --origin-border: rgba(31, 31, 28, 0.12);
  --origin-shadow: 0 24px 60px rgba(31, 31, 28, 0.16);
  background: var(--origin-panel);
  border: 1px solid var(--origin-border);
  border-radius: 28px;
  padding: 28px 44px 42px;
  box-shadow: var(--origin-shadow);
  position: relative;
  overflow: hidden;
  color: var(--origin-ink);
  text-align: left;
}

.origin-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(31, 79, 69, 0.12), transparent 60%);
  pointer-events: none;
}

.origin-panel h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  letter-spacing: -0.02em;
  opacity: 0;
  animation: origin-rise 0.7s ease 0.05s forwards;
}

.origin-panel .stage-section {
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(31, 31, 28, 0.12);
  border-left: 4px solid rgba(31, 79, 69, 0.55);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(253, 247, 236, 0.98), rgba(255, 255, 255, 0.85));
  box-shadow: 0 16px 30px rgba(31, 31, 28, 0.12);
  opacity: 0;
  transform: translateY(10px);
  animation: origin-rise 0.7s ease forwards;
}

.origin-panel .stage-section:nth-of-type(1) {
  animation-delay: 0.15s;
}

.origin-panel .stage-section:nth-of-type(2) {
  animation-delay: 0.3s;
}

.origin-panel .stage-section:nth-of-type(3) {
  animation-delay: 0.45s;
}

.origin-panel .stage-subtitle {
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(31, 31, 28, 0.55);
  margin: 0 0 10px;
  position: relative;
}

.origin-panel .stage-subtitle::after {
  content: "";
  display: block;
  height: 2px;
  width: 56px;
  margin-top: 8px;
  background: linear-gradient(90deg, rgba(31, 79, 69, 0.65), transparent);
}

.origin-panel .stage-copy {
  margin: 0 0 12px;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--origin-muted);
  text-align: left;
}

.origin-panel .stage-section .stage-copy:last-child {
  margin-bottom: 0;
}

/* Stage animations */

.stage-panel:is(.is-animated, .is-animated-header) .stage-header {
  opacity: 0;
  animation: rise-in 0.6s ease 0.1s forwards;
}

.stage-panel.is-animated .stage-copy {
  opacity: 0;
  animation: rise-in 0.8s ease 0.2s forwards;
}

.stage-panel.is-animated .stage-copy + .stage-copy {
  animation-delay: 0.4s;
}

.stage-panel.is-animated .stage-subtitle {
  opacity: 0;
  animation: rise-in 0.7s ease 0.3s forwards;
}

.stage-panel.is-animated-cards .focus-card {
  opacity: 0;
  animation: rise-in 0.6s ease 0.45s forwards;
}

.stage-panel.is-animated-cards .focus-card:nth-child(2) {
  animation-delay: 0.6s;
}

.stage-panel.is-animated-cards .focus-card:nth-child(3) {
  animation-delay: 0.75s;
}

/* Chat widget */

.chat-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--chat-accent);
  color: #f7f3ea;
  font-size: 1.6rem;
  box-shadow: var(--chat-shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 60px rgba(31, 31, 28, 0.22);
}

.chat-toggle.is-minimized {
  opacity: 0.55;
  transform: scale(0.82);
  box-shadow: 0 10px 24px rgba(31, 31, 28, 0.14);
}

.chat-toggle.is-pulse {
  animation: chat-pulse 1.38s cubic-bezier(0.2, 0.75, 0.25, 1) 1;
}

.chat-hint {
  position: fixed;
  right: 92px;
  bottom: 28px;
  background: rgba(253, 247, 236, 0.98);
  border: 1px solid rgba(31, 31, 28, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: rgba(31, 31, 28, 0.72);
  box-shadow: 0 16px 36px rgba(31, 31, 28, 0.14);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.chat-hint.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.contact-hint {
  position: fixed;
  left: 92px;
  bottom: 28px;
  background: rgba(253, 247, 236, 0.98);
  border: 1px solid rgba(31, 31, 28, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: rgba(31, 31, 28, 0.72);
  box-shadow: 0 16px 36px rgba(31, 31, 28, 0.14);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.contact-hint.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.contact-hint.is-emphasis {
  background: rgba(31, 79, 69, 0.1);
  border-color: rgba(31, 79, 69, 0.25);
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(31, 31, 28, 0.16);
}

.contact-toggle {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: rgba(31, 79, 69, 0.08);
  color: var(--ink);
  font-size: 1.3rem;
  box-shadow: var(--chat-shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

@media (max-width: 520px) {
  .chat-toggle {
    right: 16px;
    bottom: 16px;
  }

  .contact-toggle {
    left: 16px;
    bottom: 16px;
  }
}

.contact-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 60px rgba(31, 31, 28, 0.22);
  background: rgba(31, 79, 69, 0.16);
}


.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: min(360px, calc(100vw - 48px));
  background: var(--chat-panel);
  border-radius: 18px;
  box-shadow: var(--chat-shadow);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(31, 31, 28, 0.08);
}

.chat-widget[hidden] {
  display: none;
}

@media (max-width: 520px) {
  .chat-widget {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 88px;
    max-height: 70svh;
  }

  .chat-body {
    max-height: 45svh;
  }
}

.contact-widget {
  position: fixed;
  left: 24px;
  bottom: 96px;
  width: min(320px, calc(100vw - 48px));
  background: var(--chat-panel);
  border-radius: 18px;
  box-shadow: var(--chat-shadow);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid rgba(31, 31, 28, 0.08);
}

.contact-widget[hidden] {
  display: none;
}

.contact-header {
  background: var(--chat-accent);
  color: #f7f3ea;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.contact-close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
}

.contact-body {
  padding: 16px;
  display: grid;
  gap: 8px;
  color: rgba(31, 31, 28, 0.8);
}

.contact-body p {
  margin: 0;
  line-height: 1.5;
}

.contact-mail {
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
  word-break: break-all;
}

.contact-note {
  font-size: 0.85rem;
  color: rgba(31, 31, 28, 0.55);
}

.contact-credit {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(31, 31, 28, 0.12);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: rgba(31, 31, 28, 0.62);
  line-height: 1.35;
}

.contact-credit a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(31, 31, 28, 0.26);
}

.chat-header {
  background: var(--chat-accent);
  color: #f7f3ea;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.chat-close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
}

.chat-body {
  padding: 16px;
  display: grid;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
}

.chat-history-toggle {
  border: 1px dashed rgba(31, 31, 28, 0.25);
  background: rgba(31, 79, 69, 0.08);
  color: rgba(31, 31, 28, 0.7);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  justify-self: center;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chat-history-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 79, 69, 0.45);
  color: var(--ink);
}

.chat-message {
  display: grid;
  gap: 6px;
}

.chat-message.is-hidden {
  display: none;
}

.chat-message.is-old {
  opacity: 0.55;
}

.chat-message.is-latest {
  opacity: 1;
}

.chat-message strong {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(31, 31, 28, 0.55);
}

.chat-bubble {
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(31, 31, 28, 0.08);
  line-height: 1.4;
  display: grid;
  gap: 10px;
  white-space: pre-line;
}

.chat-message.user .chat-bubble {
  background: rgba(31, 79, 69, 0.12);
  border-color: rgba(31, 79, 69, 0.2);
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(31, 31, 28, 0.45);
  opacity: 0;
  animation: typing-dots 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

.chat-footer {
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(31, 31, 28, 0.08);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.chat-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(31, 31, 28, 0.2);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
}

.chat-input:focus {
  outline: 2px solid rgba(31, 79, 69, 0.25);
  border-color: rgba(31, 79, 69, 0.45);
}

.chat-status {
  font-size: 0.8rem;
  color: rgba(31, 31, 28, 0.55);
  min-height: 1rem;
  grid-column: 1 / -1;
}

.chat-send {
  align-self: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(31, 31, 28, 0.16);
  background: rgba(31, 79, 69, 0.08);
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}


.chat-send:hover {
  background: rgba(31, 79, 69, 0.14);
  border-color: rgba(31, 31, 28, 0.22);
}

.chat-send:active {
  background: rgba(31, 79, 69, 0.2);
}

@media (max-width: 520px) {
  .chat-send {
    width: 100%;
    height: 38px;
  }

  .chat-footer {
    grid-template-columns: 1fr;
  }

  .chat-input {
    font-size: 1rem;
    padding: 12px 12px;
  }
}

.chat-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-button {
  border: 1px solid rgba(31, 31, 28, 0.18);
  background: rgba(31, 79, 69, 0.08);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

@media (max-width: 520px) {
  .chat-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .chat-button {
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    font-size: 0.9rem;
  }
}

.chat-button:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 79, 69, 0.35);
  box-shadow: 0 8px 18px rgba(31, 31, 28, 0.12);
}

/* Animations */

@keyframes origin-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes caret {
  0% {
    border-color: rgba(31, 31, 28, 0.6);
  }
  10% {
    border-color: transparent;
  }
  20% {
    border-color: rgba(31, 31, 28, 0.6);
  }
  30% {
    border-color: transparent;
  }
  40% {
    border-color: rgba(31, 31, 28, 0.6);
  }
  50% {
    border-color: transparent;
  }
  60% {
    border-color: rgba(31, 31, 28, 0.6);
  }
  70% {
    border-color: transparent;
  }
  80% {
    border-color: rgba(31, 31, 28, 0.6);
  }
  90% {
    border-color: transparent;
  }
  100% {
    border-color: transparent;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ai-shine {
  0% {
    background-position: 100% 50%;
  }
  50% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes typing-dots {
  0%,
  70%,
  100% {
    opacity: 0;
    transform: translateY(0);
  }
  20% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes chat-pulse {
  0% {
    transform: scale(1);
  }
  24% {
    transform: scale(1.15);
  }
  40% {
    transform: scale(0.98);
  }
  54% {
    transform: scale(1.05);
  }
  66% {
    transform: scale(0.99);
  }
  77% {
    transform: scale(1.02);
  }
  87% {
    transform: scale(0.995);
  }
  94% {
    transform: scale(1.01);
  }
  100% {
    transform: scale(1);
  }
}

/* Accessibility + responsive */

@media (prefers-reduced-motion: reduce) {
  .stage-panel:is(.is-animated, .is-animated-header) .stage-header,
  .stage-panel.is-animated .stage-copy,
  .stage-panel.is-animated .stage-subtitle,
  .stage-panel.is-animated-cards .focus-card,
  .origin-panel h2,
  .origin-panel .stage-section {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 640px) {
  body.is-detail {
    justify-items: center;
    padding-top: 24px;
  }

  .stage-panel {
    padding: 20px 22px 28px;
    margin-top: 0;
  }

  .stage-header {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 12px;
  }
}

@media (max-width: 600px) {
  .typewriter {
    font-size: clamp(1.15rem, 5vw, 1.6rem);
    text-align: left;
    justify-items: start;
  }
  .typewriter-line {
    white-space: nowrap;
  }
  .stage-header {
    position: sticky;
    top: 12px;
    z-index: 2;
    background: var(--panel-strong);
    padding: 10px 0;
  }
}
