/* StudentPilot — application styles.
 * Single-file design system: tokens first, then base, components, and pages.
 * Palette is built for aviation: high-sky whites, deep flight blue, slate
 * inks, and a sunset-orange accent (think windsocks and golden hour). */

:root {
  --ink: #1f2933;
  --ink-soft: #4a5866;
  --ink-faint: #7d8b99;
  --paper: #f6f9fc;            /* high sky */
  --paper-deep: #e9f0f7;       /* deeper sky for wells and columns */
  --card: #ffffff;
  --line: #dbe4ee;
  --brand: #14538f;            /* flight blue */
  --brand-deep: #0e3d6b;
  --brand-soft: #e3eef9;
  --accent: #c2611b;           /* sunset orange */
  --accent-soft: #faeadd;
  --danger: #b03a2e;
  --danger-soft: #f9e7e4;
  --ok: #3f7d51;
  --ok-soft: #e9f2ea;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(20, 45, 75, .05), 0 6px 20px rgba(20, 45, 75, .07);
  --shadow-lg: 0 2px 4px rgba(20, 45, 75, .07), 0 16px 40px rgba(20, 45, 75, .12);
  --font-display: "Avenir Next", Avenir, Futura, "Century Gothic", "Segoe UI", ui-sans-serif, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 .5rem;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); }

/* ---------- Icons ---------- */

.icon {
  width: 1em; height: 1em;
  vertical-align: -0.14em;
  flex-shrink: 0;
}
.icon--brand { color: var(--brand); }
.icon--accent { color: var(--accent); }
.icon--ok { color: var(--ok); }
.icon--danger { color: var(--danger); }
.icon--muted { color: var(--ink-faint); }
h1 .icon, h2 .icon, h3 .icon { margin-right: .15em; }

/* ---------- Brand ---------- */

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.brand__mark {
  display: inline-grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 8px;
  background: linear-gradient(135deg, #1a63a8, var(--brand-deep));
  color: #fff;
}
.brand__mark .icon { width: 1.15rem; height: 1.15rem; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; letter-spacing: .01em; }
.brand--stacked { flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.brand--stacked .brand__mark { width: 2.6rem; height: 2.6rem; border-radius: 10px; }
.brand--stacked .brand__mark .icon { width: 1.5rem; height: 1.5rem; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: .55rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit; font-weight: 600; font-size: .93rem;
  letter-spacing: .01em;
  text-decoration: none; text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn--primary {
  background: linear-gradient(160deg, #1a63a8, var(--brand-deep));
  color: #fff;
  box-shadow: 0 1px 2px rgba(14, 61, 107, .35);
}
.btn--primary:hover { background: var(--brand-deep); box-shadow: 0 2px 8px rgba(14, 61, 107, .35); }
.btn--outline { background: transparent; color: var(--ink); border-color: var(--ink-faint); }
.btn--outline:hover { border-color: var(--brand); color: var(--brand-deep); }
.btn--ghost { background: transparent; color: var(--ink-soft); }
.btn--ghost:hover { background: var(--brand-soft); color: var(--brand-deep); }
.btn--danger { background: transparent; color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--iconed { display: inline-flex; align-items: center; gap: .45rem; }
.btn--iconed .icon { width: 1rem; height: 1rem; flex-shrink: 0; }
.btn__count {
  min-width: 1.3rem; text-align: center;
  padding: .05rem .45rem; border-radius: 999px;
  background: var(--brand); color: #fff;
  font-size: .75rem; font-weight: 700; line-height: 1.3;
}
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn--sm { padding: .3rem .85rem; font-size: .85rem; }
.btn--lg { padding: .8rem 1.8rem; font-size: 1.05rem; }
.btn--block { display: block; width: 100%; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Flash messages ---------- */

.flash-wrap { max-width: 1080px; margin: 1rem auto 0; padding: 0 1.5rem; }
.flash {
  padding: .7rem 1.1rem; border-radius: var(--radius);
  font-size: .95rem; font-weight: 500; margin-bottom: .5rem;
  border: 1px solid transparent;
}
.flash--notice { background: var(--ok-soft); color: var(--ok); border-color: rgba(63, 125, 81, .2); }
.flash__link {
  display: inline-block; margin-left: .6rem; padding: .15rem .7rem;
  border-radius: 999px; background: var(--ok); color: #fff;
  font-size: .85rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.flash__link:hover { background: var(--brand-deep); }
.flash--alert { background: var(--danger-soft); color: var(--danger); border-color: rgba(176, 58, 46, .2); }

/* ---------- App navigation ---------- */

.site-nav {
  background: rgba(246, 249, 252, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.site-nav__inner {
  max-width: 1080px; margin: 0 auto; padding: .7rem 1.5rem;
  display: flex; align-items: center; gap: 2rem;
}
.site-nav__menu { display: flex; align-items: center; gap: 2rem; flex: 1; min-width: 0; }
.site-nav__links { display: flex; gap: .25rem; flex: 1; }
.site-nav__link {
  padding: .4rem .8rem; border-radius: 999px;
  color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: .93rem;
  white-space: nowrap;
}
.site-nav__link:hover { background: var(--paper-deep); color: var(--ink); }
.site-nav__link.is-active { background: var(--brand-soft); color: var(--brand-deep); }
.site-nav__count {
  display: inline-block; min-width: 1.3rem; text-align: center;
  margin-left: .35rem; padding: .08rem .38rem; border-radius: 999px;
  background: var(--brand); color: #fff;
  font-size: .72rem; font-weight: 700; line-height: 1.2;
}
.site-nav__user { display: flex; align-items: center; gap: .75rem; }
.site-nav__user .btn { white-space: nowrap; }
.site-nav__email { color: var(--ink-faint); font-size: .9rem; white-space: nowrap; }

/* Hamburger — hidden on desktop, shown when the menu collapses. */
.site-nav__toggle {
  display: none;
  margin-left: auto;
  flex-direction: column; justify-content: center; gap: 4px;
  width: 2.4rem; height: 2.4rem;
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; padding: 0; align-items: center;
}
.site-nav__toggle span {
  display: block; width: 1.05rem; height: 2px; border-radius: 2px;
  background: var(--ink); transition: transform .18s, opacity .18s;
}
.site-nav--open .site-nav__toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-nav--open .site-nav__toggle span:nth-child(2) { opacity: 0; }
.site-nav--open .site-nav__toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1080px) {
  .site-nav__inner { flex-wrap: wrap; gap: .75rem 1rem; }
  .site-nav__toggle { display: flex; }
  .site-nav__menu { display: none; }
  .site-nav--open .site-nav__menu {
    display: flex; flex-direction: column; align-items: stretch;
    flex-basis: 100%; gap: .25rem; padding: .5rem 0 .75rem;
  }
  .site-nav--open .site-nav__links { flex-direction: column; gap: .1rem; }
  .site-nav--open .site-nav__link { padding: .6rem .8rem; border-radius: var(--radius); font-size: 1rem; }
  .site-nav--open .site-nav__user {
    justify-content: space-between;
    border-top: 1px solid var(--line); margin-top: .5rem; padding: .85rem .3rem 0;
  }
  .site-nav--open .site-nav__email { white-space: normal; overflow-wrap: anywhere; }
}

/* ---------- Page scaffold ---------- */

.page { max-width: 1080px; margin: 0 auto; padding: 2.25rem 1.5rem 4rem; }
.page--narrow { max-width: 640px; }
.page__header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.75rem;
}
.page__subtitle { color: var(--ink-soft); margin: 0; }
.section-title { margin: 2.25rem 0 1rem; font-size: 1.15rem; color: var(--ink-soft); }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 1.75rem;
}

/* ---------- Hero (landing) ---------- */

.hero { text-align: center; padding: 4.5rem 1.5rem 3rem; max-width: 760px; margin: 0 auto; }
.hero__kicker {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .3rem .95rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-deep);
  font-size: .85rem; font-weight: 600; letter-spacing: .02em;
  margin-bottom: 1.25rem;
}
.hero h1 { font-size: 2.6rem; letter-spacing: -0.02em; margin-bottom: .75rem; }
.hero__lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 34rem; margin: 0 auto 1.75rem; }
.hero__actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
@media (max-width: 640px) {
  .hero { padding-top: 3rem; }
  .hero h1 { font-size: 2rem; }
}

/* ---------- Stat cards & feature grid ---------- */

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem; display: flex; flex-direction: column;
}
.stat-card__value { font-family: var(--font-display); font-size: 2rem; font-weight: 600; letter-spacing: -0.01em; }
.stat-card__label { color: var(--ink-faint); font-size: .9rem; }
.stat-card--link { text-decoration: none; color: inherit; transition: box-shadow .15s, border-color .15s, transform .15s; }
.stat-card--link:hover { box-shadow: var(--shadow-lg); border-color: var(--brand); transform: translateY(-1px); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.feature-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 1.5rem;
}
.feature-card p { color: var(--ink-soft); margin: 0; font-size: .95rem; }
.feature-card--empty {
  border-style: dashed; box-shadow: none; background: transparent;
  color: var(--ink-soft); text-align: center; padding: 3rem 1.5rem;
}
.feature-card--empty p { margin: 0 auto; max-width: 34rem; }
.feature-card--link { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s, border-color .15s, transform .15s; }
.feature-card--link:hover { box-shadow: var(--shadow-lg); border-color: var(--brand); transform: translateY(-1px); }

/* ---------- Tables ---------- */

.table-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th {
  text-align: left; padding: .8rem 1.25rem;
  color: var(--ink-faint); font-weight: 600; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .08em;
  border-bottom: 1px solid var(--line);
}
.table td { padding: .8rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table__actions { text-align: right; white-space: nowrap; }
.table__actions form { display: inline-block; }

.badge {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px;
  background: var(--paper-deep); color: var(--ink-soft);
  font-size: .78rem; font-weight: 600;
}
.badge--brand { background: var(--brand-soft); color: var(--brand-deep); }
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Forms ---------- */

.form__field { margin-bottom: 1.1rem; }
.form__field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
.form__field input[type="text"],
.form__field input[type="email"],
.form__field input[type="password"],
.form__field input[type="number"],
.form__field input[type="date"],
.form__field input[type="tel"],
.form__field textarea,
.form__field select {
  width: 100%; padding: .6rem .8rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; background: #fff; color: var(--ink);
}
.form__field textarea { resize: vertical; }
.form__field input:focus,
.form__field textarea:focus,
.form__field select:focus {
  outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand);
}
.form__field--checkbox { display: flex; align-items: center; gap: .5rem; }
.form__field--checkbox label { margin: 0; font-weight: 500; }
.form__field--checkbox input { width: 1.05rem; height: 1.05rem; accent-color: var(--brand); }
.form__hint { color: var(--ink-faint); font-size: .85rem; margin: .35rem 0 0; }
.form__actions { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.form__errors {
  background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1.25rem; font-size: .95rem;
}
.form__errors ul { margin: .25rem 0 0; padding-left: 1.25rem; }

/* ---------- Library ---------- */

.book-card h3 { margin-bottom: .15rem; }
.book-card__subtitle { color: var(--brand-deep); font-weight: 600; font-size: .9rem; margin-bottom: .6rem; }
.book-card__meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: 1rem; }
.book-card--pending { opacity: .75; border-style: dashed; box-shadow: none; }

/* ---------- Reader ---------- */

.reader { max-width: 720px; }
.reader__header { margin-bottom: 2rem; }
.reader__admin { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; }
.reader__admin form { display: inline-block; }
.reader__body { font-size: 1.08rem; line-height: 1.75; }

.seg { padding: .35rem .75rem; margin: 0 -.75rem; border-radius: var(--radius); cursor: pointer; transition: background .2s; }
.seg p { margin: 0 0 .9rem; }
.seg h2 { margin: 2rem 0 .75rem; }
.seg h3 { margin: 1.5rem 0 .5rem; }
.seg:hover { background: var(--paper-deep); }
.seg--callout {
  background: var(--brand-soft); border-left: 3px solid var(--brand);
  margin: 1rem -.75rem; padding: .9rem 1rem;
}
.seg--callout p { margin: 0; font-weight: 500; }
.seg--figure_note { color: var(--ink-soft); font-size: .95rem; font-style: italic; }
.seg--figure_note p { margin: .25rem 0 1rem; }
.seg--list_item p { margin: 0 0 .5rem; padding-left: 1.4rem; position: relative; }
.seg__bullet {
  position: absolute; left: .3rem; top: .72em;
  width: .45rem; height: .45rem; border-radius: 999px; background: var(--brand);
}

/* The moving highlight — a warm, highlighter-pen wash over the passage
   being read, with the spoken word marked more strongly where supported. */
.seg.is-reading { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.seg.is-reading:hover { background: var(--accent-soft); }
.seg--callout.is-reading { border-left-color: var(--accent); }
.read-word.is-spoken { background: rgba(194, 97, 27, .3); border-radius: 3px; }

.reader__footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.5rem; }

/* Sticky bottom player bar */
body.has-reader-player { padding-bottom: 5.5rem; }
.reader-player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.reader-player__inner {
  max-width: 720px; margin: 0 auto; padding: .7rem 1.5rem;
  display: flex; align-items: center; gap: .9rem;
}
.reader-player__play {
  display: grid; place-items: center;
  width: 3rem; height: 3rem; border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(160deg, #1a63a8, var(--brand-deep)); color: #fff;
  flex-shrink: 0; transition: box-shadow .15s;
}
.reader-player__play:hover { box-shadow: 0 2px 10px rgba(14, 61, 107, .4); }
.reader-player__play .icon { width: 1.25rem; height: 1.25rem; }
.reader-player__pause-icon { display: none; }
.reader--playing .reader-player__pause-icon { display: block; }
.reader--playing .reader-player__play-icon { display: none; }
.reader-player__skip {
  display: grid; place-items: center;
  width: 2.2rem; height: 2.2rem; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft); cursor: pointer;
  flex-shrink: 0;
}
.reader-player__skip:hover { border-color: var(--brand); color: var(--brand-deep); }
.reader-player__status { flex: 1; min-width: 0; font-size: .9rem; color: var(--ink-soft); }
.reader-player__meter {
  display: block; height: 4px; margin-top: .35rem;
  background: var(--paper-deep); border-radius: 999px; overflow: hidden;
}
.reader-player__meter-fill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: 999px; transition: width .3s;
}
.reader-player__rate { display: flex; align-items: center; gap: .45rem; font-size: .85rem; flex-shrink: 0; }
.reader-player__rate select {
  font: inherit; padding: .25rem .5rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; color: var(--ink);
}
@media (max-width: 640px) {
  .reader-player__rate span { display: none; }
  .reader-player__inner { padding: .6rem 1rem; gap: .6rem; }
}

/* ---------- Dashboard ---------- */

.continue-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
}
.continue-card__eyebrow {
  color: var(--ink-faint); font-weight: 600; font-size: .85rem;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: .35rem;
}

/* ---------- Copilot chat ---------- */

.chat__title { margin-bottom: 1.5rem; }
.chat { display: flex; flex-direction: column; gap: .9rem; margin-bottom: 1.5rem; }
.chat-message { max-width: 85%; padding: .9rem 1.1rem; border-radius: var(--radius-lg); }
.chat-message p:last-child { margin-bottom: 0; }
.chat-message--student {
  align-self: flex-end;
  background: var(--brand-soft); color: var(--brand-deep);
  border-bottom-right-radius: 4px;
}
.chat-message--copilot {
  align-self: flex-start;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-bottom-left-radius: 4px;
}
.chat-message--pending { color: var(--ink-soft); }
.chat-message__sources {
  display: flex; gap: .35rem; flex-wrap: wrap; align-items: center;
  margin-top: .7rem; padding-top: .7rem; border-top: 1px solid var(--line);
  font-size: .85rem;
}
.chat__composer { padding: 1.1rem 1.25rem; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); margin-top: 2rem; }
.site-footer__inner {
  max-width: 1080px; margin: 0 auto; padding: 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  color: var(--ink-faint); font-size: .9rem;
}

/* ---------- Utilities ---------- */

.muted { color: var(--ink-faint); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ---------- Copilot drawer (reader) ---------- */

.link-button {
  background: none; border: none; padding: 0; font: inherit;
  color: var(--brand); text-decoration: underline; cursor: pointer;
}

.copilot-drawer__backdrop {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(31, 41, 51, .35);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.copilot-drawer__panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: min(420px, 100vw);
  background: var(--card); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s ease;
}
.copilot-drawer--showing .copilot-drawer__backdrop { opacity: 1; pointer-events: auto; }
.copilot-drawer--showing .copilot-drawer__panel { transform: translateX(0); }

.copilot-drawer__header {
  display: flex; align-items: center; gap: .6rem;
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--line);
}
.copilot-drawer__header h2 { font-size: 1.05rem; }
.copilot-drawer__context {
  flex: 1; min-width: 0; font-size: .85rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copilot-drawer__close {
  background: none; border: none; padding: .2rem; cursor: pointer;
  color: var(--ink-faint); display: inline-flex;
}
.copilot-drawer__close .icon { width: 1.3rem; height: 1.3rem; }
.copilot-drawer__close:hover { color: var(--ink); }

.copilot-panel__content { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat--panel {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 1rem 1.1rem; margin: 0;
}
.chat--panel .chat-message { max-width: 100%; }
.copilot-panel__empty { padding: 1rem .25rem; }
.copilot-panel__composer {
  display: flex; gap: .5rem; align-items: flex-end;
  padding: .8rem 1.1rem calc(.8rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--paper);
}
.copilot-panel__input {
  flex: 1; padding: .55rem .75rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; background: #fff; color: var(--ink); resize: none;
}
.copilot-panel__input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }

/* ---------- Reader figures ---------- */

.seg__figure { margin: 0; }
.seg__figure img {
  display: block; max-width: 100%; margin: 0 auto .5rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); background: #fff;
}
.seg__figure figcaption { text-align: center; }

/* ---------- Figure gallery ---------- */

.filter-pills { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-pill {
  padding: .35rem .9rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-soft); text-decoration: none; font-size: .9rem; font-weight: 500;
}
.filter-pill:hover { border-color: var(--brand); color: var(--brand-deep); }
.filter-pill.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-deep); }

.figure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.figure-card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow: hidden; text-decoration: none; color: inherit;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.figure-card:hover { box-shadow: var(--shadow-lg); border-color: var(--brand); transform: translateY(-1px); }
.figure-card__image {
  display: grid; place-items: center;
  background: #fff; border-bottom: 1px solid var(--line);
  height: 170px; overflow: hidden;
}
.figure-card__image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.figure-card__caption { padding: .7rem .9rem; font-size: .85rem; color: var(--ink-soft); }
