/* ===== Reset / base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: #e9eaec;
  color: #111;
  font-family:
    "Open Sans",
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  line-height: 1.35;
}

body.custom-cursor-enabled,
body.custom-cursor-enabled * {
  cursor: none !important;
}

#cb-custom-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 9999px !important;
  clip-path: circle(50%) !important;
  background: rgba(0, 0, 0, 0.6);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translate(-50%, -50%) scale(1);
  transition:
    transform 100ms ease,
    opacity 120ms ease;
  pointer-events: none;
  z-index: 2147483647;
  opacity: 0;
  will-change: transform, left, top, opacity;
}
* {
  border-radius: 0 !important;
} /* no rounding anywhere */

/* ===== Local font (place in ./assets/fonts) ===== */
@font-face {
  font-family: "Open Sans";
  src: url("./assets/fonts/OpenSans-VariableFont_wdth,wght.woff2")
    format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("./assets/fonts/OpenSans-Italic-VariableFont_wdth,wght.woff2")
    format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ===== Vars & stage ===== */
:root {
  --stage-w: 1280px;
  --stage-h: 800px;
  --chrome: #ffffff;
  --ink: #111;
  --muted: #6b7280;
  --line: #d8dbe1;
  --blue: #0b5fff;
  --blue-2: #156ff2;
  --green: #2faa3f;
  --tab-accent: #9ad77b; /* light green underline */
  --overlay-opacity: 0.45;
}
#app-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
#stage {
  position: relative;
  width: var(--stage-w);
  height: var(--stage-h);
  background: var(--chrome);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

/* ===== PDF overlay ===== */
#spec-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--overlay-opacity);
  mix-blend-mode: multiply;
  display: none;
}
#spec-overlay.active {
  display: block;
}
#spec-overlay iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===== Global crumbs ===== */
.crumbs {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}
.crumb {
  color: #2b5ea0;
}
.sep {
  color: #9aa1ad;
}

/* ===== Layout (left menu + pane) ===== */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: calc(100% - 56px);
}
.course-nav {
  border-right: 1px solid var(--line);
  padding: 20px 16px 20px 20px;
  overflow: auto;
  color: #088cec;
}
.nv-h {
  font-size: 18px;
  margin: 0 0 12px 0;
}
.nv {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0px;
  font-size: 16px;
}
.nv li {
  padding: 8px 10px;
  border: 1px solid transparent;
}
.nv li:hover {
  background: #f7f8fa;
}
.nv-active {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}

.pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: auto; /* was hidden — put it back */
}

/* ===== Screens ===== */
.screen {
  padding: 0 24px 24px 24px;
}
.screen[hidden] {
  display: none !important;
}

.app-header {
  /* global header stays fixed above screens */
  flex-shrink: 0;
}
.topbar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 18px 24px 10px 24px;
}

.title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.hamburger {
  background: transparent;
  border: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  line-height: 0;
  cursor: pointer;
  margin-right: 12px;
  color: #111;
}

.tabs {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  padding: 8px 0 0px 0;
  margin: 0 24px;
}

.tab {
  background: transparent;
  border: 0;
  padding: 8px 0;
  font: inherit;
  color: #333;
  cursor: default;
}

.tab-active {
  border-bottom: 4px solid var(--tab-accent);
  font-weight: 600;
}

/* Search area */
.bar {
  padding: 18px 0 26px;
  border-bottom: 1px solid var(--line);
}
.lbl {
  color: #555;
  font-size: 14px;
  display: block;
  margin-bottom: 20px;
}
.search {
  position: relative;
  width: 560px;
}
.search input {
  width: 110%;
  height: 40px;
  border: 1px solid var(--line);
  padding: 0 40px 0 12px;
  font: inherit;
  background: #fff;
}
.search .glass {
  position: absolute;
  right: -40px;
  top: 50%;
  transform: translateY(-50%);
  color: #7d8596;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon {
  display: block;
}

.icon-search {
  width: 18px;
  height: 18px;
}

.icon-menu {
  width: 22px;
  height: 22px;
}

/* Category row */
.cats {
  display: flex;
  gap: 50px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cat {
  background: transparent;
  border: 0;
  padding: 10px 0;
  font: inherit;
  color: #333;
}
.cat-active {
  color: #2b7d2b;
  border-bottom: 4px solid var(--tab-accent);
  font-weight: 600;
}

/* Cards grid */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px; /* even spacing */
  padding: 18px 0 8px;
}

.card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0;
  display: grid;
  grid-template-rows: 180px auto;
}
.card .img {
  border-bottom: 1px solid var(--line);
  background: #ddd;
}
.card .meta {
  padding: 14px 16px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
  margin: 0 0 6px 0;
}
.g {
  color: var(--green);
  font-weight: 600;
}
.blurb {
  color: #444;
  font-size: 14px;
  margin: 0 0 8px 0;
}
.isbn {
  font-size: 12px;
  color: #7d8596;
}

/* Noninteractive hover micro-interaction */
.noninteractive:hover {
  filter: brightness(1.02);
}

/* Book head (screens 2 & 3) */
.book-head {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 16px;
  padding: 20px 0 14px; /* breathing room above/below */
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px; /* space before next section */
}
.thumb {
  width: 128px;
  height: 112px;
  border: 1px solid var(--line);
  background: #f0f0f0;
  overflow: hidden;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bk-meta .bk-title {
  margin: 0 0 6px 0;
}
.bk-meta .authors,
.bk-meta .short {
  color: #444;
  font-size: 14px;
}
.readmore {
  display: inline-block; /* forces new line after the paragraph wrap */
  margin-top: 4px;
  color: #2b5ea0;
  text-decoration: underline;
  font-weight: 600;
}

/* Sections & lists */
.sec-h {
  margin: 16px 0 6px 0;
  font-size: 18px;
  font-weight: 700;
} /* bold hierarchy */
.hint {
  color: #555;
  margin: 0 0 14px 0;
  font-size: 16px;
}

/* ===== Table of Contents styles ===== */

/* TOC main heading */
.toc-h {
  margin: 8px 0 10px;
  font-weight: 700;
}
.theme-green {
  color: var(--green);
}

/* Book title directly under TOC heading */
.toc-book-title {
  font-size: 18px;
  font-weight: 700;
  margin: 4px 0 12px;
}

/* "Select all" row */
.sel-all {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px 0;
  font-weight: 600;
  font-size: 14px;
}

/* Container for TOC groups */
.toc {
  display: grid;
  gap: 16px;
}

/* Each TOC group (a section) */
.toc-group {
  margin-bottom: 4px;
}

/* Section heading row (with parent checkbox + title inline) */
.toc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 6px;
}
.toc-title {
  font-weight: 600;
  font-size: 15px;
}

/* Subsections list under each section */
.toc-sublist {
  list-style: none;
  margin: 0 0 8px 28px; /* indent relative to section title */
  padding: 0;
  display: grid;
  gap: 6px;
}
.toc-sublist li label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #333;
}

/* ===== Checkbox visuals (unchecked / checked / indeterminate) ===== */

/* Base (unchecked) */
.toc-head input,
.toc-sublist input,
.sel-all input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23b8bec9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3C/svg%3E");
  cursor: pointer;
  position: relative;
  outline: none;
}

/* Hover */
.toc-head input:hover,
.toc-sublist input:hover,
.sel-all input:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238e97a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3C/svg%3E");
}

/* Keyboard focus ring */
.toc-head input:focus-visible,
.toc-sublist input:focus-visible,
.sel-all input:focus-visible {
  box-shadow: 0 0 0 2px rgba(11, 95, 255, 0.25); /* soft blue glow */
}

/* CHECKED: square-check icon */
.toc-head input:checked,
.toc-sublist input:checked,
.sel-all input:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230b5fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344'/%3E%3Cpath d='m9 11 3 3L22 4' stroke-width='4'/%3E%3C/svg%3E");
}

/* INDETERMINATE: square-minus icon */
.toc-head input:indeterminate,
.toc-sublist input:indeterminate,
.sel-all input:indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230b5fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Cpath d='M8 12h8'/%3E%3C/svg%3E");
}

.subhead {
  margin: 14px 0 6px 0;
  font-weight: 700;
}

.list {
  list-style: none;
  padding: 0;
  background: #fff;
}
.list li {
  padding: 12px 16px;
}
.list li:last-child {
  border-bottom: 0;
}

/* extra vertical room for this page */
.list-roomy li {
  padding: 14px 0px;
} /* slightly more than default */

.light {
  color: #666;
}

/* Notes & price */
.note {
  color: #444;
}
.actionbar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center; /* ensures baseline alignment */
  gap: 12px;
  padding: 12px 0;
  background: #fff;
  border-top: 1px solid var(--line);
}

.price {
  font-size: 14px;
  font-weight: 600;
}
.spacer {
  flex: 1;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  padding: 10px 16px;
  cursor: default;
}
.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn.confirm {
  background: #1565c0;
  border-color: #1565c0;
  color: #fff;
}
.btn.ghost {
  background: #fff;
  color: #111;
}
.btn.flat {
  background: transparent;
  border-color: transparent;
  color: #2b5ea0;
  text-decoration: underline;
}
.btn.link {
  background: #2b8be6;
  border-color: #2b8be6;
  color: #fff;
  text-decoration: none;
  padding: 10px 16px;
}

.btn.outline {
  background: #fff;
  border-color: #cfd3db;
  color: #111;
} /* secondary */

/* Pulsing beacon */
.clickable {
  position: relative;
  cursor: pointer;
}
.clickable:hover {
  outline: 2px solid var(--blue-2);
  outline-offset: 2px;
}
.beacon {
  position: absolute;
  inset: -6px;
  border: 3px solid #ff3b30;
  opacity: 0.9;
  animation: beacon-pulse 1.4s infinite ease-out;
  pointer-events: none;
}
@keyframes beacon-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.95;
  }
  70% {
    transform: scale(1.06);
    opacity: 0.25;
  }
  100% {
    transform: scale(1.1);
    opacity: 0.05;
  }
}

/* Success screen */
.congrats {
  font-size: 24px;
  margin: 16px 0 8px 0;
}
.panel {
  border: 1px solid var(--line);
  background: #fff;
}
.panel-h {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f5f6f8;
}
.panel-g {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
}
.panel-f {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
}
.rec {
  margin: 16px 0 12px 0;
}
.cta-row {
  margin-top: 8px;
}

/* Dev help footer */
#dev-help {
  margin-top: 8px;
  color: #444;
  font-size: 12px;
  user-select: none;
}

/* Eye icon styling for sidebar */
.nv li {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nv li .eye {
  width: 14px;
  height: 14px;
  opacity: 0.5; /* muted gray */
}

.img-wrap {
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* crops nicely without stretching */
  display: block;
}

.back-link {
  color: #2b5ea0;
  text-decoration: none;
  font: inherit;
  background: transparent;
  border: 0;
  padding: 10px;
  line-height: 1;
}

/* Two-line clamp */
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
}
.clamp-2 .readmore {
  display: none; /* shown only when JS detects overflow */
  color: #2b5ea0;
  text-decoration: underline;
  font-weight: 600;
  white-space: nowrap;
}
.clamp-2.is-clamped .readmore {
  display: inline;
}

/* Screen 3 uses normal document flow (no nested internal scroll regions) */
.pane:has(.screen[data-screen="3"]:not([hidden])) {
  overflow: auto;
}

.screen[data-screen="3"] {
  padding: 0 24px 24px;
  box-sizing: border-box;
}

/* ---------- Screen 4 spacing & alignment fixes ---------- */
.screen[data-screen="4"] {
  padding: 0 24px;
}

/* 1) “Congratulations!” needs breathing room under tabs */
.screen[data-screen="4"] .congrats {
  margin-top: 16px; /* space from tabs */
  margin-bottom: 8px;
}

/* 2) Gray course details box needs top margin (was pushed up) */
.screen[data-screen="4"] .panel {
  margin-top: 12px; /* space below the intro paragraph */
  border: 1px solid var(--line);
  max-width: 750px;
  background: #fff;
}

/* 3) Consistent vertical rhythm inside the panel */
.screen[data-screen="4"] .panel-h {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: #f5f6f8;
}

.screen[data-screen="4"] .panel-g {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
  row-gap: 8px; /* add even row spacing */
  padding: 20px;
  line-height: 2.5; /* consistent text height */
}

.screen[data-screen="4"] .panel-g > div > div {
  padding: 2px 0; /* light row padding for consistency */
}

/* 4) Left-align the “Go to Courseware Settings.” link and separate it */
.screen[data-screen="4"] .panel-f {
  border-top: 1px solid var(--line);
  padding: 20px;
}

.screen[data-screen="4"] .panel-f .readmore {
  display: inline-block; /* its own line under the paragraph */
  margin-top: 6px; /* comfortable gap from text */
  color: #2b5ea0;
  text-decoration: underline;
  font-weight: 600;
}

/* 5) More space before the final CTA, and align horizontally with content */
.screen[data-screen="4"] .rec {
  margin: 16px 0 12px; /* add bottom gap before button */
}

.screen[data-screen="4"] .cta-row {
  margin-top: 8px; /* ensures it doesn’t stick to text */
  padding-top: 20px;
}

.screen[data-screen="4"] .cta-row .btn.link {
  display: inline-block; /* align with text block left edge */
  padding: 10px 16px;
}

/* Book head layout for Screens 2 & 3 */
.screen[data-screen="2"] .book-head,
.screen[data-screen="3"] .book-head {
  display: flex;
  align-items: stretch; /* image stretches to match text block height */
  gap: 20px;
  margin-bottom: 16px;
}

/* Make the thumb taller */
.screen[data-screen="2"] .thumb,
.screen[data-screen="3"] .thumb {
  flex: 0 0 200px; /* wider image column */
  height: auto;
  border: 1px solid var(--line);
  background: #f0f0f0;
  overflow: hidden;
}

/* Image fills the thumb box proportionally */
.screen[data-screen="2"] .thumb img,
.screen[data-screen="3"] .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Text block takes the rest of the space */
.screen[data-screen="2"] .bk-meta,
.screen[data-screen="3"] .bk-meta {
  flex: 1;
}

/* --- Ensure correct stacking across the stage & overlay --- */
#stage {
  position: relative;
  z-index: 0;
}
#spec-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
} /* overlay under UI */
.clickable {
  position: relative;
  overflow: visible;
  z-index: 2;
} /* targets above overlay */

/* ===== Centered ripple hint on interactive elements ===== */
.clickable::after,
.clickable::before {
  content: "";
  position: absolute;
  top: 80%;
  left: 50%;
  /* start size: tweak if you want larger/smaller ripples */
  width: 25px;
  height: 25px;
  transform: translate(-50%, -50%) scale(0.85);
  border: 3px solid var(--green); /* use --blue to match your UI */
  opacity: 0;
  pointer-events: none;
  z-index: 3; /* above button/card contents */
  animation: ripple-square 1.4s infinite ease-out;
}

/* Staggered second wave for continuous effect */
.clickable::before {
  animation-delay: 0.35s;
}

/* Don’t pause on hover (so it always “does something”) */
/* (If you prefer pausing, re-add the hover block later) */

/* Square, no border-radius to match your design rules */
@keyframes ripple-square {
  0% {
    transform: translate(-50%, -50%) scale(0.85);
    opacity: 0.75;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0.5;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.9);
    opacity: 0.2;
  }
  150% {
    transform: translate(-50%, -50%) scale(2.6);
    opacity: 0.1;
  }
  200% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 0.05;
  }
}
