/* Fonts: IBM Plex Sans (SIL OFL, see public/fonts/OFL.txt), self-hosted. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 300; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-italic.woff2") format("woff2"); }

/* Theme: change these variables to re-brand the site. */
:root {
  color-scheme: dark;

  /* HiQ brand palette */
  --hiq-pink: rgb(255 0 150);
  --hiq-blush: rgb(250 202 217);
  --hiq-teal: rgb(0 222 206);
  --hiq-grey: rgb(62 62 62);
  --hiq-black: #000;

  --color-bg: var(--hiq-black);
  --color-surface: color-mix(in srgb, var(--hiq-grey) 40%, var(--hiq-black));
  --color-text: #fff;
  --color-muted: color-mix(in srgb, #fff 68%, var(--hiq-black));
  --color-border: var(--hiq-grey);
  --color-primary: var(--hiq-pink);
  --color-primary-hover: var(--hiq-blush);
  --color-primary-contrast: var(--hiq-black);
  --color-accent-soft: color-mix(in srgb, var(--hiq-pink) 16%, var(--color-surface));
  --color-success: var(--hiq-teal);
  --color-success-soft: color-mix(in srgb, var(--hiq-teal) 14%, var(--hiq-black));
  --color-warning: var(--hiq-blush);
  --color-warning-soft: color-mix(in srgb, var(--hiq-pink) 22%, var(--hiq-black));
  --color-danger: #ff6b6b;
  --color-danger-soft: color-mix(in srgb, #ff6b6b 16%, var(--hiq-black));
  --color-focus: var(--hiq-teal);
  --color-header-bg: var(--hiq-black);

  --font-sans: "IBM Plex Sans", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 16px;
  --radius-small: 10px;
  --shadow: none;
  --shadow-hover: 0 8px 24px rgb(255 0 150 / 0.18);
  --container: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }

a { color: var(--color-primary); text-underline-offset: 2px; }
a:hover { color: var(--color-primary-hover); }

:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 300; text-transform: uppercase; letter-spacing: 0.01em; }
h2 { font-size: 1.5rem; font-weight: 300; }
h3 { font-weight: 600; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

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

.skip-link { position: absolute; left: 8px; top: -48px; background: var(--color-surface); color: var(--color-text); padding: 8px 12px; z-index: 100; border-radius: var(--radius-small); }
.skip-link:focus { top: 8px; }

.muted { color: var(--color-muted); }
.small { font-size: 0.875rem; }
.strong { font-weight: 600; }
.lead { font-size: 1.1rem; color: var(--color-muted); max-width: 65ch; margin: 0; }
.lead p { margin: 0 0 0.8em; }
.lead p:last-child { margin-bottom: 0; }
[hidden] { display: none !important; }

/* Header */
.site-header { background: var(--color-header-bg); border-bottom: 1px solid var(--color-border); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 8px 24px; min-height: 72px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--color-text); line-height: 1; padding: 12px 0; }
.brand:hover { color: var(--color-text); }
.brand__logo { display: block; height: 36px; width: auto; }
.brand__name { font-weight: 300; font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.12em; padding-left: 12px; border-left: 1px solid var(--color-border); }
.brand__area { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 10px; border-radius: 999px; background: var(--hiq-teal); color: var(--hiq-black); }
.site-nav { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-weight: 400; color: var(--color-text); }
.site-nav a:hover { color: var(--color-primary); }
.site-nav a[aria-current="page"] { color: var(--color-primary); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 8px; }
.site-main { flex: 1; padding: 32px 0 56px; outline: none; }

.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--color-primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.site-nav .link-button { text-decoration: none; font-weight: 400; color: var(--color-text); }
.site-nav .link-button:hover { color: var(--color-primary); }
.link-button:hover { color: var(--color-primary-hover); }

/* Generic components */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 3vw, 28px); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 20px; border-radius: 999px;
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.button:hover { border-color: var(--color-primary); color: var(--color-text); }
.button--primary { background: var(--hiq-blush); border-color: var(--hiq-blush); color: var(--hiq-black); }
.button--primary:hover { background: var(--hiq-pink); border-color: var(--hiq-pink); color: var(--hiq-black); }
.button--ghost { background: transparent; }
.button--danger { color: var(--color-danger); }
.button--danger:hover { background: var(--color-danger-soft); border-color: var(--color-danger); color: var(--color-danger); }
.button--small { min-height: 32px; padding: 4px 14px; font-size: 0.875rem; }
.button--block { width: 100%; }
.button:disabled { opacity: 0.6; cursor: default; }

.notice { padding: 12px 16px; border-radius: var(--radius-small); margin: 0 0 20px; border: 1px solid transparent; }
.notice--success { background: var(--color-success-soft); color: var(--color-success); border-color: color-mix(in srgb, var(--color-success) 25%, transparent); }
.notice--error { background: var(--color-danger-soft); color: var(--color-danger); border-color: color-mix(in srgb, var(--color-danger) 25%, transparent); }
.notice--warning { background: var(--color-warning-soft); color: var(--color-warning); border-color: color-mix(in srgb, var(--color-warning) 25%, transparent); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge--success { background: var(--color-success-soft); color: var(--color-success); }
.badge--neutral { background: var(--color-accent-soft); color: var(--color-muted); }

.empty-state { text-align: center; color: var(--color-muted); padding: 40px 16px; background: var(--color-surface); border: 1px dashed var(--color-border); border-radius: var(--radius); }
.empty-state::before { content: ""; display: block; width: 120px; aspect-ratio: 492 / 472; margin: 0 auto 16px; background: url("../img/octopus-blue.svg") center / contain no-repeat; }
.empty-state--page { border: 0; background: none; padding: 64px 16px; }
.empty-state--page h1 { color: var(--color-text); }

/* Forms */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; }
.field--checkbox { display: flex; align-items: center; gap: 10px; }
.field--checkbox label { font-weight: 500; }
.field--checkbox input { width: 20px; height: 20px; }
.hint { margin: 0; font-size: 0.85rem; color: var(--color-muted); }
input[type="text"], input[type="password"], input[type="search"], input:not([type]), textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-small);
  font: inherit; color: var(--color-text); background: var(--color-surface);
}
textarea { font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.5; resize: vertical; }
input[type="text"], input[type="password"], input[type="search"], input:not([type]), textarea { background: var(--hiq-black); }
input::placeholder, textarea::placeholder { color: var(--color-muted); }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 0; border-color: var(--color-focus); }

/* Login */
.login { display: grid; justify-items: center; gap: 8px; padding: 8px 0 24px; }
.login__art { width: clamp(140px, 30vw, 200px); height: auto; margin-bottom: -28px; position: relative; z-index: 1; }
.login__card { width: 100%; max-width: 420px; }
.login__card h1 { font-size: 1.8rem; }

/* Page header */
.page-header { margin-bottom: 32px; }
/* The HiQ swoosh as an eyebrow mark above page titles (not on admin rows with buttons). */
.page-header:not(.page-header--row) h1::before { content: ""; display: block; width: 48px; aspect-ratio: 832 / 688; margin-bottom: 14px; background: url("../img/hiq-swoosh.svg") left center / contain no-repeat; }
.page-header--art { display: grid; grid-template-columns: 1fr auto; gap: 24px 40px; align-items: center; }
.page-header__art { width: clamp(140px, 20vw, 240px); height: auto; }
.page-header__art--hand { width: clamp(120px, 16vw, 190px); transform: rotate(-8deg); }
@media (max-width: 640px) {
  .page-header--art { grid-template-columns: 1fr; }
  .page-header__art { display: none; }
}
.page-header--row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header--row h1 { margin: 0; }
.back-link { margin: 0 0 12px; }
.back-link a { text-decoration: none; color: var(--color-muted); }
.back-link a:hover { color: var(--color-primary); }

/* Overview */
.search { margin-bottom: 24px; max-width: 420px; }
.course-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.course-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow 0.15s, transform 0.15s; }
.course-card:hover { box-shadow: var(--shadow-hover); border-color: var(--color-primary); transform: translateY(-2px); }
.course-card__link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.course-card__link:hover { color: inherit; }
.course-card__cover { aspect-ratio: 16 / 9; background: var(--color-accent-soft); overflow: hidden; }
.course-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.course-card__placeholder { width: 100%; height: 100%; display: grid; place-items: center; font-size: 3.5rem; font-weight: 300; color: var(--color-primary); background: linear-gradient(135deg, var(--hiq-grey), var(--hiq-black)); }
.course-card__body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.course-card__title { font-size: 1.2rem; font-weight: 600; margin: 0; color: var(--color-text); }
.course-card:hover .course-card__title { color: var(--color-primary); }
.course-card__instructors { margin: 0; font-size: 0.95rem; color: var(--hiq-teal); }
.course-card__excerpt { margin: 0; color: var(--color-muted); font-size: 0.95rem; }
.course-card__meta { margin: auto 0 0; padding-top: 8px; font-size: 0.85rem; color: var(--color-muted); display: flex; gap: 6px; flex-wrap: wrap; }

/* Course page */
.course-header__instructors { font-size: 1.1rem; margin: 0; color: var(--hiq-teal); }
.course-header__instructors .muted { color: var(--color-muted); }
.course-section { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: clamp(16px, 3vw, 32px); margin-bottom: 24px; }
.heading-with-icon { display: flex; align-items: center; gap: 12px; }
.heading-with-icon img { width: 44px; height: auto; flex: none; }

.prose { max-width: 75ch; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin-top: 1.4em; }
.prose h1 { font-size: 1.4rem; }
.prose h2 { font-size: 1.2rem; }
.prose h3 { font-size: 1.05rem; }
.prose blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid var(--color-primary); color: var(--color-muted); }
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--color-accent-soft); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--color-accent-soft); padding: 12px 16px; border-radius: var(--radius-small); overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--color-border); padding: 6px 10px; text-align: left; }
.prose img { border-radius: var(--radius-small); }
.prose ul:has(input[type="checkbox"]) { list-style: none; padding-left: 4px; }

/* PDF list & viewer */
.document-list { list-style: none; margin: 0 0 16px; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-small); }
.document-list__item { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; flex-wrap: wrap; }
.document-list__item + .document-list__item { border-top: 1px solid var(--color-border); }
.document-list__item.is-active { background: var(--color-accent-soft); }
.document-list__title { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; }
.document-list__actions { display: flex; gap: 16px; font-size: 0.9rem; flex-wrap: wrap; align-items: center; }
.file-icon { flex: none; display: inline-grid; place-items: center; width: 36px; height: 24px; border-radius: 4px; background: var(--hiq-pink); color: var(--hiq-black); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em; }
.pdf-viewer__frame-wrap { border: 1px solid var(--color-border); border-radius: var(--radius-small); overflow: hidden; background: var(--hiq-grey); }
.pdf-viewer__frame { display: block; width: 100%; height: 80vh; border: 0; }
@media (max-width: 767px) {
  .pdf-viewer__frame-wrap { display: none; }
  .document-list { margin-bottom: 0; }
  .document-list__item.is-active { background: none; }
}

/* Gallery */
.gallery { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.gallery__item a { display: block; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius-small); background: var(--color-accent-soft); }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.gallery__item a:hover img { transform: scale(1.03); }
.gallery__caption { margin: 8px 2px 0; font-size: 0.9rem; color: var(--color-muted); }

/* Videos in a gallery grid */
.gallery__video { position: relative; }
.gallery__video-placeholder { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, var(--hiq-grey), var(--hiq-black)); }
.gallery__play { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; background: rgb(0 0 0 / 0.55); box-shadow: 0 2px 12px rgb(0 0 0 / 0.3); transition: background 0.15s, transform 0.15s; pointer-events: none; }
.gallery__play::after { content: ""; position: absolute; left: 26px; top: 20px; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; }
.gallery__video:hover .gallery__play { background: var(--color-primary); transform: scale(1.06); }
.gallery__duration { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 4px; background: rgb(0 0 0 / 0.7); color: #fff; font-size: 0.8rem; font-variant-numeric: tabular-nums; pointer-events: none; }
.image-tile .gallery__play { width: 44px; height: 44px; }
.image-tile .gallery__play::after { left: 17px; top: 13px; border-width: 9px 0 9px 15px; }

/* Lightbox */
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(0 0 0 / 0.95); color: #fff; overflow: hidden; }
.lightbox[open] { display: grid; grid-template-rows: 1fr auto auto; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.95); }
/* Flex (not grid) so the image's max-height: 100% resolves against the stage height and tall images fit. */
.lightbox__stage { display: flex; align-items: center; justify-content: center; min-height: 0; padding: 56px 64px 8px; touch-action: pan-y pinch-zoom; }
.lightbox__image { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.lightbox__video { max-width: 100%; max-height: 100%; background: #000; }
.lightbox__caption { margin: 0; padding: 8px 24px 0; text-align: center; min-height: 1.6em; }
.lightbox__counter { margin: 0; padding: 4px 0 16px; text-align: center; font-size: 0.85rem; color: rgb(255 255 255 / 0.7); display: flex; justify-content: center; gap: 16px; }
.lightbox__download { color: rgb(255 255 255 / 0.85); }
.lightbox__download:hover { color: #fff; }
.lightbox__button { position: absolute; background: rgb(255 255 255 / 0.12); color: #fff; border: 0; border-radius: 999px; width: 48px; height: 48px; font-size: 1.6rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.lightbox__button:hover { background: var(--hiq-pink); }
.lightbox__close { top: 12px; right: 12px; font-size: 1.2rem; }
.lightbox__prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
  .lightbox__stage { padding: 56px 0 8px; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 12px; transform: none; }
}
body.lightbox-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Speaker Spotlight */
.speakers { display: grid; gap: 28px; }
.speaker { display: grid; grid-template-columns: 160px 1fr; gap: 24px; align-items: start; }
.speaker + .speaker { border-top: 1px solid var(--color-border); padding-top: 28px; }
.speaker__name { font-size: 1.15rem; margin: 4px 0 8px; }
.speaker-photo { width: 160px; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--color-accent-soft); border: 3px solid var(--hiq-pink); display: grid; place-items: center; }
.speaker-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.speaker-photo__initials { font-size: 3rem; font-weight: 300; color: var(--color-primary); }
@media (max-width: 560px) {
  .speaker { grid-template-columns: 1fr; justify-items: start; gap: 12px; }
  .speaker-photo { width: 120px; }
}
