/* ==========================================================================
   AI Automation and Agents course theme
   University of New Mexico brand: UNM Cherry #BA0C2F + UNM Turquoise #007A86,
   with Silver #A7A8AA and derived tints for accents.
   Palette and structure follow the UNM CARC documentation theme (gradient
   identity header, card-based landing page) for the Zensical modern theme.
   ========================================================================== */

/* --- Brand color tokens ------------------------------------------------- */

:root > * {
  --md-primary-fg-color:        #ba0c2f;   /* UNM Cherry */
  --md-primary-fg-color--light: #d64d6d;
  --md-primary-fg-color--dark:  #8a0923;
  --md-accent-fg-color:         #007a86;   /* UNM Turquoise */
  --md-accent-fg-color--transparent: rgba(0, 122, 134, 0.1);

  --unm-cherry:            #ba0c2f;
  --unm-cherry-light:      #d64d6d;
  --unm-cherry-dark:       #6d0a1f;
  --unm-turquoise:         #007a86;
  --unm-turquoise-bright:  #00a9ba;
  --unm-silver:            #a7a8aa;
  --unm-warm-gray:         #f4ede5;
  --unm-cool-gray:         #e2e9eb;
  --course-gradient: linear-gradient(105deg,
      #4d0715 0%,
      #8a0923 30%,
      #ba0c2f 58%,
      #7c2440 74%,
      #0b5f6a 92%,
      #007a86 100%);
}

/* Dark scheme: lift the palette for contrast on slate backgrounds */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color:        #ff5c7c;
  --md-primary-fg-color--light: #ff8ba3;
  --md-primary-fg-color--dark:  #d64d6d;
  --md-accent-fg-color:         #35c9d6;
  --md-accent-fg-color--transparent: rgba(53, 201, 214, 0.1);
  --md-typeset-a-color:         #4fd3e0;   /* turquoise links for legibility */
}

/* --- Identity header (cherry-to-turquoise gradient) --------------------- */

.md-header,
.md-tabs {
  background: var(--course-gradient);
  color: #ffffff;
}

.md-header { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }

.md-header a,
.md-header .md-header__title,
.md-tabs a {
  color: #ffffff;
}

.md-tabs__link { opacity: 0.85; }
.md-tabs__link--active,
.md-tabs__link:hover { opacity: 1; }

/* Keep header controls (search, palette toggle, repo) legible on gradient */
.md-header .md-icon svg { fill: #ffffff; }
.md-search__form { background-color: rgba(255, 255, 255, 0.12); }
.md-search__input { color: #ffffff; }
.md-search__input::placeholder { color: rgba(255, 255, 255, 0.75); }

/* --- Landing page -------------------------------------------------------- */

/* Accessible-but-invisible page H1 (the hero banner carries the visual title) */
.course-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

.course-hero {
  text-align: center;
  margin: 0.5rem auto 1.6rem;
  max-width: 48rem;
}

.course-hero img.course-hero__img {
  width: 100%;
  max-width: 45rem;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  margin-bottom: 0.6rem;
}

.course-hero .course-hero__title {
  margin: 0.2rem 0 0.4rem;
  font-size: 1.6rem;
  line-height: 1.2;
  background: var(--course-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-md-color-scheme="slate"] .course-hero .course-hero__title {
  background: linear-gradient(105deg, #ff8ba3 0%, #ff5c7c 45%, #35c9d6 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* No permalink pilcrow or TOC entry decoration on the hero title */
.course-hero .course-hero__title .headerlink { display: none; }

.course-hero p.course-hero__tagline {
  font-size: 0.85rem;
  color: var(--md-default-fg-color--light);
}

/* Quick-action button row */
.course-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin: 1.2rem 0 0.4rem;
}

.course-actions .md-button {
  border-radius: 2rem;
  padding: 0.45rem 1.2rem;
}

.course-actions .md-button--primary {
  background: var(--course-gradient);
  border-color: transparent;
  color: #ffffff;
}

/* Card grids: turquoise hover treatment */
.md-typeset .grid.cards > ul > li,
.md-typeset .grid > .card {
  border-radius: 0.5rem;
  transition: border-color 125ms, box-shadow 125ms, transform 125ms;
}

.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid > .card:hover {
  border-color: var(--unm-turquoise);
  box-shadow: 0 6px 16px rgba(0, 122, 134, 0.18);
  transform: translateY(-2px);
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li:hover,
[data-md-color-scheme="slate"] .md-typeset .grid > .card:hover {
  border-color: var(--unm-turquoise-bright);
  box-shadow: 0 6px 16px rgba(0, 169, 186, 0.22);
}

.md-typeset .grid.cards > ul > li > hr {
  background: linear-gradient(90deg, var(--unm-cherry), var(--unm-turquoise));
  height: 2px;
  border: 0;
}

/* Link strip (partners, institutions, licence) */
.course-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0 0.5rem;
}

.course-links a {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 2rem;
  padding: 0.3rem 0.9rem;
  font-size: 0.7rem;
  color: var(--md-default-fg-color--light);
  transition: border-color 125ms, color 125ms;
}

.course-links a:hover {
  border-color: var(--unm-turquoise);
  color: var(--unm-turquoise);
}

[data-md-color-scheme="slate"] .course-links a:hover {
  border-color: var(--unm-turquoise-bright);
  color: var(--unm-turquoise-bright);
}

/* Attribution line (CC badge + institutions) */
.course-attribution {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.2rem 0 0.4rem;
  font-size: 0.7rem;
  color: var(--md-default-fg-color--light);
  text-align: center;
}

.course-attribution img {
  vertical-align: middle;
}

/* --- Content niceties ----------------------------------------------------- */

/* Slightly wider content area for the wide checklist and rubric tables */
.md-grid { max-width: 76rem; }

/* Migrated wiki heroes carry width="900"; keep them responsive */
.md-typeset img {
  max-width: 100%;
  height: auto;
}

/* Wide checklist / rubric tables scroll inside their own box */
.md-typeset table:not([class]) {
  display: block;
  overflow-x: auto;
}

/* Tables: header tint */
.md-typeset table:not([class]) th {
  background-color: var(--md-accent-fg-color--transparent);
}

/* Provenance footer line added to migrated pages */
.course-provenance {
  margin-top: 2.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--md-default-fg-color--lightest);
  font-size: 0.64rem;
  color: var(--md-default-fg-color--light);
}

/* Embedded interactive activities (concept quiz, diagnostic survey) */
.course-embed {
  width: 100%;
  min-height: 85vh;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.4rem;
  display: block;
  margin: 0.6rem 0 1rem;
}

/* Embedded slide deck (guest lectures): 16:9 slides plus the viewer's toolbar */
.course-embed--slides {
  min-height: 0;
  aspect-ratio: 16 / 10;
}

/* Embedded PDF (syllabus) */
.course-pdf {
  width: 100%;
  aspect-ratio: 8.5 / 11;
  border: 0;
  display: block;
  margin: 0.6rem 0 1rem;
}

/* Embedded video players */
iframe.course-video {
  aspect-ratio: 16 / 9;
  width: 100%;
  max-width: 44rem;
  border: 0;
  border-radius: 0.4rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  margin: 0.6rem 0 1rem;
  display: block;
}

/* Collapsed answer keys ("Show answer and feedback") */
.md-typeset details.success > summary {
  font-weight: 600;
}

/* Question admonitions: UA River instead of Material's default green */
.md-typeset .admonition.question,
.md-typeset details.question {
  border-color: var(--unm-turquoise);
}

.md-typeset .question > .admonition-title,
.md-typeset .question > summary {
  background-color: rgba(0, 122, 134, 0.1);
}

.md-typeset .question > .admonition-title::before,
.md-typeset .question > summary::before {
  background-color: var(--unm-turquoise);
}

[data-md-color-scheme="slate"] .md-typeset .admonition.question,
[data-md-color-scheme="slate"] .md-typeset details.question {
  border-color: var(--unm-turquoise-bright);
}

[data-md-color-scheme="slate"] .md-typeset .question > .admonition-title::before,
[data-md-color-scheme="slate"] .md-typeset .question > summary::before {
  background-color: var(--unm-turquoise-bright);
}

/* Machine-readable pointers appended to every page by postbuild_agent_surface.py */
.md-typeset .course-machine-readable {
  margin-top: 1.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--md-default-fg-color--lightest);
  font-size: 0.68rem;
  color: var(--md-default-fg-color--light);
}

.md-typeset .course-machine-readable a {
  color: var(--md-default-fg-color--light);
  text-decoration: underline;
}

.md-typeset .course-machine-readable a:hover {
  color: var(--md-accent-fg-color);
}

/* Recovery links added to 404.html by postbuild_agent_surface.py */
.md-typeset .course-404-recovery ul {
  margin-top: 0.4rem;
}

.md-typeset .course-404-recovery p:last-child {
  font-size: 0.72rem;
  color: var(--md-default-fg-color--light);
}
