/* @mctlhq/css 0.20.2 — site.css. */
/*
 * Public-site layout: the one shell mctl.ai, docs.mctl.ai and tg.mctl.ai
 * share. theme.css already carries the tokens (page width, gutter, header,
 * wordmark, hero and section type); this sheet assembles them into the
 * container, header, hero, section, card grid, reading column and footer, so
 * the three sites stop each re-deriving the same box from the same numbers.
 *
 * Every class is prefixed `mctl-site-` and sets only the properties it owns,
 * so it can sit next to a framework's own styles (Nuxt, VitePress) without a
 * reset. Requires theme.css; global.css is optional, so every class whose
 * size depends on its padding or border sets box-sizing itself rather than
 * relying on global.css's universal border-box.
 *
 * Contract, measured at any viewport:
 *   - content box: at most --site-content-width wide, centred, with
 *     --site-gutter on both sides. The container's max-width therefore adds
 *     both gutters back, because under border-box the padding counts inside
 *     max-width (the bug tg.mctl.ai had before 0.15.0: brand one gutter in);
 *   - the header brand, a hero with a visual and the card grid start on the
 *     content box's left edge;
 *   - from 0.18.0 everything else is centred on the content box's centre
 *     line by default: section titles and ledes, a hero without a visual,
 *     and the reading column. A heading over a full-width grid that sat on
 *     the left read as off-centre next to the centred cards under it;
 *   - hero: text left, visual right; one column below 960px. A hero with no
 *     visual, and the --stacked variant at every width, is one centred
 *     column: text, then any visual under it;
 *   - --start opts a section back into the pre-0.18.0 left-aligned title
 *     and lede (a docs-like page); --center is kept as an alias of the
 *     default and still centres a __narrow block;
 *   - long-form reading text is capped at --mctl-layout-prose-width, in a
 *     centred column; the text inside it stays start-aligned;
 *   - from 0.19.0 ledes are capped in characters, not pixels: a hero lede at
 *     --mctl-layout-measure-lede, a section lede at
 *     --mctl-layout-measure-prose; the hero stack (eyebrow, title, lede,
 *     actions, meta) is spaced by the --mctl-layout-hero-*-gap rhythm, which
 *     grows down the stack;
 *   - the accent marks the primary action only: the eyebrow and the footer
 *     links are neutral;
 *   - from 0.20.0 the active nav item is neutral (aria-current="page": text
 *     colour plus a 2px underline), the header gains an --app variant with
 *     context, badge and actions slots, and below 768px the nav is a right
 *     drawer behind a burger (toggle data-nav-open on the header);
 *   - footer: full-bleed, centred.
 */

.mctl-site-container {
  box-sizing: border-box;
  width: 100%;
  max-width: calc(var(--site-content-width) + 2 * var(--site-gutter));
  margin-inline: auto;
  padding-inline: var(--site-gutter);
}

/* ===== Header ===== */
.mctl-site-header {
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: var(--mctl-z-index-nav);
  height: var(--site-header-height);
  border-bottom: 1px solid var(--site-header-border);
}

/* The translucent background and blur live on a pseudo-element, not the
   header: backdrop-filter on the header itself would make it the containing
   block of the fixed mobile drawer and clip the drawer to the header's height. */
.mctl-site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--site-header-bg);
  -webkit-backdrop-filter: blur(var(--site-header-blur));
  backdrop-filter: blur(var(--site-header-blur));
}

.mctl-site-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.mctl-site-brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  white-space: nowrap;
  margin-right: auto;
  line-height: 1;
  color: var(--surface-fg);
  font-family: var(--font-display);
  font-size: var(--site-wordmark-size);
  font-weight: var(--site-wordmark-weight);
  letter-spacing: var(--site-wordmark-tracking);
  text-decoration: none;
}

.mctl-site-brand__accent {
  color: var(--accent);
  margin-right: var(--site-wordmark-accent-gap);
}

.mctl-site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-family: var(--font-display);
  font-size: var(--site-nav-size);
  font-weight: var(--site-nav-weight);
}

.mctl-site-nav a {
  color: var(--surface-fg-muted);
  text-decoration: none;
}

.mctl-site-nav a:hover {
  color: var(--surface-fg);
}

/* Active item: neutral text and a 2px underline in the text colour. Never the
   accent, which marks the primary action only. */
.mctl-site-nav a[aria-current='page'] {
  color: var(--surface-fg);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;
  text-underline-offset: 8px;
}

/* Brand mark: an inline SVG before the wordmark (alice, seerrsense). */
.mctl-site-brand__mark {
  flex: none;
  width: 1.1em;
  height: 1.1em;
  margin-right: 8px;
}

/* Status chip beside the brand or in the actions (BETA). Neutral, not accent. */
.mctl-site-chip {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--surface-line);
  border-radius: var(--mctl-radius-pill);
  color: var(--surface-fg-muted);
  font-family: var(--font-display);
  font-size: var(--text-caption-size);
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* ===== App header variant (academy-style) =====
   .mctl-site-header--app adds three slots next to the shared brand and nav:
     __context  a context picker after the brand ("/ Course name v"),
     __badge    a counter pill (open mistakes, unread),
     __actions  trailing controls (theme toggle, avatar, and the burger: put
                the burger inside __actions so the pair keeps its 8px gap).
   The brand stops pushing everything right; the nav takes that job instead. */
.mctl-site-header--app .mctl-site-brand {
  margin-right: 0;
}

.mctl-site-header--app .mctl-site-nav {
  margin-left: auto;
}

.mctl-site-header__context {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--mctl-radius-md);
  background: transparent;
  color: var(--surface-fg-muted);
  font: inherit;
  font-family: var(--font-display);
  font-size: var(--site-nav-size);
  text-decoration: none;
  cursor: pointer;
}

.mctl-site-header__context::before {
  content: '/';
  color: var(--surface-line);
}

.mctl-site-header__context:hover {
  color: var(--surface-fg);
}

.mctl-site-header__context:focus-visible,
.mctl-site-burger:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

.mctl-site-badge {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding-inline: 6px;
  border: 1px solid var(--surface-line);
  border-radius: var(--mctl-radius-pill);
  color: var(--surface-fg);
  font-size: var(--text-caption-size);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.mctl-site-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== Mobile navigation: burger + right drawer =====
   Below 768px a header that contains a .mctl-site-burger turns its nav into a
   fixed right drawer (70% wide, 300px max) over a scrim; a header without one
   is untouched. The CSS owns the look only. The consumer owns the behaviour:
   toggle data-nav-open on the header and keep aria-expanded / aria-controls on
   the burger in step; close on Escape, on a click outside the nav (the scrim
   is a ::after, so listen on the header or document), on route change and when
   the viewport grows past 768px (981px with --drawer-wide); return focus to
   the burger. */
.mctl-site-burger {
  display: none;
  flex: none;
  position: relative;
  z-index: 3;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--surface-fg);
  cursor: pointer;
}

.mctl-site-burger::before,
.mctl-site-burger::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: currentColor;
  transition: transform var(--mctl-motion-duration-fast) var(--mctl-motion-easing-standard);
}

.mctl-site-burger::before {
  transform: translateY(-4px);
}

.mctl-site-burger::after {
  transform: translateY(4px);
}

.mctl-site-header[data-nav-open] .mctl-site-burger::before {
  transform: rotate(45deg);
}

.mctl-site-header[data-nav-open] .mctl-site-burger::after {
  transform: rotate(-45deg);
}

/* Opt-in twice over: only a header that contains a .mctl-site-burger gets the
   drawer or even shows the burger (both need :has(), so a browser without it
   keeps the inline nav and never shows a dead burger). /site.css floats with
   main, so a site that has not migrated (a plain inline nav, or its own local
   burger) keeps its nav exactly as it was. */
@media (max-width: 767px) {
  .mctl-site-header:has(.mctl-site-burger) .mctl-site-burger {
    display: inline-block;
    margin-left: auto;
  }

  /* Actions slot beside the burger (theme toggle, avatar): the actions take the
     right-edge push and the burger follows them, so the pair stays together
     and the bar never wraps. */
  .mctl-site-header:has(.mctl-site-burger) .mctl-site-header__actions {
    margin-left: auto;
    gap: 8px;
  }

  .mctl-site-header:has(.mctl-site-header__actions):has(.mctl-site-burger) .mctl-site-burger {
    margin-left: 0;
  }

  .mctl-site-header--app:has(.mctl-site-burger) .mctl-site-nav {
    margin-left: 0;
  }

  .mctl-site-header:has(.mctl-site-burger) .mctl-site-header__context {
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mctl-site-header:has(.mctl-site-burger) .mctl-site-nav {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 2;
    box-sizing: border-box;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    width: 70%;
    max-width: 300px;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: calc(var(--site-header-height) + 16px) 24px 24px;
    background: var(--surface-bg);
    border-left: 1px solid var(--surface-line);
    visibility: hidden;
    transform: translateX(100%);
    transition:
      transform var(--mctl-motion-duration-base) var(--mctl-motion-easing-standard),
      visibility 0s linear var(--mctl-motion-duration-base);
  }

  .mctl-site-header:has(.mctl-site-burger)[data-nav-open] .mctl-site-nav {
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0s;
  }

  .mctl-site-header:has(.mctl-site-burger)[data-nav-open]::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1;
    background: var(--overlay-scrim);
  }
}

/* Wide variant: the same drawer up to 980px, for apps whose inline nav needs
   more room than 768px gives it (a course picker, a counter badge, an account
   menu). Add .mctl-site-header--drawer-wide next to .mctl-site-header and
   match the consumer's resize listener to (min-width: 981px). A media query
   cannot read a custom property, so the rules repeat rather than vary. */
@media (max-width: 980px) {
  .mctl-site-header--drawer-wide:has(.mctl-site-burger) .mctl-site-burger {
    display: inline-block;
    margin-left: auto;
  }

  /* Actions slot beside the burger (theme toggle, avatar): the actions take the
     right-edge push and the burger follows them, so the pair stays together
     and the bar never wraps. */
  .mctl-site-header--drawer-wide:has(.mctl-site-burger) .mctl-site-header__actions {
    margin-left: auto;
    gap: 8px;
  }

  .mctl-site-header--drawer-wide:has(.mctl-site-header__actions):has(.mctl-site-burger)
    .mctl-site-burger {
    margin-left: 0;
  }

  .mctl-site-header--drawer-wide.mctl-site-header--app:has(.mctl-site-burger) .mctl-site-nav {
    margin-left: 0;
  }

  .mctl-site-header--drawer-wide:has(.mctl-site-burger) .mctl-site-header__context {
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mctl-site-header--drawer-wide:has(.mctl-site-burger) .mctl-site-nav {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 2;
    box-sizing: border-box;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    width: 70%;
    max-width: 300px;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: calc(var(--site-header-height) + 16px) 24px 24px;
    background: var(--surface-bg);
    border-left: 1px solid var(--surface-line);
    visibility: hidden;
    transform: translateX(100%);
    transition:
      transform var(--mctl-motion-duration-base) var(--mctl-motion-easing-standard),
      visibility 0s linear var(--mctl-motion-duration-base);
  }

  .mctl-site-header--drawer-wide:has(.mctl-site-burger)[data-nav-open] .mctl-site-nav {
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0s;
  }

  .mctl-site-header--drawer-wide:has(.mctl-site-burger)[data-nav-open]::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1;
    background: var(--overlay-scrim);
  }
}

/* The motion rules sit after the drawer rules and repeat their selectors:
   `:has()` adds a class of specificity, so a bare .mctl-site-nav would lose. */
@media (prefers-reduced-motion: reduce) {
  .mctl-site-nav,
  .mctl-site-header:has(.mctl-site-burger) .mctl-site-nav,
  .mctl-site-header--drawer-wide:has(.mctl-site-burger) .mctl-site-nav,
  .mctl-site-burger::before,
  .mctl-site-burger::after {
    transition: none;
  }
}

/* ===== Hero ===== */
.mctl-site-hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
  gap: 48px;
  padding-block: var(--mctl-layout-section-padding);
  text-align: start;
}

/* Without a visual the text still keeps the left column's width rather than
   stretching across the page, so its line length matches a hero that has one.
   No grid gap: each item carries its own top margin from the hero rhythm, so
   the title sits close to its lede and the actions stand apart. */
.mctl-site-hero__text {
  grid-column: 1;
  display: grid;
  gap: 0;
  justify-items: start;
}

/* A small mono label above the title. Neutral: the title carries the
   accent, and a second accented line above it would compete. */
.mctl-site-hero__eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-marker-size);
  font-weight: var(--text-marker-weight);
  line-height: var(--text-marker-leading);
  letter-spacing: var(--text-marker-tracking);
  text-transform: uppercase;
  color: var(--marker-fg);
}

/* The rhythm, item by item. Two classes, so it outranks each item's own
   margin: 0 and a site's `.mctl-site-hero__text > *` reset. Each gap sits
   on the lower item's top margin. */
.mctl-site-hero__eyebrow + .mctl-site-hero__title {
  margin-top: var(--mctl-layout-hero-eyebrow-gap);
}

.mctl-site-hero__title + .mctl-site-hero__lede {
  margin-top: var(--mctl-layout-hero-title-gap);
}

.mctl-site-hero__text > .mctl-site-hero__actions:not(:first-child) {
  margin-top: var(--mctl-layout-hero-actions-gap);
}

.mctl-site-hero__text > .mctl-site-hero__actions + * {
  margin-top: var(--mctl-layout-hero-meta-gap);
}

.mctl-site-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-hero-size);
  font-weight: var(--text-hero-weight);
  line-height: var(--text-hero-leading);
  letter-spacing: var(--text-hero-tracking);
  color: var(--surface-fg);
}

.mctl-site-hero__lede {
  margin: 0;
  font-size: var(--text-subtitle-size);
  font-weight: var(--text-subtitle-weight);
  line-height: var(--text-subtitle-leading);
  letter-spacing: var(--text-subtitle-tracking);
  color: var(--surface-fg-muted);
  max-width: var(--mctl-layout-measure-lede);
  text-wrap: pretty;
}

.mctl-site-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.mctl-site-hero__visual {
  grid-column: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

@media (max-width: 959px) {
  .mctl-site-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .mctl-site-hero__visual {
    grid-column: 1;
    grid-row: 2;
  }
}

/* :is() is forgiving: a browser without :has() (old Android WebViews, where
   Telegram Mini Apps run) drops only that branch and keeps --stacked, where a
   plain selector list would drop the whole rule. */
/* Stacked hero: one centred column at every width, the visual under the text.
   The title gets the full text width, the lede keeps the reading width so a
   centred paragraph does not run 1400px wide. --mctl-site-hero-text-width
   sizes the text column the way --mctl-site-narrow-width sizes a narrow
   block. */
.mctl-site-hero:is(.mctl-site-hero--stacked, :not(:has(.mctl-site-hero__visual))) {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  text-align: center;
}

.mctl-site-hero:is(.mctl-site-hero--stacked, :not(:has(.mctl-site-hero__visual)))
  .mctl-site-hero__text {
  width: 100%;
  max-width: var(--mctl-site-hero-text-width, 960px);
  justify-items: center;
}

/* A centred title wrapping to one short last word reads as a mistake. */
.mctl-site-hero:is(.mctl-site-hero--stacked, :not(:has(.mctl-site-hero__visual)))
  .mctl-site-hero__title {
  text-wrap: balance;
}

.mctl-site-hero:is(.mctl-site-hero--stacked, :not(:has(.mctl-site-hero__visual)))
  .mctl-site-hero__actions {
  justify-content: center;
}

.mctl-site-hero--stacked .mctl-site-hero__visual {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
}

/* ===== Sections ===== */
.mctl-site-section {
  padding-block: var(--mctl-layout-section-padding);
}

.mctl-site-section + .mctl-site-section {
  padding-top: 0;
}

.mctl-site-section__title {
  margin: 0 0 var(--mctl-layout-stack);
  font-family: var(--font-display);
  font-size: var(--text-section-size);
  font-weight: var(--text-section-weight);
  line-height: var(--text-section-leading);
  letter-spacing: var(--text-section-tracking);
  color: var(--surface-fg);
  text-align: center;
  /* A centred title wrapping to one short last word reads as a mistake. */
  text-wrap: balance;
}

.mctl-site-section__lede {
  margin: 0 auto var(--mctl-layout-stack);
  text-align: center;
  max-width: var(--mctl-layout-measure-prose);
  font-size: var(--text-body-size);
  line-height: var(--text-body-leading);
  color: var(--surface-fg-muted);
}

/* --center is the default from 0.18.0 and stays as an alias, so markup that
   opted in before keeps working. --start puts a section back on the content
   box's left edge (a docs-like page that reads as a column of text).
   --mctl-site-narrow-width sizes a __narrow block (a form, a single plan;
   a pricing card is narrower than a form) without overriding the class. */
.mctl-site-section--start .mctl-site-section__title {
  text-align: start;
}

.mctl-site-section--start .mctl-site-section__lede {
  margin-inline: 0;
  text-align: start;
}

.mctl-site-section__narrow {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--mctl-site-narrow-width, 600px);
  margin-inline: auto;
}

/* ===== Card grid ===== */
.mctl-site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--mctl-layout-stack);
}

@media (max-width: 959px) {
  .mctl-site-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .mctl-site-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ===== Reading column (security, privacy, terms, articles) ===== */
.mctl-site-prose {
  max-width: var(--mctl-layout-prose-width);
  margin-inline: auto;
}

.mctl-site-section--start .mctl-site-prose {
  margin-inline: 0;
}

/* ===== Footer ===== */
.mctl-site-footer {
  padding-block: 48px;
  background: color-mix(in srgb, var(--surface-elevated) 85%, transparent);
  border-top: 1px solid var(--surface-line);
  text-align: center;
}

.mctl-site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.mctl-site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 32px;
  font-family: var(--font-display);
  font-size: var(--site-nav-size);
}

.mctl-site-footer__links a {
  color: var(--surface-fg-muted);
  text-decoration: none;
}

.mctl-site-footer__links a:hover {
  color: var(--surface-fg);
}

.mctl-site-footer__copy {
  margin: 0;
  font-size: var(--text-caption-size);
  color: var(--surface-fg-muted);
}
