/* AI:DA design system 2.0 — layouts.
 *
 * How pages are put together, for every surface the system serves:
 * the learner app (web and Aitu), the admin, marketing pages, printed
 * documents, slides and video frames. LAYOUTS.md explains when to use which
 * and in what order elements go; this file is the CSS for it.
 *
 * Breakpoints (CSS variables cannot be used in media queries, so they are
 * written out): 720px — phone; 860px — heads and sidebars fold; 1200px — the
 * product container.
 */

/* ── Primitives ───────────────────────────────────────────────────────── */

/* Things one under another with one gap. Margins between siblings are not
   used in this system: the parent owns the gap. */
.aida-stack { display: flex; flex-direction: column; gap: var(--stack, var(--space-4)); }
.aida-stack--s { --stack: var(--space-2); }
.aida-stack--l { --stack: var(--space-8); }
.aida-stack--xl { --stack: var(--space-16); }

/* Things in a line that wrap: buttons, filters, tags. */
.aida-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster, var(--space-3));
}

/* Running text never wider than 65 characters. */
.aida-measure { max-width: var(--measure); }

/* Main column and a side column. The side column is facts and the one
   action, never a second story. */
.aida-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-12);
  align-items: start;
}
.aida-split__aside { position: sticky; top: var(--space-6); }
@media (max-width: 860px) {
  .aida-split { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
  .aida-split__aside { position: static; }
}

/* Equal columns — two or three lists side by side on a dashboard, or text
   columns on a marketing page. Never a grid of cards. */
.aida-cols {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: var(--space-10) var(--space-12);
}
.aida-cols--3 { --cols: 3; }
@media (max-width: 860px) { .aida-cols--3 { --cols: 2; } }
@media (max-width: 720px) { .aida-cols { --cols: 1; } }

/* ── Learner app, web ─────────────────────────────────────────────────── */
/* .aida-page > .aida-topbar + main > .aida-head + .aida-panel… — all from
   components.css. The shell adds only the skip link target. */
.aida-main:focus { outline: none; }

/* ── Learner app in Aitu (and any phone-only screen) ──────────────────── */
/* Bar on top (back, title, one action), the content, and at most one
   primary action pinned to the bottom above the home indicator.
   If Aitu draws its own header, leave .aida-mobile__bar out. */
.aida-mobile {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--paper);
}
.aida-mobile__bar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: grid;
  grid-template-columns: var(--touch-min) minmax(0, 1fr) var(--touch-min);
  align-items: center;
  min-height: 52px;
  padding: env(safe-area-inset-top, 0px) var(--space-2) 0;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.aida-mobile__back,
.aida-mobile__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.aida-mobile__back:focus-visible,
.aida-mobile__more:focus-visible { outline: var(--focus-width) solid var(--focus-color); outline-offset: -2px; }
.aida-mobile__title {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-l);
  font-weight: 600;
}
.aida-mobile__body { flex: 1; padding: var(--space-5) var(--gutter-phone) var(--space-8); }
.aida-mobile__action {
  position: sticky;
  bottom: 0;
  padding: var(--space-3) var(--gutter-phone) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 1px solid var(--rule);
}
.aida-mobile__action .aida-btn { width: 100%; }

/* ── Admin: navigation column and the work ────────────────────────────── */
.aida-admin {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--paper);
}
.aida-admin__side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: var(--space-6) var(--space-3);
  border-right: 1px solid var(--rule);
  box-sizing: border-box;
}
.aida-admin__brand { display: block; padding: 0 12px var(--space-6); }
.aida-admin__main {
  min-width: 0;
  max-width: var(--container-wide);
  padding: 32px var(--gutter) var(--space-16);
  box-sizing: border-box;
}
@media (max-width: 860px) {
  .aida-admin { grid-template-columns: minmax(0, 1fr); }
  .aida-admin__side {
    position: static;
    height: auto;
    padding: var(--space-3) var(--gutter-phone);
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .aida-admin__main { padding: 20px var(--gutter-phone) var(--space-12); }
}

/* Denser rows for tables people work through all day. Opt in per table:
   <table class="aida-table" data-density="compact">. */
.aida-table[data-density='compact'] td { padding-top: 8px; padding-bottom: 8px; }
.aida-list[data-density='compact'] > .aida-row { padding: 12px 0; }

/* ── Forms ────────────────────────────────────────────────────────────── */
/* One column, 560px. Two short fields may share a line (first and last
   name, from and to dates). Actions at the end, on the left, the main one
   first — on a page. In a modal they stay on the right (components.css). */
.aida-form { display: flex; flex-direction: column; gap: var(--space-6); max-width: var(--form); }
.aida-form__pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.aida-form__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-top: var(--space-6);
  border-top: 1px solid var(--rule);
}
@media (max-width: 720px) {
  .aida-form__pair { grid-template-columns: 1fr; }
  .aida-form__foot .aida-btn { flex: 1 1 100%; }
}

/* ── Marketing pages ──────────────────────────────────────────────────── */
/* A page is a stack of bands. A band is paper, ink or sun — never a
   gradient, never a photo behind text. */
.aida-wrap {
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
  box-sizing: border-box;
}
@media (max-width: 720px) { .aida-wrap { padding-inline: var(--gutter-phone); } }

.aida-band { padding-block: var(--space-24); }
.aida-band--tight { padding-block: var(--space-16); }
@media (max-width: 720px) {
  .aida-band { padding-block: var(--space-16); }
  .aida-band--tight { padding-block: var(--space-10); }
}
/* On ink every letter is white — hierarchy comes from size and weight,
   not from a grey (principle 1: letters are dark or white). */
.aida-band--ink { background: var(--ink); color: var(--on-dark); }
.aida-band--ink .aida-link { color: var(--on-dark); }
.aida-band--sun { background: var(--sun); color: var(--ink); }

/* The hero states the thesis: the heading and one sentence on the left,
   the proof on the right (tiles, or three course rows), the rule under both
   — the product page head, one size up. */
.aida-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: var(--space-16);
  align-items: end;
  padding-bottom: var(--space-10);
  border-bottom: 2px solid var(--ink);
}
.aida-band--ink .aida-hero { border-bottom-color: var(--on-dark); }
.aida-hero__title {
  margin: 0;
  max-width: 15ch;
  font-family: var(--font-display);
  font-size: var(--text-display-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-hero);
  line-height: var(--leading-hero);
  text-wrap: balance;
}
.aida-hero__lead {
  max-width: 46ch;
  margin: var(--space-6) 0 0;
  font-size: var(--text-lead-xl);
  line-height: var(--leading-text);
  color: var(--ink-2);
}
.aida-band--ink .aida-hero__lead { color: var(--on-dark); }
.aida-hero__act { margin-top: var(--space-8); }
@media (max-width: 860px) {
  .aida-hero { grid-template-columns: minmax(0, 1fr); gap: var(--space-10); }
}

/* A section opens with its heading on the left and a sentence on the right,
   on one rule. No eyebrow label above the heading, no numbers beside it. */
.aida-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-6) var(--space-12);
  align-items: end;
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--rule);
}
.aida-band--ink .aida-section-head { border-bottom-color: var(--on-dark); }
.aida-section-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: 1.02;
  text-wrap: balance;
}
.aida-section-head__note { margin: 0; font-size: var(--text-l); color: var(--ink-2); max-width: 48ch; }
.aida-band--ink .aida-section-head__note { color: var(--on-dark); }
@media (max-width: 720px) {
  .aida-section-head { grid-template-columns: minmax(0, 1fr); }
  .aida-section-head__title { font-size: 32px; }
}

/* A feature is a row, like a course: title left, what it does right. */
.aida-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: var(--space-4) var(--space-12);
  padding: var(--space-6) 0;
  border-top: 1px solid var(--rule);
}
.aida-feature:first-child { border-top: 0; }
.aida-feature__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-title);
  font-weight: 400;
  letter-spacing: var(--tracking-title);
  line-height: var(--leading-title);
}
.aida-feature__text { margin: 0; font-size: var(--text-l); color: var(--ink-2); max-width: 52ch; }
.aida-band--ink .aida-feature { border-top-color: var(--rule-on-dark); }
.aida-band--ink .aida-feature__text { color: var(--on-dark); }
@media (max-width: 720px) { .aida-feature { grid-template-columns: minmax(0, 1fr); } }

/* The call to act: a sun band with one sentence and one button. */
.aida-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}
.aida-cta__title {
  margin: 0;
  max-width: 20ch;
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: 1.02;
}

.aida-foot {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  gap: var(--space-8);
  padding-block: var(--space-12);
  border-top: 1px solid var(--rule);
  font-size: var(--text-s);
}
.aida-foot__col { display: flex; flex-direction: column; gap: var(--space-2); }
.aida-foot a { color: var(--ink-2); text-decoration: none; min-height: 28px; display: inline-flex; align-items: center; }
.aida-foot a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 720px) { .aida-foot { grid-template-columns: 1fr 1fr; } }

/* ── Printed documents: A4 reports, letters, certificates ─────────────── */
/* For PDF from the backend and for printing from the browser. Sizes in
   points and millimetres; colours are the same tokens. */
@page { size: A4; margin: 0; }

.aida-doc {
  width: 210mm;
  min-height: 297mm;
  padding: 16mm 18mm 18mm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--print-body);
  line-height: 1.5;
}
.aida-doc__run {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 3mm;
  border-bottom: 0.75pt solid var(--ink);
  font-size: var(--print-caps);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-2);
}
.aida-doc__title {
  margin: 12mm 0 3mm;
  font-family: var(--font-display);
  font-size: var(--print-hero);
  font-weight: 800;
  letter-spacing: var(--tracking-hero);
  line-height: var(--leading-hero);
}
.aida-doc__lead { margin: 0 0 8mm; color: var(--ink-2); max-width: 60ch; }
.aida-doc h2 {
  margin: 8mm 0 3mm;
  padding-bottom: 2mm;
  border-bottom: 0.5pt solid var(--rule);
  font-family: var(--font-display);
  font-size: var(--print-title);
  font-weight: 800;
  letter-spacing: var(--tracking-title);
}
.aida-doc .aida-table th { font-size: var(--print-caps); }
.aida-doc .aida-table td { font-size: var(--print-body); padding: 2.5mm 4mm 2.5mm 0; }
.aida-doc__body { flex: 1; }
.aida-doc__foot {
  display: flex;
  justify-content: space-between;
  padding-top: 3mm;
  border-top: 0.5pt solid var(--rule);
  font-size: var(--print-caps);
  color: var(--ink-2);
}

/* The certificate: A4 landscape. Mark top left, number top right; the word,
   the name, the course; signatures and the score plaque at the foot. */
.aida-cert {
  width: 297mm;
  height: 210mm;
  padding: 16mm 18mm;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--print-body);
}
.aida-cert__top { display: flex; justify-content: space-between; align-items: baseline; }
.aida-cert__no { font-size: var(--print-caps); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-2); }
.aida-cert__mid { align-self: center; border-top: 2px solid var(--ink); padding-top: 8mm; }
.aida-cert__word { font-size: var(--print-caps); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-2); }
.aida-cert__name {
  margin: 4mm 0 6mm;
  font-family: var(--font-display);
  font-size: 40pt;
  font-weight: 800;
  letter-spacing: var(--tracking-hero);
  line-height: var(--leading-hero);
}
.aida-cert__course { font-family: var(--font-display); font-size: var(--print-title); letter-spacing: var(--tracking-title); max-width: 60ch; }
.aida-cert__foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12mm; }
.aida-cert__sign { flex: 1; max-width: 70mm; padding-top: 2mm; border-top: 0.5pt solid var(--ink); font-size: var(--print-caps); color: var(--ink-2); }
.aida-cert__score { background: var(--sun); color: var(--ink); padding: 5mm 7mm 4mm; min-width: 36mm; }
.aida-cert__score b { display: block; font-family: var(--font-display); font-size: 28pt; font-weight: 800; letter-spacing: var(--tracking-display); line-height: 1; }

@media print {
  body { margin: 0; }
  .aida-doc, .aida-cert { break-after: page; }
}
@page cert { size: A4 landscape; margin: 0; }
.aida-cert { page: cert; }

/* ── Frames: slides and video at 1920×1080 (and 1080×1920) ────────────── */
/* Drawn at their real pixel size and scaled as a whole by the player
   (transform: scale). Sizes come from the --frame-* scale. Everything that
   carries meaning stays inside the title-safe area, 5% in from each edge. */
.aida-frame {
  position: relative;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--frame-body);
  line-height: 1.35;
}
.aida-frame--vertical { width: 1080px; height: 1920px; }
.aida-frame--ink { background: var(--ink); color: var(--on-dark); }
.aida-frame--sun { background: var(--sun); color: var(--ink); }
.aida-frame__safe {
  position: absolute;
  inset: 5%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.aida-frame__top,
.aida-frame__foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--frame-caps);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.aida-frame__body { align-self: center; }
.aida-frame__hero {
  margin: 0;
  max-width: 14ch;
  font-family: var(--font-display);
  font-size: var(--frame-hero);
  font-weight: 800;
  letter-spacing: var(--tracking-hero);
  line-height: var(--leading-hero);
  text-wrap: balance;
}
.aida-frame__title {
  margin: 0 0 48px;
  padding-bottom: 32px;
  border-bottom: 3px solid currentColor;
  font-family: var(--font-display);
  font-size: var(--frame-title);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: 1.05;
}
.aida-frame__number {
  font-family: var(--font-display);
  font-size: var(--frame-number);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.aida-frame__list { margin: 0; padding: 0; list-style: none; }
.aida-frame__list > li { display: grid; grid-template-columns: 96px 1fr; gap: 32px; align-items: center; padding: 28px 0; border-top: 2px solid var(--rule); }
.aida-frame__list > li:first-child { border-top: 0; }
.aida-frame--ink .aida-frame__list > li { border-top-color: var(--rule-on-dark); }

/* The lower third in video: the name on ink, the role on sun, bottom left,
   inside the safe area. */
.aida-lower { position: absolute; left: 5%; bottom: 8%; display: flex; flex-direction: column; align-items: flex-start; }
.aida-lower__name { background: var(--ink); color: var(--on-dark); padding: 14px 24px 12px; font-family: var(--font-display); font-size: 44px; font-weight: 800; letter-spacing: var(--tracking-title); }
.aida-lower__role { background: var(--sun); color: var(--ink); padding: 10px 24px; font-size: var(--frame-caps); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; }
