/* ==========================================================================
   Michael Fu — site.css

   An Apple-inspired design system for a single-page academic site: system
   (SF) typography, frosted navigation, rounded grouped lists, quiet colour,
   and automatic light/dark. Everything is sized in rem/em, so the layout
   follows browser zoom and text-size settings; breakpoints are in em for the
   same reason.

   1  Tokens             7  Section headings & hero     13 Motion & user preferences
   2  Base               8  Buttons, badges, stats      14 Large screens
   3  Layout             9  Grouped lists               15 Print
   4  Profile rail      10  Feature cards, Ask-AI tile
   5  Section nav       11  Media (video, embed)
   6  Utilities         12  Footer
   ========================================================================== */


/* 1  Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          system-ui, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial,
          sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);

  --measure: 46rem;                       /* reading column */
  --gutter: 1.25rem;                      /* page side padding */
  --rail-w: clamp(17.5rem, 22vw, 21rem);    /* profile column on desktop */
  --radius: 1.25rem;                      /* cards and grouped lists */
  --pill: 62rem;                          /* fully rounded */
  --ai-gradient: linear-gradient(135deg, #bf5af2 0%, #0a84ff 38%, #30d5c8 62%, #ff9f0a 84%, #ff375f 100%);

  --bg: #ffffff;
  --card: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --line: rgba(0, 0, 0, 0.1);
  --fill: rgba(0, 0, 0, 0.06);
  --link: #0066cc;
  --tint: rgba(0, 113, 227, 0.1);
  --tint-hover: rgba(0, 113, 227, 0.17);
  --nav: rgba(255, 255, 255, 0.72);
  --focus: #0071e3;

  --rail: #1d1d1f;
  --rail-text: #f5f5f7;
  --rail-muted: #a1a1a6;
  --rail-link: #2997ff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --line: rgba(255, 255, 255, 0.14);
    --fill: rgba(255, 255, 255, 0.1);
    --link: #2997ff;
    --tint: rgba(41, 151, 255, 0.16);
    --tint-hover: rgba(41, 151, 255, 0.26);
    --nav: rgba(0, 0, 0, 0.72);
    --focus: #2997ff;

    --rail: #161617;
  }
}


/* 2  Base ------------------------------------------------------------------ */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }
img, iframe { display: block; max-width: 100%; }
img { height: auto; }

b, strong { font-weight: 600; }
em { font-style: normal; font-weight: 600; }

a {
  color: var(--link);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;   /* pressed states are styled below */
}
a:hover { text-decoration: underline; text-underline-offset: 0.18em; }

a:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
a:focus:not(:focus-visible) { outline: none; }

::selection { background: rgba(0, 113, 227, 0.25); }

[hidden] { display: none !important; }

button:focus, summary:focus, input:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
button:focus:not(:focus-visible), summary:focus:not(:focus-visible) { outline: none; }


/* 3  Layout ---------------------------------------------------------------- */
/* Small screens: profile banner on top, content below.
   >= 60em: fixed profile rail on the left, content on the right. */

.layout { min-height: 100vh; }

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.content { min-width: 0; }

@media (min-width: 40em) {
  :root { --gutter: 2rem; }
}

@media (min-width: 60em) {
  :root { --gutter: 2.5rem; }

  .layout {
    display: grid;
    grid-template-columns: 18rem minmax(0, 1fr);
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    align-items: start;
  }
}


/* 4  Profile rail ---------------------------------------------------------- */

.rail {
  background: var(--rail);
  color: var(--rail-text);
  padding: 1.75rem var(--gutter);
  padding: 1.75rem max(var(--gutter), env(safe-area-inset-right)) 1.75rem max(var(--gutter), env(safe-area-inset-left));
}

.rail a { color: var(--rail-link); }

.rail-inner {
  max-width: var(--measure);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "photo id"
    "social social"
    "contact contact"
    "quote quote";
  column-gap: 1.1rem;
}

.portrait {
  grid-area: photo;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
  background: #2b2b2e;
}

.id { grid-area: id; align-self: center; min-width: 0; }

.name {
  font-size: 1.75rem;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: #fff;
}
.role { margin-top: 0.3rem; font-size: 1.0625rem; line-height: 1.3; }
.field { margin-top: 0.15rem; font-size: 0.9375rem; line-height: 1.35; color: var(--rail-muted); }

/* Social links as app-icon tiles */
.social {
  grid-area: social;
  display: flex;
  flex-wrap: wrap;
  margin: 1.25rem -0.3rem 0;
  list-style: none;
}
.social li { margin: 0.3rem; }
.social a {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 22.37%;                 /* iOS app-icon curvature */
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.social img {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0.55rem;
  object-fit: contain;
}
.social .is-full img { padding: 0; object-fit: cover; }

@media (hover: hover) {
  .social a:hover { transform: scale(1.07); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35); }
}

.contact { grid-area: contact; margin-top: 1.1rem; font-size: 0.8125rem; line-height: 1.45; }
.contact p { text-wrap: balance; }
.contact p + p { margin-top: 0.15rem; }
.contact .muted { color: var(--rail-muted); }
.contact b { font-weight: 500; color: var(--rail-text); }

.quote {
  grid-area: quote;
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--rail-muted);
}
.quote figcaption { margin-top: 0.25rem; }

/* Tablet: portrait sits beside the details */
@media (min-width: 40em) {
  .rail { padding-top: 2.25rem; padding-bottom: 2.25rem; }
  .rail-inner {
    grid-template-areas:
      "photo id"
      "photo social"
      "photo contact"
      "quote quote";
    column-gap: 1.75rem;
  }
  .portrait { width: 8rem; height: 8rem; }
  .social { margin-top: 0.9rem; }
  .contact { margin-top: 0.6rem; }
  .quote { margin-top: 1.5rem; }
}

/* Large tablets: the quote sits in a third column, so the banner is shorter */
@media (min-width: 48em) and (max-width: 59.99em) {
  .rail-inner {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 15rem);
    grid-template-areas:
      "photo id quote"
      "photo social quote"
      "photo contact quote";
  }
  .quote {
    align-self: center;
    margin-top: 0;
    padding: 0 0 0 1.5rem;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
  }
}

/* Desktop: a single column pinned to the left, scrolls on its own when short */
@media (min-width: 60em) {
  .rail {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.5rem;
    border-right: 1px solid transparent;
  }
  .rail-inner {
    width: 100%;
    max-width: none;
    margin: auto 0;                      /* centres when there is room, scrolls from the top when not */
    display: block;
  }
  .portrait { width: 8.5rem; height: 8.5rem; margin-bottom: 1.4rem; }
  .name { font-size: 2rem; }
  .role { font-size: 1.125rem; margin-top: 0.4rem; }
  .field { font-size: 1rem; }
  .social { margin-top: 1.4rem; }
  .contact { margin-top: 1.25rem; }
  .quote { margin-top: 1.4rem; padding-top: 1.25rem; }
}

@media (min-width: 60em) and (prefers-color-scheme: dark) {
  .rail { border-right-color: rgba(255, 255, 255, 0.08); }
}


/* 5  Section nav (frosted, sticky) ----------------------------------------- */

.toc {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);                 /* fallback without backdrop-filter */
  border-bottom: 1px solid var(--line);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .toc {
    background: var(--nav);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
}

.toc ul {
  position: relative;                    /* offsetParent for the scroll-spy */
  display: flex;
  align-items: center;
  min-height: 3rem;
  margin: 0;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.toc ul::-webkit-scrollbar { display: none; }
.toc li { flex: none; }
/* Auto margins centre the links when they fit and collapse to zero when they overflow (then the bar scrolls) */
.toc li:first-child { margin-left: auto; }
.toc li:last-child { margin-right: auto; }

.toc a {
  display: block;
  padding: 0.4rem 0.7rem;
  border-radius: var(--pill);
  color: var(--text-2);
  font-size: 0.8125rem;
  line-height: 1.3;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a[aria-current="location"] { background: var(--fill); color: var(--text); }

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -4rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.6rem 1.1rem;
  border-radius: var(--pill);
  background: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 0.75rem; text-decoration: none; }


/* 7  Section headings & hero ----------------------------------------------- */

.section {
  margin-top: 4rem;
  margin-top: clamp(3rem, 8vw, 5rem);
  scroll-margin-top: 4.25rem;
}
.hero {
  margin-top: 2.5rem;
  margin-top: clamp(2rem, 6vw, 3.5rem);
  scroll-margin-top: 7rem;               /* "About" lands at the very top */
}

.section-title {
  margin-bottom: 1.1rem;
  font-size: 2rem;
  font-size: clamp(1.625rem, 1.2rem + 1.7vw, 2.25rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.subhead {
  margin: 2.25rem 0 0.9rem;
  font-size: 1.3125rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.014em;
}

.eyebrow {
  font-size: 1.0625rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text-2);
}
.hero-title {
  margin-top: 0.3rem;
  font-size: 2.75rem;
  font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.026em;
  text-wrap: balance;
}

.prose h3 {
  margin: 2.25rem 0 0.6rem;
  font-size: 1.3125rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.014em;
}
.lede { max-width: 42rem; font-size: 1.0625rem; line-height: 1.55; }


/* 8  Buttons, badges, stats ------------------------------------------------ */

.actions {
  display: flex;
  flex-wrap: wrap;
  margin: 1.4rem -0.3rem 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  margin: 0.3rem;
  padding: 0.6rem 1.15rem;
  border: 1.5px solid transparent;
  border-radius: var(--pill);
  background: var(--tint);
  color: var(--link);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
  transition: background-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn:hover { background: var(--tint-hover); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn .emoji { margin-right: 0.45em; }

/* "Ask AI": same pill, outlined with the gradient accent */
.btn-ai {
  background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--ai-gradient) border-box;
}
.btn-ai:hover {
  background: linear-gradient(var(--card), var(--card)) padding-box, var(--ai-gradient) border-box;
}
.btn-ai .more { display: none; }

/* Phones: the three links become equal-width action tiles instead of ragged pills;
   "Ask AI" spans the full width underneath */
@media (max-width: 39.99em) {
  .actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 1.4rem 0 0;
  }
  .actions .btn {
    flex-direction: column;
    justify-content: flex-start;
    margin: 0;
    padding: 0.8rem 0.35rem;
    border-radius: 1rem;
    font-size: 0.8125rem;
    line-height: 1.25;
    text-align: center;
  }
  .actions .btn .emoji { margin: 0 0 0.35rem; font-size: 1.5rem; line-height: 1; }
  .actions .btn-ai {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: center;
    padding: 0.7rem 1rem;
    border-radius: var(--pill);
    font-size: 0.9375rem;
  }
  .actions .btn-ai .emoji { margin: 0 0.4em 0 0; font-size: 1.1em; }
  .btn-ai .more { display: inline; margin-left: 0.3em; }   /* flex items drop leading spaces, so use a margin */
}

.badge {
  display: inline-block;
  margin-left: 0.2rem;
  padding: 0.05rem 0.6rem;
  border-radius: var(--pill);
  background: var(--fill);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.65;
  white-space: nowrap;
  vertical-align: 0.06em;
}
.badge b { font-weight: 600; color: var(--text); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.25rem, 1fr));
  gap: 0.75rem;
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--card);
}
.stat dd {
  font-size: 1.75rem;
  font-size: clamp(1.25rem, 0.85rem + 2.4vw, 2.25rem);
  white-space: nowrap;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat dt { margin-top: 0.2rem; font-size: 0.8125rem; line-height: 1.3; color: var(--text-2); }
@media (max-width: 26em) {
  .stats { gap: 0.5rem; }
  .stat { padding: 0.85rem 0.7rem; }
  .stat dt { font-size: 0.75rem; }
}
.stats-note { margin: 0.7rem 0 1.25rem; font-size: 0.8125rem; color: var(--text-2); }


/* 9  Grouped lists (iOS "inset grouped" style) ----------------------------- */

.list {
  margin: 0;
  list-style: none;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}
.list > li {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  line-height: 1.45;
}
.list > li + li::before {
  content: "";
  pointer-events: none;
  position: absolute;
  top: 0;
  right: 0;
  left: 1.25rem;
  height: 1px;
  background: var(--line);
}
.list--icons > li + li::before { left: 3.75rem; }

.ico {
  flex: none;
  width: 1.75rem;
  margin-right: 0.75rem;
  font-size: 1.25rem;
  line-height: 1.2;
  text-align: center;
}
.ico img { width: 1.25rem; height: auto; margin: 0.1rem auto 0; }

.row { flex: 1; min-width: 0; }
.row-sub { display: block; margin-top: 0.15rem; font-size: 0.875rem; line-height: 1.45; color: var(--text-2); }
.row-title { font-weight: 600; }

/* Rows that are a single link: whole row tappable, with a chevron.
   ".list >" keeps this ahead of the generic row padding. */
.list > .is-link { padding-right: 2.75rem; }
.is-link .row-title::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
.is-link::after {
  content: "";
  pointer-events: none;
  position: absolute;
  top: 50%;
  right: 1.35rem;
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid var(--text-2);
  border-right: 2px solid var(--text-2);
  opacity: 0.55;
  -webkit-transform: translateY(-50%) rotate(45deg);
  transform: translateY(-50%) rotate(45deg);
  transition: opacity 0.25s var(--ease), right 0.25s var(--ease);
}
@media (hover: hover) {
  .is-link:hover { background: var(--fill); }
  .is-link:hover::after { opacity: 1; right: 1.15rem; }
  .is-link .row-title:hover { text-decoration: none; }
}
.is-link .row-title { color: var(--text); }
.is-link .row-title:focus { outline-offset: 0; }
.is-link:focus-within,
.is-link:active { background: var(--fill); }

.pub .row-title { font-weight: 600; letter-spacing: -0.005em; }
.pub .row-sub { margin-top: 0.3rem; }

@media (max-width: 39.99em) {
  .list > li { padding: 0.8rem 1rem; }
  .list > li + li::before { left: 1rem; }
  .ico { width: 1.5rem; margin-right: 0.65rem; }
  .list--icons > li + li::before { left: 3.15rem; }
  .list > .is-link { padding-right: 2.25rem; }
  .is-link::after { right: 1rem; }
}


/* 10  Feature cards (Build / Train / Deploy) ------------------------------- */

.features { display: grid; gap: 0.75rem; }
.feature {
  padding: 1.4rem 1.5rem;
  border-radius: var(--radius);
  background: var(--card);
}
.feature h3 {
  font-size: 1.25rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.feature .emoji { display: block; margin-bottom: 0.5rem; font-size: 1.75rem; line-height: 1.2; }
.feature .verb { color: var(--link); }
.feature ul { margin-top: 0.8rem; list-style: none; }
.feature li { position: relative; padding-left: 1.1rem; line-height: 1.45; }
.feature li + li { margin-top: 0.4rem; }
.feature li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.62em;
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 50%;
  background: var(--text-2);
}

@media (min-width: 75em) {
  .features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* 10b  Ask-AI tile --------------------------------------------------------
   Hands a prompt (built from this page by site.js) to the visitor's own AI assistant. */

.ask {
  padding: 1.5rem 1.25rem;
  border: 1.5px solid transparent;
  border-radius: 1.5rem;
  background: linear-gradient(var(--card), var(--card)) padding-box, var(--ai-gradient) border-box;
  box-shadow: 0 22px 60px -34px rgba(100, 90, 255, 0.6);
}
.ask-title {
  font-size: 1.75rem;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.ask-title .emoji { margin-right: 0.35em; }
.ask-lede { margin-top: 0.6rem; max-width: 38rem; color: var(--text-2); font-size: 1.0625rem; line-height: 1.5; }

.chips { display: flex; flex-wrap: wrap; margin: 1.25rem -0.25rem 0; }
.chip {
  margin: 0.25rem;
  padding: 0.5rem 0.95rem;
  border: 0;
  border-radius: 1.1rem;                 /* pill when one line, soft rectangle when it wraps */
  background: var(--fill);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
@media (hover: hover) {
  .chip[aria-pressed="false"]:hover { background: var(--tint); color: var(--link); }
}

.ask-input {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;                       /* 16px: stops iOS Safari zooming in on focus */
  line-height: 1.3;
  -webkit-appearance: none;
  appearance: none;
}
.ask-input::placeholder { color: var(--text-2); opacity: 1; }

.ask-label { margin-top: 1.25rem; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.01em; color: var(--text-2); }
.ask-actions { display: flex; flex-wrap: wrap; align-items: center; margin: 0.3rem -0.3rem 0; }
.btn-fill { background: #0071e3; color: #fff; }
.btn-fill:hover { background: #0077ed; }
.btn-text {
  margin: 0.3rem;
  padding: 0.6rem 0.8rem;
  border: 0;
  border-radius: var(--pill);
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-text:hover { background: var(--tint); }

.ask-status { min-height: 1.5em; margin-top: 0.4rem; font-size: 0.875rem; color: var(--text-2); }

.ask-peek { margin-top: 0.6rem; }
.ask-peek summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
  color: var(--link);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}
.ask-peek summary::-webkit-details-marker { display: none; }
.ask-peek summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  margin-left: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  -webkit-transform: translateY(-2px) rotate(45deg);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.25s var(--ease);
}
.ask-peek[open] summary::after { -webkit-transform: translateY(2px) rotate(-135deg); transform: translateY(2px) rotate(-135deg); }
.ask-peek textarea {
  display: block;
  width: 100%;
  min-height: 9rem;
  max-height: 20rem;
  margin-top: 0.8rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.55;
  resize: vertical;
}
.ask-note { margin-top: 1rem; max-width: 40rem; font-size: 0.8125rem; line-height: 1.5; color: var(--text-2); }

@media (min-width: 40em) {
  .ask { padding: 2rem; }
  .ask-title { font-size: 2rem; }
}
@media (max-width: 39.99em) {
  .ask-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin: 0.6rem 0 0; }
  .ask-actions .btn { margin: 0; justify-content: center; }
  .ask-actions .btn-fill { grid-column: 1 / -1; }          /* main action on its own row; the others pair up below */
  .ask-actions .btn-text { grid-column: 1 / -1; justify-self: center; margin: 0; }
}


/* 11  Media (video, embeds) ------------------------------------------------ */

.showcase {
  margin-top: 0.75rem;
  padding: 1.5rem 1.25rem;
  border-radius: var(--radius);
  background: var(--card);
}
.showcase-logo { display: block; width: min(15rem, 62%); margin: 0 auto 1.25rem; }
.showcase-logo:hover { text-decoration: none; }
.showcase-logo img { width: 100%; }

.ratio {
  position: relative;
  height: 0;
  padding-top: 56.25%;                   /* 16:9; works without aspect-ratio support */
  overflow: hidden;
  border-radius: 0.9rem;
  background: #000;
  -webkit-transform: translateZ(0);      /* keeps rounded corners on iframes in Safari */
  transform: translateZ(0);
}
.ratio iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.showcase .ratio { max-width: 40rem; margin: 0 auto; }

.embed { margin-top: 1.25rem; }
.embed .ratio { border-radius: var(--radius); background: var(--card); }
.embed-caption { margin-top: 0.7rem; font-size: 0.875rem; color: var(--text-2); }


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

.site-footer { margin-top: 4rem; margin-top: clamp(3rem, 8vw, 5rem); }
.site-footer .wrap { padding-top: 1.5rem; padding-bottom: calc(2.5rem + env(safe-area-inset-bottom)); }
.site-footer p {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--text-2);
}


/* 13  Motion & user preferences -------------------------------------------- */

@-webkit-keyframes rise { from { opacity: 0; -webkit-transform: translate3d(0, 0.75rem, 0); } to { opacity: 1; -webkit-transform: none; } }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 0.75rem, 0); } to { opacity: 1; transform: none; } }

.rail-inner { -webkit-animation: rise 0.9s var(--ease) both; animation: rise 0.9s var(--ease) both; }
.hero { -webkit-animation: rise 0.9s var(--ease) 0.12s both; animation: rise 0.9s var(--ease) 0.12s both; }

/* Added by site.js to sections that start below the fold */
.reveal {
  opacity: 0;
  -webkit-transform: translate3d(0, 1.5rem, 0);
  transform: translate3d(0, 1.5rem, 0);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.is-visible { opacity: 1; -webkit-transform: none; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    -webkit-animation: none !important;
    animation: none !important;
    transition: none !important;
  }
  .reveal { opacity: 1; -webkit-transform: none; transform: none; }
}


/* Higher contrast on request */
@media (prefers-contrast: more) {
  :root { --text-2: #515154; --line: rgba(0, 0, 0, 0.35); --fill: rgba(0, 0, 0, 0.1); }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root { --text-2: #c7c7cc; --line: rgba(255, 255, 255, 0.4); --fill: rgba(255, 255, 255, 0.18); }
}

/* Windows High Contrast / forced colours drop backgrounds: give shapes an outline instead */
@media (forced-colors: active) {
  .btn, .badge, .stat, .feature, .list, .showcase, .social a, .ask, .chip, .ask-input { border: 1px solid CanvasText; }
  .chip[aria-pressed="true"] { border-width: 3px; }
  .toc a[aria-current="location"] { border: 1px solid Highlight; }
  .is-link::after { border-color: CanvasText; opacity: 1; }
}


/* 14  Large screens: scale up with the viewport ---------------------------- */

@media (min-width: 96em) {                /* >= 1536px */
  html { font-size: 112.5%; }
}
@media (min-width: 128em) {               /* >= 2048px */
  html { font-size: 125%; }
}


/* 15  Print ---------------------------------------------------------------- */

@media print {
  :root { --bg: #fff; --card: #fff; --text: #000; --text-2: #444; --link: #000; --line: #ccc; --fill: #eee; }
  html { font-size: 90%; }
  .toc, .skip-link, .ratio, .showcase, .embed, .site-footer, .social, .ask, .btn-ai { display: none !important; }
  .layout { display: block; }
  .rail { position: static; height: auto; background: none; color: #000; padding: 0 0 1rem; border-bottom: 1px solid #ccc; }
  .rail a, .name, .contact b { color: #000; }
  .field, .contact .muted, .quote { color: #444; }
  .rail-inner, .hero, .reveal { animation: none; opacity: 1; transform: none; }
  .list > li, .feature, .stat { break-inside: avoid; }
  .section { margin-top: 1.5rem; }
}
