/* SPDX-License-Identifier: EUPL-1.2 */
/* Aetheus - vitrine. Design system derived from docs/identite-aetheus.md */

/* ------------------------------------------------------------------ */
/* Design tokens                                                       */
/* ------------------------------------------------------------------ */
:root {
  /* Brand */
  --color-brand:        #1D4ED8;
  --color-brand-strong: #1E40AF;
  --color-brand-soft:   #3B82F6;
  /* CTA background kept dark enough for white text at AA in both themes */
  --btn-bg:             #1D4ED8;
  --btn-bg-hover:       #1E40AF;
  --color-accent-light: #60A5FA;
  --color-accent-pale:  #93C5FD;

  /* Semantic */
  --color-success: #16A34A;
  --color-danger:  #DC2626;
  --color-warning: #B45309;

  /* Light theme (default) */
  --color-bg:         #FFFFFF;
  --color-surface:    #F4F5F7;
  --color-surface-2:  #ECEEF2;
  --color-border:     #E2E4E9;
  --color-text:       #1A1D23;
  --color-text-muted: #5B616E;
  --color-heading:    #0B0D10;
  --color-on-brand:   #FFFFFF;

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;

  --step--1: clamp(0.83rem, 0.79rem + 0.18vw, 0.94rem);
  --step-0:  clamp(1rem, 0.95rem + 0.25vw, 1.15rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3:  clamp(1.95rem, 1.6rem + 1.7vw, 3rem);
  --step-4:  clamp(2.5rem, 1.9rem + 3vw, 4.2rem);

  /* Spacing scale */
  --space-2xs: 0.375rem;
  --space-xs:  0.625rem;
  --space-s:   1rem;
  --space-m:   1.625rem;
  --space-l:   2.625rem;
  --space-xl:  4.25rem;
  --space-2xl: 6.875rem;

  /* Radii, shadows, layout */
  --radius:    0.75rem;
  --radius-sm: 0.5rem;
  --shadow:    0 1px 2px rgba(11, 13, 16, 0.06), 0 8px 24px rgba(11, 13, 16, 0.06);
  --shadow-hover: 0 2px 4px rgba(11, 13, 16, 0.08), 0 16px 40px rgba(11, 13, 16, 0.10);
  --content-width: 68rem;
  --header-h: 4rem;
}

/* Dark palette: applied when the OS asks for dark (unless the user forced light),
   or when the user explicitly picks dark via the header toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg:         #0D0F12;
    --color-surface:    #16191E;
    --color-surface-2:  #1C2027;
    --color-border:     #262A31;
    --color-text:       #E6E8EC;
    --color-text-muted: #9AA0AB;
    --color-heading:    #F5F6F8;

    --color-brand:      #3B82F6;
    --color-brand-strong: #60A5FA;
    --btn-bg:           #2563EB;
    --btn-bg-hover:     #1D4ED8;
    --color-success:    #22C55E;
    --color-danger:     #EF4444;
    --color-warning:    #F59E0B;

    --shadow:       0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  --color-bg:         #0D0F12;
  --color-surface:    #16191E;
  --color-surface-2:  #1C2027;
  --color-border:     #262A31;
  --color-text:       #E6E8EC;
  --color-text-muted: #9AA0AB;
  --color-heading:    #F5F6F8;

  --color-brand:      #3B82F6;
  --color-brand-strong: #60A5FA;
  --btn-bg:           #2563EB;
  --btn-bg-hover:     #1D4ED8;
  --color-success:    #22C55E;
  --color-danger:     #EF4444;
  --color-warning:    #F59E0B;

  --shadow:       0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 16px 40px rgba(0, 0, 0, 0.55);
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  color: var(--color-heading);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-s);
  text-wrap: balance;
}

p { margin: 0 0 var(--space-s); }
p:last-child { margin-bottom: 0; }

a { color: var(--color-brand); text-decoration: none; }

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

:focus-visible {
  outline: 3px solid var(--color-brand-soft);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: var(--space-s);
  top: -4rem;
  z-index: 100;
  padding: var(--space-2xs) var(--space-s);
  background: var(--color-brand);
  color: var(--color-on-brand);
  border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}
.skip-link:focus { top: var(--space-s); }

.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--space-s);
}

.tabnums { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-s);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-weight: 700;
  color: var(--color-heading);
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  margin-right: auto;
}
.brand img { width: 1.85rem; height: 1.85rem; }

.nav-links {
  display: none;
  align-items: center;
  gap: var(--space-m);
}
.nav-links a {
  color: var(--color-text-muted);
  font-size: var(--step--1);
  font-weight: 500;
  position: relative;
  padding-block: 0.35rem;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: var(--color-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}
.nav-links a:hover { color: var(--color-heading); }
.nav-links a:hover::after { transform: scaleX(1); }

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-heading);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--color-brand); color: var(--color-brand); }
.theme-toggle svg { width: 1.25rem; height: 1.25rem; }
/* Show the sun in dark mode (to switch to light) and the moon in light mode. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: var(--step--1);
}
.lang-switch a {
  padding: 0.3rem 0.6rem;
  color: var(--color-text-muted);
  font-weight: 600;
}
.lang-switch a[aria-current="true"] {
  background: var(--color-brand);
  color: var(--color-on-brand);
}

/* Mobile disclosure menu (no JS, <details>) */
.menu-mobile { position: relative; display: inline-flex; }
.menu-mobile > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-heading);
}
.menu-mobile > summary::-webkit-details-marker { display: none; }
.menu-mobile > summary svg { width: 1.35rem; height: 1.35rem; }
.menu-mobile-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  z-index: 60;
}
.menu-mobile-panel a {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-weight: 500;
}
.menu-mobile-panel a:hover { background: var(--color-surface-2); color: var(--color-brand); }

@media (min-width: 60rem) {
  .nav-links { display: inline-flex; }
  .menu-mobile { display: none; }
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: var(--step-0);
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn-primary {
  background: var(--btn-bg);
  color: var(--color-on-brand);
}
.btn-primary:hover { background: var(--btn-bg-hover); transform: translateY(-2px); }
.btn-ghost {
  background: transparent;
  color: var(--color-heading);
  border-color: var(--color-border);
}
.btn-ghost:hover { border-color: var(--color-brand); color: var(--color-brand); transform: translateY(-2px); }

/* ------------------------------------------------------------------ */
/* Sections                                                            */
/* ------------------------------------------------------------------ */
main > section { padding-block: var(--space-xl); }
.section-head { max-width: 42rem; margin-bottom: var(--space-l); }
.section-head h2 { font-size: var(--step-2); }
.section-head p { color: var(--color-text-muted); font-size: var(--step-1); margin: 0; }
.eyebrow {
  display: inline-block;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: var(--space-2xs);
}

/* ------------------------------------------------------------------ */
/* Hero                                                                */
/* ------------------------------------------------------------------ */
.hero { padding-block: var(--space-2xl) var(--space-xl); }
.hero-grid {
  display: grid;
  gap: var(--space-l);
  align-items: center;
}
.hero h1 {
  font-size: var(--step-4);
  margin-bottom: var(--space-m);
}
.hero-sub {
  font-size: var(--step-1);
  color: var(--color-text-muted);
  max-width: 34rem;
  margin-bottom: var(--space-m);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--space-xs); }

.hero-figure {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  background: var(--color-surface);
}
.hero-figure img { width: 100%; }

@media (min-width: 62rem) {
  .hero-grid { grid-template-columns: 1.05fr 1.15fr; gap: var(--space-xl); }
}

/* ------------------------------------------------------------------ */
/* Features                                                            */
/* ------------------------------------------------------------------ */
.features { background: var(--color-surface); }
.feature-grid {
  display: grid;
  gap: var(--space-s);
  grid-template-columns: 1fr;
}
.feature-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-brand);
  border-radius: var(--radius);
  padding: var(--space-m);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.feature-card:nth-child(2) { border-left-color: var(--color-success); }
.feature-card:nth-child(3) { border-left-color: var(--color-warning); }
.feature-card:nth-child(4) { border-left-color: var(--color-brand-soft); }
.feature-card h3 { font-size: var(--step-1); }
.feature-card p { color: var(--color-text-muted); margin: 0; }
.feature-icon {
  width: 2.5rem; height: 2.5rem;
  margin-bottom: var(--space-xs);
  color: var(--color-brand);
}
.feature-card:nth-child(2) .feature-icon { color: var(--color-success); }
.feature-card:nth-child(3) .feature-icon { color: var(--color-warning); }
.feature-card:nth-child(4) .feature-icon { color: var(--color-brand-soft); }

@media (min-width: 40rem) { .feature-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 66rem) { .feature-grid { grid-template-columns: repeat(4, 1fr); } }

/* ------------------------------------------------------------------ */
/* Screenshots carousel                                                */
/* ------------------------------------------------------------------ */
.shots-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(88%, 46rem);
  gap: var(--space-s);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--space-s);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.shot {
  scroll-snap-align: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow);
}
.shot img { width: 100%; aspect-ratio: 1440 / 900; object-fit: cover; object-position: top left; background: #0D0F12; }
.shot figcaption {
  padding: var(--space-xs) var(--space-s);
  font-size: var(--step--1);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}
.shots-hint { font-size: var(--step--1); color: var(--color-text-muted); margin-top: var(--space-xs); }

/* ------------------------------------------------------------------ */
/* Stack                                                               */
/* ------------------------------------------------------------------ */
.stack { background: var(--color-surface); }
.badges { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.badge {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 2rem;
  background: var(--color-bg);
  color: var(--color-text);
}

/* ------------------------------------------------------------------ */
/* CTA final                                                           */
/* ------------------------------------------------------------------ */
.cta-final { text-align: center; }
.cta-final .container { max-width: 40rem; }
.cta-final h2 { font-size: var(--step-3); }
.cta-final p { color: var(--color-text-muted); font-size: var(--step-1); margin-bottom: var(--space-m); }

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-l);
  background: var(--color-bg);
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-l);
  align-items: center;
  justify-content: space-between;
}
.footer-brand { display: inline-flex; align-items: center; gap: var(--space-2xs); font-weight: 600; color: var(--color-heading); }
.footer-brand img { width: 1.4rem; height: 1.4rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-m); }
.footer-links a { color: var(--color-text-muted); font-size: var(--step--1); }
.footer-links a:hover { color: var(--color-brand); }
.footer-legal { font-size: var(--step--1); color: var(--color-text-muted); width: 100%; }

/* ------------------------------------------------------------------ */
/* Reduced motion: no smooth scroll, no decorative movement            */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .feature-card, .nav-links a::after { transition: none; }
  .btn:hover, .feature-card:hover { transform: none; }
}

/* ------------------------------------------------------------------ */
/* Scroll-in animation (progressive, never hides content by default)   */
/* ------------------------------------------------------------------ */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: reveal-in linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 22%;
    }
    @keyframes reveal-in {
      from { opacity: 0; transform: translateY(1.5rem); }
      to   { opacity: 1; transform: translateY(0); }
    }
  }
}
