/* ========================================
   CSS Custom Properties
   ======================================== */
:root {
  --c-accent: #C17A4A;
  --c-accent-light: #D4956A;
  --c-accent-dark: #A0603A;
  --c-accent-subtle: rgba(193,122,74,0.1);
  --c-accent-glow: rgba(193,122,74,0.2);

  --c-bg: #FAFAF8;
  --c-bg-alt: #EBE8E2;
  --c-bg-card: #FFFFFF;
  --c-text: #1A1A18;
  --c-text-secondary: #5C5C58;
  --c-text-muted: #706F6A;
  --c-border: #C0BDB3;
  --c-divider: #E8E6E0;

  --c-avatar-bg: #EDE3D8;

  --font-sans: 'Segoe UI',system-ui,-apple-system,BlinkMacSystemFont,sans-serif;
  --font-serif: Georgia,'Times New Roman',serif;

  --fs-xs: clamp(0.75rem,0.7rem + 0.25vw,0.8125rem);
  --fs-sm: clamp(0.8125rem,0.775rem + 0.25vw,0.9375rem);
  --fs-base: clamp(0.9375rem,0.9rem + 0.25vw,1.0625rem);
  --fs-lg: clamp(1.125rem,1rem + 0.5vw,1.3125rem);
  --fs-xl: clamp(1.5rem,1.25rem + 1vw,2rem);
  --fs-2xl: clamp(2rem,1.5rem + 2vw,3rem);
  --fs-3xl: clamp(2.75rem,2rem + 3vw,4.5rem);

  --ease-out: cubic-bezier(0.16,1,0.3,1);
  --ease-in-out: cubic-bezier(0.65,0,0.35,1);

  --max-w: 72rem;
  --section-py: clamp(4rem,8vw,7rem);
  --radius: 0.75rem;

  color-scheme: light dark;
}

[data-theme="dark"] {
  --c-bg: #141413;
  --c-bg-alt: #1C1C1A;
  --c-bg-card: #222220;
  --c-text: #EDEDEB;
  --c-text-secondary: #A8A8A3;
  --c-text-muted: #8A8A85;
  --c-border: #333330;
  --c-divider: #2A2A28;
  --c-accent: #D4956A;
  --c-accent-light: #E0AB84;
  --c-accent-dark: #C17A4A;
  --c-accent-subtle: rgba(212,149,106,0.1);
  --c-accent-glow: rgba(212,149,106,0.15);
  --c-avatar-bg: #2A2520;
}

/* ========================================
   Language Toggle (CSS-driven)
   ======================================== */
[data-lang="de"] [data-i18n="en"] { display: none; }
[data-lang="en"] [data-i18n="de"] { display: none; }

/* ========================================
   Reset & Base
   ======================================== */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,svg { display: block; max-width: 100%; }
a { color: var(--c-accent-dark); text-decoration: none; }
[data-theme="dark"] a { color: var(--c-accent-light); }

::selection {
  background: var(--c-accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ========================================
   Visually Hidden (Accessibility)
   ======================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
   Text Link (reusable underline animation)
   ======================================== */
.text-link {
  position: relative;
  display: inline-block;
  font-weight: normal;
}
.text-link::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}
.text-link:hover::after,
.hero-cert-inner:hover .text-link::after {
  transform: scaleX(1);
}

/* ========================================
   Layout
   ======================================== */
.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(1.25rem,4vw,2.5rem);
}

section {
  padding: var(--section-py) 0;
}

.bg-alt { background: var(--c-bg-alt); }

/* ========================================
   Navigation
   ======================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--c-bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-divider);
  height: 3.5rem;
}

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

.nav-logo {
  color: var(--c-accent);
  display: inline-flex;
  align-items: center;
}
.nav-logo svg {
  height: 2em;
  width: auto;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--c-border);
  color: var(--c-text-secondary);
  cursor: pointer;
  border-radius: 999px;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

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

.lang-toggle {
  padding: 0.3rem 0.75rem;
  gap: 0.25rem;
}

.lang-toggle .lang-opt {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.lang-toggle .lang-opt.active {
  color: var(--c-accent);
  background: var(--c-accent-subtle);
}

.lang-sep {
  color: var(--c-text-muted);
  margin: 0 0.1rem;
}

.theme-toggle {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.4s var(--ease-out);
}

.theme-toggle:hover svg {
  transform: rotate(30deg);
}

.icon-sun, .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: block; }

/* ========================================
   Hero
   ======================================== */
.hero {
  min-height: calc(100svh - 3.5rem);
  display: flex;
  align-items: center;
  padding: clamp(2rem,6vw,4rem) 0;
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem,5vw,4rem);
  align-items: center;
  width: 100%;
}

.hero-text {
  order: 1;
}

.hero-label {
  display: inline-block;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-accent);
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--c-text);
  margin-bottom: 0.5rem;
}

.hero-former {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.hero-services {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hero-services li {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
}

.hero-divider {
  width: clamp(3rem,20%,6rem);
  height: 2px;
  background: var(--c-accent);
  margin: 1.5rem 0;
  border: none;
}

.hero-social {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.hero-email {
  font-size: var(--fs-sm);
}

.hero-linkedin {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-sm);
}

.hero-linkedin-icon {
  width: 1.1em;
  height: 1.1em;
}

.hero-visual {
  order: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-container {
  width: clamp(440px,36vw,540px);
  border-radius: 1.5rem;
  overflow: hidden;
  position: relative;
}

.avatar-img {
  width: 100%;
  height: auto;
  display: block;
}

/* ========================================
   About Section
   ======================================== */
.about-content {
  max-width: 42rem;
}

.section-heading {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  line-height: 1.15;
}

.section-heading .accent {
  color: var(--c-accent);
}

.about-content p {
  color: var(--c-text-secondary);
  font-size: var(--fs-base);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.about-content p:last-child {
  margin-bottom: 0;
}

/* ========================================
   Services
   ======================================== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 1.25rem;
  margin-top: 2rem;
}

.service-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), border-color 0.25s;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  border-color: var(--c-accent);
}

[data-theme="dark"] .service-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.service-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--c-accent);
  margin-bottom: 1rem;
}

.service-card h3 {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.service-card p {
  color: var(--c-text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* ========================================
   Tech Stack
   ======================================== */
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 2rem;
}

.tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-secondary);
  transition: transform 0.2s var(--ease-out), color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.tech-badge:hover {
  transform: scale(1.06);
  color: var(--c-accent);
  border-color: var(--c-accent);
}

/* ========================================
   Contact
   ======================================== */
.contact {
  text-align: center;
}

.contact-email {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--c-accent);
  letter-spacing: -0.01em;
  position: relative;
  margin-top: 1rem;
  transition: color 0.2s;
}

.contact-email::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--c-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}

.contact-email:hover::after {
  transform: scaleX(1);
}

.contact p {
  color: var(--c-text-secondary);
  max-width: 28rem;
  margin: 0 auto;
}

/* ========================================
   Footer
   ======================================== */
.footer {
  border-top: 1px solid var(--c-divider);
  padding: 2rem 0;
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  color: var(--c-text-muted);
}

.footer-links a:hover {
  color: var(--c-accent);
}

/* ========================================
   Certification
   ======================================== */
.hero-cert {
  margin-top: 1rem;
}
.hero-cert-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}
.hero-cert-badge {
  height: 6rem;
  width: auto;
}
.hero-cert-label {
  font-size: var(--fs-sm);
}

.cert-content {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  max-width: 42rem;
}
.cert-badge {
  flex-shrink: 0;
  width: clamp(5rem, 10vw, 7rem);
  height: auto;
}
.cert-text p {
  color: var(--c-text-secondary);
  font-size: var(--fs-base);
  line-height: 1.75;
  margin-bottom: 1rem;
}
.cert-link {
  font-size: var(--fs-sm);
}

/* ========================================
   Scroll Reveal
   ======================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

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

/* stagger delays for grid children */
.reveal-stagger > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > *:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger > *:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger > *:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger > *:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger > *:nth-child(6) { transition-delay: 400ms; }

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ========================================
   Subpages (Impressum, Datenschutz)
   ======================================== */
.subpage {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem,4vw,2.5rem);
}
.subpage h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin-bottom: 1.5rem;
}
.subpage h2 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
}
.subpage p,
.subpage address {
  margin-bottom: 1rem;
  color: var(--c-text-secondary);
}
.subpage address {
  font-style: normal;
}
.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: var(--fs-sm);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
  .hero .wrap {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-visual {
    order: 1;
  }
  .hero-text {
    order: 2;
  }
  .hero-services {
    align-items: center;
  }
  .hero-divider {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-social {
    justify-content: center;
  }
  .services-grid {
    grid-template-columns: repeat(2,1fr);
  }
}

@media (max-width: 640px) {
  .services-grid {
    grid-template-columns: 1fr;
  }
  .avatar-container {
    width: clamp(300px,75vw,440px);
  }
  .cert-content {
    flex-direction: column;
    text-align: center;
  }
  .footer .wrap {
    flex-direction: column;
    text-align: center;
  }
}
