:root {
  --red: #e00122;
  --ink: #090909;
  --paper: #f7f3ed;
  --white: #ffffff;
  --clay: #a3492f;
  --sage: #53685a;
  --gold: #b68b3d;
  --muted: #5d5750;
  --line: rgba(9, 9, 9, 0.15);
  --line-dark: rgba(9, 9, 9, 0.35);
  --page-pad: clamp(20px, 5vw, 76px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
}

body.preview-open {
  overflow: hidden;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-170%);
  padding: 10px 14px;
  color: var(--white);
  background: var(--ink);
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

.public-admin-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px var(--page-pad);
  background: var(--ink);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

.public-admin-bar[hidden] {
  display: none;
}

.public-admin-bar a {
  color: var(--white);
  text-decoration: none;
}

.public-admin-bar a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 1px 0 var(--line);
}

.donate-strip {
  display: flex;
  justify-content: flex-end;
  padding: 8px var(--page-pad);
  background: var(--ink);
  color: var(--white);
}

.donate-strip a {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(24px, 5vw, 74px);
  align-items: center;
  padding: 18px var(--page-pad);
}

.brand img {
  width: min(280px, 42vw);
  height: auto;
}

.primary-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: clamp(14px, 2.4vw, 32px);
}

.primary-nav a,
.nav-dropdown-trigger {
  position: relative;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.nav-dropdown-item {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-dropdown-trigger::after {
  content: "";
  width: 0;
  height: 0;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  z-index: 25;
  min-width: 210px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: 0 18px 42px rgba(9, 9, 9, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.nav-dropdown-menu::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 16px;
}

.nav-dropdown-menu a {
  display: block;
  padding: 13px 14px;
  color: var(--ink);
  white-space: nowrap;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus {
  background: var(--paper);
}

.nav-dropdown-item:hover .nav-dropdown-menu,
.nav-dropdown-item:focus-within .nav-dropdown-menu {
  transform: translateX(-50%) translateY(2px);
  opacity: 1;
  pointer-events: auto;
}

.admin-logged-in .site-header {
  top: 38px;
}

.admin-auth-link {
  border-left: 1px solid var(--line);
  padding-left: 24px;
}

.intro,
.overview,
.materials-strip,
.lesson-section {
  padding-right: var(--page-pad);
  padding-left: var(--page-pad);
}

.materials-strip,
.lesson-section {
  scroll-margin-top: 150px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: clamp(30px, 5vw, 70px);
  align-items: center;
  min-height: clamp(500px, calc(100vh - 175px), 640px);
  padding-top: clamp(24px, 4vw, 48px);
  padding-bottom: clamp(24px, 4vw, 48px);
  background:
    linear-gradient(90deg, rgba(9, 9, 9, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(9, 9, 9, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px, 42px 42px, auto;
  border-bottom: 1px solid var(--line);
}

.intro-copy {
  max-width: 820px;
}

.eyebrow,
.lesson-type {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 900px;
  margin-bottom: 20px;
  font-size: clamp(48px, 8vw, 98px);
  line-height: 0.88;
  letter-spacing: 0;
}

.lede {
  max-width: 710px;
  margin-bottom: 28px;
  color: #25211d;
  font-size: clamp(19px, 2vw, 26px);
  line-height: 1.28;
}

.hero-actions,
.resource-links,
.material-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.resource-links a,
.material-list a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
}

.button.primary {
  color: var(--white);
  background: var(--red);
  border-color: var(--red);
}

.button.secondary,
.resource-links a,
.material-list a {
  background: var(--white);
}

.cover-preview {
  max-width: 340px;
  margin: 0;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 12px 12px 0 var(--ink);
}

.cover-preview img {
  width: 100%;
  aspect-ratio: 0.77;
  object-fit: cover;
  object-position: top;
  border-radius: 8px 8px 0 0;
}

.cover-preview figcaption {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.overview {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(26px, 5vw, 80px);
  padding-top: 54px;
  padding-bottom: 58px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.overview h2,
.section-heading h2 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-dark);
  border: 1px solid var(--line-dark);
}

.skill-grid div {
  min-height: 190px;
  padding: 20px;
  background: var(--paper);
}

.skill-grid strong,
.skill-grid span {
  display: block;
}

.skill-grid strong {
  margin-bottom: 18px;
  font-size: 18px;
}

.skill-grid span {
  color: var(--muted);
  line-height: 1.45;
}

.materials-strip,
.lesson-section {
  padding-top: 64px;
  padding-bottom: 72px;
}

.materials-strip {
  padding-top: clamp(28px, 4vw, 48px);
  padding-bottom: clamp(34px, 5vw, 64px);
  background: #fff9f0;
  border-bottom: 1px solid var(--line);
}

.guide-tabs {
  display: grid;
  grid-template-columns: minmax(180px, 0.28fr) minmax(0, 0.72fr);
  gap: clamp(18px, 4vw, 40px);
  align-items: stretch;
}

.guide-tabs input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.tab-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.tab-list label {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
}

.tab-list label::after {
  content: "";
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.tab-panels {
  min-height: 390px;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 10px 10px 0 var(--ink);
}

.tab-panel {
  display: none;
  max-width: 880px;
}

.tab-panel h2 {
  margin-bottom: 18px;
  font-size: clamp(28px, 3.4vw, 46px);
  line-height: 1;
  letter-spacing: 0;
}

.tab-panel p,
.tab-panel .goals-list {
  color: #2d2924;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.52;
}

.tab-panel p {
  margin-bottom: 16px;
}

#tab-overview:checked ~ .tab-list label[for="tab-overview"],
#tab-goals:checked ~ .tab-list label[for="tab-goals"],
#tab-use:checked ~ .tab-list label[for="tab-use"] {
  color: var(--white);
  background: var(--ink);
}

#tab-overview:focus-visible ~ .tab-list label[for="tab-overview"],
#tab-goals:focus-visible ~ .tab-list label[for="tab-goals"],
#tab-use:focus-visible ~ .tab-list label[for="tab-use"] {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

#tab-overview:checked ~ .tab-panels #panel-overview,
#tab-goals:checked ~ .tab-panels #panel-goals,
#tab-use:checked ~ .tab-panels #panel-use {
  display: block;
}

.goals-list {
  color: #2d2924;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.52;
}

.goals-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.goals-list li {
  position: relative;
  padding-left: 18px;
}

.goals-list li::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(220px, 0.36fr) minmax(0, 0.64fr);
  gap: clamp(18px, 4vw, 56px);
  align-items: start;
  margin-bottom: 28px;
}

.lesson-section {
  background: var(--paper);
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.lesson-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 285px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
}

.lesson-number {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 22px;
  color: var(--white);
  background: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.lesson-body {
  display: flex;
  flex-direction: column;
  padding: 22px;
}

.lesson-body h3 {
  margin-bottom: 12px;
  font-size: clamp(24px, 2.7vw, 34px);
  line-height: 1.02;
  letter-spacing: 0;
}

.lesson-body p:not(.lesson-type) {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.48;
}

.resource-links {
  margin-top: auto;
}

.resource-links a {
  min-height: 38px;
  border-color: var(--line-dark);
  color: var(--ink);
  font-size: 13px;
}

.preview-resource-link {
  cursor: zoom-in;
}

.lesson-preview-overlay[hidden] {
  display: none;
}

.lesson-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.lesson-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 9, 0.72);
}

.lesson-preview-modal {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100vw - 48px));
  height: min(860px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 14px 14px 0 rgba(0, 0, 0, 0.35);
}

.preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--white);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.preview-catalogue {
  min-width: 0;
  padding: 24px;
  background: #f2ebe0;
  border-right: 1px solid var(--line-dark);
  overflow-y: auto;
}

.preview-catalogue h2 {
  margin-bottom: 18px;
  font-size: 28px;
  line-height: 1;
}

.preview-resource-list {
  display: grid;
  gap: 18px;
}

.preview-resource-group {
  display: grid;
  gap: 8px;
}

.preview-resource-group h3 {
  margin: 0 0 2px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-dark);
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: 0;
}

.preview-resource-group + .preview-resource-group {
  padding-top: 2px;
}

.preview-resource-button {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  color: var(--ink);
  background: var(--white);
  text-align: left;
  cursor: pointer;
}

.preview-resource-button span {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
}

.preview-resource-button small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.preview-resource-button.is-active {
  color: var(--white);
  background: var(--ink);
  border-color: var(--ink);
}

.preview-resource-button.is-active small {
  color: rgba(255, 255, 255, 0.72);
}

.preview-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--paper);
}

.preview-stage-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 20px 72px 18px 22px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.preview-stage-header h2 {
  margin: 0;
  font-size: clamp(22px, 2.6vw, 38px);
  line-height: 1;
}

.preview-type {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.preview-actions [hidden] {
  display: none !important;
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--paper);
}

.lesson-card:nth-child(3n + 1) .lesson-number {
  background: var(--red);
}

.lesson-card:nth-child(3n + 2) .lesson-number {
  background: var(--sage);
}

.lesson-card:nth-child(3n) .lesson-number {
  background: var(--clay);
}

@media (max-width: 920px) {
  .brand-row,
  .intro,
  .overview,
  .section-heading,
  .guide-tabs,
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .primary-nav {
    justify-content: flex-start;
  }

  .nav-dropdown-menu {
    left: 0;
    transform: none;
  }

  .nav-dropdown-item:hover .nav-dropdown-menu,
  .nav-dropdown-item:focus-within .nav-dropdown-menu {
    transform: translateY(2px);
  }

  .intro {
    min-height: 0;
  }

  .cover-preview {
    max-width: 360px;
    box-shadow: 8px 8px 0 var(--ink);
  }

  .lesson-preview-modal {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .preview-catalogue {
    max-height: 220px;
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .preview-resource-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .preview-stage-header {
    grid-template-columns: 1fr;
    padding-right: 72px;
  }

  .preview-actions {
    justify-content: flex-start;
  }

  .skill-grid {
    grid-template-columns: 1fr;
  }

  .tab-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab-list label {
    justify-content: center;
    text-align: center;
  }

  .tab-list label::after {
    display: none;
  }

}

@media (max-width: 560px) {
  .public-admin-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .site-header {
    top: 0;
  }

  .admin-auth-link {
    border-left: 0;
    padding-left: 0;
  }

  .brand img {
    width: min(238px, 78vw);
  }

  .intro {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  h1 {
    font-size: clamp(42px, 15vw, 58px);
  }

  .cover-preview {
    max-width: 210px;
    box-shadow: 6px 6px 0 var(--ink);
  }

  .cover-preview img {
    height: 180px;
    aspect-ratio: auto;
    object-fit: cover;
    object-position: top;
  }

  .cover-preview figcaption {
    display: block;
    padding: 8px 10px;
    font-size: 11px;
  }

  .materials-strip {
    padding-top: 24px;
  }

  .tab-list {
    grid-template-columns: 1fr;
  }

  .tab-panels {
    min-height: 0;
    padding: 20px;
    box-shadow: 6px 6px 0 var(--ink);
  }

  .goals-list {
    grid-template-columns: 1fr;
  }

  .lesson-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .lesson-number {
    font-size: 16px;
  }

  .lesson-body {
    padding: 18px;
  }

  .lesson-preview-overlay {
    padding: 10px;
  }

  .lesson-preview-modal {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    box-shadow: none;
  }

  .preview-catalogue {
    max-height: 260px;
    padding: 18px;
  }

  .preview-resource-list {
    grid-template-columns: 1fr;
  }

  .preview-stage-header {
    padding: 18px;
    padding-right: 68px;
  }

  .preview-close {
    top: 10px;
    right: 10px;
  }

  .button,
  .resource-links a,
  .material-list a {
    width: 100%;
  }
}
