@font-face {
  font-family: Inter;
  src: url("/inter.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --gl-page: light-dark(#ffffff, #1e2024);
  --gl-header: light-dark(#ffffff, #24262b);
  --gl-surface: light-dark(#ffffff, #25272c);
  --gl-raised: light-dark(#f5f5f7, #2b2e34);
  --gl-rail: light-dark(#f5f5f7, #202226);
  --gl-text: light-dark(#1d1d1f, #c9cbd0);
  --gl-heading: light-dark(#1d1d1f, #d3d5da);
  --gl-secondary-text: light-dark(#3a3a3c, #b4b6bc);
  --gl-muted: light-dark(#6e6e73, #8f9298);
  --gl-muted-on-raised: light-dark(#69696f, #96999f);
  --gl-faint: light-dark(#86868b, #6f7279);
  --gl-line: light-dark(rgba(0,0,0,.08), rgba(255,255,255,.06));
  --gl-line-strong: light-dark(rgba(0,0,0,.14), rgba(255,255,255,.12));
  --gl-accent: light-dark(#2f5bd3, #a9bdf2);
  --gl-accent-hover: light-dark(#234fcb, #c0cef5);
  --gl-accent-soft: light-dark(#eaf0fe, #2f3547);
  --gl-accent-wash: light-dark(#f1f5fe, #2b303d);
  --gl-accent-border: light-dark(rgba(51,95,213,.46), rgba(169,189,242,.25));
  --gl-accent-shadow: light-dark(rgba(59,110,246,.46), rgba(0,0,0,.25));
  --gl-button: light-dark(#315bd4, #4a64b8);
  --gl-button-hover: light-dark(#234fcb, #4058a4);
  --gl-on-solid: light-dark(#f7f8fc, #f2f3f7);
  --gl-published: light-dark(#1f7a3f, #86c29d);
  --gl-chip: light-dark(#e7f5ec, #263a2e);
  --gl-chip-text: light-dark(#1f7a3f, #9ccdb0);
  --gl-success: light-dark(#0b7455, #9ccdb0);
  --gl-success-bg: light-dark(#e6f4ef, #263a2e);
  --gl-success-border: light-dark(rgba(11,122,90,.55), rgba(156,205,176,.35));
  --gl-warning: light-dark(#805000, #e5c58c);
  --gl-warning-bg: light-dark(#fdf3dc, #3a3225);
  --gl-danger: light-dark(#b3261e, #eda9aa);
  --gl-danger-bg: light-dark(#fff1f2, #3a2a2e);
  --gl-control-track: light-dark(#c9ced8, #626672);
  --gl-shadow: light-dark(rgba(20,24,34,.34), rgba(0,0,0,.35));
  --gl-scrim: light-dark(rgba(29,29,31,.32), rgba(0,0,0,.48));
  --gl-success-pulse: light-dark(rgba(11,122,90,.45), rgba(156,205,176,.32));
  --gl-green-pulse: rgba(62,207,154,.5);
  --gl-pulse-clear: transparent;
  --gl-navy: light-dark(#192e54, #2b303d);
  --gl-navy-deep: light-dark(#101a30, #24262b);
  --gl-navy-border: light-dark(#53688e, #555d73);
  --gl-navy-heading: light-dark(#f5f8ff, #d3d5da);
  --gl-navy-copy: light-dark(#d2ddf1, #c9cbd0);
  --gl-navy-muted: light-dark(#b5c6e5, #aeb1ba);
  --gl-navy-accent: light-dark(#9db8ff, #a9bdf2);
  --gl-navy-success: light-dark(#3ecf9a, #86c29d);
  --gl-menu-page: light-dark(#f5f5f7, #1e2024);
  --gl-menu-shadow: light-dark(rgba(20,24,34,.45), transparent);
  --gl-menu-edge: light-dark(transparent, rgba(255,255,255,.05));
  --gl-book-row: light-dark(#f0fbfd, #213037);
  --gl-book-search: light-dark(#eef3fb, #2c2f35);
  --gl-brand: light-dark(#3564e7, #4a64b8);
  --gl-font: Inter, system-ui, sans-serif;
}

html[data-gl-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  html:not([data-gl-theme="light"]) { color-scheme: dark; }
}

.gl-header { background: var(--gl-header); border-bottom: 1px solid var(--gl-line); }
.gl-header nav[aria-label="Main"] { align-items: center; }
.gl-nav-link, .gl-guidelines-button {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--gl-heading);
  font: 600 15px var(--gl-font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
}
.gl-guidelines-button:hover, .gl-guidelines-button[aria-expanded="true"] {
  background: var(--gl-accent-soft);
  color: light-dark(var(--gl-accent), #b3c3ee);
}
.gl-guidelines-button:focus-visible, .gl-theme-toggle:focus-visible { outline-offset: -3px; }

.gl-theme-toggle, .gl-menu-close {
  display: inline-grid;
  place-items: center;
  flex: none;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--gl-line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--gl-heading);
  cursor: pointer;
}
.gl-theme-toggle { border-color: transparent; }
.gl-theme-toggle:hover, .gl-menu-close:hover { background: var(--gl-raised); }
.gl-header :focus-visible, .gl-menu :focus-visible, .book-layout :focus-visible {
  outline: 2px solid var(--gl-accent);
}
.gl-login-nav { display: flex; gap: 4px; }
.gl-account-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

::placeholder { color: var(--gl-muted-on-raised); opacity: 1; }

.system-tile {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: light-dark(var(--system-tint), var(--system-wash));
  box-shadow: inset 0 0 0 1px light-dark(var(--system-border), var(--system-border-dark));
  color: light-dark(var(--system-strong), var(--system-icon-dark));
}

body:has(.gl-menu[open]) { overflow: hidden; }
.gl-menu {
  position: fixed;
  inset: calc(var(--gl-header-bottom, 65px) + 28px) 0 auto;
  box-sizing: border-box;
  width: min(1320px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - var(--gl-header-bottom, 65px) - 44px);
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 48px) 40px;
  overflow-y: auto;
  background: var(--gl-surface);
  border: 1px solid var(--gl-menu-edge);
  border-radius: 20px;
  box-shadow: 0 24px 60px -40px var(--gl-menu-shadow);
  color: var(--gl-text);
  font: 400 15px/1.4 var(--gl-font);
  overscroll-behavior: contain;
}
.gl-menu::backdrop {
  background: linear-gradient(transparent var(--gl-header-bottom, 65px), var(--gl-menu-page) var(--gl-header-bottom, 65px));
}
.gl-menu-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gl-line);
}
.gl-menu-heading h2 {
  margin: 0;
  color: var(--gl-heading);
  font: 700 clamp(32px, 4vw, 40px)/1.15 var(--gl-font);
  letter-spacing: -1px;
}
.gl-menu-totals { margin: 6px 0 0; color: var(--gl-muted); }
.gl-menu-actions { display: flex; gap: 16px; align-items: center; }
.gl-menu .gl-menu-library { color: var(--gl-accent); font-weight: 600; white-space: nowrap; }
.gl-menu-systems {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 40px;
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.gl-menu-systems li { border-bottom: 1px solid var(--gl-line); }
.gl-menu .gl-menu-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  color: var(--gl-heading);
  text-decoration: none;
}
.gl-menu-row > svg { flex: none; color: var(--gl-faint); }
.gl-menu-name { display: block; color: light-dark(var(--gl-heading), #cfd1d6); font-size: 17px; font-weight: 600; }
.gl-menu-description { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.gl-menu-count { display: block; margin-top: 2px; font-size: 13px; color: var(--gl-muted); }
.gl-menu-row:hover .gl-menu-name { color: var(--gl-accent); }
.gl-published-count { color: var(--gl-published); }
.chip.published { background: var(--gl-chip); color: var(--gl-chip-text); }

.book-card-heading { display: flex; align-items: flex-start; gap: 12px; }
.book-card-heading > div { min-width: 0; }
.home-guideline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  background: var(--gl-surface);
  border: 1px solid var(--gl-line);
  border-radius: 14px;
  color: var(--gl-heading);
  text-decoration: none;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.home-guideline:hover { color: var(--gl-accent); }

.book-page {
  margin: 0;
  background: var(--gl-page);
  color: var(--gl-text);
  font: 400 16px/1.4 var(--gl-font);
}
.book-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 48px);
}
.book-brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  color: var(--gl-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.3px;
  text-decoration: none;
}
.book-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--gl-brand);
  color: var(--gl-on-solid);
  font-size: 17px;
}
.book-brand-label { color: var(--gl-muted); font-size: 13px; font-weight: 500; letter-spacing: 2px; }
.book-header nav { display: flex; flex-wrap: wrap; gap: 4px; }
.book-session { display: flex; align-items: center; gap: 4px; }
.book-session a { padding-inline: 8px; }
.book-search {
  display: flex;
  flex: 1 1 260px;
  max-width: 520px;
  min-width: 0;
  box-sizing: border-box;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 18px;
  border-radius: 23px;
  background: var(--gl-book-search);
}
.book-search button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gl-heading);
  cursor: pointer;
}
.book-search input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--gl-text);
  font: 400 15px var(--gl-font);
}
.book-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, calc((100% - 120px) / 2)) minmax(0, 1fr);
  overflow-wrap: anywhere;
}
.book-layout a { color: var(--gl-heading); }
.book-layout a:hover { color: var(--gl-accent); text-decoration: underline; }
.book-rail { display: flex; flex-direction: column; gap: 4px; padding: 24px 16px; background: var(--gl-rail); }
.book-rail a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.book-rail a:first-child { background: light-dark(var(--gl-surface), var(--gl-raised)); font-weight: 600; }
.book-contents, .book-overview { min-width: 0; padding: 28px clamp(16px, 3vw, 36px) 48px; }
.book-contents { border-right: 1px solid var(--gl-line); }
.book-title-row { display: flex; align-items: center; gap: 16px; }
.book-title-row .system-tile { width: 56px; height: 56px; border-radius: 16px; }
.book-title-row h1 { margin: 0; color: var(--gl-heading); font-size: 34px; letter-spacing: -.8px; }
#book-summary { margin: 10px 0 0; color: var(--gl-muted); font-size: 14px; }
#book-summary .gl-published-count { font-weight: 600; }
#book-topics, .book-group { list-style: none; padding: 0; }
#book-topics { margin: 20px 0 0; }
.book-group { margin: 12px 0 12px 14px; }
.book-group-heading {
  margin: 22px 0 4px;
  scroll-margin-top: 16px;
  color: light-dark(var(--group-heading-light), var(--group-heading-dark,
    color-mix(in srgb, var(--system-tint) 60%, var(--system-strong))));
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.book-group-heading + .book-group { margin-block: 0; }
.book-row {
  display: grid;
  grid-template-columns: minmax(34px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  box-sizing: border-box;
  padding: 8px 12px;
  border-bottom: 1px solid var(--gl-line);
  color: var(--gl-muted);
  text-decoration: none;
}
a.book-row:not(.book-option) { background: var(--gl-book-row); border-radius: 10px; font-weight: 600; }
.book-option { grid-template-columns: auto minmax(0, 1fr) auto; font-weight: 600; }
.topic-number, .book-option-count { color: var(--gl-muted); font-size: 13px; font-weight: 400; }
a.book-row .topic-number { color: var(--gl-muted-on-raised); }
.book-status { font-size: 12px; }
.book-status.published { justify-self: start; padding: 3px 10px; border-radius: 12px; font-weight: 600; }
.book-breadcrumb { color: var(--gl-muted); font-size: 14px; }
.book-breadcrumb strong { color: var(--gl-heading); }
.book-overview h2 {
  display: inline-block;
  margin: 24px 0 0;
  padding-bottom: 10px;
  /* Soften each system rule toward the locked dark Addiction colour. */
  border-bottom: 4px solid light-dark(var(--system-strong), color-mix(in srgb, var(--system-strong) 80%, #b3ab90));
  color: var(--gl-heading);
  font-size: 26px;
  letter-spacing: -.4px;
}
.book-overview h3 { margin: 28px 0 10px; color: var(--gl-heading); font-size: 18px; }
.book-overview p { margin: 0; color: var(--gl-secondary-text); font-size: 15px; line-height: 1.65; }
.book-updates { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.book-updates li { padding: 14px 16px; background: var(--gl-surface); border: 1px solid var(--gl-line); border-radius: 14px; }
.book-updates a { font-weight: 600; text-decoration: none; }
.book-updates time { display: block; margin-top: 4px; color: var(--gl-muted); font-size: 13px; }
.gl-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 1101px) {
  .gl-header > div:first-child {
    max-width: none !important;
    min-height: 74px !important;
    padding-inline: clamp(16px, 4vw, 48px) !important;
  }
  .gl-header > div > nav[aria-label="Main"] { flex: 0 1 auto !important; gap: 6px !important; margin-left: auto; }
  .gl-header > div > nav[aria-label="Main"] + div { margin-left: 0 !important; }
  .gl-header > div > nav[aria-label="Main"] > a { font: 600 15px var(--gl-font) !important; line-height: 44px !important; }
}

@media (max-width: 1100px) {
  .gl-menu-systems { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-layout { grid-template-columns: 160px minmax(0, calc((100% - 60px) / 2)) minmax(0, 1fr); }
  .book-search { flex-basis: 100%; }
}
@media (max-width: 800px) {
  .book-layout { grid-template-columns: minmax(0, 1fr); }
  .book-rail { flex-direction: row; padding: 8px 16px; }
  .book-contents { border-right: 0; border-bottom: 1px solid var(--gl-line); }
}
@media (max-width: 720px) {
  .gl-guidelines-button, .gl-nav-link { padding-inline: 10px; font-size: 13px; }
  .gl-header .hn > a { padding-inline: 10px !important; }
  .gl-login-bar { flex-wrap: wrap; row-gap: 0 !important; }
  .gl-account-actions { gap: 6px; }
  .gl-menu { inset: 0; width: 100%; height: 100dvh; max-height: none; border: 0; border-radius: 0; padding: 20px 16px; }
  .gl-menu-actions { display: contents; }
  .gl-menu-library { align-self: start; }
  .gl-menu-heading { display: grid; align-items: start; grid-template-columns: minmax(0, 1fr) auto; }
  .gl-menu-heading > div:first-child { grid-column: 1; grid-row: 1; }
  .gl-menu-close { grid-column: 2; grid-row: 1; }
  .gl-menu-systems { grid-template-columns: minmax(0, 1fr); }
  .book-brand-label { display: none; }
  .book-header { gap: 6px 10px; }
  .book-header nav { order: 2; }
  .book-search { order: 3; }
  .book-header .gl-nav-link { padding-inline: 8px; }
  .book-row:not(.book-option) { grid-template-columns: minmax(30px, auto) minmax(0, 1fr); gap: 4px 8px; }
  .book-status { grid-column: 2; }
}
