/* ─────────────────────────────────────────────────────────────
   Eve — Studio Practice's homepage concierge
   Not a chat app: a dot-matrix intelligence. Typeset transcript,
   print-in replies, frosted + grained material, a living eye.
   Tokens inherit from sp-dotmatrix.css with literal fallbacks.
   ───────────────────────────────────────────────────────────── */

:root {
  --eve-bg:     #14151a;
  --eve-glass:  rgba(20, 21, 27, 0.94);
  --eve-panel:  #1c1d24;
  --eve-ink:    var(--dm-ink, #f6f7f9);
  --eve-muted:  #b2b4be;
  --eve-faint:  #888a96;
  --eve-accent: var(--dm-accent, #7cabee);
  --eve-line:   #33343d;
  --eve-bot:       #eef1f5; /* mascot body — EVE-white, pops on the dark frame */
  --eve-bot-visor: #191b22; /* EVE's dark face screen */
  --eve-bot-eye:   #62a6f5; /* EVE-blue, softly glowing */
  --eve-mono:   var(--dm-mono, ui-monospace, "SFMono-Regular", Menlo, monospace);
  --eve-sans:   "DM Sans", -apple-system, system-ui, sans-serif;
  --eve-ease:   cubic-bezier(0.16, 1, 0.3, 1);
  /* fine dither/grain — lifts the surface out of flat black */
  --eve-grain:  url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ── LAUNCHER ─────────────────────────────────────────────── */
.eve-launcher {
  position: fixed;
  right: clamp(16px, 3vw, 30px);
  bottom: clamp(16px, 3vw, 30px);
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 12px 17px 12px 13px;
  background: color-mix(in oklab, var(--eve-panel) 87%, var(--eve-accent));
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  color: var(--eve-ink);
  border: 1px solid color-mix(in oklab, var(--eve-accent) 52%, var(--eve-line));
  border-radius: 13px;
  font-family: var(--eve-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 12px 34px -16px rgba(0, 0, 0, 0.85),
              0 4px 22px -6px color-mix(in oklab, var(--eve-accent) 38%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.4s var(--eve-ease), border-color 0.4s var(--eve-ease);
}
.eve-launcher::after {
  content: ""; position: absolute; inset: 0; border-radius: 13px;
  background-image: var(--eve-grain); mix-blend-mode: overlay; opacity: 0.28; pointer-events: none;
}
.eve-launcher:hover { transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--eve-accent) 80%, var(--eve-line));
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.85),
              0 6px 28px -6px color-mix(in oklab, var(--eve-accent) 55%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, 0.07); }
.eve-launcher:focus-visible { outline: 2px solid var(--eve-accent); outline-offset: 3px; }
.eve-launcher[hidden] { display: none; }

/* ── EVE — the mascot: a square, obvious little pixel bot ─── */
.eve-bot { display: block; width: 26px; height: 26px; flex: none; }
.eve-bot svg { width: 100%; height: 100%; display: block; overflow: visible;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4)); }
.bot-body { fill: var(--eve-bot); }
.bot-visor { fill: var(--eve-bot-visor); }
.bot-core {
  fill: var(--eve-bot-eye);
  filter: drop-shadow(0 0 1.4px color-mix(in oklab, var(--eve-bot-eye) 70%, transparent));
}
/* open eyes — blue capsules that blink */
.bot-eye {
  fill: var(--eve-bot-eye); stroke: none;
  transform-box: fill-box; transform-origin: center;
  filter: drop-shadow(0 0 1.7px color-mix(in oklab, var(--eve-bot-eye) 75%, transparent));
  animation: eveBlink 5.4s ease-in-out infinite, eveEyeHide 5.4s ease-in-out infinite;
}
/* happy squint — the > < that appears briefly as her smile */
.bot-eye-happy {
  opacity: 0; fill: none; stroke: var(--eve-bot-eye); stroke-width: 2.7;
  stroke-linecap: square; stroke-linejoin: miter;
  filter: drop-shadow(0 0 1.7px color-mix(in oklab, var(--eve-bot-eye) 75%, transparent));
  animation: eveEyeShow 5.4s ease-in-out infinite;
}
.eve-launcher .eve-bot { animation: eveBob 3.4s ease-in-out infinite; }

/* ── PANEL ────────────────────────────────────────────────── */
.eve-panel {
  position: fixed;
  right: clamp(16px, 3vw, 30px);
  bottom: clamp(16px, 3vw, 30px);
  z-index: 2147483001;
  width: min(392px, calc(100vw - 32px));
  height: min(576px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  background: var(--eve-glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--eve-line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 40px 90px -34px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.02),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  pointer-events: none;
  transition: opacity 0.4s var(--eve-ease), transform 0.42s var(--eve-ease);
}
.eve-panel::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: var(--eve-grain); mix-blend-mode: overlay; opacity: 0.22;
}
.eve-panel > * { position: relative; z-index: 1; }
.eve-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

/* boot scanline on open — a deliberate, visible sweep with a bright core */
.eve-panel.is-booting::after {
  content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: linear-gradient(180deg,
    transparent,
    color-mix(in oklab, var(--eve-accent) 26%, transparent) 44%,
    color-mix(in oklab, var(--eve-accent) 52%, transparent) 50%,
    color-mix(in oklab, var(--eve-accent) 26%, transparent) 56%,
    transparent);
  height: 46%; animation: eveBoot 1.35s var(--eve-ease) 1;
}

/* Header — terminal status line */
.eve-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px 13px;
  border-bottom: 1px solid var(--eve-line);
}
.eve-head .eve-bot { width: 32px; height: 32px; }
.eve-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.eve-name {
  font-family: var(--eve-mono);
  font-weight: 500; font-size: 13px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--eve-ink); line-height: 1;
  display: inline-flex; align-items: center; gap: 8px;
}
.eve-name .eve-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #58c98a; box-shadow: 0 0 7px -1px #58c98a;
}
.eve-status { font-family: var(--eve-mono); font-size: 9.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--eve-faint); }
.eve-close {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--eve-line); border-radius: 8px;
  color: var(--eve-muted); cursor: pointer; font-size: 16px; line-height: 1;
  transition: color 0.25s var(--eve-ease), border-color 0.25s var(--eve-ease);
}
.eve-close:hover { color: var(--eve-ink); border-color: var(--eve-accent); }

/* ── TRANSCRIPT (no bubbles) ──────────────────────────────── */
.eve-log {
  flex: 1; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 20px 18px 10px;
  display: flex; flex-direction: column; gap: 20px;
  /* the light "paper" the machine prints on — the one bright surface,
     dark-ink-on-light for real contrast against the dark frame.
     Color vars are re-scoped here so the transcript inherits the paper
     palette; the header/input frame keeps the dark root palette. */
  background: #e9eaee;
  --eve-ink:    #191a20;
  --eve-muted:  #5b5d67;
  --eve-faint:  #8b8d97;
  --eve-accent: #2f6fe0;
  --eve-line:   #d4d5db;
  box-shadow: inset 0 2px 7px -4px rgba(0, 0, 0, 0.42), inset 0 -2px 7px -6px rgba(0, 0, 0, 0.28);
  scrollbar-width: thin; scrollbar-color: #c3c4cc transparent;
}
.eve-log::-webkit-scrollbar { width: 7px; }
.eve-log::-webkit-scrollbar-thumb { background: var(--eve-line); border-radius: 8px; }

.eve-turn {
  display: flex; flex-direction: column; gap: 7px;
  padding-left: 13px;
  border-left: 2px solid var(--eve-line);
  animation: eveRise 0.4s var(--eve-ease) both;
}
.eve-turn--eve { border-left-color: color-mix(in oklab, var(--eve-accent) 62%, transparent); }
.eve-turn__who {
  font-family: var(--eve-mono); font-size: 9.5px; letter-spacing: 0.24em;
  text-transform: uppercase;
}
.eve-turn--eve .eve-turn__who { color: var(--eve-accent); }
.eve-turn--you .eve-turn__who { color: var(--eve-faint); }
.eve-turn__text {
  font-family: var(--eve-sans); font-size: 15px; line-height: 1.62;
  color: var(--eve-ink); white-space: pre-wrap; word-wrap: break-word;
}
.eve-turn--you .eve-turn__text { color: color-mix(in oklab, var(--eve-ink) 94%, var(--eve-muted)); }
.eve-turn__text a { color: var(--eve-accent); text-underline-offset: 2px; }
/* the print cursor block */
.eve-caret {
  display: inline-block; width: 0.5em; height: 1.02em;
  margin-left: 1px; vertical-align: -2px;
  background: var(--eve-accent); animation: eveCaret 0.9s steps(1) infinite;
}

/* thinking — eye scan line, not three bouncing dots */
.eve-think {
  padding-left: 13px; border-left: 2px solid color-mix(in oklab, var(--eve-accent) 40%, transparent);
  font-family: var(--eve-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--eve-faint); animation: eveRise 0.3s var(--eve-ease) both;
}
.eve-think b { color: var(--eve-accent); font-weight: 400; animation: evePulse 1.1s ease-in-out infinite; }

/* Input */
.eve-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 12px 10px; border-top: 1px solid var(--eve-line);
}
.eve-input {
  flex: 1; resize: none; max-height: 108px; min-height: 22px;
  padding: 9px 12px; background: rgba(255,255,255,0.03);
  border: 1px solid var(--eve-line); border-radius: 10px;
  color: var(--eve-ink); font-family: var(--eve-sans); font-size: 16px; line-height: 1.4;
  outline: none; transition: border-color 0.25s var(--eve-ease), background 0.25s var(--eve-ease);
}
.eve-input::placeholder { color: var(--eve-faint); }
.eve-input:focus { border-color: color-mix(in oklab, var(--eve-accent) 55%, var(--eve-line)); background: rgba(255,255,255,0.05); }
.eve-send {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--eve-accent); color: #0e1017; border: 0; border-radius: 10px;
  cursor: pointer; transition: transform 0.25s var(--eve-ease), filter 0.25s var(--eve-ease);
}
.eve-send:hover { transform: translateY(-1px); filter: brightness(1.07); }
.eve-send:disabled { opacity: 0.35; cursor: default; transform: none; filter: none; }
.eve-send svg { width: 17px; height: 17px; display: block; }

.eve-foot {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  margin: 0 16px; padding: 11px 4px 13px; border-top: 1px solid var(--eve-line);
  font-family: var(--eve-mono); font-size: 8.5px; letter-spacing: 0.1em;
  line-height: 1.65; text-transform: uppercase; text-align: center;
}
.eve-foot-note { color: var(--eve-faint); }
.eve-foot-link {
  color: var(--eve-muted); text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--eve-muted) 40%, transparent);
  padding-bottom: 1px; transition: color .15s, border-color .15s;
}
.eve-foot-link:hover { color: var(--eve-ink); border-bottom-color: var(--eve-ink); }

/* ── MOBILE — full bottom sheet ───────────────────────────── */
@media (max-width: 520px) {
  .eve-panel {
    right: 0; left: 0; bottom: 0; top: 0; width: 100%;
    /* Full height, not 90dvh. At 90 the remaining strip exposed the nav,
       which is transparent at rest — so page copy showed through it and
       collided with the wordmark above the sheet. A chat sheet on a phone
       is a mode; it should own the screen rather than peek around a nav. */
    height: 100vh; height: 100dvh;
    border-radius: 0; transform-origin: bottom center;
  }
  /* the sheet now reaches the status bar / notch */
  .eve-head { padding-top: max(14px, env(safe-area-inset-top)); }
  /* the sheet runs edge-to-edge, so give the content real side margins
     and honor the phone's safe areas — otherwise text hugs the screen edge */
  .eve-head      { padding-left: 20px; padding-right: 18px; }
  .eve-log       { padding-left: 24px; padding-right: 24px; }
  .eve-input-row { padding-left: 18px; padding-right: 16px; }
  .eve-foot      { margin-left: 20px; margin-right: 20px;
                   padding-bottom: max(13px, env(safe-area-inset-bottom)); }
}

@keyframes eveRise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes eveCaret { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
@keyframes evePulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes eveBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.6px); } }
@keyframes eveBlink { 0%, 42%, 48%, 100% { transform: scaleY(1); } 45% { transform: scaleY(0.1); } }
@keyframes eveEyeHide { 0%, 81%, 92%, 100% { opacity: 1; } 84%, 89% { opacity: 0; } }
@keyframes eveEyeShow { 0%, 82%, 91%, 100% { opacity: 0; } 84%, 89% { opacity: 1; } }
@keyframes eveBoot { from { top: -46%; } to { top: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .eve-launcher, .eve-panel, .eve-turn, .eve-send, .eve-close, .eve-bot { transition: none; animation: none; }
  .bot-eye, .bot-eye-happy, .eve-caret, .eve-think b, .eve-panel.is-booting::after { animation: none; }
}
