@import './brand.css';

:root {
  /* Theme */
  --bg: #0a0f1a;
  --bg-alt: #0c1a10;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: var(--green);
  --accent-2: var(--green);
  --card: #ffffff;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  --radius: 16px;
  --container: clamp(18rem, 92vw, 72rem);
  --cardtext: #1e293b;
  --link: var(--green);
  /* Muted text on white card backgrounds — must pass WCAG AA on #fff */
  --card-muted: #525f73;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --bg-alt: #eef7ef;
    --text: #1e293b;
    --muted: #64748b;
    --card: #ffffff;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --card-muted: #64748b;
  }
}

* {
  box-sizing: border-box;
}

/* Accessible focus ring — visible for keyboard users, hidden for mouse */
:focus-visible {
  outline: 2px solid var(--green, #00a933);
  outline-offset: 3px;
  border-radius: 2px;
}

html {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", Helvetica, Arial;
  overflow-x: hidden;
}

h2 { font-weight: 800; }
h3 { font-weight: 700; }

/* Offset for anchor links to account for sticky header */
section[id],
[id="contact"],
[id="top"] {
  scroll-margin-top: 100px;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding: clamp(12px, 4vw, 28px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Header (desktop scrolls; mobile fixed) ===== */
.nav {
  position: relative;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(8px);
  background: #fff;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 28%, transparent);
  /* Force dark text on white header background */
  color: #1e293b;
}

.nav .container {
  padding-block: 8px;
  transition: padding 0.25s ease;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.nav-row-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
}

.nav-row-1-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: #1e293b;
  cursor: pointer;
  padding: 4px;
}

.nav-row-2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  padding-top: 6px;
}

.nav-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-newsletter {
  padding: 6px 12px;
  font-size: 0.8rem;
  margin-left: auto;
}

.nav-row-2 a {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.9;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  color: #1e293b;
}

.nav-row-2 a:hover {
  opacity: 1;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 8%, transparent);
}

.nav-row-2 a.active {
  opacity: 1;
  color: var(--green);
  border-bottom-color: var(--green);
}

.nav-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-row-2 a.active .nav-num {
  background: var(--green);
  color: #fff;
}

.nav-label {
  white-space: nowrap;
}

.nav-close {
  display: none;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-left: auto;
}

.nav-close:hover {
  color: #1e293b;
  background: color-mix(in srgb, var(--muted) 15%, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.2px;
  transition: all 0.25s ease;
}

.brand img {
  height: 46px;
  width: auto;
  border-radius: 6px;
  transition: height 0.25s ease;
}

.brand-mobile {
  display: none;
}

.lang-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.lang-wrap select {
  padding: 0.25rem 0.4rem;
  border-radius: 0.5rem;
  border: 1px solid #cfd6e4;
  background: #fff;
  color: #10131a;
  font-size: 0.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 2px solid var(--green);
  background: transparent;
  color: var(--green);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--green);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 169, 51, 0.3);
}

.btn.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  font-weight: 700;
}

.btn.primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  box-shadow: 0 6px 20px rgba(0, 169, 51, 0.4);
}

.btn.secondary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  font-weight: 700;
}

.btn.secondary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  box-shadow: 0 6px 20px rgba(255, 0, 0, 0.4);
}


/* Mobile-only overrides */
@media (max-width: 768px) {
  .nav {
    position: fixed;
    left: 0;
    right: 0;
  }
  .brand-desktop {
    display: none;
  }
  .brand-mobile {
    display: inline;
  }
  main,
  :target.legal {
    padding-top: var(--nav-h, 64px);
  }
  .menu {
    display: none;
  }
  .lang-wrap select {
    padding: 0.25rem 0.45rem;
    font-size: 0.9rem;
    border-radius: 0.55rem;
  }
  .btn {
    padding: 10px 14px;
    border-radius: 0.7rem;
    min-height: 44px;
  }
  /* Hamburger always visible on mobile */
  .hamburger {
    display: flex;
  }
  /* Nav links collapsed by default on mobile */
  .nav-row-2 {
    flex-direction: column;
    align-items: stretch;
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.2s ease;
  }
  /* Expanded state */
  .nav--menu-open .nav-row-2 {
    max-height: 400px;
    padding-top: 6px;
    opacity: 1;
  }
  .nav--menu-open .hamburger {
    display: none;
  }
  .nav--menu-open .nav-close {
    display: flex;
  }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .nav-links a {
    padding: 8px 12px;
  }
  .btn-newsletter {
    margin-left: 0;
    margin-top: 8px;
    justify-content: center;
  }
  .nav-close {
    align-self: flex-end;
    margin-left: 0;
    margin-top: 8px;
  }
  .brand span {
    font-size: 1rem;
  }
}

/* ===== Scroll-reveal ===== */
.will-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.will-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .will-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ===== Sections / Cards ===== */
.hero {
  padding: clamp(48px, 7vw, 100px) 0;
  background: linear-gradient(135deg, var(--bg) 0%, color-mix(in srgb, var(--green) 6%, var(--bg)) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  background: radial-gradient(ellipse at top right, color-mix(in srgb, var(--green) 8%, transparent), transparent 70%);
  pointer-events: none;
}

/* ===== Light-surface scope =====
   The canonical light surface is `.card`. It redefines --text and --muted
   so every descendant using var(--text) / var(--muted) cascades to the
   correct, accessible color on white in BOTH color schemes.

   Rule: any element with a white/--card background MUST use class="card"
   (visual: bordered card) OR include the same token redefinitions in its
   own rule (visual-free; see below).

   Standalone white surfaces below opt in to the same scope without taking
   on .card's visual chrome. */
.card,
.scroll-cta,
.info-box,
.conclusion-box,
.faq-item,
.newsletter-input {
  --text: var(--cardtext);
  --muted: var(--card-muted);
}

.card {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--muted) 15%, transparent);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--cardtext);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.15);
}

a.card {
  text-decoration: none;
  /* `color: inherit` would override .card's `color: var(--cardtext)` with the
     body color (white in dark mode) — making white text on white cards. Let
     the .card rule above set the color. */
}

.p {
  padding: clamp(16px, 2.5vw, 28px);
}

.title {
  font-size: clamp(16px, 2.2vw, 22px);
  line-height: 1.14;
  margin: 0 0 16px 0;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
}

.title span {
  color: var(--green);
}

.subtitle {
  font-size: clamp(16px, 1.8vw, 20px);
  opacity: 0.9;
  margin: 0 0 24px 0;
  color: var(--text);
  line-height: 1.55;
}

.cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.section {
  padding-top: clamp(10px, 1.2vw, 18px);
  padding-bottom: clamp(48px, 6vw, 90px);
  position: relative;
}

.section h2 {
  color: var(--text);
  font-size: clamp(16px, 2.2vw, 22px);
  margin: 0 0 12px 0;
  font-weight: 800;
}

.section h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--green);
  margin-top: 12px;
  border-radius: 2px;
}

.section p.lead {
  color: var(--text);
  opacity: 0.9;
  margin: 0 0 32px 0;
  font-size: 1rem;
  max-width: 700px;
  line-height: 1.6;
}

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

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

.cards .card h3 {
  margin: 0 0 8px 0;
  font-size: clamp(17px, 2vw, 20px);
  color: var(--cardtext);
}

.cards .card p {
  margin: 0;
  color: var(--cardtext);
}

.cards .card ul,
.cards .card ol {
  margin: 0.2rem 0 0 1.1rem;
  padding-left: 1.1rem;
}

.cards .card li {
  margin: 0.25rem 0;
}

.thumb {
  border-radius: 14px;
  overflow: hidden;
  margin: 0 0 10px 0;
}

.thumb img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 928/522;
  object-fit: cover;
  border-radius: inherit;
}

/* Featured slider */
.slider.card {
  overflow: hidden;
  border-radius: var(--radius);
}

.slides {
  position: relative;
  width: 100%;
  aspect-ratio: 928/522;
  border-radius: inherit;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateX(30px);
  transition: transform 0.8s ease, opacity 0.8s ease;
  border-radius: inherit;
  margin: 0;
}

.slide.active {
  opacity: 1;
  transform: translateX(0);
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.overlay {
  position: absolute;
  right: 12px;
  left: 12px;
  bottom: 12px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.25));
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  font-size: clamp(14px, 1.9vw, 18px);
}

.overlay strong {
  display: block;
  margin-bottom: 4px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

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

.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

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

.footer {
  padding: 40px 0;
  border-top: 3px solid var(--green);
  background: var(--bg-alt);
}

.footer a {
  color: var(--green);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--green-light);
  text-decoration: underline;
}

/* Legal pages toggle */
.legal {
  display: none;
}

:target.legal {
  display: block;
}

:target.legal + main {
  display: none;
}

.imprint,
.privacy {
  max-width: var(--container);
  margin-inline: auto;
  padding: clamp(18px, 4vw, 40px);
}

/* Blog specific styles */
.blog-card {
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.blog-card .thumb {
  aspect-ratio: 16/9;
  margin-bottom: 12px;
}

.blog-card h3 {
  margin: 0 0 8px 0;
  color: var(--cardtext);
}

.blog-card p {
  color: var(--cardtext);
  font-size: 1rem;
}

.blog-card .meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 8px;
}

/* Blog post layout */
.blog-post {
  max-width: 800px;
  margin: 0 auto;
}

.blog-post h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  margin-bottom: 16px;
}

.blog-post .meta {
  color: var(--muted);
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 20%, transparent);
}

.blog-post .content {
  line-height: 1.8;
}

.blog-post .content a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

.blog-post .content a:hover {
  text-decoration-color: var(--link);
}

.blog-post .content h2 {
  margin-top: 1em;
  margin-bottom: 0.5em;
}

.blog-post .content p {
  margin-bottom: 1.5em;
}

.blog-post .content ul,
.blog-post .content ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

.blog-post .content li {
  margin-bottom: 0.5em;
}

.blog-post .content pre {
  background: var(--bg-alt);
  padding: 1em;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.5em;
}

.blog-post .content code {
  font-family: "Fira Code", Consolas, Monaco, monospace;
  font-size: 0.9em;
}

.blog-post .content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5em 0;
}

.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  font-size: 0.8rem;
  padding: 4px 12px;
  background: color-mix(in srgb, var(--green) 15%, transparent);
  color: var(--green);
  border-radius: 20px;
  font-weight: 500;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  color: var(--muted);
}

.back-link:hover {
  color: var(--text);
}

/* Share buttons */
.share-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
  margin-bottom: 24px;
}

.share-label {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.copy-btn,
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(148, 163, 184, .3);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.2;
  cursor: pointer;
  transition: all .2s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.copy-btn:hover,
.share-btn:hover {
  border-color: var(--green);
  color: var(--green);
  text-decoration: none;
}

.copy-btn.copied {
  border-color: var(--green);
  color: var(--green);
}

/* Back-to-top button */
.back-to-top {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 89;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 169, 51, 0.35);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
}

.back-to-top::after {
  content: 'Top';
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--green-dark);
}

/* Scroll-trigger sticky CTA */
.scroll-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  background: var(--card);
  border-top: 2px solid var(--green);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.scroll-cta.visible {
  transform: translateY(0);
}

.scroll-cta-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  max-width: var(--container-max, 72rem);
  margin: 0 auto;
}

.scroll-cta-text {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--cardtext);
}

.scroll-cta-btn {
  padding: 8px 20px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.scroll-cta-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
  line-height: 1;
}

.scroll-cta-close:hover {
  color: var(--cardtext);
}

@media (max-width: 768px) {
  .scroll-cta-inner {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
  }
  .scroll-cta-text {
    font-size: 0.85rem;
  }
}
