/* Discovery home, topic roadmaps, course pages, tutorials and the discipline directory.
   Colours come from the tokens in style.css, so both schemes follow automatically. */

/* Shared card surface for linked entries */
.recommendation-link, .theme-entry, .lesson-tile, .next-choice,
.directory-groups .major-group-link, .directory-major-grid .directory-link {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-card); color: var(--ink); text-decoration: none;
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.recommendation-link:hover, .theme-entry:hover, .lesson-tile:hover, .next-choice:hover,
.directory-groups .major-group-link:hover, .directory-major-grid .directory-link:hover {
  color: var(--ink); border-color: var(--rule-strong); box-shadow: var(--shadow-raise); transform: translateY(-2px);
}

/* ------------------------------------------------------------------- home */
.discover-top {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; margin: .6rem 0 3rem;
}
.discovery-intro { min-width: 0; }
.discovery-intro h1 { font-size: clamp(2.4rem, 1.6rem + 2.6vw, 3.9rem); line-height: 1.14; font-weight: 740; letter-spacing: -.04em; }
.discovery-intro > p, .study-page-head > p { color: var(--ink-soft); margin: .85rem 0 1.4rem; font-size: 1.06rem; max-width: 70ch; }
.study-search {
  display: flex; align-items: center; gap: .55rem; padding: .4rem .4rem .4rem 1rem;
  background: var(--raised); border: 1px solid var(--rule-strong); border-radius: 14px;
  box-shadow: var(--shadow-card); max-width: 43rem; transition: border-color .15s ease, box-shadow .15s ease;
}
.study-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring), var(--shadow-card); }
.study-search svg { width: 20px; height: 20px; flex: none; color: var(--quiet); }
.study-search input { border: 0; background: transparent; padding: .45rem 0; min-width: 0; min-height: 0; font-size: .97rem; box-shadow: none; }
.study-search input:focus, .study-search input:focus-visible { outline: 0; box-shadow: none; }
.study-search button { white-space: nowrap; padding: .62rem 1.15rem; border-radius: 10px; box-shadow: none; }
.discovery-intro .study-search { max-width: none; }
.quick-links, .course-major-links { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .55rem; }
.quick-links { margin-top: 1rem; color: var(--quiet); font: .86rem/1.5 var(--sans); }
.quick-links a, .course-major-links a {
  font: 500 .86rem/1.5 var(--sans); padding: .22rem .75rem; border-radius: 999px; text-decoration: none;
  background: var(--sheet); border: 1px solid var(--rule); color: var(--ink-soft);
}
.quick-links a:hover, .course-major-links a:hover { border-color: var(--accent); color: var(--accent); }

/* Paper stack: featured roadmaps and tutorials as sheets on the desk.
   Sheets stay cream in both schemes, so their ink colours are fixed. */
.paper-stack { min-width: 0; display: grid; gap: .5rem; }
.paper-deck {
  --pt: 16px; --pr: 24px; --pb: 18px; --pl: 8px; --fold: 54px;
  position: relative; height: 296px; isolation: isolate; cursor: pointer;
}
.paper {
  --tone: #a1452a;
  --sheet-bg: light-dark(#fffaf1, #e6dccb);
  --sheet-edge: light-dark(#f3e9da, #d9cdb8);
  --sheet-ink: #2a231e;
  --sheet-quiet: #665a50;
  position: absolute; inset: var(--pt) var(--pr) var(--pb) var(--pl);
  color: var(--sheet-ink); text-decoration: none;
  filter: drop-shadow(0 1px 1px var(--shadow-near)) drop-shadow(0 14px 16px var(--shadow-far));
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), opacity .35s ease;
}
.paper:hover { color: var(--sheet-ink); }
.paper[data-tone="math"] { --tone: #6b4f86; }
.paper[data-tone="ai"], .paper[data-tone="computing"] { --tone: #3f617f; }
.paper[data-tone="engineering"] { --tone: #80591f; }
.paper[data-tone="finance"] { --tone: #4b6536; }
.paper[data-tone="management"] { --tone: #7a4f63; }
.paper[data-tone="tutorial"] { --tone: #36625d; }
.paper[data-pos="0"] { z-index: 3; }
.paper[data-pos="0"]:hover { transform: translateY(-3px); }
.paper[data-pos="1"] { z-index: 2; transform: translate(18px, -13px) rotate(3.4deg); }
.paper[data-pos="2"] { z-index: 1; transform: translate(-12px, 10px) rotate(-4.2deg); }
.paper[data-pos="rest"] { z-index: 0; transform: translate(-12px, 10px) rotate(-4.2deg); opacity: 0; }
.paper.is-leaving { animation: paper-turn .62s cubic-bezier(.3, .6, .2, 1); }
@keyframes paper-turn {
  0% { transform: none; opacity: 1; z-index: 4; }
  45% { transform: translate(34%, -8%) rotate(10deg); opacity: 1; z-index: 4; }
  55% { z-index: 0; }
  100% { z-index: 0; }
}
.paper-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: .3rem; overflow: hidden;
  padding: 1.55rem 1.8rem 1.35rem 2.35rem; border-radius: 14px;
  background:
    linear-gradient(to right, transparent 1.4rem, color-mix(in srgb, var(--tone) 32%, transparent) 1.4rem calc(1.4rem + 1.5px), transparent 0),
    linear-gradient(var(--sheet-bg), var(--sheet-bg));
  box-shadow: inset 0 0 0 1px var(--sheet-edge);
  clip-path: polygon(0 0, calc(100% - var(--fold)) 0, 100% var(--fold), 100% 100%, 0 100%);
}
.paper:not([data-pos="0"]) .paper-face > :not(.paper-tape) { visibility: hidden; }
.paper-tape {
  position: absolute; top: -5px; left: 42%; width: 86px; height: 22px; transform: rotate(-3deg);
  background: color-mix(in srgb, var(--tone) 34%, transparent);
}
.paper-kind { font: 600 .74rem/1.5 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--tone); }
.paper-title {
  max-width: calc(100% - 2.6rem); font-size: clamp(1.5rem, 2.2vw, 2.05rem); line-height: 1.15; font-weight: 740;
  letter-spacing: -.03em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.paper-meta { color: var(--sheet-quiet); font-size: .88rem; }
.paper-route { display: flex; margin-top: auto; padding-top: .8rem; }
.paper-route li {
  position: relative; flex: 1 1 0; min-width: 0; padding: 1.45rem .6rem 0 0;
  font-size: .86rem; color: var(--sheet-quiet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.paper-route li::before {
  content: ""; position: absolute; top: 0; left: 0; width: 15px; height: 15px; box-sizing: border-box;
  border: 2px solid var(--tone); border-radius: 50%; background: var(--sheet-bg);
}
.paper-route li:first-child::before { background: var(--tone); }
.paper-route li:not(:last-child)::after {
  content: ""; position: absolute; top: 6.5px; left: 19px; right: 4px;
  border-top: 2px dashed color-mix(in srgb, var(--tone) 55%, transparent);
}
.paper-summary {
  margin-top: .35rem; color: var(--sheet-quiet); font-size: .93rem; max-width: 46ch;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.paper-action { display: inline-flex; align-items: center; gap: .4rem; margin-top: auto; padding-top: .9rem; font: 600 .9rem/1.4 var(--sans); color: var(--tone); }
.paper-action svg { width: 16px; height: 16px; transition: transform .2s ease; }
.paper:hover .paper-action svg { transform: translateX(3px); }
.paper[data-pos="0"]:focus-visible { outline: none; }
.paper[data-pos="0"]:focus-visible .paper-face { box-shadow: inset 0 0 0 2px var(--tone); }

/* The folded corner turns to the next sheet. */
.paper-next {
  position: absolute; z-index: 5; top: var(--pt); right: var(--pr); width: var(--fold); height: var(--fold);
  min-height: 0; padding: 0; border: 0; border-radius: 0 0 0 12px; box-shadow: none;
  background: linear-gradient(225deg, transparent 50%, light-dark(#eadcc5, #cdbfa8) 50%);
  filter: drop-shadow(-2px 3px 2px var(--shadow-far));
  transform-origin: top right; transition: transform .2s ease;
}
.paper-next:hover, .paper-next:focus-visible { background: linear-gradient(225deg, transparent 50%, light-dark(#e3d1b6, #c4b49b) 50%); transform: scale(1.14); }
.paper-next svg { position: absolute; left: 8px; bottom: 9px; width: 17px; height: 17px; color: #a1452a; }
.paper-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; padding: 0 var(--pr, 24px) 0 8px; font: .8rem/1.5 var(--sans); color: var(--quiet); }
.paper-count { font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.source-link svg, .theme-entry > svg, .major-group-link svg { width: 17px; height: 17px; flex: none; }

/* Personal recommendations */
.home-recommendations { margin-block: 0 clamp(2rem, 3.4vw, 3rem); }
.home-recommendations .study-section-head { flex-wrap: wrap; margin-bottom: .9rem; }
.recommendation-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.recommendation-list li { min-width: 0; }
.recommendation-link { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 100%; padding: 1rem 1.15rem; }
.recommendation-link > span { display: grid; min-width: 0; gap: .2rem; overflow-wrap: anywhere; }
.recommendation-link strong { font-size: 1.08rem; font-weight: 600; }
.recommendation-link small, .recommendation-empty { color: var(--quiet); font-size: .88rem; }
.recommendation-link svg { width: 18px; height: 18px; flex: none; color: var(--accent); transition: transform .2s ease; }
.recommendation-link:hover svg { transform: translateX(3px); }

/* Topic and discipline columns */
.discover-columns { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.study-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin-bottom: 1rem; }
.study-section-head h2, .course-material h2, .course-actions h2, .course-quiz h2, .next-steps h2 { font-size: clamp(1.25rem, 1.6vw, 1.45rem); }
.study-more, .study-back { font: 600 .86rem/1.5 var(--sans); color: var(--accent); text-decoration: none; }
.study-more:hover, .study-back:hover { text-decoration: underline; color: var(--accent-hover); }
.study-more::after { content: " →" / ""; }
.theme-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.theme-entry { display: flex; min-width: 0; align-items: center; gap: .85rem; min-height: 84px; padding: .85rem 1rem; }
.theme-entry > svg { margin-left: auto; color: var(--quiet); width: 15px; transition: transform .2s ease, color .2s ease; }
.theme-entry:hover > svg { color: var(--accent); transform: translateX(3px); }
.topic-icon {
  --tone: var(--accent);
  width: 42px; height: 42px; display: grid; place-items: center; flex: none; border-radius: 11px;
  background: color-mix(in srgb, var(--tone) 14%, var(--sheet)); color: var(--tone);
}
.topic-icon svg { width: 23px; height: 23px; }
.topic-icon[data-tone="math"] { --tone: light-dark(#6b4f86, #bea6dc); }
.topic-icon[data-tone="ai"], .topic-icon[data-tone="computing"] { --tone: light-dark(#3f617f, #9dbcdc); }
.topic-icon[data-tone="engineering"] { --tone: light-dark(#8a6326, #dcb478); }
.topic-icon[data-tone="finance"] { --tone: light-dark(#4f6a3a, #a7c38c); }
.topic-icon[data-tone="management"] { --tone: light-dark(#7a4f63, #d6a6bc); }
.theme-text { min-width: 0; display: grid; gap: .15rem; }
.theme-text strong, .major-group-link strong { font-weight: 600; }
.theme-text small { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; color: var(--quiet); font-size: .8rem; }
.explore-majors {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 1.2rem 1.35rem .6rem;
}
.explore-majors .study-section-head { margin-bottom: .4rem; }
.major-group-link { display: flex; align-items: center; gap: .7rem; padding: .7rem .1rem; border-top: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.explore-majors .major-group-link:hover { color: var(--accent); }
.major-group-link span { margin-left: auto; color: var(--quiet); font: .8rem/1.5 var(--sans); }
.major-group-link svg { width: 14px; color: var(--quiet); }

/* Tutorials and the open lesson shelf */
.lesson-shelf { margin-top: clamp(2.4rem, 5vh, 4rem); }
.lesson-library-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: .9rem; }
.lesson-library-grid li { min-width: 0; }
.lesson-tile { height: 100%; min-height: 6.6rem; display: grid; align-content: start; gap: .25rem; padding: 1rem 1.1rem; }
.lesson-tile strong { font-size: 1.04rem; font-weight: 600; }
.lesson-tile span, .lesson-tile small { color: var(--quiet); overflow-wrap: anywhere; }
.lesson-tile span { font-size: .9rem; }
.lesson-tile small { font: .76rem/1.5 var(--sans); margin-top: auto; padding-top: .25rem; }
.source-link .lesson-description { margin-top: .25rem; font-size: .9rem; font-weight: 400; color: var(--quiet); max-width: 75ch; }

/* ------------------------------------------------------------- page heads */
.study-page-head { max-width: 58rem; margin-bottom: 1.8rem; }
.study-page-head h1, .view > .band-head h1 { font-size: clamp(2.1rem, 1.5rem + 2.2vw, 3.1rem); line-height: 1.2; margin: .4rem 0 .5rem; font-weight: 700; }
.study-page-head .study-search { margin-top: 1rem; max-width: 39rem; }
.study-page-head .coverage-status { font-size: .93rem; margin-top: 1rem; }
.course-row-tutorial { display: inline-block; margin-top: .4rem; }

/* ------------------------------------------------------------ directory */
.life-home {
  display: flex; align-items: center; flex-wrap: wrap; gap: 1rem 1.6rem;
  margin: 0 0 clamp(2rem, 3.4vw, 3rem); padding: 1.15rem clamp(1.2rem, 2.5vw, 2rem);
  background: var(--ok-wash); border-inline-start: 4px solid var(--ok); border-radius: 0 var(--radius) var(--radius) 0;
}
.life-home > div:first-child { flex: 1 1 18rem; }
.life-home h2 { font-size: 1.25rem; }
.life-home p { color: var(--ink-soft); font-size: .94rem; margin-top: .2rem; }
.life-home .button { flex: none; }
.life-shortcuts, .life-related { display: flex; flex-wrap: wrap; gap: .55rem 1.15rem; }
.life-shortcuts a, .life-related a { color: var(--ink-soft); text-decoration-color: var(--quiet); }
.life-shortcuts a:hover, .life-related a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.life-shortcuts { font-size: .9rem; }
.life-section { margin: 0 0 clamp(2rem, 4.4vw, 3.5rem); }
.life-section > h2 { margin: 0 0 1rem; }
.life-groups { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.life-group {
  height: 100%; display: grid; align-content: start; gap: .45rem; padding: 1.05rem 1.15rem;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); color: var(--ink); text-decoration: none;
}
.life-group:hover { border-color: var(--rule-strong); color: var(--accent); box-shadow: var(--shadow-card); }
.life-scenes .life-group { border-top: 3px solid var(--ok); }
.life-group-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.life-group-heading strong { font-weight: 650; }
.life-group-heading svg { width: 1rem; height: 1rem; flex: none; align-self: center; color: var(--quiet); }
.life-group small, .life-detail-progress, .life-activity-meta { font: .85rem/1.55 var(--sans); color: var(--quiet); }
.life-description { font-size: .95rem; color: var(--ink-soft); }
.life-detail-actions, .life-activity-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.life-activities { border-top: 1px solid var(--rule); max-width: 65rem; }
.life-activities > li { position: relative; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1.4rem; padding: 1.1rem .1rem; border-bottom: 1px solid var(--rule); }
.life-activities > li > .study-more { position: relative; z-index: 1; }
.life-activities > li:has(.course-name:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.life-activities > li > div { flex: 1 1 18rem; }
.life-activities p { margin: .3rem 0; }
.life-done { font-weight: 600; color: var(--ok); }
.life-featured-themes, .life-paths { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 23rem), 1fr)); }
.life-theme-link, .life-path { display: grid; gap: .65rem; align-content: start; border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.35rem; }
.life-theme-link { background: var(--ok-wash); border-inline-start: 4px solid var(--ok); color: var(--ink); text-decoration: none; }
.life-theme-link:hover, .life-home-theme:hover { color: var(--accent); }
.life-home-theme { display: inline-flex; gap: .55rem; align-items: center; margin-top: .6rem; color: var(--ink); }
.life-home-theme svg { width: 1rem; height: 1rem; }
.life-path { background: var(--sheet); }
.life-path h3 { margin: 0; }
.life-path p { margin: 0; color: var(--ink-soft); }
.home-workshops { margin: 1.5rem 0 2rem; }
.workshop-samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: .75rem; }
.workshop-sample { position: relative; display: grid; gap: .45rem; align-content: start; padding: 1rem 2.5rem 1rem 1.1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); color: var(--ink); text-decoration: none; }
.workshop-sample span, .theme-sample { color: var(--ink-soft); font: .9rem/1.5 var(--sans); }
.workshop-sample svg { position: absolute; inset: 1.15rem 1rem auto auto; width: 1rem; height: 1rem; }
.workshop-sample:hover { color: var(--accent); border-color: var(--rule-strong); }
.practice-directory .life-theme-link { background: var(--sheet); border-inline-start-width: 1px; }
.practice-directory .theme-sample { border-top: 1px solid var(--rule); padding-top: .55rem; }
.theme-worksheet { display: grid; gap: 1rem; max-width: 53rem; padding: clamp(1rem,3vw,2rem); border: 1px solid var(--rule); border-top: 3px solid var(--accent); border-radius: var(--radius); background: var(--sheet); }
.theme-worksheet h2, .theme-worksheet p { margin: 0; }
.worksheet-check { line-height: 1.6; color: var(--ink-soft); }
@media (max-width: 700px) {
  .site-header nav { flex-wrap: wrap; overflow: visible; margin-inline: 0; }
}
@media (max-width: 540px) {
  .site-header nav { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .1rem; }
  .site-header nav a { text-align: center; white-space: normal; }
}
.life-path-scenes, .life-path-courses { display: grid; gap: .4rem; padding-inline-start: 1.3rem; }
.life-path-scenes { list-style: disc; }
.life-path-courses { list-style: decimal; margin-top: .5rem; }
.life-path summary { cursor: pointer; }
.life-path .button { justify-self: start; }
.life-topic-entry { margin-bottom: .7rem; }
@media (max-width: 460px) {
  .site-header nav { gap: .12rem; }
  .site-header nav a { padding-inline: .35rem; font-size: .84rem; }
}

.directory-groups, .directory-major-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; }
.directory-groups .major-group-link, .directory-major-grid .directory-link { height: 100%; padding: 1rem 1.15rem; border-top: 1px solid var(--rule); }
.directory-groups .major-group-link strong { font-size: 1.06rem; }
.directory-groups .major-group-link::after {
  content: ""; width: .45rem; height: .45rem; margin: 0 .2rem; flex: none;
  border-top: 1.5px solid var(--quiet); border-right: 1.5px solid var(--quiet); transform: rotate(45deg);
}
.directory-groups .major-group-link:hover::after { border-color: var(--accent); }
#directory-back { justify-self: start; }

/* ---------------------------------------------------------- topic roadmap */
.roadmap {
  padding: 1.3rem clamp(1rem, 2.5vw, 1.9rem) 1.1rem; margin-bottom: 2rem;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.branch-button { min-height: 32px; font-size: .8rem; padding: .25rem .75rem; border-radius: 999px; }
.stage-graph { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: clamp(1.4rem, 4.9vw, 5rem); position: relative; padding: .7rem 0; isolation: isolate; }
.stage-graph > svg { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--rule-strong); z-index: -1; }
.graph-column { display: grid; gap: 1.2rem; align-content: center; }
.graph-stage {
  display: grid; align-content: center; justify-content: start; text-align: left; gap: .15rem;
  min-height: 92px; padding: .75rem 1rem; font-family: var(--body);
  background: var(--raised); border: 1px solid var(--rule-strong); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.graph-stage:hover { background: var(--raised); border-color: var(--accent); box-shadow: var(--shadow-raise); }
.graph-stage small, .graph-stage span { font: .76rem/1.5 var(--sans); color: var(--quiet); }
.graph-stage strong { font-size: 1.05rem; font-weight: 600; }
.graph-stage[data-next="true"] { border-color: var(--accent); background: var(--accent-wash); }
.graph-stage[data-next="true"] span { color: var(--accent); font-weight: 600; }
.graph-stage[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 3px; }
.graph-legend { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: .7rem; font: .78rem/1.5 var(--sans); color: var(--quiet); }
.graph-legend span { display: flex; align-items: center; gap: .4rem; }
.graph-legend i { width: 24px; border-top: 2px solid var(--rule-strong); }
.graph-legend .recommended { border-top-style: dashed; }

/* ------------------------------------------------------------ course list */
.results-section, .course-quiz, .next-steps, .study-summary { margin: 1.4rem 0 2rem; }
.course-selection { display: flex; gap: 1rem; align-items: center; font: .86rem/1.5 var(--sans); color: var(--quiet); border-bottom: 1px solid var(--rule); padding-bottom: .75rem; }
.course-selection span:nth-child(2) { margin-left: auto; }
.study-course-row { display: flex; gap: 1.1rem; align-items: center; border-bottom: 1px solid var(--rule); padding: .95rem .25rem; }
.study-course-row > div { min-width: 0; }
.course-name { font-size: 1.1rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.course-name:hover { text-decoration: underline; color: var(--accent); }
.course-row-title { display: flex; align-items: baseline; gap: .65rem; flex-wrap: wrap; }
.course-next { font: 600 .74rem/1.5 var(--sans); color: var(--accent); background: var(--accent-wash); padding: .05rem .55rem; border-radius: 999px; }
.study-course-row p, .course-duration, .study-empty p { color: var(--quiet); font-size: .88rem; }
.course-duration { margin-left: auto; white-space: nowrap; font-family: var(--sans); }
.study-empty { padding: 1rem 0; }
.study-course-list + button { margin-top: 1rem; }

/* ------------------------------------------------------------ course page */
.course-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; font: .86rem/1.5 var(--sans); color: var(--quiet); }
.course-crumbs a { text-decoration: none; }
.course-crumbs a:hover { text-decoration: underline; }
.course-crumbs > * + *::before { content: '/'; margin-right: .5rem; color: var(--rule-strong); }
.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 23rem); gap: clamp(1rem, 4vw, 3.5rem); align-items: start; }
.course-material section + section { margin-top: 2rem; }
.course-material h2, .next-steps h2, .course-quiz h2, .course-actions h2 { margin-bottom: .8rem; }
.source-link { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .85rem .2rem; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.source-link > span { display: grid; gap: .12rem; }
.source-link:hover { color: var(--accent); }
.source-link:hover strong { text-decoration: underline; }
.source-link small, .chapter-entry, .course-actions p, .course-actions small { color: var(--quiet); }
.reading-link { padding: .85rem 1rem; border: 1px solid var(--rule); background: var(--sheet); border-radius: var(--radius); }
.reading-link > .reading-mark { flex: none; width: 2.75rem; height: 3.2rem; place-items: center; color: var(--accent); background: var(--accent-wash); border-radius: var(--radius-sm); }
.reading-mark svg { width: 1.45rem; height: 1.45rem; }
.reading-link > span:nth-child(2) { flex: 1; min-width: 0; }
.resource-grid, .results-section .study-course-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.75rem), 1fr));
  gap: 1.25rem; align-items: stretch;
}
.resource-card, .course-index-card {
  overflow: hidden; min-width: 0; color: var(--ink); background: var(--sheet);
  border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.resource-card { display: flex; flex-direction: column; text-decoration: none; }
.resource-card:hover, .course-index-card:focus-within { border-color: var(--rule-strong); box-shadow: var(--shadow-raise); }
.resource-card:hover .resource-card-title, .course-index-link:hover .course-index-title { color: var(--accent); text-decoration: underline; text-underline-offset: .17em; }
.resource-cover {
  display: grid; position: relative; isolation: isolate; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--wash); border-bottom: 1px solid var(--rule);
}
.resource-cover img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--wash); }
.resource-cover[data-kind="video-thumbnail"] img, .resource-cover[data-kind="page-preview"] img { object-fit: cover; }
.cover-credit {
  position: absolute; inset: auto .35rem .35rem auto; z-index: 1; max-width: calc(100% - .7rem);
  padding: .12rem .45rem; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: light-dark(rgb(252 249 243 / .9), rgb(25 22 19 / .88)); color: var(--ink-soft); font: .68rem/1.35 var(--sans);
}
.resource-card-item { display: flex; flex-direction: column; min-width: 0; gap: .35rem; }
.resource-card-item > .resource-card { flex: 1; }
.cover-attribution-links { margin: 0; padding-inline: .15rem; font: .76rem/1.45 var(--sans); color: var(--quiet); }
.cover-attribution-links a { color: var(--ink-soft); }
.cover-paper {
  --book: light-dark(#36565e, #2f4e55); display: flex; min-width: 0; flex-direction: column; justify-content: space-between;
  gap: .4rem; margin: .75rem 1.25rem 0; padding: .8rem 1.1rem; border-left: .3rem solid rgb(0 0 0 / .16);
  background: var(--book); color: #fff9e9; border-radius: 2px 4px 0 0; box-shadow: 2px 3px 5px var(--shadow-far);
}
.resource-cover[data-format="project"] .cover-paper { --book: #465743; }
.resource-cover[data-format="course"] .cover-paper { --book: #674d3d; }
.cover-imprint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 .75rem/1.4 var(--sans); }
.cover-subject { border-top: 1px solid rgb(255 255 255 / .5); padding-top: .4rem; font: 650 clamp(1rem, 1.4vw, 1.35rem)/1.2 var(--display); }
.resource-card-body { padding: .95rem 1.05rem .65rem; display: grid; gap: .45rem; overflow-wrap: anywhere; }
.resource-card-meta, .resource-card-source { display: flex; align-items: center; gap: .5rem; color: var(--quiet); font: .8rem/1.4 var(--sans); }
.resource-type { font-weight: 650; color: var(--accent); }
.resource-card-meta > span + span { border-left: 1px solid var(--rule-strong); padding-left: .5rem; }
.resource-card-title { color: var(--ink); font: 650 1.07rem/1.45 var(--display); }
.resource-card-summary { color: var(--ink-soft); font-size: .9rem; line-height: 1.55; }
.resource-card-source { margin: auto 1.05rem 0; padding: .7rem 0 .85rem; border-top: 1px solid var(--rule); justify-content: space-between; }
.resource-card-source svg { width: 1rem; height: 1rem; flex: none; color: var(--accent); }
.specimen-head:has(.specimen-cover), .curriculum .specimen-head:has(.specimen-cover) {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: start; gap: .3rem .85rem;
}
.specimen-cover { grid-column: 1; grid-row: 1 / span 3; width: clamp(5.25rem, 10vw, 9rem); aspect-ratio: 16 / 9; object-fit: contain; border-radius: var(--radius-sm); background: var(--wash); }
.specimen-head:has(.specimen-cover) > :not(.specimen-cover) { grid-column: 2; }
.results-section .study-course-list { margin-top: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.study-course-row.course-index-card { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 0; height: 100%; padding: 0; }
.course-index-link { display: block; text-decoration: none; }
.course-index-title { display: block; padding: .8rem 1rem .15rem; font-weight: 650; }
.course-index-details { padding: .25rem 1rem .85rem; overflow-wrap: anywhere; }
.course-index-details .course-row-tutorial { font-size: .83rem; line-height: 1.45; }
.course-index-footer { margin: auto 1rem 0; padding: .5rem 0; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; border-top: 1px solid var(--rule); }
.course-index-footer label { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; cursor: pointer; color: var(--ink-soft); font-size: .85rem; }
.course-index-footer .course-duration { white-space: normal; }
.course-actions {
  display: grid; gap: .75rem; padding: 1.35rem 1.45rem;
  background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-raise);
}
.course-actions h2 { margin: 0; }
.course-actions h3 { font-size: 1rem; margin-top: .5rem; }
.course-quiz { max-width: 53rem; padding-block: 1.6rem; border-block: 1px solid var(--rule); }
.course-quiz > button { margin-top: .7rem; }
.quiz-form { display: grid; gap: 1rem; }
.quiz-form fieldset { margin: 0; padding: .55rem 1.1rem .8rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.quiz-form legend, .quiz-score { font-weight: 600; }
.quiz-form legend { padding-inline: .3rem; }
.quiz-form label { display: flex; align-items: center; gap: .7rem; padding: .3rem 0; }
.answer-explanation { padding: .75rem 0; color: var(--ink-soft); }
.next-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 53rem; }
.next-choice { display: grid; align-content: start; gap: .3rem; padding: 1rem 1.15rem; }
.next-choice span { font-size: .88rem; color: var(--quiet); }
#personal-study { margin-top: 2rem; }

/* --------------------------------------------------------------- tutorial */
#study-tutorial { max-width: 100rem; margin-inline: auto; }
.tutorial-heading { border-bottom: 1px solid var(--rule); margin-bottom: 2rem; padding-bottom: 1.1rem; }
.tutorial-heading .tutorial-name { font-size: clamp(1.3rem, 2vw, 1.7rem); font-weight: 600; color: var(--ink); margin: .55rem 0 .25rem; }
.tutorial-heading > p { max-width: 72ch; color: var(--quiet); margin: 0 0 .6rem; }
.tutorial-heading details, .tutorial-exercise details { margin-top: .7rem; }
.tutorial-heading summary, .tutorial-exercise summary { cursor: pointer; color: var(--accent); width: fit-content; font-family: var(--sans); font-size: .92rem; }
.tutorial-layout { display: grid; grid-template-columns: minmax(13rem, 1fr) minmax(0, 3fr); gap: clamp(1.4rem, 4vw, 4rem); align-items: start; }
.tutorial-chapters {
  position: sticky; top: 1.25rem; padding: 1rem .8rem 1rem 1rem;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.tutorial-chapters h2 { font-size: 1rem; margin: 0 0 .6rem; }
.tutorial-chapters ol { list-style: decimal; padding-inline-start: 1.5rem; line-height: 1.45; color: var(--quiet); }
.tutorial-chapters li { padding: .1rem 0; }
.tutorial-chapters a { display: block; padding: .45rem .6rem; border-radius: var(--radius-sm); color: var(--ink-soft); text-decoration: none; }
.tutorial-chapters a:hover, .tutorial-chapters a[aria-current] { background: var(--accent-wash); color: var(--accent); }
.tutorial-chapters a[aria-current] { font-weight: 600; }
.tutorial-article { max-width: 75ch; min-width: 0; line-height: 1.75; overflow-wrap: anywhere; }
.tutorial-article h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.25; margin: 0 0 .8rem; }
.tutorial-article h2 { font-size: 1.28rem; margin: 0 0 .55rem; }
.tutorial-article h3 { font-size: 1.04rem; margin: 1rem 0 .4rem; }
.tutorial-article p { margin: .6rem 0; }
.tutorial-intro { color: var(--ink-soft); font-size: 1.05rem; }
.tutorial-article section { margin: 2rem 0; }
.tutorial-article ul, .tutorial-heading ul { list-style: disc; padding-inline-start: 1.45rem; }
.tutorial-code {
  overflow: auto; margin: 0; padding: 1rem 1.1rem; white-space: pre; font: .88rem/1.65 var(--mono);
  background: light-dark(#2e2823, #15120f); color: light-dark(#f1e7d8, #e8dccb);
  border: 1px solid light-dark(#2e2823, #36302a); border-radius: var(--radius);
}
.tutorial-example-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1rem; margin-bottom: .5rem; color: var(--quiet); font: .86rem/1.5 var(--sans); }
.tutorial-example-tools button { font-size: .82rem; padding: .25rem .65rem; min-height: 32px; }
.tutorial-exercise { border-block: 1px solid var(--rule); padding: 1.1rem 0; }
.tutorial-pagination { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem; border-top: 1px solid var(--rule); padding-top: 1rem; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 44rem) {
  .tutorial-layout { grid-template-columns: minmax(0, 1fr); }
  .tutorial-chapters { position: static; }
}
@media (max-width: 40rem) {
  .recommendation-list { gap: .7rem; }
}
/* Wide screens: give lists more columns so the page is used edge to edge. */
@media (min-width: 80rem) {
  .theme-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .course-layout { grid-template-columns: minmax(0, 1fr) minmax(20rem, 27%); }
  .sp-main .sp-weeks {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 34rem), 1fr));
    column-gap: clamp(1.5rem, 3vw, 4rem); align-items: start;
  }
  .specimen-list:not(.curriculum-specimens) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 34rem), 1fr)); align-items: start; }
}
@media (min-width: 95rem) {
  .discover-top, .discover-columns { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
  .paper-deck { height: 310px; }
}
@media (max-width: 950px) {
  .discover-columns { grid-template-columns: minmax(0, 1fr); }
}
/* 700px matches the vertical stage-graph switch in study-discovery.js. */
@media (max-width: 700px) {
  .lesson-shelf-preview .lesson-library-grid li:nth-child(n+5) { display: none; }
  .discover-top, .course-layout { grid-template-columns: minmax(0, 1fr); }
  .discover-top { gap: 1.3rem; margin: .2rem 0 2rem; }
  .discovery-intro h1 { font-size: 2.3rem; }
  .discovery-intro > p { font-size: .98rem; margin: .5rem 0 1rem; }
  .paper-deck { --pt: 14px; --pr: 18px; --pb: 14px; --pl: 4px; --fold: 46px; height: 252px; }
  .paper-face {
    padding: 1.2rem 1.3rem 1.1rem 1.9rem;
    background:
      linear-gradient(to right, transparent 1.1rem, color-mix(in srgb, var(--tone) 32%, transparent) 1.1rem calc(1.1rem + 1.5px), transparent 0),
      linear-gradient(var(--sheet-bg), var(--sheet-bg));
  }
  .paper-title { font-size: 1.45rem; }
  .paper-route li { font-size: .8rem; }
  .paper-next svg { left: 6px; bottom: 7px; width: 15px; height: 15px; }
  .theme-list { gap: .7rem; }
  .theme-entry { gap: .55rem; min-height: 70px; padding: .7rem .8rem; }
  .theme-entry > svg { display: none; }
  .topic-icon { width: 34px; height: 34px; border-radius: 9px; }
  .topic-icon svg { width: 20px; height: 20px; }
  .stage-graph { grid-auto-flow: row; grid-auto-columns: auto; gap: 1.7rem; padding: .45rem 1.2rem .45rem .2rem; }
  .graph-column { gap: 1.7rem; }
  .graph-stage { min-height: 76px; }
  .study-course-row { gap: .65rem; align-items: flex-start; }
  .study-course-row > input { margin-top: .4rem; }
  .course-duration { white-space: normal; min-width: 3rem; text-align: right; font-size: .75rem; }
  .study-course-row p { font-size: .84rem; }
  .course-selection { gap: .5rem; }
  .course-actions { grid-row: 1; }
  .course-layout { gap: 1.3rem; }
  .next-choices { gap: .6rem; }
}
@media (max-width: 380px) {
  .theme-list { grid-template-columns: minmax(0, 1fr); }
  .header-tools { gap: .25rem; }
}
@media (prefers-reduced-motion: reduce) {
  .recommendation-link:hover, .theme-entry:hover, .lesson-tile:hover, .next-choice:hover, .paper[data-pos="0"]:hover,
  .directory-groups .major-group-link:hover, .directory-major-grid .directory-link:hover { transform: none; }
}

/* Practice sheets share the paper, rule and accent colours of the course reader. */
.life-practice { margin: 1.5rem 0 2rem; max-width: 57rem; min-width: 0; }
.life-practice h2 { margin: 0 0 .85rem; }
.practice-context { max-width: 75ch; margin: .6rem 0 1rem; line-height: 1.65; white-space: pre-line; }
.life-practice fieldset { min-width: 0; margin: 0; }
.practice-switcher { display: flex; flex-wrap: wrap; gap: .35rem; border: 0; padding: .2rem 0 .7rem; }
.practice-switcher label { position: relative; cursor: pointer; }
.practice-switcher input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.practice-switcher span {
  display: inline-flex; align-items: center; min-height: 2.6rem; padding: .42rem .85rem;
  font: 600 .9rem/1.3 var(--sans); color: var(--ink-soft); background: var(--sheet);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
}
.practice-switcher input:checked + span { background: var(--accent-wash); color: var(--accent); border-color: var(--accent); }
.practice-switcher input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.practice-panel {
  display: grid; align-content: start; gap: 1rem; max-width: 100%; padding: clamp(.9rem, 2.5vw, 1.6rem);
  background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--accent); border-radius: var(--radius);
  overflow-wrap: anywhere; line-height: 1.65;
}
.practice-panel > p, .practice-panel .practice-question p { margin: 0; }
.practice-panel button { justify-self: start; }
.practice-question, .practice-checklist { display: grid; gap: .25rem; border: 0; padding: 0; }
.practice-question + .practice-question { border-top: 1px solid var(--rule); padding-top: .7rem; }
.practice-question legend, .practice-checklist legend { font-weight: 650; padding: 0 0 .5rem; }
.practice-question label, .practice-check {
  display: flex; align-items: baseline; gap: .55rem; padding: .45rem .2rem; cursor: pointer;
}
.practice-question label input, .practice-check input { flex: none; }
.practice-feedback, .practice-outcome { border-inline-start: 3px solid var(--rule-strong); padding: .55rem .85rem; background: var(--paper); }
.practice-feedback[data-correct="true"] { border-inline-start-color: var(--accent); }
.practice-question button { margin: .45rem 0; }
.practice-steps { display: grid; gap: .55rem; list-style: decimal; padding-inline-start: 1.6rem; margin: 0; }
.practice-write { display: grid; gap: .35rem; }
.practice-write > span { font-weight: 600; }
.practice-write textarea { box-sizing: border-box; width: 100%; min-height: 4.2rem; font: inherit; }
.practice-solo summary { cursor: pointer; color: var(--accent); }
.practice-solo p { margin: .5rem 0; }
.practice-references { display: flex; flex-wrap: wrap; gap: .35rem 1rem; list-style: none; margin: .65rem 0; padding: 0; }
.practice-footer { display: flex; align-items: center; gap: .45rem 1rem; flex-wrap: wrap; margin-top: .8rem; }
.practice-note, .practice-status { margin: 0; font: .83rem/1.5 var(--sans); color: var(--quiet); }
.practice-status:not(:empty) { margin-top: .5rem; }
.practice-footer button { font-size: .8rem; }
.life-print-card { display: none; }
@media (max-width: 35rem) {
  .practice-switcher { display: grid; grid-template-columns: 1fr 1fr; }
  .practice-switcher span { display: flex; height: 100%; }
}
@media print {
  body:has(> .life-print-card) > :not(.life-print-card) { display: none !important; }
  body:has(> .life-print-card) { margin: 0; background: white; color: black; }
  .life-print-card { display: block; color: black; padding: 5mm; font: 12pt/1.55 sans-serif; }
  .life-print-card h1 { font-size: 19pt; margin: 0 0 3mm; }
  .life-print-card h2 { font-size: 14pt; margin: 5mm 0 2mm; }
  .life-print-card ul { list-style: none; padding: 0; }
  .life-print-card li { margin: 3mm 0; break-inside: avoid; }
  .life-print-note { min-height: 32mm; white-space: pre-wrap; overflow-wrap: anywhere; border-bottom: 1px solid #888; }
}
