/* Shared workbook chrome — sticky navbar + hub shells */

@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600..800&family=Figtree:wght@400;500;600;700&display=swap");

:root {
  --wb-ink: #12261c;
  --wb-forest: #1a4a32;
  --wb-leaf: #2a8f5c;
  --wb-moss: #4f7a63;
  --wb-sand: #e8efe9;
  --wb-paper: #f3f7f4;
  --wb-clay: #c45c26;
  --wb-gold: #c9a227;
  --wb-white: #ffffff;
  --wb-line: #c5d4cb;
  --wb-line-soft: #dde6e0;
  --wb-max: 70rem;
  --wb-radius: 0.75rem;
  --wb-font-display: "Bricolage Grotesque", "Avenir Next", sans-serif;
  --wb-font-body: "Figtree", "Segoe UI", sans-serif;
  --wb-nav-h: 3.5rem;
}

.wb-nav *,
.wb-home * {
  box-sizing: border-box;
}

/* Sticky bar should sit flush; lesson pages often rely on default body margin */
body:has(> .wb-nav) {
  margin: 0;
}

/* ——— Sticky site navbar ——— */
.wb-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  box-sizing: border-box;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  width: 100%;
  min-height: var(--wb-nav-h);
  margin: 0;
  padding: 0.55rem clamp(0.85rem, 3vw, 1.75rem);
  background: color-mix(in srgb, var(--wb-white) 92%, transparent);
  border: 0;
  border-bottom: 1px solid var(--wb-line);
  border-radius: 0;
  backdrop-filter: blur(12px);
  color: var(--wb-ink);
  font-family: var(--wb-font-body);
  font-size: 0.92rem;
  line-height: 1.35;
  overflow-x: auto;
  scrollbar-width: thin;
}

.wb-nav a {
  flex: 0 0 auto;
  padding: 0.4rem 0.65rem;
  background: transparent;
  border: 0;
  border-radius: 0.45rem;
  color: var(--wb-forest);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}

.wb-nav a:hover {
  background: var(--wb-sand);
  color: var(--wb-ink);
}

.wb-nav a:focus-visible,
.wb-home a:focus-visible {
  outline: 3px solid var(--wb-gold);
  outline-offset: 2px;
}

.wb-nav a[aria-current="page"] {
  background: var(--wb-sand);
  color: var(--wb-ink);
  font-weight: 700;
}

/* Brand: first link, or explicit brand class */
.wb-nav > a:first-of-type,
.wb-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-right: 0.25rem;
  padding: 0.35rem 0.55rem;
  color: var(--wb-forest);
  font-family: var(--wb-font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wb-nav > a:first-of-type:hover,
.wb-nav__brand:hover {
  background: transparent;
  color: var(--wb-leaf);
}

.wb-nav > a:first-of-type::before,
.wb-nav__brand::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 0.2rem;
  background: linear-gradient(135deg, var(--wb-leaf), var(--wb-forest));
  flex: 0 0 auto;
}

.wb-nav__links {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.2rem 0.35rem;
  margin-left: auto;
}

.wb-nav__spacer {
  flex: 1 1 auto;
  min-width: 1rem;
}

/* ——— Workbook hub shells ——— */
.wb-home {
  min-height: 100vh;
  margin: 0;
  padding: 0 0 2.5rem;
  background:
    radial-gradient(120% 80% at 100% -10%, #d7ebe0 0%, transparent 55%),
    radial-gradient(90% 70% at -10% 20%, #f0e6d4 0%, transparent 50%),
    linear-gradient(180deg, #eef5f0 0%, var(--wb-paper) 40%, #e7f0ea 100%);
  color: var(--wb-ink);
  font-family: var(--wb-font-body);
  font-size: 1.02rem;
  line-height: 1.6;
}

.wb-home__shell {
  width: min(64rem, calc(100% - 2rem));
  margin: 1.5rem auto 0;
}

.wb-home__shell--wide {
  width: min(52rem, calc(100% - 2rem));
}

.wb-home__hero {
  margin: 0 0 1.5rem;
  padding: clamp(2rem, 4vw, 2.75rem) clamp(1.25rem, 3vw, 2rem);
  background:
    linear-gradient(145deg, var(--wb-forest) 0%, #235c40 55%, var(--wb-leaf) 120%);
  border-radius: 1rem;
  color: var(--wb-white);
}

.wb-home__hero h1 {
  margin: 0 0 0.5rem;
  font-family: var(--wb-font-display);
  font-size: clamp(1.75rem, 3.5vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.wb-home__hero p {
  max-width: 42rem;
  margin: 0;
  color: #dceadd;
}

.wb-home__summary {
  margin: 0.85rem 0 0;
  color: #b9d0c2;
  font-size: 0.95rem;
  font-weight: 700;
}

.wb-home__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}

.wb-home__card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 100%;
  padding: 1.35rem 1.4rem 1.45rem;
  background: var(--wb-white);
  border: 1px solid var(--wb-line-soft);
  border-radius: var(--wb-radius);
}

.wb-home__card h2 {
  margin: 0;
  color: var(--wb-forest);
  font-family: var(--wb-font-display);
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.wb-home__card-meta {
  margin: 0;
  color: var(--wb-moss);
  font-size: 0.82rem;
  font-weight: 700;
}

.wb-home__card p {
  flex: 1;
  margin: 0.15rem 0 0.85rem;
  color: #3d4a42;
  font-size: 0.95rem;
}

.wb-home__card > a,
.wb-home__cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  margin-top: auto;
  padding: 0.55rem 0.95rem;
  background: var(--wb-forest);
  border-radius: 0.55rem;
  color: var(--wb-white);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 140ms ease;
}

.wb-home__card > a:hover,
.wb-home__cta:hover {
  background: var(--wb-leaf);
}

.wb-home__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wb-home__list li {
  margin: 0 0 0.65rem;
  padding: 0.75rem;
  background: var(--wb-white);
  border: 1px solid var(--wb-line-soft);
  border-radius: 0.625rem;
}

.wb-home__list a {
  display: inline-block;
  padding: 0.55rem 0.95rem;
  background: var(--wb-forest);
  border-radius: 0.55rem;
  color: var(--wb-white);
  font-weight: 700;
  text-decoration: none;
}

.wb-home__list a:hover {
  background: var(--wb-leaf);
  color: var(--wb-white);
}

/* Jump links / phase chips */
.wb-home__toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, var(--wb-white) 88%, transparent);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius);
}

.wb-home__toc a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--wb-line);
  border-radius: 0.5rem;
  background: var(--wb-sand);
  color: var(--wb-forest);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}

.wb-home__toc a:hover {
  background: var(--wb-forest);
  border-color: var(--wb-forest);
  color: var(--wb-white);
}

.wb-home__group {
  margin: 0 0 1.75rem;
}

.wb-home__group:last-child {
  margin-bottom: 0;
}

.wb-home__group-title {
  margin: 0 0 0.75rem;
  padding: 0 0.15rem;
  color: var(--wb-moss);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wb-home__phases {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.wb-home__phase {
  margin: 0;
  padding: 0;
  background: var(--wb-white);
  border: 1px solid var(--wb-line-soft);
  border-radius: var(--wb-radius);
  overflow: hidden;
}

.wb-home__phase > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.95rem 1.15rem;
  cursor: pointer;
  list-style: none;
  color: var(--wb-forest);
}

.wb-home__phase > summary::-webkit-details-marker {
  display: none;
}

.wb-home__phase > summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-right: 0.55rem;
  border: 1px solid var(--wb-line);
  border-radius: 0.35rem;
  background: var(--wb-sand);
  color: var(--wb-forest);
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}

.wb-home__phase[open] > summary::before {
  content: "–";
}

.wb-home__phase > summary:hover {
  background: var(--wb-sand);
}

.wb-home__phase-title {
  flex: 1 1 12rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.wb-home__count {
  color: var(--wb-moss);
  font-size: 0.85rem;
  font-weight: 600;
}

.wb-home__phase-body {
  padding: 0 1.15rem 1.15rem;
  border-top: 1px solid var(--wb-line-soft);
}

.wb-home__blurb {
  margin: 0.85rem 0 0.75rem;
  color: #4d5c53;
  font-size: 0.95rem;
}

.wb-home__lessons {
  margin: 0;
  padding: 0 0 0 1.25rem;
}

.wb-home__lessons li {
  margin: 0;
  padding: 0.35rem 0;
  border-bottom: 1px solid #eef2ef;
}

.wb-home__lessons li:last-child {
  border-bottom: 0;
}

.wb-home__lessons a {
  color: var(--wb-forest);
  font-weight: 600;
  text-decoration: none;
}

.wb-home__lessons a:hover {
  color: var(--wb-clay);
  text-decoration: underline;
}

.wb-home__panel {
  margin: 0 0 1.25rem;
  padding: 1.25rem 1.35rem;
  background: var(--wb-white);
  border: 1px solid var(--wb-line-soft);
  border-radius: var(--wb-radius);
}

.wb-home__panel h2 {
  margin: 0 0 0.55rem;
  color: var(--wb-forest);
  font-family: var(--wb-font-display);
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.wb-home__panel p {
  margin: 0 0 0.75rem;
  color: #3d4a42;
}

.wb-home__panel p:last-child {
  margin-bottom: 0;
}

.wb-home__chapters {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.wb-home__chapters li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--wb-sand);
  border: 1px solid var(--wb-line-soft);
  border-radius: 0.625rem;
}

.wb-home__chapters li:nth-child(even) {
  background: var(--wb-white);
}

.wb-home__chapters .label {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: var(--wb-white);
  border: 1px solid var(--wb-line);
  border-radius: 999px;
  color: var(--wb-forest);
  font-size: 0.75rem;
  font-weight: 700;
}

.wb-home__chapters a {
  color: var(--wb-forest);
  font-weight: 700;
  text-decoration: none;
}

.wb-home__chapters a:hover {
  color: var(--wb-clay);
  text-decoration: underline;
}

.wb-home__footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--wb-line);
  color: var(--wb-moss);
  font-size: 0.95rem;
  text-align: center;
}

.wb-home__footer a {
  color: var(--wb-forest);
  font-weight: 700;
  text-decoration: none;
}

.wb-home__footer a:hover {
  color: var(--wb-clay);
  text-decoration: underline;
}

@media (max-width: 40rem) {
  .wb-nav {
    gap: 0.25rem 0.4rem;
    padding: 0.5rem 0.75rem;
  }

  .wb-nav > a:first-of-type,
  .wb-nav__brand {
    font-size: 0.95rem;
  }

  .wb-home__shell,
  .wb-home__shell--wide {
    width: calc(100% - 1.25rem);
    margin-top: 1rem;
  }

  .wb-home__hero {
    padding: 1.75rem 1.25rem;
  }
}
