/* =========================================
   GENERAL & INDEX STYLES
   ========================================= */

/* Enable cross-document view transitions for all same-origin navigations */
@view-transition {
  navigation: auto;
}

/* Ripple theme transition (View Transitions API) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 0;
}

::view-transition-new(root) {
  z-index: 1;
}

/* Nav stays perfectly still during page slides */
.centered-nav {
  view-transition-name: site-nav;
}
.mobile-header {
  view-transition-name: mobile-nav;
}
/* Nav stays perfectly still while the page content slides underneath it.
   Freeze the group (no positional morph) AND skip the default old→new
   cross-fade, otherwise the bar dims/flickers during the slide. The old
   snapshot is hidden and the new one is shown statically at full opacity. */
::view-transition-group(site-nav),
::view-transition-group(mobile-nav),
::view-transition-image-pair(site-nav),
::view-transition-image-pair(mobile-nav) {
  animation: none !important;
}
/* Mobile nav group must paint above the sliding root layers */
::view-transition-group(mobile-nav) {
  z-index: 9999;
}
::view-transition-old(site-nav),
::view-transition-old(mobile-nav) {
  animation: none !important;
  opacity: 0;
}
::view-transition-new(site-nav),
::view-transition-new(mobile-nav) {
  animation: none !important;
  opacity: 1;
}

/* Slide keyframes: spring ease-out on enter, crisp ease-in on exit */
@keyframes slide-out-left  { to   { transform: translateX(-100vw); } }
@keyframes slide-in-right  { from { transform: translateX(100vw);  } }
@keyframes slide-out-right { to   { transform: translateX(100vw);  } }
@keyframes slide-in-left   { from { transform: translateX(-100vw); } }

html[data-transition="forward"]::view-transition-old(root) {
  animation: 420ms cubic-bezier(0.55, 0, 1, 0.45) slide-out-left both;
}
html[data-transition="forward"]::view-transition-new(root) {
  animation: 500ms cubic-bezier(0.34, 1.56, 0.64, 1) slide-in-right both;
}
html[data-transition="backward"]::view-transition-old(root) {
  animation: 420ms cubic-bezier(0.55, 0, 1, 0.45) slide-out-right both;
}
html[data-transition="backward"]::view-transition-new(root) {
  animation: 500ms cubic-bezier(0.34, 1.56, 0.64, 1) slide-in-left both;
}

/* Intro Screen Animation */
.intro-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  color: #000000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Geist', sans-serif;
  font-size: 2.5rem;
  font-weight: 600;
  z-index: 10000;
  transition: background-color 0.5s ease, color 0.5s ease, opacity 0.5s ease;
}

.intro-screen.dark {
  background-color: #000000;
  color: #ffffff;
}

.intro-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

:root {
  --bg-color: #ffffff;
  --text-color: #000000;
}

/* General Website Style */
body.dark-mode {
  /* pure black so the inverting (difference) cursor trail comes out exactly #fff
     while text it covers flips to legible black */
  --bg-color: #000000;
  --text-color: #ffffff;
}


body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-family: 'Geist', sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Homepage is a single, non-scrolling screen. Locking scroll keeps the mobile
   browser's URL bar from collapsing, which otherwise shoves the fixed bottom
   bar up/down. Scoped to .home so about/work still scroll normally. */
body.home {
  height: 100svh;             /* smallest viewport height → content always fits, page can't scroll */
  overflow: hidden;
  overscroll-behavior: none;  /* no rubber-band bounce that could collapse the mobile toolbar */
}

/* Nav Bar */
.centered-nav {
  position: fixed;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;        /* keep the ✳ ai pill from stretching to row height */
  gap: 2.375rem;               /* 38px — matches Figma nav spacing */
  font-family: 'Geist', sans-serif;
  font-size: 2rem;
  font-weight: 500;
  z-index: 100;
}

/* Case-study nav: transparent bar, text inverts to match whatever is behind it */
.centered-nav.case-study-nav {
  mix-blend-mode: difference;
}

.centered-nav.case-study-nav .nav-link {
  color: white;
}

.centered-nav.case-study-nav .nav-link::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='10'%3E%3Cpath d='M0 5 Q7 1 14 5 Q21 9 28 5' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Mobile Header (hidden on desktop, shown in mobile media query) */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  align-items: center;
  overflow: hidden;
  background: transparent;
  z-index: 1000;
}

.mobile-name {
  position: absolute;
  left: 20px;
  font-family: 'Geist', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}

.mobile-burger {
  position: absolute;
  left: calc(100% - 57px);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 29px;
  width: 37px;
  transition: left 0.45s cubic-bezier(0.65, 0, 0.35, 1),
              transform 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}

.burger-bar {
  display: block;
  height: 5px;
  width: 100%;
  background: var(--text-color);
  border-radius: 2px;
}

.mobile-nav-links {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.5rem;
  transform: translateX(100vw);
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Open state — triggered by .menu-open on body */
.menu-open .mobile-name {
  transform: translateX(calc(-100vw - 20px));
}

.menu-open .mobile-burger {
  left: 20px;
  transform: rotate(90deg);
}

.menu-open .mobile-nav-links {
  transform: translateX(calc(-50% + 20px));
}

/* Center Circle Text and Image  */
.nav-link {
  position: relative;
  text-decoration: none;
  color: var(--text-color);
  transition: opacity 0.2s ease;
  font-weight: 400;
}

/* underline that grows out from the centre on hover — squiggly SVG wave */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -0.65rem;
  left: 50%;
  transform: translateX(-50%);
  height: 10px;
  width: 0%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='10'%3E%3Cpath d='M0 5 Q7 1 14 5 Q21 9 28 5' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 28px 10px;
  transition: width 0.3s ease;
}

body.dark-mode .nav-link::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='10'%3E%3Cpath d='M0 5 Q7 1 14 5 Q21 9 28 5' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
}

.nav-link:hover::after {
  width: 100%;
}

.circle-container {
  width: 31.25rem;
  height: 31.25rem;
  position: relative;
  margin-bottom: 0rem;
}

.center-image {
  position: absolute;
  top: 49%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 29rem;
  height: 29rem;
  object-fit: contain;
  z-index: 1;
}

.circle-text {
  width: 100%;
  height: 100%;
}

text {
  font-family: 'Geist', sans-serif;
  font-size: .85rem;
  letter-spacing: .0625rem;
  text-transform: lowercase;
}

.rotate {
  transform-origin: 50% 50%;
  /* rotation now lives on the .circle-text ring SVG (see spin-ring below) */
}

@keyframes spin-ring {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* slow auto-rotation of the portrait ring; respects users who opt out of motion */
@media (prefers-reduced-motion: no-preference) {
  .circle-text {
    transform-origin: center center;
    animation: spin-ring 60s linear infinite;
  }
}

/* pause when hovering anywhere over the portrait or the ring itself */
.circle-container:hover .circle-text,
.circle-text:hover {
  animation-play-state: paused;
}


/* Iridescent rainbow on AI card — follows the cursor via CSS custom properties
   set by ai-chat.js. Card interior is always white, so multiply shows color. */
.ai-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 140% 140% at var(--rx, 50%) var(--ry, 50%),
      hsl(calc(var(--rhue, 0) + 0)   100% 60%) 0%,
      hsl(calc(var(--rhue, 0) + 50)  100% 60%) 16%,
      hsl(calc(var(--rhue, 0) + 100) 100% 60%) 32%,
      hsl(calc(var(--rhue, 0) + 160) 100% 60%) 50%,
      hsl(calc(var(--rhue, 0) + 220) 100% 60%) 68%,
      hsl(calc(var(--rhue, 0) + 280) 100% 60%) 84%,
      hsl(calc(var(--rhue, 0) + 340) 100% 60%) 100%);
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 600ms ease;
}
.ai-card:hover::before { opacity: 0.35; }

@media (prefers-reduced-motion: reduce) {
  .ai-card::before { transition: none; }
}

.nav-link.name {
  font-weight: 700;
  text-transform: none;
  white-space: nowrap;        /* never wrap the name onto a second line */
}

/* the name has no hover animation */
.nav-link.name::after {
  display: none;
}

/* Cursor Trail — paints the per-pixel inverse of whatever is on screen */
#paint-trail-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;            /* above content (inverts it); below intro overlay (10000) */
  mix-blend-mode: difference;
  filter: url(#goo-trail);
}


/* Bottom Bar */
.bottom-bar {
  position: fixed;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9rem; 
  z-index: 100;
  font-family: 'Geist', sans-serif;
  font-size: 2rem;
  color: var(--text-color);
}

#chicagoClock {
  /* full opacity so its text is pure black/white — lets the difference trail
     invert it to completely white when the black trail passes over it */
  opacity: 1;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums; /* all digits equal-width — prevents layout shift as seconds tick */
}

.clock-ampm {
  display: inline-block;
  min-width: 2.5ch; /* AM and PM occupy the same layout footprint — prevents text shift on period change */
  text-align: left;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.theme-toggle img {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
}

.theme-toggle:hover {
   transform: rotate(30deg);
}

/* During the intro scramble, the AI button and moon spin in place (rather than
   shaking from neighbor text reflow) and ease to a stop. Ending on 720° ≡ 0°
   leaves them visually stationary with no `forwards` fill needed. The moon runs
   slightly longer since the bottom bar resolves later in the stagger. */
@keyframes scramble-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(720deg); }
}
body.scramble-spin .ai-toggle        { animation: scramble-spin 1.4s ease-out; }
body.scramble-spin .theme-toggle img { animation: scramble-spin 1.6s ease-out; }

/* =========================================
   ABOUT SECTION
   ========================================= */
.about-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6rem;
  margin-top: 2vh;
  padding: 2rem;
  flex-wrap: wrap;
  text-align: left;
}

.about-image img {
  width: 35rem;
  height: auto;
  border-radius: 0.5rem;
  object-fit: cover;
  z-index: 100;
}

.about-content {
  max-width: 35rem;
  font-family: 'Geist', sans-serif;
  font-size: 28px;
  line-height: 1.25;
  color: var(--text-color);
  z-index: 10;
}

.about-content p {
  margin-top: 0.35rem;   
  margin-bottom: 4rem;   
}

.about-content a {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}

.hover-word {
  transition: color 0.15s ease;
  cursor: default;
}

.icon-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.35rem;
  position: relative; /* Needed to anchor the toast message */
}

.icon-links img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.icon-links img:hover {
  transform: scale(1.1);
}

body.dark-mode .github-icon {
  filter: brightness(0) invert(1);
}

/* Blob Canvas */
#blobCanvas {
  width: 30rem;
  height: 30rem;
  filter: url(#goo);
  z-index: 0;
  position: relative;
  display: block;
}

.about-inner {
  display: flex;
  gap: 6rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
}

.copy-toast {
  position: absolute;
  top: -40px; 
  left: 20%;
  transform: translateX(-50%);
  background-color: #333;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none; 
}

.copy-toast.show {
  opacity: 1;
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */

@media screen and (max-width: 1024px) {
  /* No squiggly underline on tap — :hover latches on touch devices */
  .nav-link::after {
    display: none;
  }

  .nav-link {
    -webkit-tap-highlight-color: transparent;
  }

  /* Remove the Mobile Blocker */
  #mobileNotice {
    display: none;
  }
  
  body {
    height: 100vh;
    padding: 0 1.5rem;
    align-items: center;
    box-sizing: border-box;
  }

  /* Mobile header replaces desktop nav */
  .centered-nav {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  /* Scale ai-toggle to ~0.6× of desktop proportions */
  .mobile-nav-links .ai-toggle {
    height: 1.8rem;
    width: 2.9rem;
    font-size: 1.2rem;
    gap: 0.13rem;
    padding: 0 0 0 0.25rem;
    border-radius: 0.37rem;
  }

  .mobile-nav-links .ai-toggle-glyph {
    width: 1.25rem;
    height: 1.32rem;
    border-radius: 0.55rem;
  }

  .mobile-nav-links .ai-toggle-glyph svg {
    width: 0.8rem;
    height: 0.73rem;
  }

  .mobile-nav-links .ai-toggle-label {
    padding-right: 0.30rem;
  }

  /* Hero / Home Section */
  .circle-container {
    width: 90vw;
    height: 90vw;
    max-width: 350px;
    max-height: 350px;
    margin: auto;
    overflow: hidden; /* bound the 3D sway layer so it can't add scroll/overflow on mobile */
  }

  .center-image {
    width: 90%;
    height: 90%;
  }

  /* hedcut canvas runs on mobile too (with the MOBILE_SWAY_AMP horizontal sway) */
  canvas#head-canvas {
    display: block;
  }

  img.mobile-face {
    display: none; /* canvas takes over; JS also hides this once rendered */
  }

  /* Moon icon — sized + zeroed button padding to center it under the burger */
  .theme-toggle {
    padding: 0;
  }

  .theme-toggle img {
    width: 2.1rem;
    height: 2.1rem;
    padding-right: .09rem;
  }
  
  /* Bottom Bar — show on mobile, full-width with clock left and moon right */
  .bottom-bar {
    display: flex;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    font-size: 1.5rem;
    gap: 0;
  }

  #chicagoClock {
    font-size: 1.4rem;
  }

  .ai-card::before {
    display: none;
  }

  /* About Section */
  .about-section {
    flex-direction: column;
    gap: 3rem;
    padding: 0;
    align-self: flex-start;
    margin-top: 64px;
  }

  .about-image img {
    width: 100%;
    height: auto;
  }

  .about-content {
    font-size: 1.2rem;
    max-width: 100%;
  }
  
  .about-content p {
    margin-bottom: 2rem;
  }
  
  #blobCanvas {
    width: 22rem;
    height: 22rem;
    display: none; /* blob effect disabled on mobile for performance */
  }
  
  .about-inner {
    gap: 2rem;
  }
}

/* 3D cursor-tracking head canvas — sizing/centering inherited from .center-image.
   Intentionally no border-radius so the transparent cutout's hair/edges aren't clipped. */
#head-canvas {
  display: block;
  z-index: 9999; /* above the paint trail (9998) so the trail flows behind the face, below the intro (10000) */
}

/* Static face shown only on mobile (desktop uses the WebGL #head-canvas) */
.mobile-face {
  display: none;
}

/* gentle upright sway for the mobile face; translate keeps it centered */
@keyframes face-sway {
  0%   { transform: perspective(600px) translate(-50%, -50%) rotateY(-25deg); }
  50%  { transform: perspective(600px) translate(-50%, -50%) rotateY(25deg); }
  100% { transform: perspective(600px) translate(-50%, -50%) rotateY(-25deg); }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-face { animation: none; }
}

/* =========================================
   AI CHAT PANEL
   ========================================= */

/* Nav ✳ ai badge — a rounded-rect (radius ~10px, NOT a full pill) that fills
   with the current text color, holding a contrasting star-square + "ai". It
   inverts automatically across states (light page → black badge/white "ai";
   dark page or panel open → white badge/black "ai") via the theme vars. */
.ai-toggle {
  display: inline-flex;
  align-items: center;
  align-self: center;
  flex-shrink: 0;
  gap: 0.23rem;
  height: 3rem;                 /* 48px */
  width: 4.875rem;              /* 78px */
  padding: 0 0 0 0.42rem;
  box-sizing: border-box;
  background: var(--text-color);
  color: var(--bg-color);
  border: none;
  text-decoration: none;
  border-radius: 0.62rem;       /* ~10px */
  font-family: 'Geist', sans-serif;
  font-size: 2.083rem;          /* 33.333px */
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.ai-toggle:hover { transform: scale(1.04); }

/* the small contrasting rounded square holding the sparkle */
.ai-toggle-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.083rem;              /* 33.333px */
  height: 2.199rem;             /* 35.185px */
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: 0.926rem;      /* 14.815px */
  line-height: 1;
}

.ai-toggle-glyph svg {
  display: block;
  width: 1.312rem;              /* 20.992px */
  height: 1.218rem;             /* 19.491px */
}

.ai-toggle-label {
  flex: 1;
  text-align: center;
  padding-right:.5rem;
  color: var(--bg-color);
  font-weight: 500;
}

/* Panel-open page state — transient, independent of the persisted .dark-mode
   day/night toggle, so closing restores whatever theme the user had. */
body.ai-open {
  --bg-color: #000000;
  --text-color: #ffffff;
}

body.ai-open .circle-container { display: none; }
body.ai-open .ai-view { display: flex; }
body.ai-page .ai-view { display: flex; }

/* Overlay holds the centered card; it lets clicks pass through so the nav,
   ai button and bottom bar stay interactive behind it. */
.ai-view {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  padding-top: calc(5vh + 1.8rem); /* push center point below nav (nav sits at top: 5%) */
  pointer-events: none;
  z-index: 9999;              /* above trail (9998) so card is unaffected; below intro (10000) */
}

.ai-card {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 37.5rem;              /* 600px */
  height: 41.8rem;            /* 669px per Figma */
  max-width: 92vw;
  background: #ffffff;
  border: 10px solid #000000; /* chunky black outline per Figma */
  border-radius: 20px;
  box-shadow: none;
  padding: 0 0.6rem 0.65rem; /* no top padding — text clips flush at border */
  box-sizing: border-box;
  /* the card interior is always light, regardless of page theme */
  color: #000000;
  font-family: 'Geist', sans-serif;
}


.ai-scroll {
  position: absolute;
  inset: 0;                /* fills the full card interior — clips at border */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0.65rem 0.6rem 5.75rem; /* top breathing room; bottom clears the floating inputbar */
  z-index: 1;
  scrollbar-width: none;
}
.ai-scroll::-webkit-scrollbar { display: none; }

/* Idle prompt pills — float above the input bar, anchored to bottom-right */
.ai-prompts {
  position: absolute;
  right: 0.6rem;
  bottom: 5.5rem;              /* sits above the floating inputbar */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  z-index: 2;
}

.prompt-pill {
  background: #ffffff;
  border: 2px solid #000000;
  color: #000000;
  border-radius: 999px;
  height: 3rem;                /* 48px */
  padding: 0 0.95rem;          /* ~15px */
  display: inline-flex;
  align-items: center;
  font-family: 'Geist', sans-serif;
  font-size: 2rem;             /* 32px */
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms ease, color 150ms ease;
}

.prompt-pill:hover,
.prompt-pill:focus-visible {
  background: #000000;
  color: #ffffff;
  outline: none;
}

/* Siblings slide off to the right when a prompt is chosen / submitted. */
.pill-exit {
  transform: translateX(110vw);
  opacity: 0;
  transition: transform 320ms ease-in, opacity 320ms ease-in;
}

/* Answered turn: question echo → wavy divider → answer text. */
.ai-response {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* The echoed question keeps the pill look but is inert (no hover invert). */
.prompt-pill--static {
  cursor: default;
}
.prompt-pill--static:hover,
.prompt-pill--static:focus-visible {
  background: #ffffff;
  color: #000000;
}

/* Squiggly divider under the question — same wave as the nav hover underline, thicker. */
.ai-divider {
  display: block;
  width: 100%;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14'%3E%3Cpath d='M0 7 Q7 2 14 7 Q21 12 28 7' fill='none' stroke='%23000' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 28px 14px;
  margin: 1.1rem 0 0.7rem;
  flex-shrink: 0;
}

.ai-answer {
  margin: 0;
  font-size: 2rem;             /* 32px */
  line-height: 1.18;
  color: #000000;
  white-space: pre-wrap;       /* preserve paragraph breaks from the response */
}

/* Loading indicator: three pulsing dots shown while awaiting the reply. */
.ai-answer.ai-thinking::after {
  content: "•••";
  letter-spacing: 0.12em;
  color: currentColor;
  animation: ai-thinking-pulse 1.2s ease-in-out infinite;
}
@keyframes ai-thinking-pulse {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-answer.ai-thinking::after { animation: none; opacity: 0.6; }
}

/* Input bar: floats at the bottom of the card, scroll content goes behind it */
.ai-inputbar {
  position: absolute;
  bottom: 0.65rem;
  left: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  display: flex;
  align-items: stretch;
  gap: 10px;
  height: 4.17rem;             /* ~67px, matches Figma 66.67px */
  box-sizing: border-box;
  background: #000000;         /* black outer container */
  border: none;
  border-radius: 14px;         /* matches Figma rx=14.108 */
  padding: 9px 13px 9px 7px;  /* matches Figma insets: 10t 13.3r 8.3b 6.7l */
}

.ai-send {
  flex: 0 0 auto;
  width: 3.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;         /* white rounded button */
  color: #000000;
  border: none;
  border-radius: 16px;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.ai-send-icon {
  display: block;
  width: 2rem;
  height: 2rem;
  transition: transform 0.15s ease;
}

.ai-send:hover .ai-send-icon { transform: translateY(-2px); }

.ai-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: #ffffff;         /* white text area */
  border-radius: 16px;
  color: #000000;
  font-family: 'Geist', sans-serif;
  font-size: 2rem;
  padding: 0.2rem 0.6rem 0.2rem 0.9rem;
}

.ai-input:focus { outline: none; }
.ai-input { caret-color: transparent; }

.ai-input::placeholder {
  color: #717171;
  font-style: normal;
  text-indent: 0.2rem;
}

.fake-caret {
  position: absolute;
  width: 3px;
  height: 1.8rem;
  background: #000000;
  border-radius: 1px;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
}
.fake-caret.active {
  animation: caret-blink 1.1s step-end infinite;
}
@keyframes caret-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ---- Dark-mode: white outer ring so the black border reads against the dark bg ---- */
body.dark-mode .ai-card {
  box-shadow: 0 0 0 7px #ffffff;
}

@media screen and (max-width: 1024px) {
  .ai-toggle { height: 1.6rem; font-size: 1.1rem; gap: 0.13rem; padding: 0 0.36rem 0 0.24rem; }
  .ai-toggle-glyph { width: 1.1rem; height: 1.16rem; border-radius: 0.49rem; }
  .ai-card { width: 92vw; height: 68vh; max-height: 34rem; }
  .prompt-pill { height: 2.1rem; font-size: 1.15rem; padding: 0 0.65rem; }
  .ai-answer { font-size: 1.25rem; }
  .ai-inputbar { height: 3rem; padding: 6px 8px 6px 5px; gap: 6px; bottom: 0.5rem; left: 0.4rem; right: 0.4rem; }
  .ai-prompts { bottom: 4rem; right: 0.4rem; }
  .ai-scroll { padding-bottom: 4.5rem; }
  .ai-send { width: 2.2rem; border-radius: 30px; font-size: 1.3rem; }
  .ai-input { font-size: 1.25rem; }
  .fake-caret { height: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pill-exit { transition: none; }
  .ai-toggle { transition: none; }
}

