/*
  Mobile first: the base rules are the phone layout. Wider layouts are added
  further down with min-width media queries only:
    621px  form fields side by side
    921px  desktop navigation, two-column hero and footer
           (same breakpoint as DESKTOP_QUERY in assets/js/main.js)
    981px  three service cards side by side

  Look: flat. Solid backgrounds, hairline borders, one small corner radius,
  no shadows, gradients or blur.
*/

/* IBM Plex, served from this site (SIL Open Font License, see assets/fonts/LICENSE.txt).
   Latin subset only; it covers German. */
@font-face{
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}
@font-face{
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
}
@font-face{
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}
@font-face{
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

:root{
  color-scheme: light;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --brand: #021190;
  /* Links, list markers and focus rings. The brand blue is too dark for them on
     the dark theme, so that theme overrides it. */
  --accent: var(--brand);
  /* Fill of the primary button. */
  --primary: var(--brand);
  --primary-hover: #0a1cb4;

  --bg: #ffffff;
  --surface: #f4f5f7;
  --text: #15171c;
  --muted: #565e6c;
  --border: #dcdfe5;
  --border-strong: #b9bec8;
  --danger: #b3261e;

  --radius: 6px;

  --maxw: 1120px;
  --pad: clamp(18px, 3.2vw, 36px);
}

[data-theme="dark"]{
  color-scheme: dark;

  --accent: #8f9bff;
  --primary: #2a3bd1;
  --primary-hover: #3a4be0;

  --bg: #0e1014;
  --surface: #16191f;
  --text: #e8eaee;
  --muted: #a3aab8;
  --border: #2b303a;
  --border-strong: #454c5a;
  --danger: #ff8a80;
}

*{ box-sizing: border-box; }
html{
  scroll-behavior: smooth;
  /* Anchor targets must not end up underneath the sticky header. */
  scroll-padding-top: 76px;
  /* Keeps the page from jumping sideways when the mobile menu locks scrolling. */
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* No scrolling of the page behind the open mobile menu. */
html.nav-open,
html:has(dialog[open]){ overflow: hidden; }

body{
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}
a{ color: inherit; }
/* Buttons don't inherit the page font by default. */
button{ font-family: inherit; }
h1, h2, h3{
  font-weight: 600;
  overflow-wrap: break-word;
}
:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.container{ width: min(var(--maxw), calc(100% - 2*var(--pad))); margin: 0 auto; }

/* Header */
header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
}
.navlink{
  text-decoration: none;
  border: 0;
  background: transparent;
  font-family: inherit;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  line-height: inherit;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s ease;
}
.navlink:hover{ color: var(--text); }

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: transparent;
  text-decoration: none;
  font-family: inherit;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.4;
  transition: border-color .15s ease, background .15s ease;
  user-select: none;
  cursor: pointer;
  color: var(--text);
}
.btn:hover{ background: var(--surface); border-color: var(--text); }
.btn.primary{
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover{ background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:disabled{
  opacity: .6;
  cursor: progress;
}

.icon{
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: -3px;
  flex: 0 0 auto;
}

/* Logo */
.brand{
  display: flex;
  align-items: center;
  text-decoration: none;
  border-radius: var(--radius);
}
.logo-wrap{
  display: grid;
  place-items: center;
  width: 168px;
  max-width: 44vw;
}
.logo svg{
  width: 100%;
  height: auto;
  display: block;
}
.logo.color{ display: block; }
.logo.white{ display: none; }
[data-theme="dark"] .logo.color{ display: none; }
[data-theme="dark"] .logo.white{ display: block; }

/* Hero */
.hero{
  padding: clamp(32px, 6vw, 72px) 0 clamp(32px, 5vw, 56px);
}
.hero-grid{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
}

h1{
  margin: 0 0 12px;
  /* Small enough that "Softwareentwicklung" fits a 320px wide phone. */
  font-size: clamp(25px, 7.8vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.nowrap{ white-space: nowrap; }
.lead{
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.5vw, 18px);
  max-width: 60ch;
}
.cta-row{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.video-card{
  aspect-ratio: 16 / 9;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
  overflow: hidden;
}
.video-card video{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Sections: a hairline on top, the title directly under it. */
section{ padding: 0 0 clamp(32px, 5vw, 52px); }
section > .container{
  border-top: 1px solid var(--border);
  padding-top: clamp(20px, 3vw, 28px);
}
.section-title{
  font-size: clamp(19px, 2vw, 22px);
  line-height: 1.3;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.cards{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.card{
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
}
.card h3{
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.3;
}
.list{
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 15px;
}
.list li{
  position: relative;
  padding-left: 16px;
}
.list li::before{
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 5px;
  height: 5px;
  background: var(--accent);
}

/* Contact form */
.cta{ max-width: 640px; }

form{
  display: grid;
  gap: 14px;
}
label{
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  display: grid;
  gap: 6px;
}
input, textarea{
  width: 100%;
  /* 16px keeps iOS from zooming into the page when a field gets focus. */
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
::placeholder{ color: var(--muted); opacity: .8; }
textarea{ min-height: 132px; resize: vertical; }
input:focus, textarea:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.form-row{
  display:grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.toast{
  display:none;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}
.toast.show{ display:block; }
.toast.error{
  border-color: var(--danger);
  color: var(--danger);
}

/* Other ways to get in touch, below the form. */
.contact-alt{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
}
.contact-alt a{
  /* Padding makes the link a comfortable tap target. */
  padding: 8px 0;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

/* Footer */
footer{
  padding: 28px 0 max(36px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--muted);
}
.footergrid{
  display:grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.footer-title{
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text);
}
.fineprint{
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* Impressum / Datenschutz pages: one readable text column on the page grid. */
.legal{ padding: clamp(32px, 6vw, 64px) 0 clamp(40px, 6vw, 64px); }
.legal > *{ max-width: 68ch; }
.legal h1{ font-size: clamp(26px, 6vw, 34px); margin: 0 0 20px; }
.legal h2{ font-size: 18px; line-height: 1.3; margin: 28px 0 8px; }
.legal p{ margin: 0 0 10px; }
.legal a{ color: var(--accent); }
.legal a[href^="mailto:"]{ font-family: var(--font-mono); font-size: .95em; }

/* Theme toggle */
.theme-toggle{
  display:inline-flex;
  flex: 0 0 auto;
}
.theme-btn{
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: transparent;
  cursor:pointer;
  color: var(--text);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition: border-color .15s ease, background .15s ease;
}
.theme-btn:hover{ background: var(--surface); border-color: var(--text); }

/* Accessibility helpers */
.sr-only{
  position:absolute !important;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0);
  white-space:nowrap; border:0;
}

/* Navigation
   Phone: a menu button that opens the links in a slide-in panel (the script moves
   #navItems into the dialog). Without JavaScript the links stay in the header as
   one row that can be swiped sideways. */
.site-nav{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}

.nav-items{
  display:flex;
  align-items:center;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content:flex-end;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-items::-webkit-scrollbar{ display:none; }
.nav-items .btn{ margin-left: 6px; }

.nav-toggle{
  display:none;
  width: 44px;
  padding: 0;
  flex: 0 0 auto;
}
html.nav-enhanced .nav-toggle{ display:inline-flex; }
html.nav-enhanced .site-nav .nav-items{ display:none; }

.nav-dialog{
  margin: 0;
  padding: 0;
  border: 0;
  /* Fill the whole viewport; browsers cap a dialog's size by default. */
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  overflow: hidden;
  background: transparent;
}

.nav-dialog::backdrop{
  background: rgba(0,0,0,.4);
}
html[data-theme="dark"] .nav-dialog::backdrop{
  background: rgba(0,0,0,.6);
}

.nav-dialog__panel{
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(340px, 86vw);

  background: var(--bg);
  color: var(--text);
  border-left: 1px solid var(--border);

  padding:
    max(12px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    18px;

  display: flex;
  flex-direction: column;
  gap: 8px;

  transform: translateX(110%);
  transition: transform .22s ease;
  will-change: transform;
}

.nav-dialog[open] .nav-dialog__panel{
  transform: translateX(0);
  animation: nav-panel-in .22s ease;
}
.nav-dialog.closing .nav-dialog__panel{
  animation: none;
  transform: translateX(110%);
}
@keyframes nav-panel-in{
  from{ transform: translateX(110%); }
}

.nav-dialog__head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}
.nav-dialog__title{
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.nav-dialog__body{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.nav-dialog .nav-items{
  display:grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-content: start;
  overflow: visible;
}

/* Menu entries as plain rows separated by hairlines. */
.nav-dialog .navlink{
  display:flex;
  align-items:center;
  width: 100%;
  min-height: 52px;
  padding: 12px 0;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 17px;
  text-align: left;
}

.nav-dialog .nav-items .btn{
  width: 100%;
  min-height: 48px;
  margin: 18px 0 0;
  font-size: 16px;
}

.nav-close{
  flex: 0 0 auto;
  width: 44px;
  padding: 0;
}

html.dialog-fallback .nav-dialog{
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  background: rgba(0,0,0,.4);
}
html.dialog-fallback[data-theme="dark"] .nav-dialog{
  background: rgba(0,0,0,.6);
}
html.dialog-fallback .nav-dialog[open]{
  display: block;
}

/* Client and project logos */
.logo-marquee {
  position: relative;
  overflow: hidden;
  padding: 4px 0;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    #000 8%,
    #000 92%,
    transparent
  );
  mask-image: linear-gradient(
    to right,
    transparent,
    #000 8%,
    #000 92%,
    transparent
  );
}

.logo-marquee-track,
.project-marquee-track {
  --marquee-duration: 28s;
  display: flex;
  align-items: center;
  width: 100%;
}
.project-marquee-track { --marquee-duration: 35s; }

/* Each of the two groups is at least as wide as the visible area and moves by
   exactly its own width, so the loop has no empty stretch on wide screens. */
.logo-marquee-group {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex: 0 0 auto;
  min-width: 100%;
  gap: clamp(24px, 4vw, 48px);
  padding-right: clamp(24px, 4vw, 48px);
  animation: logo-scroll var(--marquee-duration) linear infinite;
}
.logo-marquee:focus-within .logo-marquee-group { animation-play-state: paused; }
@media (hover: hover) {
  .logo-marquee:hover .logo-marquee-group { animation-play-state: paused; }
}

.trust-logo {
  display: grid;
  place-items: center;
  width: clamp(108px, 14vw, 148px);
  height: 68px;
  flex: 0 0 auto;
}

.trust-logo a {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: var(--radius);
}
.trust-logo a:focus-visible { outline-offset: -2px; }

.trust-logo img {
  display: block;
  max-width: 100% !important;
  max-height: 52px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.72;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.trust-logo img:hover,
.trust-logo a:focus-visible img {
  filter: grayscale(0);
  opacity: 1;
}

/* Dark theme: most logos read fine on the dark background as they are. The ones
   drawn in dark colours only (class "dark-artwork" in index.php) would disappear,
   so their lightness is flipped; the hue rotation keeps their colours on hover. */
[data-theme="dark"] .trust-logo img { opacity: 0.8; }
[data-theme="dark"] .trust-logo img.dark-artwork {
  filter: grayscale(1) invert(1) brightness(1.2);
}
[data-theme="dark"] .trust-logo img:hover,
[data-theme="dark"] .trust-logo a:focus-visible img { opacity: 1; }
[data-theme="dark"] .trust-logo img.dark-artwork:hover,
[data-theme="dark"] .trust-logo a:focus-visible img.dark-artwork {
  filter: invert(1) hue-rotate(180deg) brightness(1.2);
}

@keyframes logo-scroll {
  to { transform: translateX(-100%); }
}

/* ---- Wider screens ------------------------------------------------------- */

@media (min-width: 621px){
  .form-row{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 921px){
  .topbar{ padding: 14px 0; }

  .hero-grid{ grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
  h1{ font-size: clamp(36px, 3.9vw, 48px); }

  .footergrid{ grid-template-columns: 1.3fr .7fr; }

  /* Desktop navigation: links in the header, no menu button. */
  .site-nav{ flex-wrap: wrap; gap: 10px; }
  .nav-items,
  html.nav-enhanced .site-nav .nav-items{
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
  }
  html.nav-enhanced .nav-toggle{ display: none; }

  /* Mouse users don't need touch-sized buttons. */
  .btn{ min-height: 40px; padding: 8px 16px; }
  .theme-btn{ width: 40px; height: 40px; }
}

@media (min-width: 981px){
  .cards{ grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}

/* ---- Reduced motion -------------------------------------------------------- */

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

  .nav-dialog__panel,
  .nav-dialog[open] .nav-dialog__panel{
    transition: none;
    animation: none;
  }

  /* No scrolling logos: show each logo once, wrapped and centred. */
  .logo-marquee{
    -webkit-mask-image: none;
    mask-image: none;
  }
  .logo-marquee-group{
    animation: none;
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: center;
    padding-right: 0;
  }
  .logo-marquee-group[aria-hidden="true"]{ display: none; }
  /* The project logos are repeated inside the group to fill the loop. */
  .project-marquee-track .trust-logo:nth-child(n+3){ display: none; }
}
