/* ============================================================
   CSS RESET & BASE
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: dark;
  --bg-0:      #1a1a1a;
  --bg-1:      #1e1e1e;
  --bg-2:      #222222;
  --bg-3:      #252525;
  --accent:    #ff7a18;
  --accent-glow: rgba(255,122,24,.35);
  --hex-color: #6f8fa8;
  --hex-glow:  rgba(111,143,168,.3);
  --text-primary:   #f0f0f0;
  --text-secondary: #9a9a9a;
  --border:    rgba(255,255,255,.06);
  --nav-bg:    rgba(26,26,26,.8);
  --menu-bg:   rgba(20,20,20,.97);
  --card-bg:   rgba(255,255,255,.03);
  --footer-bg: #111;
  --max-w:     1200px;
  --radius:    8px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-0: #f4f6f8;
  --bg-1: #ffffff;
  --bg-2: #edf1f4;
  --bg-3: #f7f9fb;
  --text-primary: #17212b;
  --text-secondary: #5f6b76;
  --border: rgba(23,33,43,.12);
  --nav-bg: rgba(255,255,255,.86);
  --menu-bg: rgba(255,255,255,.98);
  --card-bg: rgba(255,255,255,.78);
  --footer-bg: #e7ebef;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-0);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background .25s ease, color .25s ease;
}

.icon-sprite { display: none; }

.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;
}

/* ============================================================
   UTILITY
============================================================ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ============================================================
   NAVIGATION
============================================================ */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  width: 130px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-decoration: none;
}

.nav-logo img {
  width: 70px;
  height: 128px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: .02em;
  transition: color .2s;
}

.nav-links a:hover { color: var(--text-primary); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.desktop-preferences {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.language-switch {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card-bg);
}

.language-option {
  min-width: 34px;
  min-height: 28px;
  padding: 0 .5rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font: 700 .72rem 'Inter', sans-serif;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease;
}

.language-option:hover { color: var(--text-primary); }

.language-option.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255,122,24,.24);
}

.theme-toggle {
  position: relative;
  width: 58px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.theme-track {
  position: absolute;
  inset: 1px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: rgba(255,122,24,.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
  transition: background .3s ease, border-color .3s ease, box-shadow .3s ease, transform .15s ease;
}

.theme-thumb {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 75%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.24);
  transform: translate(-50%, -50%);
  transition: left .35s cubic-bezier(.2,.8,.2,1), background .3s ease, box-shadow .3s ease;
}

.theme-symbol {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 22px;
  color: var(--text-primary);
  font-size: .78rem;
  line-height: 1;
  text-align: center;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  transition: opacity .3s ease, color .3s ease, transform .35s ease;
}

.theme-sun { left: 25%; opacity: .42; }
.theme-moon { left: 75%; color: #fff; opacity: 1; }

:root[data-theme="light"] .theme-track {
  background: rgba(255,122,24,.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

:root[data-theme="light"] .theme-thumb {
  left: 25%;
  background: #fff;
  box-shadow: 0 2px 9px rgba(23,33,43,.18);
}

:root[data-theme="light"] .theme-sun {
  color: var(--accent);
  opacity: 1;
  transform: translate(-50%, -50%) rotate(90deg) scale(1.05);
}

:root[data-theme="light"] .theme-moon {
  color: var(--text-secondary);
  opacity: .38;
  transform: translate(-50%, -50%) rotate(-35deg) scale(.88);
}

.theme-toggle:active .theme-track { transform: scale(.94); }

.mobile-preferences { display: none; }

.language-option:focus-visible,
.theme-toggle:focus-visible,
.burger:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============================================================
   HERO SECTION
============================================================ */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--bg-0);
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255,122,24,.16), transparent 42%);
  opacity: 0;
  animation: hero-flash 1.8s ease-out both;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 8rem 2rem 6rem;
  text-align: center;
  animation: hero-arrive .9s .55s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes hero-flash {
  0%   { opacity: 0; transform: scale(.35); }
  35%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.25); }
}

@keyframes hero-arrive {
  from { opacity: 0; transform: translateY(24px); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.hero-eyebrow {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(3.25rem, 8vw, 7rem);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.hero-title .accent { color: var(--accent); }

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 400;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.75;
}

.btn-primary {
  display: inline-block;
  padding: .9rem 2.4rem;
  background: var(--accent);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255,122,24,.4);
}

/* ============================================================
   HERO HEXAGON RING
   6 hexagons positioned on a circle, behind hero text
============================================================ */
#hex-ring {
  position: absolute;
  /* center of the ring */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  z-index: 1;
  pointer-events: none;
}

.ring-hex {
  position: absolute;
  /*
   * Flat-top hex: lato piatto in alto e in basso.
   * W = 200px, H = W * (sqrt(3)/2) = 200 * 0.866 = 173px
   */
  width: 200px;
  height: 173px;
  transform-origin: center center;
  filter: drop-shadow(0 0 20px rgba(111,143,168,.24));
  will-change: transform;
}

.ring-hex-inner {
  width: 100%;
  height: 100%;
  /*
   * Flat-top: lato piatto in alto/basso
   * (25%,0%) (75%,0%) (100%,50%) (75%,100%) (25%,100%) (0%,50%)
   */
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  background: var(--hex-color);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .22;
  transition: opacity .3s;
}

.ring-hex-inner svg {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: rgba(255,255,255,.6);
  stroke-width: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  #hero::before, .hero-content { animation: none; }
  .ring-hex { will-change: auto; }
}

/* ============================================================
   ANGLED SECTION DIVIDERS
============================================================ */
.skew-divider {
  height: 60px;
  overflow: hidden;
}

.skew-divider.down { transform: skewY(-1.8deg); margin-top: -30px; }
.skew-divider.up   { transform: skewY( 1.8deg); margin-bottom: -30px; }

/* ============================================================
   FEATURE SECTIONS
============================================================ */
.feature-section {
  padding: 6rem 2rem;
  position: relative;
}

.feature-section:nth-child(odd)  { background: var(--bg-1); }
.feature-section:nth-child(even) { background: var(--bg-2); }

.feature-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: center;
}

/* Alternate layout: even sections reverse column order */
.feature-inner.reverse { direction: rtl; }
.feature-inner.reverse > * { direction: ltr; }

.feature-visual {
  position: relative;
  width: 100%;
  height: 139px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-visual img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  max-width: 500px;
  height: 230px;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

/* Small hexagon icon */
.feature-hex {
  justify-self: center;
  width: 160px;
  height: 139px;  /* 160 * 0.866 */
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  background: var(--hex-color);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;            /* animated in by JS */
  transform: translateY(20px);
  transition: opacity .5s ease, transform .5s ease, box-shadow .3s, filter .3s;
  cursor: default;
}

.feature-hex.visible {
  opacity: 1;
  transform: translateY(0);
}

.feature-hex:hover {
  transform: translateY(-6px) !important;
  box-shadow: 0 0 32px var(--hex-glow);
  filter: brightness(1.15);
}

.feature-hex svg {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: rgba(255,255,255,.7);
  stroke-width: 1.5;
  transition: transform .3s;
}

.feature-hex:hover svg { transform: scale(1.12); }

.feature-heading {
  position: relative;
  margin-bottom: 1rem;
}

.feature-heading .feature-hex {
  position: absolute;
  top: 4px;
  left: -50px;
  width: 36px;
  height: 31px;
  justify-self: auto;
}

.feature-heading .feature-hex svg {
  width: 18px;
  height: 18px;
}

.feature-heading h3 { margin-bottom: 0; }

.feature-text h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.feature-text p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ============================================================
   SERVICES / CARDS SECTION
============================================================ */
#services {
  background: var(--bg-3);
  padding: 7rem 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: .75rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.cards-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,122,24,.3);
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
}

.card-icon {
  width: 48px;
  height: 48px;
  background: rgba(255,122,24,.12);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.card-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.8;
}

.card h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .6rem;
}

.card p {
  font-size: .9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================================================
   CTA SECTION
============================================================ */
#cta {
  background: var(--bg-1);
  padding: 7rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

#cta h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -.03em;
  margin-bottom: 1.25rem;
  position: relative;
}

#cta p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
  position: relative;
}

.btn-outline {
  display: inline-block;
  padding: .9rem 2.8rem;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius);
  cursor: pointer;
  background: transparent;
  transition: background .2s, color .2s, box-shadow .2s, transform .2s;
  position: relative;
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 30px rgba(255,122,24,.4);
  transform: translateY(-2px);
}

/* ============================================================
   FOOTER
============================================================ */
footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: .8rem;
  color: var(--text-secondary);
}

/* ============================================================
   BURGER MENU
============================================================ */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.burger span {
  display: block;
  height: 1.5px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: transform .25s, opacity .25s, background .2s;
}

.burger:hover span { background: var(--text-primary); }

/* Animated X state */
.burger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile dropdown */
.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  left: 0; right: 0;
  background: var(--menu-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem 1.5rem;
  z-index: 99;
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition: transform .22s ease, opacity .22s ease, visibility 0s .22s;
  pointer-events: none;
}

.mobile-menu.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
  pointer-events: auto;
}

.mobile-menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.mobile-menu a {
  display: block;
  padding: .65rem 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  transition: color .2s;
}

.mobile-menu ul li:last-child a { border-bottom: none; }
.mobile-menu a:hover { color: var(--text-primary); }

.mobile-preferences {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.preference-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-primary);
  font-size: .85rem;
  font-weight: 600;
}

.preference-row + .preference-row { margin-top: .9rem; }

/* Small laptops */
@media (min-width: 1025px) and (max-width: 1280px) {
  :root { --max-w: 1120px; }
  .feature-inner { gap: 4rem; }
  .feature-visual img { max-width: 470px; }
}

/* Large tablets */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --max-w: 900px; }
  .nav-inner { padding: 1rem 1.5rem; }
  .nav-logo { width: 96px; }
  .nav-links { gap: 1.1rem; }
  .nav-links a { font-size: .8rem; }
  .desktop-preferences { gap: .45rem; }
  .feature-section { padding: 5rem 1.5rem; }
  .feature-inner { gap: 3rem; }
  .feature-visual img { max-width: 390px; height: 210px; }
  .feature-text h3 { font-size: 1.3rem; }
  .ring-hex { width: 150px; height: 130px; }
  .ring-hex-inner svg { width: 39px; height: 39px; }
  #services, #cta { padding: 6rem 1.5rem; }
}

@media (max-width: 768px) {
  :root {
    --ring-hex-w: 110px;
    --ring-hex-h: 95px;
  }

  .nav-inner { padding: 1rem; }
  .nav-logo { width: 64px; justify-content: flex-start; }
  .nav-links { display: none; }
  .desktop-preferences { display: none; }
  .nav-actions { gap: 0; }
  .burger { display: flex; }
  .mobile-menu { display: block; }
  .mobile-preferences { display: block; }

  .hero-title { font-size: clamp(2.7rem, 12vw, 4.5rem); }

  .ring-hex {
    width: var(--ring-hex-w);
    height: var(--ring-hex-h);
  }

  .ring-hex-inner svg { width: 26px; height: 26px; }

  .feature-inner {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }

  /* always show hex on top on mobile */
  .feature-inner.reverse { direction: ltr; }
  .feature-hex { justify-self: center; }

  .feature-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
  }

  .feature-heading .feature-hex {
    position: static;
    flex: 0 0 auto;
  }

  .feature-heading h3 { text-align: left; }

  .cards-grid { grid-template-columns: 1fr; }

  footer { padding: 1.25rem 1rem; }
}

/* Small tablets */
@media (min-width: 481px) and (max-width: 768px) {
  .hero-content { padding-inline: 3rem; }
  .ring-hex-inner svg { width: 30px; height: 30px; }
  .feature-section { padding: 5rem 2.5rem; }
  .feature-visual img { max-width: 460px; }
  #services, #cta { padding-inline: 2.5rem; }
}

/* Phones */
@media (max-width: 480px) {
  :root { --ring-hex-w: 90px; --ring-hex-h: 78px; }
  .hero-content { padding: 7rem 1.25rem 5rem; }
  .hero-eyebrow { font-size: .66rem; letter-spacing: .16em; }
  .hero-subtitle { font-size: .95rem; line-height: 1.65; }
  .ring-hex-inner svg { width: 24px; height: 24px; }
  .feature-section { padding: 4.5rem 1.25rem; }
  .feature-inner { gap: 2.5rem; }
  .feature-visual img { height: 210px; }
  .feature-text h3 { font-size: 1.3rem; }
  .feature-text p { font-size: .95rem; }
  #services, #cta { padding: 5rem 1.25rem; }
  .card { padding: 2rem; }
  .mobile-menu { padding-inline: 1.25rem; }
}
