:root {
  color-scheme: light;
  --bg: #f0f2ee;
  --surface: #f8f9f6;
  --text: #263640;
  --muted: #263640;
  --line: #d5ddd9;
  --accent: #315b70;
  --bg-deep: #dfe8ee;
  --surface-strong: #f5f8fa;
  --accent-soft: rgba(49, 93, 120, 0.11);
  --header-bg: rgba(233, 238, 242, 0.78);
  --shadow: 0 20px 60px rgba(36, 55, 68, 0.08);
  --radius: 22px;
  --max: 1280px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11181e;
  --bg-deep: #17232b;
  --surface: rgba(27, 38, 46, 0.78);
  --surface-strong: #1a252d;
  --text: #edf3f6;
  --muted: #aab8c1;
  --line: rgba(237, 243, 246, 0.14);
  --accent: #8db8d1;
  --accent-soft: rgba(141, 184, 209, 0.12);
  --header-bg: rgba(17, 24, 30, 0.82);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

/* --------------------------------------------------
   Reset / base
-------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 78% 10%,
      rgba(151, 190, 211, 0.24),
      transparent 32rem),
    linear-gradient(135deg,
      var(--bg) 0%,
      var(--bg-deep) 100%);
  line-height: 1.6;
  transition:
    background-color 220ms ease,
    color 220ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image:
    linear-gradient(to bottom,
      rgba(0, 0, 0, 0.24),
      transparent 45%);
}

a {
  color: inherit;
}

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

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-200%);
  transition: transform 160ms ease;
}

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

/* --------------------------------------------------
   Header
-------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.nav {
  width: min(calc(100% - 1.5rem), var(--max));
  min-height: 4.5rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  flex-shrink: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  padding-left: 0.5rem;
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.nav-actions a,
.theme-toggle {
  min-height: 2.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.nav-actions a:hover,
.nav-actions a:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
  border-color: var(--line);
  background: var(--accent-soft);
}

.nav-actions a:focus-visible,
.theme-toggle:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.nav-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 600px) {
  .nav {
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    padding-block: .65rem;
  }

  .nav-top {
    width: 100%;
  }

  .nav-actions {
    justify-content: space-around;
    width: 100%;
    overflow-x: auto;
    gap: 0;
    scrollbar-width: none;
    padding-bottom: .15rem;
    
  }

  .nav-actions::-webkit-scrollbar {
    display: none;
  }

  .nav-actions a {
    padding-inline: .55rem;
    font-size: .72rem;
    flex-shrink: 0;
  }
}

/* --------------------------------------------------
   Hero
-------------------------------------------------- */

.hero-shell {
  width: min(calc(100% - 2rem), var(--max));
  margin-inline: auto;
  padding-block: clamp(1rem, 11vw, 3rem) clamp(1rem, 12vw, 3rem);
}

.hero {
  min-height: min(78vh, 800px);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  align-items: center;
  gap: clamp(3rem, 8vw, 9rem);
  padding-inline: clamp(0rem, 5vw, 5rem);
  border-radius: 24px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1 {
  max-width: 850px;
  margin-bottom: 2rem;
  font-size: clamp(3rem, 7.1vw, 4.5rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
  text-wrap: balance;
  overflow-wrap: normal;
  word-break: normal;
}

.hero-lead {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.7;
}

/* --------------------------------------------------
   Venn diagram
-------------------------------------------------- */

.diagram-wrap {
  display: grid;
  justify-items: center;
  gap: 1.5rem;
}

.venn {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1;
}

.circle {
  position: absolute;
  top: 14%;
  width: 62%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: clamp(0.8rem, 1.3vw, 1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.circle-system {
  left: 0;
  background: rgba(43, 152, 211, 0.14);
}

.circle-environment {
  right: 0;
  background: rgba(156, 214, 70, 0.12);
}

.circle-system span {
  position: absolute;
  left: 25%;
}

.circle-environment span {
  position: absolute;
  right: 15%;
}

.intersection {
  position: absolute;
  z-index: 2;
  top: 45%;
  left: 50%;
  width: 25%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
}

:root[data-theme="light"] .intersection {
  color: #4480a3;
}

:root[data-theme="dark"] .intersection {
  color: #94cce7;
}

.diagram-caption {
  width: 100%;
  max-width: 260px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* --------------------------------------------------
   Scrolling word bar
-------------------------------------------------- */

.word-bar {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 1.1rem 0;
  border-top: 1px solid rgba(237, 243, 246, .12);
  border-bottom: 1px solid rgba(237, 243, 246, .12);
  background: #263f4d;
  color: #edf3f6;
}

.word-bar-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: word-bar-scroll 65s linear infinite;
}

.word-bar-group {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-right: 1.5rem;
  white-space: nowrap;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.word-bar-group span:nth-child(even) {
  color: #9bb8c8;
  font-weight: 400;
}

@keyframes word-bar-scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

/* --------------------------------------------------
   Sections
-------------------------------------------------- */

.section {
  border-top: 1px solid var(--line);
}

.section-understanding {
  padding-block: clamp(3rem, 11vw, 6rem);
  border-top: 0;
}

.section-layout {
  width: min(calc(100% - 2rem), var(--max));
  margin-inline: auto;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 7vw, 7rem);
}

.section-content {
  min-width: 0;
}

.section-heading {
  max-width: 850px;
  margin-bottom: 3rem;
}

h2 {
  margin-bottom: 1.5rem;
  font-size: clamp(2.6rem, 5.8vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.section-intro {
  max-width: 650px;
  margin-bottom: clamp(3.5rem, 7vw, 6rem);
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.8;
}

/* --------------------------------------------------
   Definition
-------------------------------------------------- */

.definition {
  display: grid;
  grid-template-columns: minmax(100px, 0.25fr) 1fr;
  gap: 2rem;
  margin-bottom: clamp(3rem, 6vw, 5rem);
  padding-block: 1.75rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.definition-label {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.definition p {
  max-width: 800px;
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  line-height: 1.5;
  letter-spacing: -0.025em;
}

/* --------------------------------------------------
   Word breakdown
-------------------------------------------------- */

.word-breakdown {
  margin-bottom: clamp(3rem, 6vw, 5rem);
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.word-breakdown-title {
  display: flex;
  align-items: baseline;
  justify-content: space-evenly;
  gap: 1rem;
  margin: 0 0 3rem;
  color: var(--text);
  font-size: clamp(3.5rem, 9vw, 6.5rem);
  line-height: 1;
  letter-spacing: -.075em;
}

.word-plus {
  color: var(--accent);
  font-size: .65em;
  font-weight: 400;
}

.word-parts {
  display: flex;
  justify-content: space-around;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.word-part {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.word-part-definition {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
}

.word-part-badge {
  display: inline-flex;
  align-items: center;
  padding: .35rem .65rem;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .07em;
}

.word-part-meaning {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
}

.word-part-description {
  max-width: 38ch;
  margin: .75rem 0 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.7;
}

/* --------------------------------------------------
   Concept grid
-------------------------------------------------- */

.concept-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow);
}

.concept-card {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    background-color 180ms ease,
    transform 180ms ease;
}

.concept-card:hover {
  background: var(--surface-strong);
}

.card-number {
  margin-bottom: auto;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.concept-card h3 {
  max-width: 360px;
  margin: 3rem 0 0.9rem;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.concept-card p {
  max-width: 450px;
  margin-bottom: 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.card-example {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --------------------------------------------------
   Chapter 2 — Types of interfaces
-------------------------------------------------- */

.section-types {
  padding-block: clamp(3rem, 11vw, 6rem);
}

.type-card {
  flex: 0 0 calc(50% - .625rem);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
}

.type-card-image {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--line);
}

.type-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 350ms ease;
}

.type-card:hover .type-card-image img {
  transform: scale(1.035);
}

.type-card-number {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 50%;
  background: rgba(20, 35, 43, .45);
  color: white;
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}

.type-card-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 230px;
  padding: 1.5rem;
}

.type-card-category {
  margin: 0 0 .75rem;
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.type-card h3 {
  margin: 0 0 .8rem;
  color: var(--text);
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1.2;
  letter-spacing: -.035em;
}

.type-card-content > p:not(.type-card-category) {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.7;
}

.type-card-example {
  margin-top: auto;
  padding-top: 1.5rem;
  color: var(--text);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .025em;
}

/* --------------------------------------------------
   Chapter 3 — Derived forms
-------------------------------------------------- */

.section-forms {
  padding-block: clamp(3rem, 11vw, 6rem);
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.word-card {
  min-width: 0;
  min-height: 260px;
}

.word-card-inner {
  min-height: 260px;
}

.word-card-face {
  padding: 1.5rem;
}

.word-card-front {
  justify-content: space-between;
}

.word-card-back {
  justify-content: center;
}

.word-card-back h3 {
  margin: 0 0 .75rem;
}

.word-card h3 {
  margin: 1rem 0;
  color: var(--text);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: -.045em;
}

.word-card-back p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.65;
}

.word-card-back .word-card-example {
  margin-top: 1rem;
  font-size: .8rem;
  font-style: italic;
}

.word-card-badge {
  align-self: flex-start;
  padding: .35rem .65rem;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
}

.word-card-hint {
  color: var(--muted);
  font-size: .75rem;
}

/* --------------------------------------------------
   Chapter 4 — Perspectives
-------------------------------------------------- */

.section-perspectives {
  padding-block: clamp(3rem, 11vw, 6rem);
}

.perspectives-carousel {
  width: 100%;
}

.perspective-card {
  flex: 0 0 calc(33.333% - .7rem);
  min-width: 0;
  max-width: 450px;
  min-height: 250px;
}

.perspective-card-inner {
  min-height: 280px;
}

.perspective-card-front {
  padding: 1.5rem;
  justify-content: space-between;
}

.perspective-number {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .08em;
}

.perspective-card blockquote {
  margin: 1.5rem 0;
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.45;
  letter-spacing: -.025em;
}

.perspective-author {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
}

.perspective-card-back {
  padding: 1.5rem;
  justify-content: center;
}

.perspective-card-back blockquote {
  margin: 0;
  color: var(--text);
  font-size: .95rem;
  line-height: 1.7;
}

.perspective-card-back video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: calc(var(--radius) - 8px);
}

/* --------------------------------------------------
   Closing section
-------------------------------------------------- */

.closing-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  margin-top: 8rem;
  padding: 6rem 2rem;
  overflow: hidden;
  background: #263640;
  color: #f0f2ee;
  text-align: center;
}

.closing-section::before {
  content: "";
  position: absolute;
  width: min(90vw, 1000px);
  aspect-ratio: 1;
  border: 1px solid rgba(169, 200, 216, .13);
  border-radius: 50%;
  pointer-events: none;
}

.closing-content {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
}

.closing-eyebrow {
  display: block;
  margin-bottom: 2rem;
  color: #a9c8d8;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .16em;
}

.closing-content h2 {
  margin: 0;
  color: #f0f2ee;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.065em;
  text-wrap: balance;
}

.closing-content a {
  display: inline-block;
  margin: 2rem 0 0;
  color: rgba(240, 242, 238, .65);
  font-size: .95rem;
  line-height: 1.6;
  text-decoration: none;
  transition: color 160ms ease;
}

.closing-content a:hover {
  color: #fff;
}

.closing-content a:focus-visible {
  outline: 2px solid #a9c8d8;
  outline-offset: 5px;
}

/* --------------------------------------------------
   Footer
-------------------------------------------------- */

.site-footer {
  width: 100%;
  margin: 0;
  padding: 2rem 1rem 2.5rem;
  border-top: 1px solid rgba(237, 243, 246, .14);
  background: #263640;
  color: rgba(240, 242, 238, .65);
  text-align: center;
  font-size: 0.75rem;
}

.site-footer p {
  margin: 0;
}

/* --------------------------------------------------
   Dark-mode card contrast
-------------------------------------------------- */

[data-theme="dark"] .concept-card,
[data-theme="dark"] .type-card {
  border-color: rgba(237, 243, 246, .2);
  background: #263640;
}

[data-theme="dark"] .concept-card:hover {
  background: #30434e;
}

[data-theme="dark"] .word-card-face,
[data-theme="dark"] .perspective-card-face {
  border-color: rgba(237, 243, 246, .2);
  background: #263640;
}

[data-theme="dark"] .word-card-back,
[data-theme="dark"] .perspective-card-back {
  background: #30434e;
}

/* --------------------------------------------------
   Responsive
-------------------------------------------------- */

@media (max-width: 900px) {
  .forms-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 0;
    padding-inline: 0;
  }

  .hero-shell {
    padding-block: 5rem 7rem;
  }

  .diagram-wrap {
    justify-items: center;
    width: 100%;
  }

  .diagram-caption {
    width: 100%;
    max-width: 100%;
    text-align: center;
  }

  .venn {
    width: min(100%, 330px);
    margin-inline: auto;
  }

  .type-card {
    flex-basis: 100%;
  }

  .type-card-content {
    min-height: 210px;
  }
}

@media (max-width: 620px) {
  .hero-shell,
  .section-layout {
    width: min(calc(100% - 1.5rem), var(--max));
  }

  h1 {
    font-size: clamp(2.5rem, 12.5vw, 3.6rem);
    line-height: 0.98;
  }

  h2 {
    font-size: clamp(2.6rem, 12vw, 4.5rem);
  }

  .definition {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .word-breakdown {
    margin-bottom: 3.5rem;
  }

  .word-breakdown-title {
    margin-bottom: 2.5rem;
  }

  .word-parts {
    flex-direction: column;
    gap: 2rem;
  }

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

  .concept-card {
    min-height: 240px;
  }

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

  .section-forms {
    padding-top: 4rem;
  }

  .section-perspectives {
    padding-top: 4rem;
  }

  .perspective-card {
    flex-basis: 85%;
  }

  .closing-section {
    min-height: 380px;
    margin-top: 5rem;
    padding: 5rem 1.5rem;
  }

  .closing-content h2 {
    font-size: clamp(2.8rem, 12vw, 4rem);
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }

  .word-bar {
    display: none;
  }

  .section-understanding {
    border-top: 1px solid var(--line);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
  }
}