/* ═══════════════════════════════════════
   Sähköasennus Anttila Ky — 2026 Design
   Dark electric theme with OKLCH colors
   ═══════════════════════════════════════ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ═══ CSS Custom Properties ═══ */
@property --gradient-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 135deg;
}

:root {
  /* OKLCH Brand Colors */
  --brand: oklch(0.60 0.20 240);
  --brand-light: color-mix(in oklab, var(--brand) 40%, white);
  --brand-dark: color-mix(in oklab, var(--brand) 60%, black);

  /* Tinted Surfaces (not pure gray) */
  --surface-1: oklch(0.98 0.005 240);
  --surface-2: oklch(0.14 0.01 240);
  --surface-3: oklch(0.10 0.008 240);

  /* Text Colors */
  --text-primary: oklch(0.92 0.01 240);
  --text-secondary: oklch(0.60 0.02 240);

  /* Accent */
  --accent: oklch(0.75 0.25 60);

  /* Typography */
  --font-display: 'Rajdhani', sans-serif;
  --font-body: 'Outfit', sans-serif;

  /* Spacing (4px base unit) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--surface-3);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ═══ Custom Selection Color ═══ */
::selection {
  background: color-mix(in oklab, var(--brand) 30%, white);
  color: var(--surface-3);
}

/* ═══ Focus Styles (Accessibility) ═══ */
*:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ═══ Utility Classes ═══ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}

.section-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.glow-line {
  width: 60px;
  height: 3px;
  background: var(--brand);
  box-shadow: 0 0 12px var(--brand), 0 0 30px color-mix(in srgb, var(--brand) 40%, transparent);
  margin-bottom: 2rem;
}

/* ═══ Scroll-Driven Animations ═══ */
.section-reveal {
  animation: sectionReveal linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 70%;
}

@keyframes sectionReveal {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══ Emergency Banner ═══ */
.emergency-banner {
  background: var(--brand);
  color: var(--surface-3);
  padding: 0.6rem 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  position: relative;
  z-index: 100;
}

.emergency-banner a {
  color: var(--surface-3);
  text-decoration: none;
  font-weight: 700;
}

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--surface-3);
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.7);
  }
}

/* ═══ Navigation ═══ */
nav {
  position: sticky;
  top: 0;
  z-index: 90;
  background: color-mix(in srgb, var(--surface-3) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 12%, transparent);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-logo .bolt {
  color: var(--brand);
  font-size: 1.1em;
}

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

.nav-links a {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.25s;
}

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

.nav-cta {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.6rem 1.4rem;
  background: var(--brand);
  color: var(--surface-3);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  transition: box-shadow 0.3s, transform 0.2s;
}

.nav-cta:hover {
  box-shadow: 0 0 20px color-mix(in srgb, var(--brand) 50%, transparent);
  transform: translateY(-1px);
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: 0.3s;
}

/* ═══ Hero Section ═══ */
.hero {
  position: relative;
  min-height: 110vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface-3);
  padding: 80px 0 300px 0;
}

/* Circuit pattern background */
.circuit-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.035;
}

.circuit-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--brand) 1px, transparent 1px),
    linear-gradient(90deg, var(--brand) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* Lightning bolt decoration */
.hero-bolt {
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(200px, 30vw, 480px);
  height: clamp(300px, 50vw, 700px);
  opacity: 0.06;
  pointer-events: none;
}

.hero-bolt::before {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: polygon(
    55% 0%, 30% 42%, 52% 42%,
    20% 100%, 75% 50%, 52% 50%,
    80% 8%
  );
  background: linear-gradient(var(--gradient-angle), var(--brand), var(--brand-light));
  animation: rotateGradient 8s linear infinite;
}

@keyframes rotateGradient {
  to {
    --gradient-angle: 495deg;
  }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

.hero-title .highlight {
  color: var(--brand);
  text-shadow: 0 0 40px color-mix(in srgb, var(--brand) 30%, transparent);
}

.hero-subtitle {
  font-weight: 300;
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  padding: 1rem 2rem;
  background: var(--brand);
  color: var(--surface-3);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: box-shadow 0.3s ease-out, transform 0.2s ease-out;
  min-height: 44px;
}

.btn-primary:hover {
  box-shadow: 0 0 30px color-mix(in srgb, var(--brand) 50%, transparent), 0 0 60px color-mix(in srgb, var(--brand) 20%, transparent);
  transform: translateY(-2px);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  padding: 1rem 2rem;
  background: transparent;
  color: var(--brand);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: border-color 0.3s, background 0.3s;
  min-height: 44px;
}

.btn-outline:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
}

/* Hero Stats Bar */
.hero-stats {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  border-top: 1px solid color-mix(in srgb, var(--brand) 15%, transparent);
  background: color-mix(in srgb, var(--surface-3) 85%, transparent);
  backdrop-filter: blur(12px);
}

.hero-stats-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.stat-item {
  padding: 1.5rem 2rem;
  border-right: 1px solid color-mix(in srgb, var(--brand) 10%, transparent);
  text-align: center;
}

.stat-item:last-child {
  border-right: none;
}

.stat-number {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  color: var(--brand);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.25rem;
}

/* ═══ Services Section ═══ */
.services {
  padding: 8rem 0;
  position: relative;
  background: var(--surface-3);
}

.services-header {
  margin-bottom: 4rem;
  max-width: 600px;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.service-card {
  background: var(--surface-2);
  padding: clamp(2rem, 3vw, 3rem);
  position: relative;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.service-card:hover {
  transform: translateY(-4px);
}

/* Glowing top border on hover */
.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand);
  box-shadow: 0 0 16px var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.service-card:hover::before {
  transform: scaleX(1);
}

/* Service Images */
.service-image {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 2px;
  margin-bottom: 1.5rem;
  display: block;
}

.service-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  position: relative;
}

.service-icon::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  clip-path: polygon(
    60% 0%, 25% 45%, 48% 45%,
    15% 100%, 80% 48%, 55% 48%,
    85% 5%
  );
  background: var(--brand);
  opacity: 0.8;
  transition: opacity 0.3s;
}

.service-card:hover .service-icon::before {
  opacity: 1;
}

.service-icon.icon-shield::before {
  clip-path: polygon(50% 0%, 95% 15%, 90% 65%, 50% 100%, 10% 65%, 5% 15%);
}

.service-icon.icon-gauge::before {
  clip-path: polygon(50% 5%, 85% 20%, 95% 55%, 80% 85%, 20% 85%, 5% 55%, 15% 20%);
}

.service-number {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 4rem;
  color: var(--brand);
  opacity: 0.06;
  position: absolute;
  bottom: 1rem;
  right: 1.5rem;
  line-height: 1;
}

.service-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.service-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.service-price {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ═══ About Section ═══ */
.about {
  padding: 8rem 0;
  position: relative;
  background: var(--surface-2);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(3rem, 6vw, 6rem);
  align-items: start;
}

.about-text p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.about-text p strong {
  color: var(--text-primary);
  font-weight: 600;
}

.cert-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1rem;
}

.cert-badge {
  background: var(--surface-3);
  border: 1px solid color-mix(in srgb, var(--brand) 15%, transparent);
  padding: 1.5rem;
  text-align: center;
  position: relative;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  transition: border-color 0.3s, box-shadow 0.3s;
}

.cert-badge:hover {
  border-color: var(--brand);
  box-shadow: 0 0 20px color-mix(in srgb, var(--brand) 15%, transparent);
}

.cert-badge-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 0.75rem;
  position: relative;
}

.cert-badge-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0%, 95% 15%, 90% 65%, 50% 100%, 10% 65%, 5% 15%);
  background: var(--brand);
  opacity: 0.7;
}

.cert-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.cert-detail {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ═══ Emergency CTA Section ═══ */
.emergency {
  padding: 6rem 0;
  position: relative;
  overflow: hidden;
  background: var(--surface-3);
}

.emergency-inner {
  position: relative;
  background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
  padding: clamp(3rem, 5vw, 5rem);
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 24px 100%, 0 calc(100% - 24px));
  overflow: hidden;
}

.emergency-bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.08;
  pointer-events: none;
}

/* Animated glow border */
.emergency-inner::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  animation: glowSlide 3s ease-in-out infinite;
  z-index: 1;
}

@keyframes glowSlide {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

.emergency-bolt {
  position: absolute;
  right: -2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 200px;
  height: 300px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

.emergency-bolt::before {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: polygon(
    55% 0%, 30% 42%, 52% 42%,
    20% 100%, 75% 50%, 52% 50%,
    80% 8%
  );
  background: var(--brand);
}

.emergency-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
}

.emergency-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  padding: 0.4rem 1rem;
  margin-bottom: 1rem;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--brand);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

.emergency h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  margin-bottom: 0.75rem;
}

.emergency p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 520px;
}

.emergency-phone {
  text-align: center;
}

.emergency-phone a {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  color: var(--brand);
  text-decoration: none;
  letter-spacing: 0.02em;
  text-shadow: 0 0 30px color-mix(in srgb, var(--brand) 40%, transparent);
  transition: text-shadow 0.3s;
}

.emergency-phone a:hover {
  text-shadow: 0 0 40px color-mix(in srgb, var(--brand) 60%, transparent), 0 0 80px color-mix(in srgb, var(--brand) 25%, transparent);
}

.emergency-phone span {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 0.25rem;
}

/* ═══ Footer ═══ */
footer {
  background: var(--surface-2);
  border-top: 1px solid color-mix(in srgb, var(--brand) 10%, transparent);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand .nav-logo {
  display: inline-block;
  margin-bottom: 1rem;
}

.footer-brand p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 280px;
}

.footer-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.6rem;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.25s;
}

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

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-contact-item .label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  display: block;
  margin-bottom: 0.15rem;
}

.footer-contact-item a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.25s;
}

.footer-contact-item a:hover {
  color: var(--brand);
}

.footer-bottom {
  border-top: 1px solid color-mix(in srgb, var(--brand) 8%, transparent);
  padding-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

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

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

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  .nav-cta {
    display: none;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-3);
    border-bottom: 1px solid color-mix(in srgb, var(--brand) 15%, transparent);
    padding: 1.5rem clamp(1.25rem, 4vw, 3rem);
    gap: 1rem;
  }

  .hero {
    min-height: auto;
    padding: 6rem 0 8rem;
  }

  .hero-bolt {
    opacity: 0.03;
  }

  .hero-stats-inner {
    grid-template-columns: 1fr 1fr;
  }

  .stat-item:nth-child(2) {
    border-right: none;
  }

  .services {
    padding: 4rem 0;
  }

  .services-grid {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .about {
    padding: 4rem 0;
  }

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

  .emergency {
    padding: 4rem 0;
  }

  .emergency-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .emergency-phone {
    margin-top: 1rem;
  }

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

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero-stats-inner {
    grid-template-columns: 1fr 1fr;
  }

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

/* ═══ Reduced Motion Support ═══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
