/* Robot Buddy design (project 01, issue #0006).
   Zero external requests; see .agents/rules/frontend.md. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  text-align: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #fff7ed, #ffedd5);
  color: #1f2937;
}

/* ---------- Hero: Askii + headline ---------- */

.hero {
  padding-top: 7vh;
  margin-bottom: 26px;
}

.bot-wrap {
  position: relative;
  width: 150px;
  margin: 0 auto;
}

svg.bot {
  width: 150px;
  height: 150px;
  display: block;
}

.bot .head-group {
  animation: bot-bob 3.2s ease-in-out infinite;
}

@keyframes bot-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.bot .eye {
  animation: bot-blink 4.6s infinite;
  transform-origin: center;
  transform-box: fill-box;
}

@keyframes bot-blink {
  0%, 94%, 100% { transform: scaleY(1); }
  96%, 98% { transform: scaleY(0.08); }
}

.bot .antenna-ball {
  animation: bot-pulse 2.2s ease-in-out infinite;
}

@keyframes bot-pulse {
  0%, 100% { fill: #fb923c; }
  50% { fill: #fbbf24; }
}

.bot .arm-left {
  transform-origin: 26px 118px;
}

.bot.wave .arm-left {
  animation: bot-wave 0.9s ease-in-out 2;
}

@keyframes bot-wave {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(-38deg); }
}

.bubble {
  position: absolute;
  inset-inline-start: 122px;
  top: -4px;
  width: max-content;
  max-width: 260px;
  background: #fff;
  border: 2px solid #1f2937;
  border-radius: 14px;
  border-end-start-radius: 2px;
  padding: 11px 15px;
  font-size: 15px;
  line-height: 1.45;
  color: #1f2937;
  text-align: start;
  box-shadow: 3px 3px 0 #1f2937;
  z-index: 1;
}

/* RTL: the side-tail bubble geometry doesn't translate — center it.
   (In RTL the static position right-aligns, so center via `right`.) */
[dir="rtl"] .bubble {
  position: relative;
  inset-inline-start: auto;
  left: auto;
  right: 50%;
  transform: translateX(50%);
  top: auto;
  margin: 12px 0 0;
  width: max-content;
  max-width: min(320px, calc(100vw - 40px));
  text-align: center;
  border-radius: 14px;
}

/* Playback: Askii speaks first — everything else waits, then fades in. */
body.playback .bubble {
  font-size: 16px;
  max-width: 300px;
}

.bubble.speaking::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  margin-left: 3px;
  vertical-align: -0.12em;
  animation: caret-blink 0.9s steps(1) infinite;
}

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

body.playback h1,
body.playback #tagline,
body.playback main {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

body.playback.stage-in h1 {
  opacity: 1;
  transform: none;
}

body.playback.stage-in #tagline {
  opacity: 1;
  transform: none;
  transition-delay: 0.12s;
}

body.playback.stage-in main {
  opacity: 1;
  transform: none;
  transition-delay: 0.24s;
}

h1 {
  font-size: clamp(30px, 5.4vw, 46px);
  font-weight: 800;
  color: #7c2d12;
  margin: 16px 12px 0;
  letter-spacing: -0.01em;
}

.description {
  font-size: 16px;
  font-weight: 400;
  color: #9a5b32;
  line-height: 1.55;
  margin: 12px auto 0;
  padding: 0 16px;
  max-width: 520px;
}

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

form {
  margin-bottom: 34px;
}

.bar {
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 620px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 3px solid #1f2937;
  border-radius: 20px;
  padding: 6px;
  padding-inline-start: 18px;
  box-shadow: 5px 5px 0 #1f2937;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bar:focus-within {
  transform: translate(-1px, -1px);
  box-shadow: 7px 7px 0 #1f2937;
}

.searchbar {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  background: transparent;
  color: #1f2937;
  caret-color: #f97316;
}

.searchbar::placeholder {
  color: #b08968;
}

.ask-button {
  border: 2px solid #1f2937;
  background: #fb923c;
  color: #1f2937;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  padding: 12px 22px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #1f2937;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  white-space: nowrap;
}

.ask-button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #1f2937;
}

.ask-button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #1f2937;
}

/* ---------- Ask link reveal ---------- */

.copy-url-container {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  padding: 10px;
  padding-inline-start: 16px;
  width: 620px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 3px dashed #fb923c;
  border-radius: 16px;
  animation: reveal-pop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

@keyframes reveal-pop {
  from { opacity: 0; transform: scale(0.94); }
}

.copy-url-container .url {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 4px 0;
  font-size: 14px;
  font-family: inherit;
  text-align: start;
  color: #9a3412;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
  border: none;
  outline: none;
}

.copy-url-btn {
  border: 2px solid #1f2937;
  background: #fde68a;
  color: #1f2937;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1f2937;
  white-space: nowrap;
}

.copy-url-btn:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.copy-url-btn.copied {
  background: #86efac;
}

/* ---------- Language switcher ---------- */

.lang-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  margin: 40px auto 0;
  padding: 0 16px 28px;
  max-width: 640px;
}

.lang-nav a {
  color: #b08968;
  font-size: 13px;
  text-decoration: none;
  padding: 3px 4px;
  border-radius: 6px;
}

.lang-nav a:hover {
  color: #7c2d12;
  text-decoration: underline;
}

.lang-nav a[aria-current="page"] {
  color: #7c2d12;
  font-weight: 700;
}

body.playback .lang-nav {
  display: none;
}

/* ---------- Send-off (exit transition to AI Mode) ---------- */

#exit-veil {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #fff;
  pointer-events: none;
  opacity: 0;
  clip-path: circle(0% at 50% 44%);
}

body.send-off #exit-veil {
  opacity: 1;
  animation: veil-grow 0.55s ease-in 0.35s forwards;
}

@keyframes veil-grow {
  to { clip-path: circle(150% at 50% 44%); }
}

body.send-off .bot-wrap {
  animation: bot-launch 0.7s cubic-bezier(0.55, -0.25, 0.75, 1) forwards;
}

@keyframes bot-launch {
  25% { transform: translateY(8px) rotate(0); }
  100% { transform: translateY(-75vh) rotate(-6deg); }
}

body.send-off h1,
body.send-off .description,
body.send-off .bubble,
body.send-off main {
  animation: fade-away 0.4s ease forwards;
}

@keyframes fade-away {
  to { opacity: 0; transform: translateY(-16px); }
}

/* ---------- Responsive ---------- */

@media (max-width: 719px) {
  .bubble {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    margin: 12px 0 0;
    width: max-content;
    max-width: min(320px, calc(100vw - 40px));
    text-align: center;
    border-radius: 14px;
  }
}

@media (max-width: 559px) {
  .bar {
    flex-wrap: wrap;
    padding: 6px;
  }

  .searchbar {
    padding: 0 12px;
  }

  .ask-button {
    flex: 1 1 100%;
  }

  .copy-url-container {
    flex-wrap: wrap;
  }

  .copy-url-container .url {
    flex: 1 1 100%;
    text-align: center;
  }

  .copy-url-btn {
    flex: 1 1 100%;
  }
}

@media (min-width: 768px) {
  .hero {
    padding-top: 10vh;
  }

  .description {
    font-size: 18px;
  }
}

/* ---------- Accessibility ---------- */

.ask-button:focus-visible,
.copy-url-btn:focus-visible {
  outline: 3px solid #1f2937;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .bot .head-group,
  .bot .eye,
  .bot .antenna-ball,
  .bot.wave .arm-left,
  .copy-url-container,
  .bubble.speaking::after {
    animation: none !important;
  }

  .bar,
  .ask-button,
  body.playback h1,
  body.playback #tagline,
  body.playback main {
    transition: none !important;
  }
}
