/* AI Glossary — white canvas, soft blue/violet glows, SF-style type,
   two phone-shaped cards per row. Shares glossary-v2-data.js; the content is
   identical to v2 on purpose so the two pages differ only in design.

   Motion contract: only `transform` and `opacity` ever animate, so every frame
   stays on the compositor — no backdrop-filter, no animated box-shadow, no
   blur() filters (all three routinely drop frames mid-transition). Because the
   tile and the expanded card share the same phone aspect ratio, the FLIP scale
   is uniform (sx ≈ sy), so nothing stretches while it turns. */

:root {
  --blue: #3B6EFF;
  --violet: #8B5CF6;
  --ink: #0B0B12;
  --ink-2: #494954;
  --ink-3: #8A8A96;
  --hair: rgba(16, 18, 45, .10);
  --hair-2: rgba(16, 18, 45, .18);

  --ease: cubic-bezier(.32, .72, 0, 1);
  --in: 640ms;
  --out: 470ms;
  --micro: 180ms;

  --phone: 9 / 15.5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.011em;
}

/* Static radial washes — cheap to raster, never animated. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(58% 42% at 16% 8%, rgba(59, 110, 255, .17), transparent 72%),
    radial-gradient(52% 38% at 88% 18%, rgba(139, 92, 246, .16), transparent 72%),
    radial-gradient(64% 44% at 52% 104%, rgba(90, 140, 255, .13), transparent 74%);
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { letter-spacing: -.028em; font-weight: 640; margin: 0; }

/* --- Header --- */
.v3-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 18px;
}
.v3-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}
.v3-dot {
  width: 26px; height: 26px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--blue), var(--violet));
}
.v3-nav { display: flex; gap: 20px; font-size: 13.5px; color: var(--ink-2); }
.v3-nav a { color: inherit; text-decoration: none; }
.v3-nav a:hover { color: var(--ink); }

.v3-headright { display: flex; align-items: center; gap: 10px; }

.v3-lang { display: inline-flex; border: 1px solid var(--hair); border-radius: 999px; overflow: hidden; }
.v3-lang button {
  font: inherit;
  font-size: 11.5px;
  font-weight: 620;
  letter-spacing: .04em;
  padding: 6px 11px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: color var(--micro) var(--ease), background var(--micro) var(--ease);
}
.v3-lang button:hover { color: var(--ink); }
.v3-lang button[aria-pressed="true"] { background: linear-gradient(120deg, var(--blue), var(--violet)); color: #fff; }

/* Shown when the coding category is picked; dismissible, and stays dismissed
   for the rest of the visit. */
.v3-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 620px;
  margin: 0 auto 26px;
  padding: 13px 14px 13px 16px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(59, 110, 255, .08), rgba(139, 92, 246, .08));
}
.v3-note p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.v3-note-x {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  margin-left: auto;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.v3-note-x:hover { color: var(--ink); background: #fff; }

/* Visitors arrive here from the Project Finder, so there has to be an obvious
   way back out that isn't just the logo. */
/* Named -backlink, not -back: `.v3-back` is the flip card's back face and
   carries rotateY(180deg), which renders the label mirrored. */
.v3-backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: none;
  padding: 6px 12px 6px 9px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  transition: color var(--micro) var(--ease), border-color var(--micro) var(--ease);
}
.v3-backlink:hover { color: var(--ink); border-color: var(--hair-2); }

/* --- Hero --- */
.v3-hero { padding: 22px 0 20px; text-align: center; }
.v3-eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: linear-gradient(95deg, var(--blue), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.v3-hero h1 { font-size: clamp(34px, 5.4vw, 52px); line-height: 1.06; margin: 12px 0 12px; font-weight: 700; }
.v3-hero p { margin: 0 auto; max-width: 52ch; font-size: 16px; line-height: 1.55; color: var(--ink-2); }

/* --- Gradient controls: kept slim, because it pins to the top --- */
.v3-bar { position: sticky; top: 0; z-index: 30; padding: 10px 0 8px; background: rgba(255, 255, 255, .92); }
.v3-bar::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: 9px;
  background: linear-gradient(90deg, transparent, rgba(59, 110, 255, .35), rgba(139, 92, 246, .35), transparent);
}

.v3-row { display: flex; align-items: center; justify-content: center; gap: 9px; }
.v3-search { position: relative; flex: 1 1 auto; max-width: 380px; }
.v3-search input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 10px 14px 10px 38px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--hair);
  border-radius: 13px;
  box-shadow: 0 6px 18px -12px rgba(40, 60, 160, .5);
  transition: border-color var(--micro) var(--ease);
}
.v3-search input:focus { outline: none; border-color: rgba(59, 110, 255, .55); }
.v3-search input::placeholder { color: var(--ink-3); }
.v3-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); }

.v3-sort {
  font: inherit;
  font-size: 12.5px;
  padding: 9px 11px;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--hair);
  border-radius: 12px;
  flex: 0 0 auto;
}

/* Pills stay on one line and scroll sideways rather than stacking the bar taller. */
.v3-filters {
  display: flex;
  gap: 7px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.v3-filters::-webkit-scrollbar { display: none; }
.v3-filters-in { display: flex; gap: 7px; margin: 0 auto; padding: 0 2px; }

.v3-pill {
  flex: 0 0 auto;
  font: inherit;
  font-size: 12.5px;
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: transform var(--micro) var(--ease), border-color var(--micro) var(--ease);
}
.v3-pill:hover { border-color: var(--hair-2); color: var(--ink); }
.v3-pill[aria-pressed="true"] {
  background: linear-gradient(120deg, var(--blue), var(--violet));
  border-color: transparent;
  color: #fff;
}
.v3-pill:active { transform: scale(.97); }

.v3-count { display: block; text-align: center; margin-top: 7px; font-size: 12px; color: var(--ink-3); }
.v3-count:empty { display: none; }

/* --- Grid: two phone-shaped cards per row, centred --- */
.v3-section { margin: 26px 0 40px; }
.v3-section h2 { font-size: 19px; text-align: center; }
.v3-section .sub { text-align: center; font-size: 12.5px; color: var(--ink-3); margin: 4px 0 20px; }
/* Fills the row instead of stranding half the container, so the page scrolls
   a third as far. Phones fall back to a fixed 2-up, which auto-fill can't
   reach at that width. */
.v3-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
@media (max-width: 560px) {
  .v3-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* --- Phone card --- */
.v3-phone {
  position: relative;
  aspect-ratio: var(--phone);
  width: 100%;
  border-radius: 30px;
  border: 1px solid var(--hair);
  background: linear-gradient(165deg, #fff 0%, #fbfcff 52%, #f7f9ff 100%);
  box-shadow: 0 20px 40px -26px rgba(40, 55, 140, .5);
  overflow: hidden;
}
.v3-phone::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, rgba(59, 110, 255, .5), rgba(139, 92, 246, .42), transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .8;
  pointer-events: none;
}

.v3-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 14px 28px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  text-align: center;
  transition: transform var(--micro) var(--ease);
}
/* Soft orb behind the term — fills the phone face without another element.
   Sized in % so it holds its proportions as the columns get narrower. */
.v3-tile::before, .v3-front::before {
  content: "";
  position: absolute;
  top: 26%;
  left: 50%;
  width: 62%;
  aspect-ratio: 1;
  margin-left: -31%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 110, 255, .22), rgba(139, 92, 246, .15) 46%, transparent 70%);
  pointer-events: none;
}
.v3-tile:hover { transform: translateY(-4px); }
.v3-tile:active { transform: translateY(-1px) scale(.99); }
.v3-tile:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
.v3-tile.is-source { visibility: hidden; }

.v3-tile > * { position: relative; }
/* Emoji, not images: crisp at any size, no extra requests. Note they render
   in each platform's own emoji font, so Windows/Android differ from Apple. */
.ico {
  font-size: 30px;
  line-height: 1;
  letter-spacing: 1px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.ico-lg { font-size: 42px; }
.v3-tile .term {
  font-size: clamp(19px, 2.2vw, 25px);
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.v3-tile .hint { position: absolute; left: 0; right: 0; bottom: 26px; font-size: 10.5px; color: var(--ink-3); }
/* Home indicator — sells the phone silhouette. */
.v3-bezel {
  position: absolute;
  left: 50%;
  bottom: 11px;
  width: 70px; height: 4px;
  border-radius: 999px;
  background: rgba(16, 18, 45, .16);
  margin-left: -35px;
}

/* --- Expand layer --- */
.v3-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: radial-gradient(60% 50% at 30% 20%, rgba(59, 110, 255, .2), transparent 70%),
    radial-gradient(55% 45% at 78% 78%, rgba(139, 92, 246, .2), transparent 70%), rgba(255, 255, 255, .92);
  opacity: 0;
  transition: opacity var(--in) var(--ease);
}
.v3-host {
  position: fixed;
  inset: 0;
  z-index: 41;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 16px;
}
.v3-host[hidden], .v3-scrim[hidden] { display: none; }

.v3-shell {
  position: relative;
  aspect-ratio: var(--phone);
  height: min(760px, calc(100vh - 52px));
  max-width: calc(100vw - 32px);
  perspective: 1800px;
  transform-origin: center center;
  will-change: transform;
  transition: transform var(--in) var(--ease);
  outline: none;
}
.v3-shell.is-closing, .v3-shell.is-closing .v3-flipper { transition-duration: var(--out); }

.v3-flipper {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform var(--in) var(--ease);
}
.v3-flipper.is-flipped { transform: rotateY(180deg); }

.v3-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  border-radius: 36px;
  border: 1px solid var(--hair);
  background: linear-gradient(165deg, #fff 0%, #fbfcff 55%, #f6f8ff 100%);
  box-shadow: 0 40px 90px -40px rgba(40, 55, 140, .55);
  overflow: hidden;
}
.v3-front { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; padding: 38px 28px; text-align: center; }
.v3-front > * { position: relative; }
.v3-front .term { font-size: clamp(24px, 4.4vw, 32px); font-weight: 680; line-height: 1.12; letter-spacing: -.03em; }
.v3-back { transform: rotateY(180deg) translateZ(0); padding: 32px 24px 28px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.v3-label {
  font-size: 10px;
  font-weight: 680;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: linear-gradient(95deg, var(--blue), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}
.v3-back .term { font-size: 22px; font-weight: 680; letter-spacing: -.03em; line-height: 1.16; margin: 2px 0 18px; }
.v3-back p { margin: 0 0 18px; font-size: 14.5px; line-height: 1.58; color: var(--ink); }
.v3-back p.soft { color: var(--ink-2); }
.v3-shot {
  border: 1px solid var(--hair);
  border-radius: 16px;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, rgba(59, 110, 255, .07), rgba(139, 92, 246, .07));
}
.v3-shot span {
  font-size: 54px;
  line-height: 1;
  letter-spacing: 2px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.v3-close {
  position: absolute;
  top: 15px; right: 16px;
  z-index: 2;
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.v3-close:hover { color: var(--ink); border-color: var(--hair-2); }

/* --- Live code exercise --- */
.v3-code {
  width: 100%;
  min-height: 92px;
  font: 12px/1.6 ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: #f4f6ff;
  background: #0B0B12;
  border: 0;
  border-radius: 14px;
  padding: 12px;
  white-space: pre;
  resize: vertical;
}
.v3-code:focus { outline: 2px solid rgba(59, 110, 255, .6); outline-offset: 2px; }

.v3-actions { display: flex; align-items: center; gap: 8px; margin: 9px 0 10px; }
.v3-run {
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  padding: 8px 16px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(120deg, var(--blue), var(--violet));
  cursor: pointer;
  transition: transform var(--micro) var(--ease);
}
.v3-run:active { transform: scale(.97); }
.v3-reset {
  font: inherit;
  font-size: 12.5px;
  padding: 8px 13px;
  border-radius: 11px;
  border: 1px solid var(--hair);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
}
.v3-reset:hover { color: var(--ink); border-color: var(--hair-2); }

.v3-out {
  font: 11.5px/1.6 ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  background: #0B0B12;
  color: #f4f6ff;
  border-radius: 14px;
  padding: 12px;
  min-height: 42px;
  white-space: pre-wrap;
  word-break: break-word;
}
.v3-out .muted { color: rgba(244, 246, 255, .45); }
.v3-out .err { border-left: 2px solid rgba(139, 92, 246, .9); padding-left: 9px; }
.v3-out .err::before { content: "ERR  "; opacity: .55; }
.v3-out.is-fresh { animation: v3-pulse 420ms var(--ease); }
@keyframes v3-pulse { from { opacity: .4; } to { opacity: 1; } }

.v3-try { font-size: 13px; line-height: 1.55; color: var(--ink-2); margin: 12px 0 0; }
.v3-try strong { color: var(--ink); font-weight: 640; }

.v3-empty { text-align: center; color: var(--ink-3); font-size: 14px; padding: 40px 0; }
.v3-foot { text-align: center; font-size: 12px; color: var(--ink-3); padding: 30px 0 40px; }

@media (prefers-reduced-motion: reduce) {
  .v3-shell, .v3-flipper, .v3-scrim, .v3-tile, .v3-pill, .v3-run { transition: none !important; }
  .v3-out.is-fresh { animation: none; }
}
