/* ==========================================
   TesselBee — Design System & Styles
   ========================================== */

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

:root {
  /* --- The brand comes first ----------------------------------------------
     /static/brand/tokens.css (a copy of brand/tokens/tokens.css from the
     tesselbee-app repository, loaded before this file) defines the charter's
     roles: --surface, --surface-raised, --ink, --ink-muted, --ink-faint,
     --accent, --accent-fill, --on-accent, --accent-soft, --highlight,
     --line, --line-strong, the Nuit scale, the brand colours, Recursive
     (--font-sans, --font-mono) and the motion tokens. The page is dark only.
     Everything below is DERIVED from those roles; no colour is invented here.
     Never write `--x: var(--x)`: the variable would become invalid, silently.
     The names the site shares with the charter (--ink, --ink-faint,
     --surface-raised, --accent, --accent-soft, --font-mono, --ease-out,
     --ease-in-out) are the charter's own and are not redefined. */

  /* Accent, as a role. -rgb triplets exist because rgba() cannot take a hex.
     Cyan on Nuit is 8.8:1, Nuit on cyan (--on-accent) the same. */
  --accent-rgb: 60, 184, 252;
  --accent-on: var(--on-accent);           /* readable ON the accent */
  --accent-hover: color-mix(in srgb, var(--accent) 82%, var(--ink));
  --accent-mid: var(--accent);             /* accent text on the ground */
  --accent-mid-rgb: var(--accent-rgb);
  --accent-bright: var(--accent);
  --accent-bright-rgb: var(--accent-rgb);
  --accent-ink: var(--accent);
  /* The deep glow behind a hero: a large brand area, so the logo's indigo. */
  --accent-deep-rgb: 74, 51, 246;          /* --brand-indigo */

  /* Ground, surfaces, lines. */
  --ground: var(--surface);
  --surface-frame: var(--surface-raised);
  --veil: color-mix(in srgb, var(--surface) 86%, transparent);       /* scrolled nav */
  --veil-solid: color-mix(in srgb, var(--surface) 97%, transparent); /* mobile menu */
  --bg-card: var(--surface-raised);
  --surface-hover: color-mix(in srgb, var(--ink) 5%, transparent);
  --surface-glass: color-mix(in srgb, var(--surface-raised) 88%, transparent);
  --surface-hover-strong: color-mix(in srgb, var(--ink) 10%, transparent);
  --surface-sunk: var(--nuit-800);         /* a well inside a card: counts, io bars */
  --border: var(--line);
  --border-light: var(--line);
  --border-hover: var(--line-strong);

  /* Foreground tiers, measured on --surface and --surface-raised. */
  --ink-strong: var(--ink);                /* headings, 18.2:1 */
  --ink-bright: var(--nuit-100);
  --ink-body: var(--nuit-200);             /* body copy, 14.6:1 */
  --ink-soft: var(--ink-muted);            /* secondary copy, 10.1:1 */
  --ink-dim: var(--ink-faint);             /* the quietest text, 6.3:1 */

  --rule-quiet: var(--line-strong);        /* a marker that must not look like the accent */
  --shadow-strong: rgba(0, 0, 0, 0.55);
  --shadow-soft: rgba(0, 0, 0, 0.4);

  /* Spacing */
  --section-pad: clamp(80px, 10vw, 140px);
  --container-max: 1200px;

  /* Typography: Recursive, self-hosted (/static/fonts/fonts.css). */
  --font: var(--font-sans);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--ground);
  color: var(--ink-body);
  line-height: 1.6;
  overflow-x: hidden;
}

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

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

strong { color: var(--ink-strong); font-weight: 600; }

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 40px);
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 clamp(20px, 4vw, 40px);
  transition: background 0.4s, backdrop-filter 0.4s, border-color 0.4s;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: var(--veil);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom-color: var(--border);
}

.nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

/* The logo is a file (brand/logos), never live text: the horizontal
   logotype, 28 px high = 138 px wide (the charter's minimum is 120), its
   protection zone (H / 4) kept clear by the nav's own padding. */
.nav-logo {
  display: flex;
  align-items: center;
  padding: 7px 0;
}

.tb-logo {
  display: block;
  height: 28px;
  width: auto;
}

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

.lang-switch {
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-soft) !important;
  transition: color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.lang-switch:hover {
  color: var(--ink-strong) !important;
  border-color: var(--ink-muted);
}

.lang-switch::after {
  display: none !important;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color var(--duration-fast) var(--ease-out);
  position: relative;
}

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

.nav-links > a::after{
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width var(--duration-base) var(--ease-out);
}

.nav-links > a:hover::after{
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--focus-ring);
}

/* One primary button per view (the charter): the form's. The nav's CTA is
   the same action, so it stays a calm, accent-outlined button. */
.btn-nav {
  padding: 8px 16px;
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-nav:hover {
  background: var(--accent-soft);
}

.btn-primary {
  padding: 14px 28px;
  background: var(--accent-fill);
  color: var(--on-accent);
  border-color: var(--accent-fill);
}

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

.btn-lg {
  font-size: 0.95rem;
  padding: 16px 32px;
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 110;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink-body);
  border-radius: 2px;
  transition: transform var(--duration-base) var(--ease-in-out), opacity var(--duration-base) var(--ease-in-out);
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--veil-solid);
  backdrop-filter: blur(20px);
  z-index: 99;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.mobile-menu.open {
  opacity: 1;
  pointer-events: all;
}

.mobile-link {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink-body);
  transition: color var(--duration-fast) var(--ease-out);
}

.mobile-link:hover {
  color: var(--ink-strong);
}

.mobile-cta {
  margin-top: 16px;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: 72px;
}

/* A tag of the charter: accent on --accent-soft (7.3:1), mono capitals. */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 32px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}

/* --- Sections Common --- */
.section {
  padding: var(--section-pad) 0;
  position: relative;
}

.section-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
  padding: 5px 10px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

/* --- CTA --- */
.section-cta {
  padding-bottom: 0;
}

.cta-box {
  text-align: center;
  padding: clamp(48px, 6vw, 80px) clamp(24px, 4vw, 60px);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

.cta-box h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  color: var(--ink-strong);
  margin-bottom: 12px;
  letter-spacing: -0.03em;
  position: relative;
}

.cta-box p {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 36px;
  position: relative;
}

/* --- Footer --- */
.footer {
  padding: 80px 0 32px;
  border-top: 1px solid var(--border);
  margin-top: var(--section-pad);
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-tagline {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--ink-faint);
}

.footer h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.footer-contact p,
.footer-contact a {
  font-size: 0.9rem;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 4px;
}

.footer-contact a:hover {
  color: var(--accent-bright);
}

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-nav a {
  font-size: 0.9rem;
  color: var(--ink-faint);
  transition: color var(--duration-fast) var(--ease-out);
}

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

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--ink-dim);
}

/* --- Animations --- */
/* Cards arrive and settle: --duration-slow, --ease-out, no overshoot. With
   reduced motion, a fade only. */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-animate] { transform: none; transition: opacity var(--duration-slow) linear; }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .btn-nav { display: none; }
  .nav-toggle { display: flex; }
  .mobile-menu { display: flex; }

  .hero h1 {
    font-size: clamp(1.8rem, 6vw, 2.8rem);
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.6rem;
  }

  .cta-box {
    padding: 36px 20px;
  }
}
