/* Fresco on the class pages, step 1: the class around the material. The header (where you
   are, the title, the action bar), the tabs, «Next class» and the frame of each activity,
   the same on Cebollitas, Patatas, Tortillas, Aventura and Teens. What runs inside a tab
   (class practice, guided grammar, conversations, readings, the board) follows in its
   own step, so it is left alone here.

   The chrome comes from src/lessonChrome.js plus each level's own header. Loaded after
   fresco.css; the level sheets set these controls with !important (no-gradients.css,
   aventura-illustrated.css), so the overrides here need it too. A classroom environment
   (data-ct-theme other than classic) keeps painting its own launch buttons. */

/* The old tokens, remapped inside the class chrome so anything built on them follows. */
:is(.cebollitas-adventure-header, .patatas-adventure-header, .av-unit-head, .av-class-head, .av-class-header, .av-nav-toggle, .av-lesson-nav, .tl-toolbar, .teens-book-head, .lesson-context, .lesson-next, .class-actions, .cebollitas-resource-tabs, .av-clean .av-tabs, .classic-class-header, .classic-class-material .media-tabs) {
  --brand-navy: var(--fresco-ink);
  --brand-navy-2: var(--fresco-primary);
  --brand-cyan: var(--fresco-primary);
  --brand-cyan-strong: var(--fresco-primary);
  --brand-cyan-soft: var(--fresco-primary-soft);
  --accent-green: var(--fresco-primary);
  --text: var(--fresco-ink);
  --muted: var(--fresco-muted);
  --line: var(--fresco-line);
  --av-purple: var(--fresco-primary);
  --av-line: var(--fresco-line);
  --lesson-accent: var(--fresco-primary);
  font-family: var(--fresco-font);
  font-synthesis: none;
}

/* ---- Header ---- */

:is(.cebollitas-adventure-heading, .patatas-adventure-heading, .av-unit-head, .tl-brand, .teens-book-head) h1,
.av-class-head h2 {
  color: var(--fresco-ink);
  font-family: var(--fresco-display);
  font-weight: 600;
  letter-spacing: -0.015em;
}

:is(.av-unit-head, .av-class-head, .teens-book-head) p {
  color: var(--fresco-muted);
  font-weight: 400;
}

:is(.av-class-head small, .tl-brand small, .cebollitas-adventure-heading .eyebrow, .patatas-adventure-heading .eyebrow) {
  color: var(--fresco-muted);
  font-size: var(--fresco-text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.lesson-context {
  font: 500 var(--fresco-text-sm) / 1.4 var(--fresco-font);
  color: var(--fresco-muted);
}

:is(.lesson-context, .av-unit-head) a {
  color: var(--fresco-primary);
  font-weight: 600;
}

/* Tortillas' mark keeps its level colour, as a quiet tint like the Materials icons. */
.tl-root .tl-mark {
  background: color-mix(in srgb, var(--tl-accent, var(--fresco-primary)) 14%, #fff);
  color: var(--tl-accent, var(--fresco-primary));
}

/* ---- One button family ---- */

:is(.class-actions .button, .av-nav-toggle, .lesson-next a, .ct-controls:where(:not([data-ct-theme]:not([data-ct-theme="classic"]) *)) .button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fresco-space-2);
  min-height: var(--fresco-control) !important;
  border: 1px solid var(--fresco-line) !important;
  border-radius: var(--fresco-radius-sm) !important;
  padding: 0 var(--fresco-space-4) !important;
  background-color: var(--fresco-surface) !important;
  color: var(--fresco-ink) !important;
  font: 600 0.9375rem / 1.2 var(--fresco-font) !important;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none !important;
  transform: none !important;
}

:is(.class-actions .button, .av-nav-toggle, .lesson-next a, .ct-controls:where(:not([data-ct-theme]:not([data-ct-theme="classic"]) *)) .button):hover {
  border-color: var(--fresco-line-strong) !important;
  background-color: var(--fresco-ground) !important;
}

.class-actions .button.primary {
  border-color: var(--fresco-primary) !important;
  background-color: var(--fresco-primary) !important;
  color: #fff !important;
}

.class-actions .button.primary:hover {
  border-color: var(--fresco-primary-hover) !important;
  background-color: var(--fresco-primary-hover) !important;
}

/* Student view and «Show unit classes» stay pressed while they are on. */
:is(.class-actions .button[aria-pressed="true"], .av-nav-toggle[aria-expanded="true"]) {
  border-color: var(--fresco-primary) !important;
  background-color: var(--fresco-primary-soft) !important;
  color: var(--fresco-primary) !important;
}

.class-actions .button:disabled {
  opacity: 0.5;
  cursor: default;
}

.ct-controls:where(:not([data-ct-theme]:not([data-ct-theme="classic"]) *)) .button {
  /* On a phone the two launch buttons share one row, so a long environment name wraps. */
  white-space: normal;
  text-align: center;
}

.ct-controls:where(:not([data-ct-theme]:not([data-ct-theme="classic"]) *)) .button strong {
  font-weight: 600;
}

:is(.class-actions .button, .av-nav-toggle, .lesson-next a, .ct-controls .button):focus-visible {
  outline: 2px solid var(--fresco-primary);
  outline-offset: 2px;
}

.lesson-next {
  font: 500 var(--fresco-text-sm) / 1.4 var(--fresco-font);
  color: var(--fresco-muted);
}

/* ---- One tab style: text tabs on a line, the open one underlined in indigo ---- */

:is(.cebollitas-resource-tabs, .av-clean .av-tabs) {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--fresco-space-1);
  overflow-x: auto;
  scrollbar-width: thin;
  box-shadow: inset 0 -1px 0 var(--fresco-line);
  border-bottom: 0 !important;
}

:is(.cebollitas-resource-tabs, .av-clean .av-tabs) button {
  flex: none !important;
  min-height: 44px;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  padding: 10px 12px !important;
  background: none !important;
  color: var(--fresco-muted) !important;
  font: 600 0.9375rem / 1.2 var(--fresco-font) !important;
  white-space: nowrap;
  box-shadow: none !important;
  transform: none !important;
}

:is(.cebollitas-resource-tabs, .av-clean .av-tabs) button:hover {
  color: var(--fresco-ink) !important;
}

:is(.cebollitas-resource-tabs, .av-clean .av-tabs) button[aria-selected="true"] {
  border-bottom-color: var(--fresco-primary) !important;
  color: var(--fresco-ink) !important;
}

:is(.cebollitas-resource-tabs, .av-clean .av-tabs) button:focus-visible {
  outline: 2px solid var(--fresco-primary);
  outline-offset: -2px;
}

/* ---- Aventura: the unit's classes beside the class ---- */

.av-lesson-nav .av-lesson {
  border: 1px solid transparent;
  border-radius: var(--fresco-radius-sm);
  color: var(--fresco-ink);
  font-family: var(--fresco-font);
}

.av-lesson-nav .av-lesson :is(b, span) {
  font-weight: 600;
}

.av-lesson-nav .av-lesson b {
  color: var(--fresco-muted);
}

.av-lesson-nav .av-lesson:hover {
  background: var(--fresco-surface);
}

.av-lesson-nav .av-lesson[aria-current] {
  border-color: var(--fresco-primary-soft);
  background: var(--fresco-primary-soft);
  box-shadow: none;
}

.av-lesson-nav .av-lesson[aria-current] b {
  color: var(--fresco-primary);
}

.av-lesson-nav .av-nav-label {
  color: var(--fresco-muted);
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* ---- The frame each activity sits in: a white panel with a thin line ---- */

:is(.cebollitas-adventure-frame, .patatas-adventure-frame) {
  border: 1px solid var(--fresco-line) !important;
  border-radius: var(--fresco-radius-lg) !important;
  background: var(--fresco-surface) !important;
}

.av-clean .av-class-main,
.tl-root {
  border: 1px solid var(--fresco-line) !important;
  border-radius: var(--fresco-radius-lg) !important;
  background-color: var(--fresco-surface) !important;
  box-shadow: var(--fresco-shadow) !important;
}

.av-clean .av-class-head {
  border-bottom-color: var(--fresco-line);
}

.tl-root .tl-toolbar {
  border-color: var(--fresco-line);
  border-radius: var(--fresco-radius-lg) var(--fresco-radius-lg) 0 0;
  background: var(--fresco-surface);
}

@media (max-width: 700px) {
  :is(.class-actions .button, .ct-controls:where(:not([data-ct-theme]:not([data-ct-theme="classic"]) *)) .button) {
    padding: 0 var(--fresco-space-3) !important;
    font-size: var(--fresco-text-sm) !important;
  }
}

/* Classroom aids at the end of every class bar: a thin line, then Class phrases and
   Theme (with a swatch of the theme on screen). The row above the class is gone. */
.class-actions { gap: 6px; }
.class-actions .button { padding: 0 14px !important; }
.class-actions .class-actions-aid.is-first-aid { position: relative; margin-left: 9px; }
.class-actions .class-actions-aid.is-first-aid::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: -9px; width: 1px; background: var(--fresco-line-strong); }
.class-actions .button.class-actions-aid { padding: 0 var(--fresco-space-3) !important; }
.class-actions-swatch { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 4px; background: var(--ct-accent, var(--fresco-primary)); box-shadow: inset -5px 0 0 var(--ct-pop, var(--fresco-accent)); }
.ct-controls.is-dialog-only { margin: 0; }
@media (max-width: 640px) { .class-actions .class-actions-aid.is-first-aid { margin-left: 0; } .class-actions .class-actions-aid.is-first-aid::before { display: none; } }

/* ---- Classic classes (Aventura «Repaso», trial classes): the shared header ----
   Where you are, the title, the shared bar; the material's own tabs drawn like the
   class tabs, without the ones a class has nothing for. */
.classic-class-header { display: grid; justify-items: start; gap: 10px; padding: 18px 22px 0; }
.classic-class-header h1 { margin: 0; color: var(--fresco-ink); font: 600 clamp(24px, 3vw, 36px) / 1.15 var(--fresco-display); letter-spacing: -0.015em; }
.classic-class-header .workspace-objective { color: var(--fresco-muted); font-size: var(--fresco-text-sm); }
.classic-class-header .workspace-objective summary { cursor: pointer; font-weight: 600; }
/* The material has the width to itself: the inline board beside it is gone. */
.classic-class-workspace .classic-class-material.module-panel-body.teaching-workspace { display: block; padding: 0 22px; }
.classic-class-material .media-tabs { display: flex; flex-wrap: nowrap; gap: var(--fresco-space-1); overflow-x: auto; scrollbar-width: thin; box-shadow: inset 0 -1px 0 var(--fresco-line); }
.classic-class-material .media-tab { flex: none !important; width: auto !important; min-height: 44px; border: 0 !important; border-bottom: 2px solid transparent !important; border-radius: 0 !important; padding: 10px 12px !important; background: none !important; color: var(--fresco-muted) !important; font: 600 0.9375rem / 1.2 var(--fresco-font) !important; white-space: nowrap; box-shadow: none !important; transform: none !important; }
.classic-class-material .media-tab .ui-icon { display: none; }
.classic-class-material .media-tab:hover { color: var(--fresco-ink) !important; }
.classic-class-material .media-tab.is-active { border-bottom-color: var(--fresco-primary) !important; color: var(--fresco-ink) !important; }
.classic-class-material .media-tab.is-unavailable { display: none !important; }
.classic-class-workspace > :is(.trial-extension-panel, .lesson-next, .assignment-panel) { margin-inline: 22px; }
@media (max-width: 700px) { .classic-class-workspace > :is(.trial-extension-panel, .lesson-next, .assignment-panel) { margin-inline: 10px; } }
/* Student view: the material alone, with the bar's own button to come back. */
.classic-class-workspace.is-student-presenting .classic-class-header > :not(.class-actions),
.classic-class-workspace.is-student-presenting .class-actions > :not([data-student-presentation]),
.classic-class-workspace.is-student-presenting > :is(.assignment-panel, .trial-extension-panel, .lesson-next) { display: none !important; }
.classic-class-workspace.is-student-presenting .classic-class-header { padding: 8px 12px 0; }
@media (max-width: 700px) { .classic-class-header { padding: 12px 10px 0; } .classic-class-workspace .classic-class-material.module-panel-body.teaching-workspace { padding: 0 10px; } }

/* ---- Aventura: the same header as every class ----
   Where you are (with «Show unit classes» on that line), the class title, the shared
   bar; the unit's class list and the material below. */
.av-clean .av-class-header { display: grid; justify-items: start; gap: 8px; margin: 0 0 18px; }
.av-clean .av-class-header h1 { margin: 0; color: var(--fresco-ink); font: 600 clamp(24px, 3vw, 36px) / 1.15 var(--fresco-display); letter-spacing: -0.015em; }
.av-clean .av-class-header .av-class-subtitle { margin: -4px 0 4px; color: var(--fresco-muted); font-size: var(--fresco-text-sm); }
.av-clean .av-class-header .av-class-subtitle:empty { display: none; }
.av-clean .av-unit-context { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.av-clean .av-unit-context .av-nav-toggle { min-height: 30px !important; margin: 0; padding: 0 12px !important; font-size: var(--fresco-text-xs) !important; }
.av-clean.av-student .av-unit-context { display: none; }
.av-clean.av-student .av-class-actions [data-assignment-open] { display: none !important; }
/* ---- Tortillas con Flow: the title at the size every class uses; the practice book's
   deliveries sit under the class, not above it. ---- */
.tl-workspace .tl-root .tl-toolbar .tl-brand h1 { font: 600 clamp(24px, 3vw, 36px) / 1.15 var(--fresco-display); letter-spacing: -0.015em; }
/* The page is a grid: without this its children keep the width of their widest content
   (the book, the deliveries) and a phone scrolls sideways. */
.tl-workspace > * { min-width: 0; }
