/* ===============================================================
   Start Free Agent — styles/main.css
   Editorial Brutalist AI Interface: Pure Single Sentence, Seamless Inline Input
   =============================================================== */

/* Self-hosted Typography */
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 200;
  font-display: swap;
  src: url('../fonts/unbounded-200.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/unbounded-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/unbounded-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/unbounded-900.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/inter-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/inter-500.woff2') format('woff2');
}

/* Design Tokens */
:root {
  --c-bg:        #F7F6F3;
  --c-ink:       #0A0A0A;
  --c-ink-mid:   #1A1A1A;
  --c-ink-muted: #666666;
  --c-ink-faint: #A0A0A0;

  --f-display:   'Unbounded', 'Arial Black', Arial, sans-serif;
  --f-body:      'Inter', Arial, sans-serif;

  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Film Grain Overlay */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.032;
  pointer-events: none;
  z-index: 999;
  transform: translateZ(0);
}

/* Subtle Screen Glitch */
body.glitching {
  animation: glitchBody 0.45s steps(1) forwards;
}

@keyframes glitchBody {
  0%   { transform: translate3d(0, 0, 0); }
  10%  { transform: translate3d(-1.5px, 0, 0) skewX(-0.5deg); }
  25%  { transform: translate3d(2px, 0, 0) skewX(0.3deg); }
  45%  { transform: translate3d(-1px, 0, 0); }
  70%  { transform: translate3d(0, 0, 0); }
  85%  { transform: skewX(0.3deg); }
  100% { transform: translate3d(0, 0, 0); }
}

/* App Viewport Layout */
.agent-app {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(1.8rem + env(safe-area-inset-top)) calc(2rem + env(safe-area-inset-right)) calc(1.8rem + env(safe-area-inset-bottom)) calc(2rem + env(safe-area-inset-left));
  z-index: 1;
}

@media (min-width: 768px) {
  .agent-app {
    padding: 3rem 5rem;
  }
}

/* Minimalist Header */
.agent-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  z-index: 20;
}

.brand-tag {
  font-family: var(--f-display);
  font-size: clamp(0.8rem, 1.2vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.brand-tag:hover {
  opacity: 0.65;
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-ink);
}

/* Main Interactive Stage */
.agent-stage {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
}

/* Top Response Area (Word-by-word streaming) */
.response-container {
  width: 100%;
  min-height: 2.5rem;
  margin-bottom: 2.5rem;
  opacity: 0;
  transform: translateY(-16px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
  pointer-events: none;
  z-index: 10;
}

.response-container.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.response-text {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: var(--c-ink);
  word-break: break-word;
}

.response-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(6px);
  animation: wordAppear 0.2s var(--ease-out) forwards;
  margin-right: 0.28em;
}

@keyframes wordAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Prompt Stage */
.prompt-container {
  position: relative;
  width: 100%;
  cursor: text;
  z-index: 5;
}

/* Background Echo Layer (Previous query positioned UP at top on the background) */
.background-echo {
  position: absolute;
  top: -4.5rem;
  left: 0;
  width: 100%;
  pointer-events: none;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 4.2rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--c-ink);
  opacity: 0;
  transform: translateY(12px);
  transform-origin: left top;
  transition: opacity 0.6s var(--ease-out), font-size 0.5s var(--ease-out), transform 0.6s var(--ease-out);
  z-index: 0;
  word-break: break-word;
}

.background-echo.visible {
  opacity: 0.10;
  transform: translateY(0);
}

/* Monumental Giant Single Phrase (Seamless Inline Typing) */
.greeting-phrase {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(5.5rem, 15vw, 14rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
  color: var(--c-ink);
  user-select: none;
  word-break: break-word;
  display: inline;
  transition: font-size 0.16s var(--ease-out);
}

.phrase-prefix {
  display: inline;
  color: var(--c-ink);
}

.phrase-input {
  display: inline;
  color: var(--c-ink-mid);
  word-break: break-word;
  white-space: pre-wrap;
  outline: none !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  caret-color: var(--c-ink);
  cursor: text;
}

.phrase-input:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* Blinking Cursor Bar (Positioned inline directly at the end) */
.cursor-bar {
  display: inline-block;
  width: clamp(10px, 1.5vw, 24px);
  height: 0.85em;
  background: var(--c-ink);
  vertical-align: -0.05em;
  margin-left: clamp(4px, 0.6vw, 12px);
  animation: cursorBlink 0.9s steps(1) infinite;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Footer / Action Hints */
.agent-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(10, 10, 10, 0.06);
  z-index: 20;
}

.footer-hint {
  font-family: var(--f-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--c-ink-muted);
  letter-spacing: 0.02em;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--c-ink);
  color: var(--c-ink);
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.action-btn:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.action-btn:active {
  transform: scale(0.96);
}

.send-trigger-mobile {
  display: none;
}

@media (max-width: 767px) {
  .footer-hint {
    font-size: 0.72rem;
  }
  .send-trigger-mobile {
    display: inline-flex;
  }
  .desktop-shortcut-hint {
    display: none;
  }
}
