/* ==================================================================
   05 — AI section (#ai, prefix .ai-)
   ================================================================== */
#ai {
  --ai-card-bg: rgba(255, 255, 255, 0.02);
  --ai-win-bg: #111217;
  --ai-scale: 0.9918;
  width: 100%;
  margin: 180px auto;
  overflow-x: clip;
  /* the live page's body text features (the shared base turns on ss02/ss08, which
     makes Inter draw "AI" oddly in these small sizes) */
  font-feature-settings: "liga" 1, "calt" 1, "kern" 1, "ss03" 1;
}
#ai .ai-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
#ai .ai-inner {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- heading ---------- */
#ai .ai-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 72px 20px 56px;
}
#ai .ai-eyebrow {
  font-family: var(--mono);
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  margin-bottom: 5px;
}
#ai .ai-title {
  color: #fff;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 15px;
  text-wrap: balance;
}
#ai .ai-desc {
  color: rgba(255, 255, 255, 0.5);
  max-width: 500px;
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

/* ---------- bento ---------- */
#ai .ai-bento {
  letter-spacing: normal;
  display: grid;
  margin-top: 40px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}
#ai .ai-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px;
  border-radius: 30px;
  background: var(--ai-card-bg);
  overflow: hidden;
}
/* hairline border brighter on the diagonal corners */
#ai .ai-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,.1), rgba(255,255,255,.06) 38%, rgba(255,255,255,.06) 62%, rgba(255,255,255,.1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
#ai .ai-card--chat { grid-column: 1 / 3; overflow: visible; }
#ai .ai-card-visual {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-bottom: 24px;
  user-select: none;
  -webkit-user-select: none;
}
#ai .ai-card-title {
  color: #fff;
  max-width: 450px;
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}
#ai .ai-card-desc {
  color: rgba(255, 255, 255, 0.4);
  mix-blend-mode: plus-lighter;
  max-width: 450px;
  font-size: 15px;
  line-height: 1.5;
  text-wrap: pretty;
}

/* ---------- shared chat atoms ---------- */
#ai .ai-msg { display: flex; flex-direction: column; align-items: flex-end; width: 100%; }
#ai .ai-bubble {
  max-width: min(100%, 52% + 117px);
  padding: 6px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
  word-break: break-word;
}
#ai .ai-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  margin-block: -7px -5px;
  padding-inline: 3px 4px;
  border-radius: 0.4em;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.85em;
  line-height: 1;
  vertical-align: -0.25em;
}
#ai .ai-pill > svg { flex: none; width: 14px; height: 14px; }
#ai .ai-pill > span { margin-bottom: -1px; }

#ai .ai-tool-icon {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
}
#ai .ai-tool-icon > * { grid-area: 1 / 1; }
#ai .ai-tool-icon > svg { width: 16px; height: 16px; transition: opacity .25s, transform .35s var(--ease-out); }
#ai .ai-spin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-top-color: rgba(255, 255, 255, 0.75);
  opacity: 0;
  transition: opacity .2s;
  animation: ai-spin .8s linear infinite;
}
#ai [data-loading="true"] .ai-spin { opacity: 1; }
#ai [data-loading="true"] .ai-tool-icon > svg { opacity: 0; transform: scale(.6); }

#ai .ai-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color .3s;
}
#ai [data-loading="true"] .ai-label {
  color: rgba(255, 255, 255, 0.33);
  background: linear-gradient(90deg, rgba(255,255,255,.2) 0%, #fff 25%, rgba(255,255,255,.2) 50%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ai-shimmer 1.5s linear infinite;
}
#ai .ai-count {
  display: inline-block;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  line-height: 16px;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.4);
  font-variant-numeric: tabular-nums;
}
#ai .ai-word { transition: opacity .35s ease-out; }
#ai .ai-word.is-off { opacity: 0; }

/* entrance for animated blocks */
#ai .ai-anim { transition: opacity .45s var(--ease-out), transform .55s var(--ease-out); }
#ai .ai-anim.is-off { opacity: 0; transform: translateY(6px); }

/* ==================================================================
   AI Chat window
   ================================================================== */
#ai .ai-chat-visual {
  position: relative;
  z-index: 4;
  aspect-ratio: 1842 / 750;
  margin-top: -64px;
  pointer-events: none;
}
/* warm glow leaking from behind the window */
#ai .ai-chat-visual::before {
  content: "";
  position: absolute;
  inset: -24px 20px 35%;
  z-index: 0;
  border-radius: 30px;
  background: radial-gradient(ellipse at 30% 55%, rgba(255, 73, 57, 0.25), rgba(255, 73, 57, 0) 75%);
  filter: blur(40px);
  transform: translateZ(0);
}
#ai .ai-chat-viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
          mask-image: linear-gradient(#000 55%, transparent);
}
#ai .ai-window {
  position: relative;
  isolation: isolate;
  display: flex;
  width: 980px;
  min-height: 475px;
  border-radius: 26px;
  overflow: hidden;
  color: #fff;
  font-family: var(--font);
  letter-spacing: normal;
  transform: scale(var(--ai-scale));
  transform-origin: 0 0;
  background: linear-gradient(rgba(17, 18, 23, 0.96), rgba(17, 18, 23, 0.98));
  box-shadow: 0 16px 48px 8px rgba(0,0,0,.2), 0 0 0 .5px rgba(0,0,0,.75), 0 4px 8px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.8);
}
#ai .ai-window::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 .5px rgba(255,255,255,.1), inset 0 0 0 1px rgba(255,255,255,.1);
}

/* glass controls */
#ai .ai-glass {
  position: relative;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  background: linear-gradient(rgba(255,255,255,.15), rgba(255,255,255,.12) 20%, rgba(255,255,255,.12) 80%, rgba(255,255,255,.15));
  box-shadow: 0 0 0 .5px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.12), inset 0 -1px 0 rgba(255,255,255,.08);
}
#ai .ai-glass svg { width: 18px; height: 18px; }
#ai .ai-glass--round { justify-content: center; width: 36px; height: 36px; }
#ai .ai-glass--wide { height: 36px; padding: 4px; }
#ai .ai-glass--wide > span { display: grid; place-items: center; width: 28px; height: 28px; }

/* sidebar */
#ai .ai-sidebar {
  position: relative;
  z-index: 1;
  flex: none;
  align-self: stretch;
  width: 280px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ai-win-bg), #fff 6%);
}
#ai .ai-sidebar-tint {
  position: absolute;
  inset: -40px;
  pointer-events: none;
  opacity: 0.1;
  filter: blur(40px) saturate(1.25);
  background: radial-gradient(60% 50% at 20% 20%, #7a3a3f, transparent 70%), linear-gradient(135deg, #422629, #111217 70%);
}
#ai .ai-lights { position: absolute; top: 20px; left: 20px; z-index: 2; display: flex; gap: 8px; }
#ai .ai-lights > span { width: 14px; height: 14px; border-radius: 50%; }
#ai .ai-lights > span:nth-child(1) { background: #ff625b; border: .5px solid #e53733; }
#ai .ai-lights > span:nth-child(2) { background: #febc2e; border: .5px solid #e9b713; }
#ai .ai-lights > span:nth-child(3) { background: #27c840; border: .5px solid #33b036; }
#ai .ai-sb-controls {
  position: absolute;
  top: 8px;
  left: 96px;
  right: 8px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
}
#ai .ai-sb-content {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding-top: 64px;
  font-size: 13px;
  line-height: 16px;
}
#ai .ai-sb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 4px;
  padding: 8px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.4);
  line-height: 20px;
}
#ai .ai-sb-search svg { width: 16px; height: 16px; flex: none; }
#ai .ai-sb-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 4px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}
#ai .ai-sb-group svg { width: 16px; height: 16px; flex: none; }
#ai .ai-sb-group:nth-of-type(4) { margin-bottom: 0; }
#ai .ai-sb-list li {
  margin: 0 8px;
  padding: 8px 12px;
  border-radius: 10px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#ai .ai-sb-list li.is-active { background: rgba(255, 255, 255, 0.1); }

/* chat pane */
#ai .ai-chat {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 700px;
  width: 700px;
  height: 475px;
  overflow: hidden;
}
#ai .ai-chat-header {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 8px 8px 0 16px;
}
#ai .ai-chat-heading { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
#ai .ai-chat-title { font-size: 13px; line-height: 16px; }
#ai .ai-chat-meta { color: rgba(255, 255, 255, 0.6); font-size: 11px; line-height: 13px; }
#ai .ai-chat-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  padding: 32px 16px 28px;
  font-size: 14px;
  line-height: 1.5;
}
#ai .ai-tools { margin: 16px 0 8px; }
#ai .ai-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  color: rgba(255, 255, 255, 0.4);
  line-height: normal;
}
#ai .ai-answer { color: rgba(255, 255, 255, 0.9); }

/* ==================================================================
   Quick AI
   ================================================================== */
#ai .ai-quick {
  position: relative;
  min-height: 280px;
  height: 100%;
  margin: -14px -14px 0;
  overflow: hidden;
  pointer-events: none;
}
#ai .ai-quick-search {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
}
#ai .ai-quick-logo { flex: none; width: 24px; height: 24px; color: rgba(255, 255, 255, 0.3); }
#ai .ai-quick-query {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  line-height: 28px;
}
#ai .ai-quick-text { white-space: pre; overflow: hidden; text-overflow: ellipsis; }
#ai .ai-quick-cursor {
  flex: none;
  width: 1px;
  height: 24px;
  margin-left: 1px;
  border-radius: 1px;
  background: currentColor;
}
#ai .ai-quick-hint {
  display: flex;
  align-items: center;
  flex: none;
  gap: 8px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
}
#ai .ai-quick-hint kbd {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  line-height: 1;
}
#ai .ai-quick-prompts {
  position: relative;
  height: 192px;
  margin: 12px 0 0;
  padding: 0 20px 0 56px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 18px;
  line-height: 32px;
  -webkit-mask-image: linear-gradient(#000, transparent);
          mask-image: linear-gradient(#000, transparent);
}
#ai .ai-quick-prompts li {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ==================================================================
   AI Extensions
   ================================================================== */
#ai .ai-ext {
  position: relative;
  min-height: 0;
  margin: -14px -14px 0;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 10%, transparent);
          mask-image: linear-gradient(#000 10%, transparent);
}
#ai .ai-ext-flow {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 340px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  line-height: 1.5;
}
#ai .ai-ext-steps { display: flex; flex-direction: column; }
#ai .ai-ext-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  color: rgba(255, 255, 255, 0.4);
  line-height: normal;
}
/* app icon stack: one glyph, then a second one slides in beside it */
#ai .ai-ext-stack {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  transform: translateX(-2px);
}
#ai .ai-ext-app {
  position: absolute;
  inset: 0;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  transition: transform .45s var(--ease-out), opacity .3s ease-out;
}
#ai .ai-ext-app--a { transform: translateX(2px); }
#ai .ai-ext-app--b { opacity: 0; transform: translateX(10px) scale(.7); }
#ai .ai-ext-row[data-apps="2"] .ai-ext-stack { width: 25px; }
#ai .ai-ext-row[data-apps="2"] .ai-ext-app--a { transform: translateX(0); }
#ai .ai-ext-row[data-apps="2"] .ai-ext-app--b {
  opacity: 1;
  transform: translateX(10px);
  box-shadow: 0 0 0 1.5px #121317;
}
#ai .ai-count--pill {
  flex: none;
  height: 16px;
  margin-left: -4px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.6);
  transform: translateY(1px);
}
#ai .ai-answer--sm { color: rgba(255, 255, 255, 0.8); }

/* ---------- learn more ---------- */
#ai .ai-more { display: flex; justify-content: center; margin-top: 50px; }
#ai .ai-more-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--grey-200);
  font-size: 16px;
  font-weight: 500;
  line-height: 140%;
  letter-spacing: .3px;
  transition: color .3s;
}
#ai .ai-more-link svg { width: 16px; height: 16px; transition: transform .3s; }
#ai .ai-more-link:hover { color: #fff; }
#ai .ai-more-link:hover svg { transform: translateX(2px); }

/* pause decorative loops while off-screen */
#ai.ai-paused * { animation-play-state: paused !important; }

@keyframes ai-spin { to { transform: rotate(360deg); } }
@keyframes ai-shimmer { 0% { background-position: 100% 0; } 80%, 100% { background-position: -100% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  #ai { margin: 120px auto; }
}
@media (max-width: 768px) {
  #ai { margin-block: 80px; }
  #ai .ai-heading { padding: 48px 0 40px; }
  #ai .ai-desc { font-size: 15px; }
  #ai .ai-bento { grid-template-columns: minmax(0, 1fr); gap: 15px; margin-top: 0; }
  #ai .ai-card { padding: 15px; border-radius: 20px; }
  #ai .ai-card--chat { grid-column: auto; }
  #ai .ai-chat-visual { margin-top: 0; }
  #ai .ai-card-title { font-size: 15px; }
  #ai .ai-card-desc { font-size: 13px; }
  #ai .ai-quick { min-height: 230px; margin: -5px -5px 0; }
  #ai .ai-quick-search { height: 52px; gap: 8px; padding-inline: 12px; border-radius: 15px; }
  #ai .ai-quick-query { font-size: 14px; line-height: 22px; }
  #ai .ai-quick-cursor { height: 18px; }
  #ai .ai-quick-prompts { height: 168px; padding-inline: 44px 12px; font-size: 14px; line-height: 28px; }
  #ai .ai-ext { margin: -5px -5px 0; padding: 12px; border-radius: 15px; }
  #ai .ai-ext-flow { min-height: 260px; font-size: 13px; }
  #ai .ai-more { margin-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  #ai .ai-spin,
  #ai [data-loading="true"] .ai-label { animation: none !important; }
  #ai .ai-anim, #ai .ai-word, #ai .ai-ext-app { transition: none !important; }
}
