@import url("https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap");

/* ---------- tokens: light, warm, same teal brand ---------- */
:root {
  --paper: #ffffff;
  --paper-2: #f5f3ee;
  --ink: #111414;
  --ink-2: #4d5454;
  --ink-3: #7a8080;
  --line: #e8e5de;
  --teal: #1d7581;
  --teal-deep: #165e68;
  --teal-bright: #2a9aa7;
  --teal-glow: rgba(42, 154, 167, 0.22);
  --coral: #ff6a4d;
  --gold: #e3b866;
  --gold-ink: #9a6b1c;
  --sans: "Inter Tight", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --radius: 24px;
  --lift: 0 30px 60px -34px rgba(17, 20, 20, 0.28);
  --cc-w: 420px;
}

body { font-family: var(--sans); letter-spacing: -0.005em; -webkit-font-smoothing: antialiased; background: var(--paper); }
h1, h2, h3 { letter-spacing: -0.025em; }

/* ---------- header: white glass ---------- */
.site-header {
  background: rgba(255, 255, 255, 0.78) !important;
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line) !important;
}
.site-header .brand { color: var(--ink) !important; font-weight: 600; }
.site-header .brand::after {
  content: "PRO";
  margin-left: 10px; padding: 3px 8px 2px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em;
  color: #3a2706; background: linear-gradient(135deg, #f6e2b4, var(--gold) 55%, #cf9f4f);
  box-shadow: 0 4px 14px -4px rgba(207, 159, 79, 0.55);
}
.site-header .nav a { color: var(--ink-2) !important; transition: color 0.2s; }
.site-header .nav a:hover { color: var(--ink) !important; }
.site-header .cta-pill { background: #fff !important; color: var(--ink) !important; border: 1px solid var(--line) !important; }
.site-header .cta-pill:hover { border-color: var(--teal-bright) !important; box-shadow: 0 0 0 4px var(--teal-glow); }

/* ---------- home hero: warm paper with a soft aurora ---------- */
.home .page-hero--home {
  position: relative; isolation: isolate;
  width: auto !important; max-width: none !important; margin: 0 !important;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr) !important; gap: 56px !important;
  padding: 88px max(40px, calc((100% - 1320px) / 2)) 96px !important;
  background: var(--paper); color: var(--ink);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.home .page-hero--home::before {
  content: ""; position: absolute; inset: -30%; z-index: -2;
  background:
    radial-gradient(38% 48% at 16% 28%, rgba(42, 154, 167, 0.22), transparent 70%),
    radial-gradient(34% 44% at 84% 18%, rgba(255, 106, 77, 0.14), transparent 70%),
    radial-gradient(44% 50% at 62% 92%, rgba(227, 184, 102, 0.22), transparent 70%);
  filter: blur(24px);
  animation: aurora 22s ease-in-out infinite alternate;
}
.home .page-hero--home::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.05; pointer-events: none; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  100% { transform: translate3d(4%, -3%, 0) rotate(8deg) scale(1.08); }
}
.home .page-hero--home .eyebrow-line { color: var(--gold-ink) !important; letter-spacing: 0.16em; }
.home .page-hero--home h1 { color: var(--ink); font-weight: 600; font-size: clamp(40px, 4.1vw, 66px); line-height: 1.03; text-wrap: balance; }
.home .page-hero--home h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--teal); letter-spacing: -0.01em; }
.home .page-hero--home .sub { color: var(--ink-2) !important; font-size: 19px; line-height: 1.55; }
.home .page-hero--home .facts { gap: 8px !important; }
.home .page-hero--home .facts li {
  color: var(--ink-2) !important; border: 1px solid var(--line) !important; border-radius: 999px; padding: 6px 13px !important;
  background: rgba(255, 255, 255, 0.72); backdrop-filter: blur(6px); font-size: 14px;
}
.home .page-hero--home .facts li::before { display: none !important; }
.home .page-hero--home .facts b { color: var(--ink); }
.home .page-hero--home .pill {
  background: linear-gradient(135deg, var(--teal-bright), var(--teal-deep)) !important; color: #fff !important; border: 0 !important;
  box-shadow: 0 12px 28px -12px rgba(29, 117, 129, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.home .page-hero--home .pill--ghost { background: #fff !important; color: var(--ink) !important; border: 1px solid var(--line) !important; box-shadow: 0 6px 18px -12px rgba(17, 20, 20, 0.25); }
.home .page-hero--home .card-label, .home .page-hero--home .video-note { color: var(--ink-3) !important; }
.home .hero-video .player {
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(17, 20, 20, 0.06), 0 40px 80px -36px rgba(17, 20, 20, 0.35), 0 0 70px -20px var(--teal-glow);
}

/* ---------- module doors: elevated, gradient edge on hover ---------- */
.doors .door {
  position: relative; border: 1px solid var(--line) !important; overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}
.doors .door .num { font-family: var(--serif); font-size: 56px; line-height: 1; color: var(--teal); font-weight: 400; }
.doors .door:hover { transform: translateY(-4px); box-shadow: var(--lift); border-color: transparent !important; }
.doors .door::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; opacity: 0; transition: opacity 0.35s;
  background: linear-gradient(135deg, var(--teal-bright), var(--gold), var(--coral));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.doors .door:hover::before { opacity: 1; }

/* module thumbnails (added by companion.js): the module's drawing above its number */
.doors .door .door-art {
  display: flex; align-items: flex-end; justify-content: center; height: 168px; margin: -8px -8px 2px;
}
.doors .door .door-art img {
  height: 100%; width: auto; max-width: 100%; object-fit: contain;
  transition: transform 0.6s var(--ease); transform-origin: 50% 90%;
}
.doors .door:has(.door-art) .num { font-size: 40px; }
.doors .door:hover .door-art img { transform: scale(1.05) translateY(-2px); }
.doors .door--off .door-art img, .doors .door:has(.soon) .door-art img { filter: saturate(0.55); opacity: 0.8; }
@media (max-width: 720px) { .doors .door .door-art { height: 150px; } }

/* align the cards in each row: drawing, number, title, description and link sit on shared lines */
@supports (grid-template-rows: subgrid) {
  .doors .door:has(.door-art) { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 8px; align-content: start; }
  .doors .door:has(.door-art) .num { align-self: end; }
  .doors .door:has(.door-art) .go { align-self: end; }
}
/* nine cards fill three columns; at two columns the last card spans the row, drawing beside the text */
@media (min-width: 720px) and (max-width: 1099px) {
  .doors .door:last-child:nth-child(odd) {
    grid-column: 1 / -1; grid-row: span 1; grid-template-rows: none;
    grid-template-columns: minmax(240px, 38%) 1fr; grid-template-areas: "art num" "art t" "art d" "art go";
    column-gap: 32px; row-gap: 8px; align-content: center;
  }
  .doors .door:last-child:nth-child(odd) .door-art { grid-area: art; height: 190px; margin: 0; align-self: center; }
  .doors .door:last-child:nth-child(odd) .num { grid-area: num; align-self: end; }
  .doors .door:last-child:nth-child(odd) .t { grid-area: t; }
  .doors .door:last-child:nth-child(odd) .d { grid-area: d; }
  .doors .door:last-child:nth-child(odd) .go { grid-area: go; align-self: start; }
}
.doors .door .num--word { font-style: italic; }

/* the Foundation page (/foundation/): the checklist groups sit in the main column */
.rn-foundation-page .fd-group { position: static; top: auto; max-height: none; margin: 0 0 20px; }
.rn-foundation-page .fd-group .check__head { padding-bottom: 4px; }
.rn-foundation-page .fd-group h2 { font-size: 1.25rem; }
.rn-foundation-page .page-hero { margin-bottom: 8px; }
.rn-foundation-page .fd-done { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: rgba(42, 154, 167, 0.1); }
.rn-foundation-page .pagenav { margin-top: 28px; }

/* course structure (structure.js): hold the page until it's renumbered, never longer than 2.5s */
html:not(.rn-ready) main, html:not(.rn-ready) .site-footer { opacity: 0; animation: rn-show 0s 2.5s forwards; }
main, .site-footer { transition: opacity 0.2s; }
@keyframes rn-show { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .doors .door .door-art img { transition: none; } .doors .door:hover .door-art img { transform: none; } }

/* ---------- course repo section (added by companion.js) ---------- */
.cr-sec { margin-top: 24px; }
.cr-sec h2 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--teal); }
.cr-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
@media (max-width: 1100px) { .cr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cr-card {
  display: block; padding: 20px 20px 18px; border-radius: 18px; background: #fff; color: var(--ink);
  border: 1px solid var(--line); text-decoration: none; position: relative; overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.cr-card::after {
  content: ""; position: absolute; width: 180px; height: 180px; right: -70px; top: -70px; border-radius: 50%;
  background: radial-gradient(circle, var(--teal-glow), transparent 70%); transition: transform 0.4s var(--ease);
}
.cr-card:nth-child(2)::after { background: radial-gradient(circle, rgba(227, 184, 102, 0.3), transparent 70%); }
.cr-card:nth-child(3)::after { background: radial-gradient(circle, rgba(255, 106, 77, 0.18), transparent 70%); }
.cr-card:hover { transform: translateY(-3px); box-shadow: var(--lift); }
.cr-card:hover::after { transform: scale(1.4); }
.cr-card b { display: block; font-size: 34px; font-weight: 600; letter-spacing: -0.03em; }
.cr-card span { display: block; color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.cr-card i { display: block; font-style: normal; color: var(--teal); font-size: 13px; margin-top: 14px; font-weight: 500; }

/* ---------- topic pages ---------- */
.topic-head h1 { font-weight: 600; }
.doc__index .idx__link.is-active { background: linear-gradient(135deg, var(--teal-bright), var(--teal-deep)) !important; color: #fff !important; }
.doc__index .idx__link.is-active .idx__num { color: rgba(255, 255, 255, 0.75) !important; }
.video-block .player { border-radius: 20px; overflow: hidden; box-shadow: var(--lift); }

.repo-card {
  margin: 22px 0 8px; padding: 18px 20px; border-radius: 18px;
  background: linear-gradient(180deg, #fff, #f7faf9); border: 1px solid var(--line);
  overflow: hidden; min-width: 0;
}
.repo-card__label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal); margin: 0 0 10px; }
.repo-card__label svg { width: 16px; height: 16px; }
.repo-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.repo-card a { display: block; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: inherit; transition: background 0.2s; }
.repo-card a:hover { background: #eef4f3; }
.repo-card a b { display: block; font-weight: 600; font-size: 15px; line-height: 1.35; }
.repo-card a code { display: block; margin-top: 3px; font-size: 12px; color: var(--ink-3); background: none; padding: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repo-card button { margin-top: 10px; border: 0; background: none; color: var(--teal); font: 600 14px var(--sans); cursor: pointer; padding: 4px 12px; }

/* make room for the docked chat on wide screens */
@media (min-width: 1280px) {
  body.cc-open { padding-right: var(--cc-w); transition: padding-right 0.45s var(--ease); }
  body.cc-open .site-header { right: var(--cc-w); }
  body.cc-open .doc--aside { grid-template-columns: 200px minmax(0, 1fr) 340px; gap: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .home .page-hero--home::before { animation: none; }
}

/* the way back to the welcome video, under the hero buttons */
.wl-again {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 4px 0; border: 0; background: none;
  font: 500 15px var(--sans); color: var(--ink-2); cursor: pointer;
}
.wl-again i { font-style: normal; color: var(--ink-3); }
.wl-again:hover { color: var(--teal); }
.wl-again__play { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 1px solid var(--line); position: relative; box-shadow: 0 4px 12px -6px rgba(17, 20, 20, 0.3); }
.wl-again__play::after { content: ""; position: absolute; left: 11px; top: 8px; border-left: 9px solid var(--coral); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }

/* ---------- the welcome video: its own screen on the first visit ---------- */
html.wl-lock { overflow: hidden; }
.wl {
  position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: minmax(0, 1040px); justify-content: center; align-content: center;
  padding: 24px 16px; overflow-y: auto;
  background: radial-gradient(1200px 600px at 15% 0%, rgba(42, 154, 167, 0.16), transparent 60%),
              radial-gradient(900px 500px at 90% 100%, rgba(227, 184, 102, 0.18), transparent 60%),
              rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  animation: wl-in 0.35s var(--ease, ease) both;
}
.wl.is-leaving { animation: wl-out 0.28s ease both; }
.wl__card { position: relative; width: 100%; max-width: 1040px; min-width: 0; }
.wl__kick { margin: 0 56px 16px 0; min-height: 40px; display: flex; align-items: center; font-size: 12.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-ink); }
.wl__player { border-radius: 20px; overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px rgba(17, 20, 20, 0.06), 0 40px 80px -36px rgba(17, 20, 20, 0.4), 0 0 80px -20px var(--teal-glow); }
.wl__player video { display: block; width: 100%; height: auto; max-height: 74vh; }
.wl__player { position: relative; }
.wl__play {
  position: absolute; left: 50%; top: 50%; width: 104px; height: 104px; margin: -52px 0 0 -52px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.94); cursor: pointer;
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.35), 0 24px 48px -16px rgba(17, 20, 20, 0.45);
  transition: transform 0.2s, box-shadow 0.2s; animation: wl-pulse 2.4s ease-in-out infinite;
}
.wl__play::after { content: ""; position: absolute; left: 41px; top: 32px; border-left: 34px solid var(--coral); border-top: 20px solid transparent; border-bottom: 20px solid transparent; }
.wl__play:hover, .wl__play:focus-visible { transform: scale(1.06); outline: none; box-shadow: 0 0 0 10px rgba(42, 154, 167, 0.35), 0 24px 48px -16px rgba(17, 20, 20, 0.45); }
.wl__play[hidden] { display: none; }
@keyframes wl-pulse { 50% { box-shadow: 0 0 0 18px rgba(255, 255, 255, 0.18), 0 24px 48px -16px rgba(17, 20, 20, 0.45); } }
@media (max-width: 640px) { .wl__play { width: 56px; height: 56px; margin: -28px 0 0 -28px; box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.35), 0 14px 28px -12px rgba(17, 20, 20, 0.45); animation: none; } .wl__play::after { left: 22px; top: 17px; border-left-width: 18px; border-top-width: 11px; border-bottom-width: 11px; } }
@media (prefers-reduced-motion: reduce) { .wl__play { animation: none; } }
.wl__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.wl__note { font-size: 14px; color: var(--ink-3); }
.wl__go { border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 15px var(--sans); padding: 12px 22px; border-radius: 999px; cursor: pointer; transition: box-shadow 0.2s, border-color 0.2s; }
.wl__go:hover, .wl__go:focus-visible { border-color: var(--teal-bright); box-shadow: 0 0 0 4px var(--teal-glow); outline: none; }
.wl__go.is-done { color: #fff; border: 0; background: linear-gradient(135deg, var(--teal-bright), var(--teal-deep)); box-shadow: 0 12px 28px -12px rgba(29, 117, 129, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.wl__x { position: absolute; top: 0; right: 0; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 15px; cursor: pointer; }
.wl__x:hover, .wl__x:focus-visible { color: var(--ink); border-color: var(--teal-bright); outline: none; }
@keyframes wl-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes wl-out { to { opacity: 0; } }
@media (max-width: 640px) { .wl { align-content: start; } .wl__x { position: static; float: right; margin: 0 0 8px 8px; } }
@media (prefers-reduced-motion: reduce) { .wl, .wl.is-leaving { animation: none; } }

/* modules that aren't open yet (tools/lock_modules.py, proof/access.json): links muted with a "soon" badge; the lock page */
.doc__index a.idx__link[data-rn-locked] { color: var(--ink-3, #7b8282) !important; }
.doc__index a.idx__link[data-rn-locked]::after,
.prose a[data-rn-locked]::after {
  content: "soon"; display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; vertical-align: 1px;
  color: var(--gold-ink); background: rgba(227, 184, 102, 0.18); text-decoration: none;
}
.doors .door[data-rn-locked] .door-art img { filter: saturate(0.55); opacity: 0.8; }
.doors .door[data-rn-locked] .go { color: var(--gold-ink) !important; }
.doors .door[data-rn-locked] .go::before { content: "\1F512\FE0E  "; }
.rn-locked-page .page-hero { min-height: 52vh; align-items: center; }
.rn-locked-page .hero-art { filter: saturate(0.7); }
.rn-locked-page .lk-badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 14px; padding: 5px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: #3a2706; background: linear-gradient(135deg, #f6e2b4, var(--gold) 55%, #cf9f4f);
}
.rn-locked-page .lk-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
