/* ====== Shadcn-ish dark system tokens ====== */
[hidden] { display: none !important; }

/* Screen reader only - visible to crawlers but hidden visually */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root{
  --bg: 10 10 16;
  --fg: 235 237 245;
  --muted: 160 165 185;
  --card: 14 14 22;
  --border: 255 255 255 / 0.10;

  --primary: 120 90 255;    /* violet */
  --accent: 0 214 255;      /* cyan */
  --danger: 255 75 110;

  --shadow: 0 20px 80px rgba(0,0,0,.55);
  --radius: 18px;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";

  --focus: 0 0 0 3px rgba(0,214,255,.25);
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
}
body{
  font-family: var(--sans);
  color: rgb(var(--fg));
  background: rgb(var(--bg));
  overflow-y: auto;
  max-width: 100vw;
  position: relative;
}

a{ color: rgba(var(--accent), 1); text-decoration: none; }
a:hover{ text-decoration: underline; }

#fx{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(1200px 600px at 20% 15%, rgba(120,90,255,.14), transparent 60%),
    radial-gradient(900px 500px at 80% 35%, rgba(0,214,255,.12), transparent 55%),
    radial-gradient(900px 700px at 50% 90%, rgba(255,255,255,.06), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.02), transparent 35%);
}

/* subtle vignette */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(70% 60% at 50% 40%, transparent 30%, rgba(0,0,0,.55) 100%);
}

.shell{
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 16px;
  max-width: 100%;
  overflow-x: hidden;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 8px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 10px;
  user-select:none;
}

.dot{
  width: 10px; height: 10px;
  border-radius: 999px;
  background: rgba(var(--accent), 1);
  box-shadow:
    0 0 20px rgba(var(--accent), .45),
    0 0 40px rgba(var(--primary), .25);
}

.brand__text{
  font-family: var(--mono);
  letter-spacing: .08em;
  text-transform: lowercase;
  font-size: 12px;
  opacity: .9;
}

.muted{ color: rgba(var(--muted), 1); }

.status{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(var(--border));
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  font-family: var(--mono);
  font-size: 12px;
}

.pulse{
  width: 8px; height: 8px;
  border-radius: 999px;
  background: rgba(var(--primary), 1);
  box-shadow: 0 0 18px rgba(var(--primary), .45);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse{
  0%,100%{ transform: scale(1); opacity: .65; }
  50%{ transform: scale(1.35); opacity: 1; }
}

.stage{
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 50px; /* Reserve space for absolute footer */
}

/* Footer: absolutely positioned at bottom of stage */
.stage > .footer {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
}


.card{
  width: min(980px, 92vw);
  border-radius: var(--radius);
  border: 1px solid rgba(var(--border));
  background: rgba(var(--card), .68);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card__glow{
  position:absolute;
  inset:-40%;
  background:
    radial-gradient(circle at 30% 30%, rgba(var(--primary), .22), transparent 55%),
    radial-gradient(circle at 70% 55%, rgba(var(--accent), .18), transparent 55%);
  filter: blur(18px);
  opacity: .9;
  transform: translateZ(0);
  pointer-events:none;
}

.card__inner{
  position: relative;
  padding: clamp(18px, 3vw, 34px);
}

.kicker{
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  color: rgba(var(--muted), 1);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.title{
  margin: 0 0 10px;
  font-size: clamp(20px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.title__sub{
  display:block;
  margin-top: 6px;
  font-weight: 500;
  color: rgba(var(--muted), 1);
  font-size: clamp(13px, 1.4vw, 16px);
}

.hint{
  margin: 10px 0 18px;
  color: rgba(var(--muted), 1);
  font-size: 13px;
}

.controls{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.btn{
  border: 1px solid rgba(var(--border));
  background: rgba(255,255,255,.04);
  color: rgb(var(--fg));
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  user-select:none;
}
.btn:hover{
  background: rgba(255,255,255,.07);
  transform: translateY(-1px);
}
.btn:active{
  transform: translateY(0px);
}
.btn:focus-visible{
  outline: none;
  box-shadow: var(--focus);
}
.btn:disabled{
  opacity: .45;
  cursor: not-allowed;
  transform:none;
}
.btn--primary{
  border-color: rgba(var(--primary), .45);
  background:
    linear-gradient(180deg, rgba(var(--primary), .20), rgba(255,255,255,.03));
  box-shadow: 0 0 30px rgba(var(--primary), .14);
}
.btn__icon{ margin-right: 8px; opacity: .9; }

.terminal{
  margin-top: 6px;
  padding: 16px 14px;
  border-radius: 14px;
  border: 1px solid rgba(var(--border));
  background: rgba(0,0,0,.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
  min-height: 92px;

  /* Smooth height transition */
  transition: height .28s cubic-bezier(0.4, 0, 0.2, 1);

  position: relative;
  overflow: hidden; /* Clip content during transition to prevent visual jumps */

  /* Stack rows vertically without flex-grow interference */
  display: block;

  /* Prevent horizontal overflow */
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}


.terminal__row{
  display: block;
  font-family: var(--mono);
  line-height: 1.55;
  font-size: 14px;
  letter-spacing: .01em;
  min-height: 1.55em;
  /* Content grows naturally, no flex interference */
}

/* First terminal__meta rule removed - consolidated below */


.caret{
  width: 10px;
  height: 18px;
  border-radius: 4px;
  background: rgba(var(--accent), 1);
  box-shadow: 0 0 18px rgba(var(--accent), .35);
  animation: caret 1s steps(2, end) infinite;
  flex: 0 0 auto;
  margin-top: 2px;
}
@keyframes caret{
  0%,49%{ opacity: 1; }
  50%,100%{ opacity: 0; }
}

.terminal__meta{
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(var(--border));
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(var(--muted), 1);
  display: flex;
  align-items: center;
  gap: 8px;
  /* Stable positioning - won't shift during terminal height animation */
}

.tag{
  font-size: 11px;
  letter-spacing: .12em;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(var(--border));
  background: rgba(255,255,255,.04);
  color: rgba(var(--fg), .92);
}
.sep{ opacity: .5; }

.footer{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(var(--muted), 1);
  margin-bottom: 8px;
}
.footer__link{
  color: rgba(var(--muted), 1);
  opacity: .85;
}
.footer__link:hover{
  color: rgb(var(--fg));
  opacity: 1;
  text-decoration: none;
}
.footer__sep{ opacity: .35; }

/* Talk area */
.talk{
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(var(--border));
}

.talk__top{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.talk__title{
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 16px;
}
.talk__desc{
  color: rgba(var(--muted), 1);
  font-size: 13px;
}

.talk__viz{
  margin: 14px 0 10px;
  display:grid;
  place-items:center;
  height: 160px;
  position: relative;
}

.orb{
  width: 86px;
  height: 86px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.18), rgba(255,255,255,.03) 55%, rgba(0,0,0,.22));
  border: 1px solid rgba(var(--border));
  box-shadow:
    0 0 22px rgba(var(--accent), .15),
    0 0 60px rgba(var(--primary), .12);
  transform: translateZ(0);
}

.rings{
  position:absolute;
  inset: 0;
  pointer-events:none;
  opacity: .85;
}
.rings::before,
.rings::after{
  content:"";
  position:absolute;
  left: 50%; top: 50%;
  width: 140px; height: 140px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 1px solid rgba(var(--accent), .22);
  filter: blur(.2px);
}
.rings::after{
  width: 210px; height: 210px;
  border-color: rgba(var(--primary), .20);
}

.talk__controls{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.talk__log{
  border: 1px solid rgba(var(--border));
  background: rgba(0,0,0,.14);
  border-radius: 14px;
  padding: 12px;
  min-height: 84px;
  color: rgba(var(--fg), .95);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}

.msg{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(var(--border));
  background: rgba(255,255,255,.03);
  margin: 8px 0;
}
.msg--me{
  border-color: rgba(var(--accent), .22);
}
.msg--ai{
  border-color: rgba(var(--primary), .22);
}
.msg__role{
  font-size: 11px;
  letter-spacing: .14em;
  color: rgba(var(--muted), 1);
  margin-bottom: 4px;
  text-transform: uppercase;
}
.footnote{
  margin: 10px 0 0;
  color: rgba(var(--muted), 1);
  font-size: 12px;
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  display:grid;
  place-items:center;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(10px);
  padding: 16px;
  z-index: 50;
}
.modal__panel{
  width: min(680px, 92vw);
  border-radius: 16px;
  border: 1px solid rgba(var(--border));
  background: rgba(var(--card), .88);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal__head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(var(--border));
}
.modal__title{
  font-family: var(--mono);
  letter-spacing: .10em;
  font-size: 12px;
  color: rgba(var(--muted), 1);
  text-transform: uppercase;
}
.iconbtn{
  border: 1px solid rgba(var(--border));
  background: rgba(255,255,255,.04);
  color: rgb(var(--fg));
  border-radius: 10px;
  padding: 8px 10px;
  cursor:pointer;
}
.iconbtn:focus-visible{ outline:none; box-shadow: var(--focus); }
.modal__body{
  padding: 14px;
  color: rgba(var(--fg), .92);
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 520px){
  /* Mobile: allow full page scroll, prevent horizontal overflow */
  html, body{
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* Shell: flex column taking at least full viewport height */
  .shell{
    height: auto;
    min-height: 100svh;
    min-height: 100dvh; /* dynamic viewport height for mobile browsers */
    display: flex;
    flex-direction: column;
    padding: 12px;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Stage: flex column for scrollable content on mobile */
  .stage{
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: auto;
    padding-bottom: 0;
    justify-content: flex-start; /* Don't center on mobile - allow scroll */
  }

  /* Footer: override desktop absolute, use normal flow */
  .stage > .footer {
    position: static;
  }

  /* Card: don't grow, let content determine size */
  .card{
    flex: 0 0 auto;
    overflow: hidden; /* Keep hidden to clip glow effect */
    width: calc(100vw - 24px); /* Account for shell padding */
    max-width: 100%;
  }

  /* Card inner can show content that visually "breaks out" */
  .card__inner{
    overflow: visible;
  }

  /* Footer: pushed to bottom on mobile via margin-top auto */
  .footer{
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
  }

  /* Terminal grows naturally based on content */
  .terminal{
    min-height: 106px;
    height: auto !important;
  }

  .talk__viz{ height: 140px; }
  .rings::after{ width: 190px; height: 190px; }

  /* Hero section: prevent overflow */
  .heroTitleWrap{
    gap: 12px;
    max-width: 100%;
  }

  .heroViz{
    width: 60px;
    height: 60px;
    flex-shrink: 0;
  }

  .heroViz .orb{
    width: 60px;
    height: 60px;
  }

  .heroTitleWrap h1{
    flex: 1 1 auto;
    min-width: 0; /* Allow text to wrap/shrink */
  }

  /* Avatar positioning fix for mobile */
  .avatar{
    left: 16px;
  }
}


/* === Terminal voice viz (top-left inside the main terminal) === */
.terminal__row {
  position: relative;
}

.terminalViz {
  position: absolute;
  left: 10px;
  top: -14px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 2;
}

.terminalViz .orb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(var(--border));
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.25), rgba(255,255,255,.06) 55%, rgba(0,0,0,.22));
}

.terminalViz .rings::before,
.terminalViz .rings::after{
  width: 34px;
  height: 34px;
}

.terminalViz .rings::after{
  width: 48px;
  height: 48px;
}

/* shift caret a bit so it won't clash with viz */
.terminal__row .caret { margin-left: 46px; }

/* === Hero voice viz (big, left of H1) === */
/* === Hero title + voice viz layout === */
.heroTitleWrap{
  display: flex;
  flex-direction: row-reverse; /* 👈 זה כל הקסם */
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}


/* keep title locked to the left */
.heroTitleWrap h1{
  margin: 0;
}


.heroViz{
  position: relative;
  width: 86px;
  height: 86px;
  flex: 0 0 auto;
  margin-top: 6px;
  margin-right: 4px; /* ריווח עדין מהמסגרת */
}


.heroViz .orb{
  width: 86px;
  height: 86px;
}

.heroViz .rings{
  position:absolute;
  inset: 0;
}

/* Align dynamic line to the same left inset as the header row */
#line{
  margin-left: 0 !important;
  padding-left: 7px !important;
  min-height: 1.3em;     /* ✅ שורה אחת מינימום */
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}
.terminal__row{
  padding-left: 0 !important;
  max-width: 100%;
  overflow-wrap: break-word;
}
.avatar{
  position:relative;
  left:22px;
  top:-19px;              /* כוון לפי העיצוב שלך */
  transform:translateX(-50%);
  width:50px;             /* גודל הדמות על המסך */
  height:50px;
  pointer-events:none;
  z-index: 6;
}

.avatarSprite{
  width:100%;
  height:100%;

  background-image:url("assets/avatar/adir_sprite.png");
  background-repeat:no-repeat;
  background-size:300% 300%;
  background-position: 0% 0%;

  /* ✅ hide the 2px black edge */
  overflow:hidden;
  border-radius: 18px;               /* אם מתאים לך, מרכך קצוות */
  clip-path: inset(2px 0 2px 0);       /* חותך 2px מלמטה */
  
  /* פילטר עתידני */
  filter:
    contrast(1.08)
    saturate(0.92)
    drop-shadow(0 0 18px rgba(120, 181, 255, 0))
    drop-shadow(0 0 48px rgba(161, 120, 255, 0));
    
}


/* =========================================================
   DRAMATIC BUILD (Entrance choreography)
   ========================================================= */

:root{
  --enter-ease: cubic-bezier(.16, 1, .3, 1);
}

/* מצב התחלתי (לפני שהוספנו class מה-JS) */
body:not(.is-enter) .card{
  opacity: 0;
  transform: translateY(-38px) scale(.985);
  filter: blur(2px);
}

body:not(.is-enter) .footer{
  opacity: 0;
  transform: translateY(26px);
  filter: blur(2px);
}

body:not(.is-enter) .brand{
  opacity: 0;
  transform: translateX(-14px);
  filter: blur(1px);
}

body:not(.is-enter) .status{
  opacity: 0;
  transform: translateX(14px);
  filter: blur(1px);
}

/* אנימציית כניסה (אחרי שה-JS מוסיף class) */
.card, .footer, .brand, .status{
  will-change: transform, opacity, filter;
  transition:
    transform 900ms var(--enter-ease),
    opacity 900ms var(--enter-ease),
    filter 900ms var(--enter-ease);
}

body.is-enter .card,
body.is-enter .footer,
body.is-enter .brand,
body.is-enter .status{
  opacity: 1;
  transform: none;
  filter: blur(0);
}

/* תיזמונים */
.card{
  transition-delay: 120ms;
}

.footer{
  transition-delay: 1120ms; /* בערך שניה אחרי שה-card התחיל */
}

.brand, .status{
  transition-delay: 1700ms; /* אחרי שה-footer נכנס */
}

/* נגישות: אם user מבקש reduce motion */
@media (prefers-reduced-motion: reduce){
  .card, .footer, .brand, .status{
    transition: none !important;
  }
  body:not(.is-enter) .card,
  body:not(.is-enter) .footer,
  body:not(.is-enter) .brand,
  body:not(.is-enter) .status{
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* Mobile footer rules merged into main mobile media query above */

