/* ============================================================
   CP Software & Solutions — styles
   Design: "Systemplan" — technical drawing, hairlines, mono annotations
   Mobile-first: base rules target small screens, min-width
   queries add the wider layouts.
   ============================================================ */

:root {
  --paper: #f7f8f6;
  --paper-raised: #ffffff;
  --ink: #1e2a32;
  --ink-soft: #46555f;
  --hairline: #c9d2d8;
  --hairline-soft: #dfe5e9;
  --accent: #2050c8;
  --accent-ink: #ffffff;
  --grid-line: rgba(30, 42, 50, 0.045);

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, Menlo, monospace;

  --fs-hero: clamp(2.3rem, 5.5vw, 4rem);
  --fs-h2: clamp(1.55rem, 3vw, 2.1rem);
  --fs-h3: 1.125rem;
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-label: 0.78125rem;

  --measure: 62ch;
  --page-max: 1140px;
  --pad-x: clamp(1.25rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1721;
    --paper-raised: #14202c;
    --ink: #dce5ec;
    --ink-soft: #93a4b1;
    --hairline: #2c3d4b;
    --hairline-soft: #22303c;
    --accent: #6e96f5;
    --accent-ink: #0e1721;
    --grid-line: rgba(220, 229, 236, 0.04);
  }
}

/* Viewer theme toggle must win in both directions */
:root[data-theme="light"] {
  --paper: #f7f8f6;
  --paper-raised: #ffffff;
  --ink: #1e2a32;
  --ink-soft: #46555f;
  --hairline: #c9d2d8;
  --hairline-soft: #dfe5e9;
  --accent: #2050c8;
  --accent-ink: #ffffff;
  --grid-line: rgba(30, 42, 50, 0.045);
}

:root[data-theme="dark"] {
  --paper: #0e1721;
  --paper-raised: #14202c;
  --ink: #dce5ec;
  --ink-soft: #93a4b1;
  --hairline: #2c3d4b;
  --hairline-soft: #22303c;
  --accent: #6e96f5;
  --accent-ink: #0e1721;
  --grid-line: rgba(220, 229, 236, 0.04);
}

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

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink);
  /* nothing may widen the page beyond the viewport */
  overflow-x: clip;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---------- language switching ----------
   Both languages are in the DOM as .de / .en elements (each also
   carries a lang attribute for assistive tech). The root's
   data-lang decides which set is visible; the markup defaults to
   data-lang="de", so the page works without JS. */

html:not([data-lang]) .en,
html[data-lang="de"] .en {
  display: none !important;
}

html[data-lang="en"] .de {
  display: none !important;
}

/* ---------- layout primitives ---------- */

.shell {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.section {
  border-top: 1px solid var(--hairline);
  padding-block: clamp(3.5rem, 8vw, 6rem);
}

/* Title-block style section header: mono code above the heading
   on small screens, side by side from 720px up. */
.section-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section-code {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.section-head h2 {
  font-size: var(--fs-h2);
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}

.section-intro {
  color: var(--ink-soft);
  margin-bottom: clamp(2rem, 4vw, 3rem);
  margin-top: -1rem;
}

@media (min-width: 720px) {
  .section-head {
    flex-direction: row;
    align-items: baseline;
    gap: 1rem;
  }
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.site-header .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.75rem;
}

.wordmark {
  font-weight: 750;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

/* on narrow screens the wordmark collapses to "CP." so the header
   (wordmark + language, theme and menu buttons) never overflows */
.wordmark .wm-full {
  display: none;
}

@media (min-width: 520px) {
  .wordmark .wm-full {
    display: inline;
  }

  .wordmark .wm-short {
    display: none;
  }
}

.wordmark .tld {
  color: var(--accent);
}

.site-nav {
  display: none;
}

.site-nav a {
  font-size: var(--fs-small);
  color: var(--ink-soft);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 379px) {
  .header-tools {
    gap: 0.35rem;
  }

  .lang-toggle a {
    padding: 0.4rem 0.5rem;
  }

  .nav-burger {
    padding: 0.5rem 0.4rem;
  }

  .theme-toggle {
    padding: 0.4rem;
  }
}

.lang-toggle {
  display: flex;
  border: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
}

.lang-toggle a {
  color: var(--ink-soft);
  text-decoration: none;
  letter-spacing: 0.08em;
  padding: 0.45rem 0.7rem;
}

.lang-toggle a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
}

/* legal pages switch languages in place (buttons instead of links) */
.lang-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  letter-spacing: 0.08em;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.theme-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--hairline);
  padding: 0.45rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--ink-soft);
}

.theme-toggle:hover {
  color: var(--ink);
}

.theme-icon {
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.nav-burger {
  appearance: none;
  background: transparent;
  border: 1px solid var(--hairline);
  padding: 0.55rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.burger-bar {
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
  .burger-bar {
    transition: none;
  }
}

.nav-open .burger-bar:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.nav-open .burger-bar:nth-child(2) {
  opacity: 0;
}

.nav-open .burger-bar:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* mobile nav panel, toggled by the burger */
.nav-open .site-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  padding: 1.25rem var(--pad-x) 1.5rem;
}

.nav-open .site-nav a {
  font-size: var(--fs-body);
  color: var(--ink);
}

/* the horizontal nav needs ~840px together with wordmark and toggles;
   below that the burger menu takes over */
@media (min-width: 840px) {
  .site-nav {
    display: flex;
    gap: 1.5rem;
    margin-left: auto;
  }

  .site-header .shell {
    gap: 1.5rem;
  }

  .header-tools {
    gap: 0.75rem;
  }

  .nav-burger {
    display: none;
  }

  /* neutralize the mobile panel if the menu was left open while resizing */
  .nav-open .site-nav {
    position: static;
    flex-direction: row;
    gap: 1.5rem;
    border-bottom: 0;
    padding: 0;
    background: transparent;
  }

  .nav-open .site-nav a {
    font-size: var(--fs-small);
    color: var(--ink-soft);
  }
}

/* ---------- hero ---------- */

.hero {
  padding-block: clamp(4rem, 9vw, 7.5rem);
}

.hero .shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: var(--fs-hero);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: break-word;
  margin-bottom: 1.5rem;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  max-width: 52ch;
  color: var(--ink-soft);
  margin-bottom: 2.25rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.btn {
  display: inline-block;
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--ink);
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-ghost {
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (min-width: 860px) {
  .hero .shell {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
}

/* hero schematic — a minimal system diagram drawn with borders */

.schematic {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.06em;
  border: 1px solid var(--hairline);
  background: var(--paper-raised);
  padding: 1.75rem 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  justify-content: space-between;
  align-items: center;
  justify-items: center;
  row-gap: 0;
  width: 100%;
  max-width: 26rem;
  margin-inline: auto;
  overflow-x: auto;
}

.schematic .col-1 { grid-column: 1; }
.schematic .col-2 { grid-column: 2; }
.schematic .col-3 { grid-column: 3; }

.schematic .node {
  border: 1px solid var(--ink-soft);
  padding: 0.45rem 0.8rem;
  background: var(--paper);
  color: var(--ink);
  white-space: nowrap;
}

.schematic .node-core {
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.schematic .wire-v {
  width: 1px;
  height: 1.5rem;
  background: var(--hairline);
  justify-self: center;
  min-height: 1.5rem;
}

.schematic .bus {
  grid-column: 1 / -1;
  justify-self: stretch;
  height: 1px;
  background: var(--hairline);
  margin-inline: 2rem;
}

.schematic-caption {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 1.25rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

@media (max-width: 380px) {
  .schematic .node {
    padding: 0.35rem 0.5rem;
    letter-spacing: 0;
  }
}

/* ---------- services: shared-border spec-sheet grid ---------- */

.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--hairline);
  background: var(--hairline);
  gap: 1px;
}

.service {
  background: var(--paper-raised);
  padding: 1.75rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.service:hover {
  outline: 1.5px solid var(--accent);
  outline-offset: -1.5px;
}

.service-index {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  color: var(--accent);
}

.service h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.service-outcome {
  font-size: var(--fs-small);
  font-weight: 550;
  color: var(--ink);
  max-width: 34ch;
}

.service ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

.service li {
  padding-left: 1.1rem;
  position: relative;
}

.service li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.45rem;
  height: 1px;
  background: var(--accent);
}

@media (min-width: 620px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- track record: timeline ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tl-item {
  position: relative;
  border-left: 1px solid var(--hairline);
  margin-left: 4px;
  padding: 0 0 clamp(2rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tl-item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

/* station marker: a small square sitting on the line */
.tl-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.35rem;
  width: 9px;
  height: 9px;
  background: var(--paper);
  border: 1.5px solid var(--accent);
}

.tl-item h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.tl-item > p {
  font-size: var(--fs-small);
  color: var(--ink-soft);
  max-width: var(--measure);
}

.case-client {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.case-tags {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding-top: 0.25rem;
}

/* wide screens: station label moves into its own left column so the
   timeline uses the full width while text keeps a readable measure.
   (Must come after the .tl-item base rule to win the cascade.) */
@media (min-width: 860px) {
  .tl-item {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    column-gap: 2.5rem;
    row-gap: 0.5rem;
  }

  .tl-item > * {
    grid-column: 2;
  }

  .tl-item > .case-client {
    grid-column: 1;
    grid-row: 1;
    padding-top: 0.2rem;
  }
}

/* mid-page call to action after the track record */
.section-cta {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: clamp(1.5rem, 3vw, 2rem);
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
}

.section-cta p {
  font-weight: 600;
  color: var(--ink);
}

/* ---------- principles (how we work) ---------- */

.principles {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.75rem, 4vw, 3rem);
}

.principle {
  border-top: 2px solid var(--ink);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.principle h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.principle p {
  color: var(--ink-soft);
  font-size: var(--fs-small);
  max-width: 48ch;
}

@media (min-width: 620px) {
  .principles {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- about ---------- */

.about .shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 5vw, 4rem);
}

.about-body p {
  max-width: var(--measure);
}

.about-body p + p {
  margin-top: 1rem;
}

.about-aside {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-self: start;
}

/* freigestellte Illustration: bewusst zurückgenommen, damit sie
   sich dem Seiteninhalt unterordnet statt ihn zu dominieren */
/* figure spans the full column so the caption gets one line;
   only the image itself stays constrained */
.about-portrait {
  margin: 0;
  text-align: center;
}

.about-portrait img {
  display: block;
  width: 100%;
  max-width: 15rem;
  height: auto;
  margin-inline: auto;
  filter: saturate(0.45);
  opacity: 0.88;
}

.about-portrait figcaption {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-top: 0.5rem;
  border-top: 1px solid var(--hairline);
}

.about-facts {
  font-size: var(--fs-small);
  border: 1px solid var(--hairline);
  background: var(--paper-raised);
}

.about-facts > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 1.25rem;
}

.about-facts > div + div {
  border-top: 1px solid var(--hairline-soft);
}

.about-facts dt {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.about-facts dd {
  margin: 0;
  color: var(--ink);
}

@media (min-width: 860px) {
  .about .shell {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  }
}

/* ---------- contact ---------- */

.contact-panel {
  border: 1px solid var(--hairline);
  background: var(--paper-raised);
  padding: clamp(1.75rem, 5vw, 3.5rem);
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: center;
}

.contact-panel h2 {
  font-size: var(--fs-h2);
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
  margin-bottom: 0.75rem;
}

.contact-panel .lede {
  color: var(--ink-soft);
  max-width: 46ch;
  margin-bottom: 1.75rem;
}

.contact-channels {
  font-size: var(--fs-small);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.contact-channels a {
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.contact-channels .label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.1rem;
}

@media (min-width: 860px) {
  .contact-panel {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--hairline);
  padding-block: 2rem;
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

.site-footer .shell {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: baseline;
}

.site-footer nav {
  display: flex;
  gap: 1.5rem;
}

.site-footer a {
  color: var(--ink-soft);
}

.site-footer a:hover {
  color: var(--ink);
}

/* ---------- root language chooser (JS normally redirects) ---------- */

.chooser {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2rem;
}

.chooser .wordmark {
  font-size: 1.25rem;
}

.chooser-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ---------- legal pages ---------- */

.legal {
  padding-block: clamp(3rem, 7vw, 5rem);
}

.legal h1 {
  font-size: var(--fs-h2);
  font-weight: 750;
  letter-spacing: -0.015em;
  margin-bottom: 2rem;
}

.legal h2 {
  font-size: var(--fs-h3);
  font-weight: 700;
  margin-top: 2.25rem;
  margin-bottom: 0.6rem;
}

.legal p,
.legal address {
  max-width: var(--measure);
  font-style: normal;
}

.legal p + p {
  margin-top: 0.8rem;
}

/* convenience-translation hint: quiet annotation, clearly set apart */
.legal .note {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-top: -1rem;
  margin-bottom: 2.5rem;
}

.legal a {
  overflow-wrap: anywhere;
}
