:root {
  --red: #e31b2f;
  --red-dark: #a81020;
  --ink: #111318;
  --muted: #66707d;
  --line: #dfe2e6;
  --paper: #f6f6f4;
  --white: #fff;
  --header-height: 78px;
  --container: 1120px;
  --page-gutter: clamp(20px, 5vw, 88px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Manrope", Arial, sans-serif; line-height: 1.65; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 8px 12px; color: white; background: var(--red); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

.site-header { position: absolute; z-index: 20; top: 0; left: 0; right: 0; min-height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 14px var(--page-gutter); color: var(--white); background: linear-gradient(180deg, rgba(7,9,13,.9), rgba(7,9,13,.1)); }
.solid-header { position: relative; background: #0b0e13; }
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 4px; color: rgba(255,255,255,.65); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.main-nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 34px); font-size: 13px; font-weight: 700; }
.main-nav a { color: rgba(255,255,255,.78); }
.main-nav a:hover { color: white; }
.menu-toggle { display: none; padding: 8px; border: 0; color: white; background: transparent; cursor: pointer; }
.menu-toggle > span:not(.sr-only) { display: block; width: 23px; height: 2px; margin: 5px 0; background: currentColor; }

.hero { position: relative; isolation: isolate; min-height: 680px; display: flex; align-items: center; overflow: hidden; color: white; background: #070a0e; }
.hero::before { position: absolute; z-index: -2; inset: -80px 0 0 23%; content: ""; background: url("assets/images/4dweb-home-hero.jpg") 40% 55%/cover no-repeat; mask-image: linear-gradient(90deg, transparent, #000 15%); }
.hero::after { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(90deg, #070a0e 0%, rgba(7,10,14,.94) 26%, rgba(7,10,14,.33) 53%, rgba(7,10,14,.05) 100%), linear-gradient(180deg, rgba(7,10,14,.25), transparent 45%, rgba(7,10,14,.48)); }
.hero-copy { width: min(610px, calc(100% - 40px)); margin: 0 0 0 var(--page-gutter); padding: calc(var(--header-height) + 70px) 0 85px; }
.eyebrow { margin-bottom: 13px; color: var(--red); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow.light { color: #ff6675; }
.hero h1 { max-width: 610px; margin-bottom: 24px; font-size: clamp(52px, 5.4vw, 82px); line-height: .94; font-weight: 800; letter-spacing: -.045em; text-transform: uppercase; }
.hero-lede { max-width: 485px; margin-bottom: 0; color: rgba(255,255,255,.82); font-size: clamp(18px, 2vw, 23px); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.button { display: inline-flex; min-height: 45px; align-items: center; justify-content: center; padding: 0 18px; border: 1px solid transparent; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.button-primary { color: white; background: var(--red); }
.button-primary:hover { background: var(--red-dark); }
.button-ghost { border-color: rgba(255,255,255,.55); color: white; }
.button-ghost:hover { background: rgba(255,255,255,.1); }
.button-secondary { border-color: var(--ink); background: transparent; }
.button-secondary:hover { color: white; background: var(--ink); }
.text-link { font-size: 12px; font-weight: 800; }
.section-shell { width: min(var(--container), calc(100% - var(--page-gutter) - var(--page-gutter))); margin-left: var(--page-gutter); margin-right: 0; }
.library { padding-top: 90px; padding-bottom: 110px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 60px; margin-bottom: 38px; }
.section-heading h2, .closing h2 { margin: 0; font-size: clamp(36px, 5vw, 62px); line-height: 1; letter-spacing: -.04em; text-transform: uppercase; }
.section-heading > p { max-width: 470px; margin: 0; color: var(--muted); }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; padding: 11px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 4px; }
.filter { min-height: 36px; padding: 0 13px; border: 0; color: var(--muted); background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.filter.active { color: white; background: var(--ink); }
.search-label input { width: min(230px, 35vw); min-height: 38px; padding: 0 10px; border: 1px solid var(--line); background: white; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.project-card { min-height: 285px; display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); background: white; transition: border-color 160ms ease; }
.project-card:hover { border-color: var(--red); }
.project-card:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.card-top { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 26px; }
.card-index { color: var(--red); font-size: 11px; font-weight: 800; }
.status { padding: 5px 7px; border: 1px solid #47936f; color: #27734f; font-size: 9px; line-height: 1; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.status.coming { border-color: #aeb4bc; color: var(--muted); }
.card-kicker { margin: auto 0 8px; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.card-title { margin-bottom: 12px; font-size: clamp(24px, 2.4vw, 32px); line-height: 1; letter-spacing: -.035em; text-transform: uppercase; }
.card-description { max-width: 520px; margin-bottom: 20px; color: var(--muted); font-size: 13px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 21px; }
.card-meta span { padding: 4px 7px; border: 1px solid var(--line); color: #515964; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.card-link { align-self: flex-start; color: var(--red); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.card-graphic { display: none; }
.empty-state { padding: 50px; color: var(--muted); text-align: center; }
.method { padding: 90px 0; color: white; background: #11151b; }
.method-inner { display: grid; grid-template-columns: .8fr 1.2fr; gap: 80px; }
.method-intro h2 { margin: 0; font-size: clamp(36px, 5vw, 60px); line-height: 1; letter-spacing: -.04em; text-transform: uppercase; }
.method-steps { margin: 0; padding: 0; list-style: none; border-top: 1px solid rgba(255,255,255,.3); }
.method-steps li { display: grid; grid-template-columns: 55px 1fr; gap: 14px; padding: 20px 0; border-bottom: 1px solid rgba(255,255,255,.15); }
.method-steps li > span { color: var(--red); font-size: 10px; font-weight: 800; }
.method-steps h3 { margin-bottom: 3px; font-size: 16px; text-transform: uppercase; }
.method-steps p { margin: 0; color: rgba(255,255,255,.62); font-size: 13px; }
.closing { padding-top: 95px; padding-bottom: 100px; }
.closing h2 { max-width: 780px; margin-bottom: 30px; }

.site-footer { display: grid; grid-template-columns: 1.3fr .7fr auto; align-items: center; gap: 35px; padding: 38px var(--page-gutter); color: rgba(255,255,255,.62); background: #090b0e; font-size: 11px; }
.site-footer strong, .site-footer span { display: block; }
.site-footer strong { color: white; }
.footer-brand { display: flex; align-items: center; gap: 11px; }
.footer-brand img { width: 42px; height: 42px; object-fit: contain; }
.footer-links { display: flex; gap: 18px; }
.site-footer.compact { grid-template-columns: 1fr auto; }

.guide-hero { padding: 82px 0 62px; color: white; background: linear-gradient(135deg, #111720, #07090d); }
.guide-hero-inner { width: min(var(--container), calc(100% - 40px)); margin: auto; }
.guide-crumb { display: inline-block; margin-bottom: 45px; color: rgba(255,255,255,.65); font-size: 12px; }
.guide-hero-grid { display: grid; grid-template-columns: 1fr 330px; align-items: end; gap: 60px; }
.guide-hero h1 { max-width: 780px; margin: 0; font-size: clamp(44px, 7vw, 80px); line-height: .95; letter-spacing: -.045em; text-transform: uppercase; }
.guide-tagline { max-width: 690px; margin: 22px 0 0; color: rgba(255,255,255,.78); font-size: 17px; }
.guide-facts { margin: 0; border-top: 1px solid rgba(255,255,255,.3); }
.guide-facts div { display: grid; grid-template-columns: 95px 1fr; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.17); }
.guide-facts dt { color: rgba(255,255,255,.48); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.guide-facts dd { margin: 0; font-size: 11px; font-weight: 700; }
.guide-layout { width: min(1000px, calc(100% - 40px)); display: grid; grid-template-columns: 200px 1fr; gap: 65px; margin: auto; padding: 65px 0 100px; }
.guide-toc { position: sticky; top: 20px; align-self: start; }
.guide-toc p { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.guide-toc a { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; }
.guide-toc a:hover { color: var(--red); }
.guide-section { margin-bottom: 52px; padding-bottom: 52px; border-bottom: 1px solid var(--line); }
.guide-section:last-child { border-bottom: 0; }
.section-number { color: var(--red); font-size: 9px; font-weight: 800; }
.guide-section h2 { margin: 9px 0 18px; font-size: clamp(28px, 4vw, 40px); line-height: 1; text-transform: uppercase; }
.guide-section p, .guide-section li { color: #414852; }
.guide-section ul, .guide-section ol { padding-left: 21px; }
.guide-section li { margin-bottom: 8px; }
.note { margin-top: 24px; padding: 17px 19px; border: 1px solid var(--line); background: #ecece8; font-size: 12px; }
.experiments-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.experiments-head h2 { margin: 5px 0 0; font-size: 36px; text-transform: uppercase; }
.experiment-list { border-top: 1px solid var(--ink); }
.experiment-row { min-height: 77px; display: grid; grid-template-columns: 45px 1fr 95px 20px; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); }
.experiment-row:hover { background: white; }
.experiment-row .num { color: var(--red); font-size: 10px; font-weight: 800; }
.experiment-row strong { display: block; font-size: 13px; text-transform: uppercase; }
.experiment-row small { color: var(--muted); font-size: 11px; }
.experiment-row .level { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.coming-panel { width: min(760px, calc(100% - 40px)); margin: auto; padding: 110px 0 130px; text-align: center; }
.coming-code { display: block; color: var(--red); font-size: 58px; font-weight: 800; }
.coming-panel h1 { font-size: clamp(40px, 7vw, 70px); line-height: .95; text-transform: uppercase; }
.coming-panel p { max-width: 550px; margin: 0 auto 25px; color: var(--muted); }

.lesson-hero { padding: 65px 0 50px; color: white; background: #10141a; }
.lesson-hero-inner, .lesson-layout { width: min(1000px, calc(100% - 40px)); margin: auto; }
.lesson-breadcrumb { display: inline-block; margin-bottom: 30px; color: rgba(255,255,255,.62); font-size: 11px; }
.lesson-no { display: block; color: var(--red); font-size: 10px; font-weight: 800; }
.lesson-hero h1 { max-width: 800px; margin: 8px 0 17px; font-size: clamp(38px, 6vw, 65px); line-height: 1; letter-spacing: -.04em; text-transform: uppercase; }
.lesson-summary { max-width: 700px; margin: 0; color: rgba(255,255,255,.72); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 23px; }
.lesson-meta span { padding: 5px 8px; border: 1px solid rgba(255,255,255,.28); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.lesson-layout { display: grid; grid-template-columns: 1fr 260px; gap: 60px; padding: 65px 0 95px; }
.lesson-block { margin-bottom: 50px; }
.lesson-block h2 { padding-bottom: 10px; border-bottom: 1px solid var(--ink); font-size: 21px; text-transform: uppercase; }
.lesson-block li { margin-bottom: 7px; }
.code-wrap { position: relative; }
.code-wrap pre { overflow-x: auto; margin: 0; padding: 22px; color: #e6e8eb; background: #15191f; font: 12px/1.65 ui-monospace, Consolas, monospace; }
.copy-code { position: absolute; top: 9px; right: 9px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.3); color: white; background: #242a33; font-size: 9px; font-weight: 800; cursor: pointer; text-transform: uppercase; }
.safety-note { padding: 17px; border: 1px solid #d4b04b; background: #fff4d2; font-size: 12px; }
.lesson-card { margin-bottom: 17px; padding: 20px; border: 1px solid var(--line); background: white; }
.lesson-card h2 { font-size: 11px; text-transform: uppercase; }
.lesson-card ul { margin: 0; padding-left: 17px; color: var(--muted); font-size: 11px; }
.lesson-card .button { width: 100%; }
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 48px; }
.lesson-nav a { min-height: 65px; padding: 13px; border: 1px solid var(--line); background: white; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.lesson-nav a:last-child { text-align: right; }
.not-found { min-height: 60vh; display: grid; place-items: center; padding: 50px 20px; text-align: center; }

@media (max-width: 850px) {
  .hero::before { inset: -80px 0 0 28%; }
  .hero::after { background: linear-gradient(90deg, #070a0e 0%, rgba(7,10,14,.9) 50%, rgba(7,10,14,.28) 100%), linear-gradient(180deg, rgba(7,10,14,.25), transparent 45%, rgba(7,10,14,.48)); }
  .section-heading, .guide-hero-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-inner { grid-template-columns: 1fr; gap: 45px; }
  .guide-layout { grid-template-columns: 1fr; }
  .guide-toc { position: static; }
  .guide-toc nav { display: flex; flex-wrap: wrap; gap: 7px; }
  .guide-toc a { padding: 6px 9px; border: 1px solid var(--line); }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-side { grid-row: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
}

@media (max-width: 640px) {
  :root { --header-height: 70px; }
  .menu-toggle { display: block; }
  .main-nav { position: absolute; top: var(--header-height); left: 0; right: 0; display: none; align-items: stretch; flex-direction: column; gap: 0; padding: 10px 20px 18px; background: #0b0e13; }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 11px 0; }
  .hero { min-height: 630px; }
  .hero::before { inset: -55px 0 0; background-position: 16% center; mask-image: none; }
  .hero::after { background: linear-gradient(90deg, rgba(7,10,14,.95), rgba(7,10,14,.72) 65%, rgba(7,10,14,.28)), linear-gradient(0deg, rgba(7,10,14,.7), transparent 55%); }
  .hero-copy { padding-top: calc(var(--header-height) + 65px); }
  .section-heading { align-items: start; flex-direction: column; gap: 18px; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .search-label input { width: 100%; }
  .project-card { min-height: 310px; padding: 24px; }
  .project-grid { grid-template-columns: 1fr; }
  .card-top { margin-bottom: 42px; }
  .site-footer, .site-footer.compact { grid-template-columns: 1fr; }
  .experiment-row { grid-template-columns: 35px 1fr 18px; gap: 8px; }
  .experiment-row .level { display: none; }
  .lesson-side { grid-template-columns: 1fr; }
  .lesson-nav { grid-template-columns: 1fr; }
  .lesson-nav a:last-child { text-align: left; }
}

@media print {
  .site-header, .site-footer, .lesson-nav, .copy-code, .lesson-card:last-child { display: none !important; }
  body { background: white; }
  .lesson-hero { padding: 25px 0; color: black; background: white; border-bottom: 2px solid black; }
  .lesson-hero * { color: black !important; }
  .lesson-layout { display: block; padding-top: 30px; }
  .code-wrap pre { white-space: pre-wrap; color: black; background: #eee; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
