:root {
  color-scheme: light dark;
  --bg: #f6f7f5;
  --surface: #fff;
  --surface-2: #eef3f3;
  --text: #172f39;
  --muted: #50646c;
  --line: #d5dfe0;
  --brand: #cef2fb;
  --link: #174f66;
  --accent: #f3b040;
  --shadow: 0 14px 32px rgb(23 47 57/0.16);
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
body.drawer-open {
  overflow: hidden;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: var(--link);
  text-underline-offset: 3px;
}
a,
button,
input,
select {
  -webkit-tap-highlight-color: #cef2fb;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #bf7211;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.wrap {
  max-width: 1080px;
  margin: auto;
  padding-inline: max(20px, env(safe-area-inset-left));
}
.skip {
  position: fixed;
  z-index: 20;
  top: -100px;
  left: 16px;
  padding: 12px;
  background: var(--surface);
}
.skip:focus {
  top: 12px;
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 24px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}
.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-left: auto;
}
.source-link,
.home-link {
  padding: 10px 0;
  white-space: nowrap;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 25px;
}
.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.language {
  position: relative;
}
.language-menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 9px);
  right: 0;
  min-width: 184px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.language-menu button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}
.language-menu button:hover,
.language-menu button[aria-current="true"] {
  background: var(--brand);
}
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
h1 {
  margin: 8px 0 12px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.035em;
}
h2 {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.course-intro {
  max-width: 740px;
  padding: 40px 0 28px;
}
.course-intro p,
.home-intro p {
  margin: 0;
  color: var(--muted);
}
footer {
  margin-top: 54px;
  padding: 26px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

/* Home: compact navigation, not a marketing landing page. */
.home-main {
  padding-top: 28px;
}
.course-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 650;
}
.course-menu-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: center;
  gap: 32px;
  padding: 34px 0 24px;
}
.home-intro h1 {
  font-size: clamp(27px, 3.3vw, 38px);
  max-width: 720px;
}
.home-art {
  display: block;
  width: 180px;
  height: 180px;
  object-fit: contain;
}
.home-panel {
  padding: 25px 0;
  border-top: 1px solid var(--line);
}
.home-panel h2 {
  margin: 6px 0 18px;
}
.section-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.text-button,
.remove-shortcut {
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.shortcut-area {
  display: flex;
  min-height: 112px;
  align-items: flex-start;
}
.shortcut-tile {
  display: grid;
  justify-items: center;
  gap: 7px;
  width: 92px;
  padding: 0;
  border: 0;
  background: transparent;
}
.shortcut-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 1px solid rgb(255 255 255/0.12);
  border-radius: 18px;
  background: #101a2c;
  color: #dbeafe;
  box-shadow: 0 8px 20px rgb(23 47 57/0.12);
  font-size: 27px;
  font-weight: 750;
  line-height: 1;
}
.shortcut-label {
  max-width: 100%;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.subject-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 26px;
}
.subject-group h3 {
  margin: 0 0 8px;
  font-size: 17px;
}
.subject-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.subject-group li + li {
  margin-top: 4px;
}
.subject-group a {
  display: inline-block;
  min-height: 38px;
  padding: 7px 0;
}
.course-drawer {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: min(360px, 88vw);
  padding: 22px;
  background: var(--surface);
  box-shadow: 10px 0 36px rgb(0 0 0/0.24);
  transform: translateX(-105%);
  transition: transform 0.24s ease;
  overflow: auto;
}
.course-drawer[data-open="true"] {
  transform: translateX(0);
}
.drawer-scrim {
  position: fixed;
  z-index: 29;
  inset: 0;
  background: rgb(0 0 0/0.48);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  font-size: 20px;
}
.drawer-nav details {
  border-bottom: 1px solid var(--line);
}
.drawer-nav summary {
  min-height: 54px;
  padding: 15px 2px;
  cursor: pointer;
  font-weight: 700;
}
.drawer-nav ul {
  margin: 0 0 14px;
  padding: 0 0 0 16px;
  list-style: none;
}
.drawer-nav a {
  display: block;
  min-height: 44px;
  padding: 10px 8px;
  border-radius: 6px;
  text-decoration: none;
}
.drawer-nav a:hover {
  background: var(--brand);
}
dialog {
  max-width: min(640px, calc(100vw - 32px));
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: rgb(0 0 0/0.58);
}
.shortcut-dialog form {
  padding: 22px;
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.dialog-head h2 {
  margin: 5px 0 18px;
}
.shortcut-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.shortcut-options button {
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  text-align: left;
}
.shortcut-options button:hover {
  background: var(--brand);
}

/* Course pages mirror the established Chemistry 12 information layout. */
.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 650;
}
.filters input,
.filters select,
.filters > button {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px;
  border: 1px solid #82959c;
  border-radius: 7px;
  background: var(--bg);
}
.filters > button {
  width: auto;
  padding-inline: 18px;
  background: var(--brand);
  color: var(--link);
}
.results-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 0;
  color: var(--muted);
  font-size: 14px;
}
.unit {
  margin: 0 0 42px;
  scroll-margin-top: 20px;
}
.unit-heading {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0;
  padding: 0 0 14px;
  border-bottom: 2px solid var(--text);
  font-size: 23px;
}
.unit-number {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
}
.document-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 88px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.document-kind {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.document-row h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}
.document-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.document-actions a,
.document-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--link);
  font-weight: 650;
  text-decoration: none;
}
.document-actions a:first-child,
.document-actions button:first-child {
  background: var(--brand);
}
.document-actions .unavailable {
  background: var(--surface);
  color: var(--muted);
  cursor: not-allowed;
}
.empty-state {
  padding: 36px 0;
}
.subject-landing {
  padding: 0 0 30px;
}
.landing-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.landing-links a {
  display: block;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-weight: 700;
  text-decoration: none;
}
.video-dialog {
  max-width: min(900px, calc(100vw - 28px));
  padding: 20px;
}
.video-dialog video {
  display: block;
  width: 100%;
  max-height: 65vh;
  background: #000;
}
.video-body p {
  color: var(--muted);
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
  }
  .source-link {
    display: none;
  }
  .header-actions {
    gap: 8px;
  }
  .home-link {
    font-size: 14px;
  }
  .home-intro {
    grid-template-columns: 1fr 100px;
    gap: 12px;
  }
  .home-art {
    width: 100px;
    height: 100px;
  }
  .subject-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .filters > div:first-child {
    grid-column: 1/-1;
  }
  .filters > button {
    width: 100%;
  }
  .document-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .document-actions {
    justify-content: flex-start;
  }
  .landing-links {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  .wrap {
    padding-inline: max(16px, env(safe-area-inset-left));
  }
  .site-header {
    padding-block: 16px;
  }
  .brand span {
    display: none;
  }
  .home-intro {
    grid-template-columns: 1fr;
  }
  .home-art {
    display: none;
  }
  .subject-columns,
  .shortcut-options {
    grid-template-columns: 1fr;
  }
  .filters {
    grid-template-columns: 1fr;
  }
  .filters > div:first-child {
    grid-column: auto;
  }
  .results-meta {
    padding: 22px 0;
  }
  .unit-heading {
    font-size: 20px;
  }
  .document-actions a,
  .document-actions button {
    flex: 1;
  }
  .header-actions {
    margin-left: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .course-drawer {
    transition: none;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101c21;
    --surface: #1b2a31;
    --surface-2: #24363e;
    --text: #f0f6f7;
    --muted: #b2c1c7;
    --line: #3b5059;
    --brand: #285f73;
    --link: #c9f3ff;
    --accent: #f4bc58;
  }
  .shortcut-icon {
    background: #101a2c;
    color: #dbeafe;
  }
  .filters input,
  .filters select {
    border-color: #617681;
  }
}
