/* =========================================================
   Foundations page
   ========================================================= */

/* ---------- Kicker ---------- */
.found-kicker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  padding: 96px 0 56px;
  align-items: start;
}
.found-kicker h1 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--fs-h0);
  letter-spacing: -0.022em; line-height: 0.92;
  margin: 0;
  /* Align cap height with body intro baseline */
  margin-top: -0.18em;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
.found-kicker__intro p {
  font-size: var(--fs-h2);
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin: 0; max-width: 32ch;
}

/* ---------- Frameworks intro ---------- */
.found-intro {
  padding: 56px 0 32px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
.found-intro h2 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--fs-h1);
  letter-spacing: -0.015em; line-height: 1;
  margin: 0;
}
.found-intro__body p {
  font-size: var(--fs-body);
  line-height: 1.5;
  margin: 0 0 16px;
  max-width: 54ch;
}
.found-intro__lede { font-style: italic; }

/* ---------- Framework tiles ---------- */
.frameworks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 24px 0 40px;
}
.framework-tile {
  margin: 0;
  display: flex; flex-direction: column; gap: 14px;
}
.framework-tile__img {
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.framework-tile__img img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.framework-tile figcaption {
  font-size: var(--fs-body);
  color: var(--ink);
}

/* ---------- Glossary ---------- */
.glossary {
  padding: 56px 0 96px;
  border-top: 1px solid var(--rule);
}
.glossary__head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  padding-bottom: 32px;
  align-items: start;
}
.glossary__head h2 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--fs-h1);
  letter-spacing: -0.015em; line-height: 1;
  margin: 0;
}
.glossary__intro p {
  font-size: var(--fs-body);
  line-height: 1.5;
  margin: 0;
  max-width: 54ch;
}

/* ---------- Sticky find bar ---------- */
.gloss-find {
  position: sticky;
  top: 64px; /* flush against site header */
  z-index: 45;
  background: var(--bg);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 24px 0 0;
  transition: border-color 200ms ease;
}
.gloss-find.is-stuck {
  border-top-color: transparent;
}
.gloss-find__inner {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 14px 0;
}
.gloss-find__search {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--rule);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg);
}
.gloss-find__search:focus-within {
  border-color: var(--ink);
}
.gloss-find__icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-soft); }
.gloss-find__search input {
  border: 0; outline: 0; background: transparent;
  font: inherit;
  font-size: var(--fs-small);
  color: var(--ink);
  width: 100%;
}
.gloss-find__search input::-webkit-search-cancel-button { appearance: none; }

.gloss-find__tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.gloss-find__tab {
  font: inherit;
  font-size: var(--fs-small);
  padding: 7px 14px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.gloss-find__tab span {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--rule);
}
.gloss-find__tab:hover { border-color: var(--ink); }
.gloss-find__tab.is-on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.gloss-find__tab.is-on span {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

.gloss-find__jump select {
  font: inherit;
  font-size: var(--fs-small);
  padding: 8px 36px 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 5 L6 8 L9 5' fill='none' stroke='%23111' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  min-width: 200px;
}
.gloss-find__jump select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Glossary rows ---------- */
.gloss-rows {
  margin-top: 0;
  scroll-margin-top: 160px;
}
.gloss-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  padding: 32px 0 40px;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 160px;
}
.gloss-row.is-hidden { display: none; }
.gloss-row.is-match mark {
  background: var(--accent);
  color: var(--ink);
  padding: 0 2px;
}
.gloss-row.is-flash {
  animation: gloss-flash 1.1s ease-out;
}
@keyframes gloss-flash {
  0%   { background: transparent; }
  20%  { background: rgba(232,255,92,0.55); }
  100% { background: transparent; }
}
.gloss-row__term {
  display: flex; flex-direction: column; gap: 2px;
}
.gloss-row__term h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.gloss-row__kicker {
  font-size: var(--fs-body);
  color: var(--ink);
  margin: 0;
  font-style: italic;
}
.gloss-row__sub {
  font-size: var(--fs-body);
  color: var(--ink);
  margin: 0;
}
.gloss-row__body {
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink);
}
.gloss-row__body p { margin: 0 0 12px; max-width: 56ch; }
.gloss-row__body p:last-child { margin-bottom: 0; }
.gloss-row__body ul {
  margin: 0 0 12px;
  padding-left: 18px;
}
.gloss-row__body ul li {
  margin-bottom: 8px;
  line-height: 1.45;
}
.gloss-row__body b { font-weight: 500; }

.gloss-empty {
  padding: 60px 0 40px;
  text-align: center;
  color: var(--ink-soft);
}
.gloss-empty button {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Examples in the world link ---------- */
.gloss-examples-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: var(--fs-body);
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  align-self: flex-start;
  transition: color 160ms ease, border-color 160ms ease, gap 200ms ease;
}
.gloss-examples-link:hover {
  gap: 10px;
  color: var(--ink);
}
.gloss-examples-link svg {
  width: 14px; height: 14px;
  transition: transform 200ms ease;
}
.gloss-examples-link:hover svg { transform: translate(2px, -2px); }

/* ---------- Modal ---------- */
.ex-modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ex-modal[aria-hidden="false"] { display: flex; }
.ex-modal__scrim {
  position: absolute; inset: 0;
  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(2px);
  animation: ex-fade 200ms ease;
}
.ex-modal__panel {
  position: relative;
  background: var(--bg);
  width: min(900px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 36px 40px 40px;
  border: 1px solid var(--ink);
  animation: ex-pop 240ms cubic-bezier(.2,.8,.2,1);
}
.ex-modal__close {
  position: absolute; top: 18px; right: 18px;
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.ex-modal__close:hover { border-color: var(--ink); }
.ex-modal__eyebrow {
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin: 0 0 6px;
}
.ex-modal__title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0 0 8px;
}
.ex-modal__sub {
  font-size: var(--fs-body);
  color: var(--ink-soft);
  margin: 0 0 28px;
  font-style: italic;
}
.ex-list { display: flex; flex-direction: column; gap: 24px; }
.ex-card {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
  align-items: start;
}
.ex-card:last-child { border-bottom: 1px solid var(--rule); }
.ex-card__brand {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ex-card__quote {
  font-size: 18px;
  line-height: 1.4;
  margin: 0 0 8px;
  letter-spacing: -0.005em;
}
.ex-card__note {
  font-size: var(--fs-small);
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}
@keyframes ex-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ex-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 600px) {
  .ex-modal__panel { padding: 28px 22px 32px; }
  .ex-card { grid-template-columns: 1fr; gap: 6px; }
  .ex-card__brand { font-size: 13px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) and (min-width: 901px) {
  /* Tablet: search on its own row, filter tabs + jump underneath */
  .gloss-find__inner {
    grid-template-columns: 1fr auto;
    row-gap: 12px;
    column-gap: 16px;
  }
  .gloss-find__search { grid-column: 1 / -1; grid-row: 1; }
  .gloss-find__tabs { grid-column: 1; grid-row: 2; }
  .gloss-find__jump { grid-column: 2; grid-row: 2; justify-self: end; }
}
@media (max-width: 900px) {
  .gloss-find { top: 47px; }
  .found-kicker {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 64px 0 40px;
    align-items: start;
  }
  .found-kicker__intro p { padding-bottom: 0; }
  .found-intro,
  .glossary__head {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .gloss-row { grid-template-columns: 1fr; gap: 16px; padding: 24px 0 32px; }
  .frameworks-grid { grid-template-columns: 1fr; gap: 24px; }
  .glossary__toc { grid-template-columns: 1fr 1fr; }
  .gloss-find__inner {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .gloss-find__jump select { width: 100%; }
}
@media (max-width: 600px) {
  .glossary__toc { grid-template-columns: 1fr; }
  .gloss-find__tabs { font-size: 12px; }
}
