/* ─── Reset ──────────────────────────────────────────────────────────────── */

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

/* ─── Design Tokens: Primitive ───────────────────────────────────────────── */

:root {
  /* Primitive — Besa brand system */
  --forest: #1B3A2D;
  --canopy: #2E6B4F;
  --sage:   #A8D5B5;
  --paper:  #F5F8F3;
  --ink:    #17281F;
  --charcoal: #202624;
  --deny:     #9B3F38;

  /* Semantic */
  --color-base:          var(--paper);
  --color-authority:     var(--forest);
  --color-accent:        var(--canopy);
  --color-accent-strong: #163024;
  --color-on-dark:       #EAF3EA;
  --color-accent-on-dark: var(--sage);
  --color-text:          var(--ink);
  --color-text-mid:      #3E5A4C;
  --color-text-muted:    #556E61;
  --color-border:        rgba(27, 58, 45, 0.16);
  --color-border-strong: rgba(27, 58, 45, 0.30);

  /* Typography */
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-sans:  system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:  ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Interaction tints — forest-derived, never a foreign hue */
  --tint-authority-weak:   rgba(27, 58, 45, 0.05);
  --tint-authority-medium: rgba(27, 58, 45, 0.08);
  --tint-authority-strong: rgba(27, 58, 45, 0.10);

  /* Motion — Apple-calibrated */
  --ease-apple:  cubic-bezier(0.25, 0.1, 0, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast:    160ms;
  --dur-base:    500ms;
  --dur-reveal:  700ms;
  --dur-slow:    900ms;
}

/* ─── Base ────────────────────────────────────────────────────────────────── */

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light;
}

::selection {
  background: var(--sage);
  color: var(--color-authority);
}

body {
  background-color: var(--color-base);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ─── Animations ──────────────────────────────────────────────────────────── */

@keyframes drawRule {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Header / Nav ────────────────────────────────────────────────────────── */

.site-header {
  margin: 0 auto;
  max-width: 760px;
  min-width: 0;
  padding: 1.5rem 2rem 0;
  width: 100%;
}

.nav {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-width: 0;
}

.nav-brand {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-width: 0;
  text-decoration: none;
}

.nav-mark {
  display: block;
  height: 40px;
  width: 40px;
}

.nav-word {
  color: var(--color-authority);
  font-family: var(--font-serif);
  font-feature-settings: "kern" 1, "liga" 1;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

/* ─── Language Toggle ─────────────────────────────────────────────────────── */

.lang-toggle {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
}

.lang-btn {
  background: transparent;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-mid);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.7rem;
  transition:
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    background-color var(--dur-fast) ease;
}

.lang-btn.active {
  background: var(--tint-authority-medium);
  border-color: var(--color-authority);
  color: var(--color-authority);
  font-weight: 700;
}

.lang-btn:hover:not(.active) {
  border-color: var(--color-text-mid);
  color: var(--color-text);
}

.lang-btn:focus-visible,
.spec-link:focus-visible,
.source-link:focus-visible,
.install-cmd:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* ─── Main Layout ─────────────────────────────────────────────────────────── */

main {
  margin: 0 auto;
  max-width: 760px;
  min-width: 0;
  padding: 0 2rem 8rem;
  width: 100%;
}

/* ─── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  padding: 5.5rem 0 5rem;
}

.category-eyebrow {
  animation: fadeUp var(--dur-reveal) var(--ease-apple) 0.08s both;
  color: var(--color-accent);
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-rule {
  animation: drawRule var(--dur-base) var(--ease-apple) 0.34s both;
  background-color: var(--color-accent);
  height: 2px;
  margin: 1.5rem 0 2.4rem;
  transform-origin: left center;
}

.hero-brand {
  animation: fadeUp var(--dur-slow) var(--ease-apple) 0.56s both;
  color: var(--color-authority);
  font-family: var(--font-serif);
  font-feature-settings: "kern" 1, "liga" 1;
  font-size: 7rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  margin-bottom: 1.5rem;
}

.hero-claim {
  animation: fadeUp var(--dur-slow) var(--ease-apple) 0.72s both;
  color: var(--color-authority);
  font-family: var(--font-serif);
  font-feature-settings: "kern" 1, "liga" 1;
  font-size: 2.15rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.22;
  margin-bottom: 1.25rem;
  max-width: 580px;
}

.hero-sub {
  animation: fadeUp var(--dur-slow) var(--ease-apple) 0.88s both;
  color: var(--color-text-mid);
  font-size: 1.05rem;
  line-height: 1.78;
  margin-bottom: 2.75rem;
  max-width: 560px;
}

.hero-claim,
.hero-sub,
.problem-copy,
.category-name,
.category-desc,
.artifact-desc,
.status-copy,
.footer-legal {
  hyphens: none;
  overflow-wrap: anywhere;
}

html[lang="de"] .hero-claim,
html[lang="de"] .hero-sub,
html[lang="de"] .problem-copy,
html[lang="de"] .category-name,
html[lang="de"] .category-desc,
html[lang="de"] .artifact-desc,
html[lang="de"] .status-copy,
html[lang="de"] .footer-legal {
  hyphens: auto;
}

/* ─── Pipeline Card ───────────────────────────────────────────────────────── */

.pipeline-card {
  animation: fadeUp var(--dur-slow) var(--ease-apple) 1.04s both;
  border: 1px solid var(--color-border-strong);
  border-left: 3px solid var(--color-accent);
  margin-bottom: 2.75rem;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 1.6rem 1.8rem;
}

.pipeline-flow {
  color: var(--color-authority);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.95;
  min-width: max-content;
  white-space: pre;
}

/* ─── Hero CTA ────────────────────────────────────────────────────────────── */

.hero-cta {
  align-items: center;
  animation: fadeUp var(--dur-slow) var(--ease-apple) 1.2s both;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.install-cmd {
  background: var(--tint-authority-weak);
  border: 1px solid var(--color-authority);
  color: var(--color-authority);
  cursor: pointer;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.8rem 1.2rem;
  transition:
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    background-color var(--dur-fast) ease;
  user-select: none;
  white-space: pre;
}

.install-cmd:hover {
  background: var(--tint-authority-strong);
  border-color: var(--color-accent);
}

.install-cmd.copied {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.install-cmd.copied::after {
  content: "  \2713";
}

.spec-link {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--dur-fast) ease;
}

.spec-link:hover {
  color: var(--color-authority);
}

/* ─── Section Label (shared) ──────────────────────────────────────────────── */

.section-label {
  color: var(--color-accent);
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 1.4rem;
  text-transform: uppercase;
}

/* ─── Problem (full-bleed forest band) ───────────────────────────────────── */

.problem {
  background: var(--charcoal);
  border-top: 3px solid var(--deny);
  margin-left: -2rem;
  margin-right: -2rem;
  padding: 5rem 2rem;
}

.problem .section-label {
  color: rgba(168, 213, 181, 0.82);
}

.problem-copy {
  color: var(--color-on-dark);
  font-family: var(--font-serif);
  font-feature-settings: "kern" 1, "liga" 1;
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.55;
  max-width: 560px;
}

/* ─── Sections: shared border rhythm ─────────────────────────────────────── */

.category,
.proof,
.cli,
.artifact,
.status {
  border-top: 1px solid var(--color-border);
  padding: 4.5rem 0;
}

/* ─── Category ────────────────────────────────────────────────────────────── */

.category-name {
  color: var(--color-authority);
  font-family: var(--font-serif);
  font-feature-settings: "kern" 1, "liga" 1;
  font-size: 3.1rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.category-desc {
  color: var(--color-text-mid);
  font-size: 1.05rem;
  line-height: 1.78;
  max-width: 560px;
}

/* ─── Proof List ──────────────────────────────────────────────────────────── */

.proof-list {
  list-style: none;
  margin-top: 0.25rem;
}

.proof-list li {
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.6;
  padding: 0.9rem 0;
}

.proof-list li:first-child {
  border-top: 1px solid var(--color-border);
}

.proof-list li::before {
  color: var(--color-accent);
  content: "\2192\00a0\00a0";
  font-family: var(--font-mono);
}

/* ─── Terminal Card (CLI section) ─────────────────────────────────────────── */

.terminal-card {
  background: var(--charcoal);
  border-left: 3px solid var(--color-accent-on-dark);
  margin-top: 0.5rem;
  overflow-x: auto;
  padding: 1.8rem 2rem;
}

.terminal-card pre {
  color: var(--color-on-dark);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.9;
  min-width: max-content;
  white-space: pre;
}

/* ─── Artifact / Receipt Card ─────────────────────────────────────────────── */

.artifact-desc {
  color: var(--color-text-mid);
  font-size: 1rem;
  margin-bottom: 1.25rem;
}

.receipt-card {
  background: var(--color-authority);
  border-left: 3px solid var(--color-accent-on-dark);
  overflow-x: auto;
  padding: 1.8rem 2rem;
}

.receipt-card pre {
  color: var(--color-on-dark);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.9;
  min-width: max-content;
  white-space: pre;
}

/* ─── Status ──────────────────────────────────────────────────────────────── */

.status {
  padding-bottom: 0;
}

.status-copy {
  color: var(--color-text-mid);
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
}

.source-link {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color var(--dur-fast) ease;
}

.source-link:hover {
  color: var(--color-authority);
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 5rem;
  padding: 2rem;
}

.footer-inner {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  margin: 0 auto;
  max-width: 760px;
}

.footer-mark {
  display: block;
  height: 20px;
  opacity: 0.55;
  width: 20px;
}

.footer-copy {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.footer-legal {
  color: var(--color-text-muted);
  font-size: 0.68rem;
  line-height: 1.65;
  margin: 0.75rem auto 0;
  max-width: 760px;
  padding: 0 0.5rem;
  text-align: center;
}

/* ─── Screen-reader-only ──────────────────────────────────────────────────── */

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* ─── Scroll Reveal ───────────────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--dur-reveal) var(--ease-apple),
    transform var(--dur-reveal) var(--ease-apple);
  will-change: transform, opacity;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Reduced Motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-delay: 0.01ms !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .hero-rule {
    transform: scaleX(1);
  }

  .reveal {
    opacity: 1;
    transform: none;
    will-change: auto;
  }
}

/* ─── Mobile ≤640px ───────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .site-header {
    padding: 1rem 1.25rem 0;
  }

  main {
    padding: 0 1.25rem 5rem;
  }

  .hero {
    padding: 3.5rem 0 3.5rem;
  }

  .hero-brand {
    font-size: 4rem;
  }

  .hero-claim {
    font-size: 1.5rem;
  }

  .hero-sub {
    font-size: 0.98rem;
    margin-bottom: 2.25rem;
  }

  .pipeline-card {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding: 1.2rem 1.25rem;
  }

  .pipeline-flow {
    font-size: 0.78rem;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }

  .hero-cta {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
  }

  .install-cmd {
    font-size: 0.8rem;
    overflow-wrap: anywhere;
    padding: 0.7rem 1rem;
    white-space: pre-wrap;
    width: 100%;
  }

  .problem {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding: 4rem 1.25rem;
  }

  .category,
  .proof,
  .cli,
  .artifact,
  .status {
    padding: 3.25rem 0;
  }

  .terminal-card,
  .receipt-card {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding: 1.25rem;
  }

  .terminal-card pre,
  .receipt-card pre {
    font-size: 0.78rem;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }
}
