@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800&family=Barlow:wght@400;500;600&display=swap');

:root {
  --c-bg: #171717;
  --c-surface: #202020;
  --c-surface2: #2a2a2a;
  --c-border: rgba(255,255,255,0.11);
  --c-border2: rgba(255,255,255,0.18);
  --c-text: #f0ede8;
  --c-muted: #9a9a9a;
  --c-accent: #c10e1a;
  --c-accent2: #e8f0fc;
  --c-blue: #60a5fa;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Barlow', sans-serif;
  --radius: 10px;
  --radius-lg: 16px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
}

/* NAV */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0 2rem;
  height: 64px;
  background: rgba(13,13,13,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
}
.nav-links {
  margin-left: auto;
}
.nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}
.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--c-muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--c-text); }
.nav-cta {
  background: var(--c-accent) !important;
  color: #0d0d0d !important;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 600 !important;
  font-size: 13px !important;
}
.nav-cta:hover { opacity: 0.9; }
.nav-hamburger { display: none; cursor: pointer; flex-direction: column; gap: 5px; }
.nav-hamburger span { width: 22px; height: 2px; background: var(--c-text); display: block; }
.nav-mobile { display: none; }

@media (max-width: 700px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-mobile {
    display: none;
    position: fixed; top: 64px; left: 0; right: 0;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 1.5rem 2rem;
    flex-direction: column; gap: 1.25rem;
    z-index: 99;
  }
  .nav-mobile.open { display: flex; }
  .nav-mobile a { font-size: 16px; font-weight: 500; color: var(--c-muted); text-decoration: none; }
  .nav-mobile a.active, .nav-mobile a:hover { color: var(--c-text); }
}

/* FOOTER */
footer {
  border-top: 1px solid var(--c-border);
  padding: 3rem 2rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  margin-top: 4rem;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 600px) { footer { grid-template-columns: 1fr; } }

.footer-brand p { font-size: 13px; color: var(--c-muted); margin-top: 8px; line-height: 1.6; }
.footer-col h4 { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); margin-bottom: 12px; }
.footer-col a { display: block; font-size: 14px; color: var(--c-muted); text-decoration: none; margin-bottom: 8px; transition: color 0.2s; }
.footer-col a:hover { color: var(--c-text); }
.footer-col p { font-size: 14px; color: var(--c-muted); margin-bottom: 6px; }
.footer-bottom {
  text-align: center; font-size: 12px; color: var(--c-muted);
  padding: 1.5rem 2rem 1rem;
  border-top: 1px solid var(--c-border);
}

/* UTILITIES */
.container { max-width: 1100px; margin: 0 auto; padding: 0 2rem; }
.page-top { padding-top: 64px; }
.section { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }
.label {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 10px;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.1; }
h1 { font-size: clamp(44px, 7vw, 82px); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: clamp(32px, 4vw, 48px); }
h3 { font-size: 22px; font-weight: 700; }
.text-accent { color: var(--c-accent); }
.text-muted { color: var(--c-muted); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--c-accent);
  color: #0d0d0d;
}
.btn-primary:hover { background: #a50d16; transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--c-text);
  border: 1px solid var(--c-border2);
}
.btn-outline:hover { border-color: var(--c-accent); color: var(--c-accent); }

/* Divider line */
.divider { border: none; border-top: 1px solid var(--c-border); margin: 0; }

/* Card */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--c-border2); transform: translateY(-2px); }

/* Fade-in on scroll */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ============================================
   BACKGROUND LIFE & TEXTURE
   ============================================ */

/* Animated noise grain overlay on body */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* Floating ambient orbs behind content */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 50% 35% at 15% 20%, rgba(193,14,26,0.04) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 85% 75%, rgba(193,14,26,0.03) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(255,255,255,0.012) 0%, transparent 70%);
  animation: ambientShift 18s ease-in-out infinite alternate;
}
@keyframes ambientShift {
  0%   { opacity: 1; transform: scale(1) translate(0, 0); }
  33%  { opacity: 0.7; transform: scale(1.05) translate(1%, -1%); }
  66%  { opacity: 0.9; transform: scale(0.97) translate(-1%, 1%); }
  100% { opacity: 1; transform: scale(1.03) translate(0.5%, 0.5%); }
}

/* Make sure content sits above the bg effects */
nav, footer, .footer-bottom, .page-top, section, .container {
  position: relative;
  z-index: 1;
}

/* Subtle diagonal line pattern on surfaces */
.services-strip {
  background-image: linear-gradient(var(--c-surface), var(--c-surface)),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(255,255,255,0.012) 8px,
      rgba(255,255,255,0.012) 9px
    );
  background-blend-mode: normal;
}

/* Nav gets a subtle glow line at bottom on scroll */
nav {
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 1px 0 rgba(193,14,26,0.15);
}

/* ============================================
   IMAGE STYLING — blend into dark theme
   ============================================ */

/* All project/gallery images get dark treatment */
.project-img img,
.ev-right img,
[style*="aspect-ratio"] img {
  filter: brightness(0.88) contrast(1.08) saturate(0.85);
  transition: filter 0.4s ease, transform 0.4s ease;
}

.project-card:hover .project-img img,
[style*="aspect-ratio"]:hover img {
  filter: brightness(0.96) contrast(1.05) saturate(0.95);
}

/* Photo strip on homepage */
.photo-strip img {
  filter: brightness(0.82) contrast(1.1) saturate(0.75) sepia(0.08);
  transition: filter 0.5s ease, transform 0.5s ease;
}
.photo-strip img:hover {
  filter: brightness(0.92) contrast(1.06) saturate(0.9);
}

/* Gallery images on latausasemat */
.laturi-gallery img {
  filter: brightness(0.85) contrast(1.1) saturate(0.8);
  transition: filter 0.4s ease, transform 0.4s ease;
}
.laturi-gallery > div:hover img {
  filter: brightness(0.95) contrast(1.05) saturate(0.92);
  transform: scale(1.04);
}

/* Palvelut service photos */
.palvelu-photos img {
  filter: brightness(0.83) contrast(1.09) saturate(0.78);
  transition: filter 0.4s ease;
}
.palvelu-photos img:hover {
  filter: brightness(0.93) contrast(1.05) saturate(0.9);
}

/* ev-right photo grid */
.ev-right {
  overflow: hidden;
}
.ev-right img {
  filter: brightness(0.8) contrast(1.12) saturate(0.75);
}
.ev-right div:hover img {
  filter: brightness(0.92) contrast(1.06) saturate(0.88);
}

/* ============================================
   SECTION BACKGROUND VARIETY
   ============================================ */

/* Alternate sections get very subtle surface tint */
.section:nth-child(even) > .container {
  background: none;
}

/* Hero gets a more dramatic top-down vignette */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--c-bg));
  pointer-events: none;
  z-index: 1;
}
.hero-content { z-index: 2; }

/* Cards get a very subtle inner highlight on top edge */
.card,
.info-card,
.about-card,
.review-card,
.project-card,
.calc-wrap,
.ev-highlight {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Accent line on section labels */
.label::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 2px;
  background: var(--c-accent);
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 1px;
}

/* ============================================
   SCROLL REVEAL STAGGER
   ============================================ */
.cards-grid .card:nth-child(1) { transition-delay: 0s; }
.cards-grid .card:nth-child(2) { transition-delay: 0.08s; }
.cards-grid .card:nth-child(3) { transition-delay: 0.16s; }
.cards-grid .card:nth-child(4) { transition-delay: 0.24s; }

.projects-grid .project-card:nth-child(1) { transition-delay: 0s; }
.projects-grid .project-card:nth-child(2) { transition-delay: 0.07s; }
.projects-grid .project-card:nth-child(3) { transition-delay: 0.14s; }
.projects-grid .project-card:nth-child(4) { transition-delay: 0.21s; }
.projects-grid .project-card:nth-child(5) { transition-delay: 0.28s; }
.projects-grid .project-card:nth-child(6) { transition-delay: 0.35s; }


/* Palvelu kuville */
.palvelu-photos img {
  transition: transform 0.3s ease;
}

.palvelu-photos img:hover {
  transform: scale(1.05);
}


@media (max-width: 768px) {
  .palvelu-photos {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.theme-toggle {
  background: none;
  border: 1px solid var(--c-border2);
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--c-muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--c-text); background: var(--c-surface2); }
.theme-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sun { display: none; }
.icon-moon { display: block; }

/* Logo variants */
.logo-dark { display: block !important; }
.logo-light { display: none !important; }

/* ============================================
   LIGHT THEME
   ============================================ */
html[data-theme="light"] {
  --c-bg: #f2f1ef;
  --c-surface: #ffffff;
  --c-surface2: #e8e6e2;
  --c-border: rgba(0,0,0,0.10);
  --c-border2: rgba(0,0,0,0.20);
  --c-text: #1a1a1a;
  --c-muted: #5c5c5c;
  --c-blue: #2563eb;
  --c-accent2: #1a1a2e;
}

html[data-theme="light"] nav {
  background: rgba(242,241,239,0.95);
  box-shadow: 0 1px 0 rgba(193,14,26,0.10);
}

html[data-theme="light"] .nav-mobile {
  background: var(--c-surface);
}

html[data-theme="light"] body::before {
  opacity: 0.035;
}

html[data-theme="light"] body::after {
  background:
    radial-gradient(ellipse 50% 35% at 15% 20%, rgba(193,14,26,0.05) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 85% 75%, rgba(193,14,26,0.04) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(0,0,0,0.02) 0%, transparent 70%);
}

html[data-theme="light"] .services-strip {
  background-image: linear-gradient(var(--c-surface), var(--c-surface)),
    repeating-linear-gradient(
      -45deg,
      transparent, transparent 8px,
      rgba(0,0,0,0.018) 8px, rgba(0,0,0,0.018) 9px
    );
}

html[data-theme="light"] .card,
html[data-theme="light"] .info-card,
html[data-theme="light"] .about-card,
html[data-theme="light"] .project-card,
html[data-theme="light"] .calc-wrap,
html[data-theme="light"] .ev-highlight {
  box-shadow: 0 1px 4px rgba(0,0,0,0.07), inset 0 1px 0 rgba(255,255,255,0.8);
}

html[data-theme="light"] .btn-primary { color: #fff; }
html[data-theme="light"] .nav-cta { color: #fff !important; }

/* Light mode logo — !important ohittaa inline display:none/block */
html[data-theme="light"] .logo-dark { display: none !important; }
html[data-theme="light"] .logo-light { display: block !important; }

/* Light mode icon toggle */
html[data-theme="light"] .icon-sun { display: block; }
html[data-theme="light"] .icon-moon { display: none; }

/* Light mode image filters — luonnollisemmat */
html[data-theme="light"] .project-img img,
html[data-theme="light"] [style*="aspect-ratio"] img {
  filter: brightness(1) contrast(1.02) saturate(0.95);
}
html[data-theme="light"] .project-card:hover .project-img img,
html[data-theme="light"] [style*="aspect-ratio"]:hover img {
  filter: brightness(1.03) contrast(1.01) saturate(1);
}
html[data-theme="light"] .photo-strip img {
  filter: brightness(0.97) contrast(1.03) saturate(0.92);
}
html[data-theme="light"] .photo-strip img:hover {
  filter: brightness(1.01) contrast(1.01) saturate(0.97);
}
html[data-theme="light"] .laturi-gallery img {
  filter: brightness(0.97) contrast(1.02) saturate(0.93);
}
html[data-theme="light"] .laturi-gallery > div:hover img {
  filter: brightness(1.02) contrast(1.01) saturate(0.98);
}
html[data-theme="light"] .palvelu-photos img {
  filter: brightness(0.97) contrast(1.02) saturate(0.93);
}
html[data-theme="light"] .ev-right img {
  filter: brightness(0.95) contrast(1.03) saturate(0.9);
}
html[data-theme="light"] .ev-right div:hover img {
  filter: brightness(1.01) contrast(1.01) saturate(0.97);
}

/* ============================================
   RESPONSIVE GRID UTILITIES
   Käytetään korvaamaan inline grid-tyylit
   ============================================ */
.r-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.r-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.r-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* Tablet: 700px tai alle */
@media (max-width: 700px) {
  .r-grid-2 { grid-template-columns: 1fr; }
  .r-grid-3 { grid-template-columns: 1fr 1fr; }
  .r-grid-4 { grid-template-columns: 1fr 1fr; }
}

/* Puhelin: 480px tai alle */
@media (max-width: 480px) {
  .r-grid-2 { grid-template-columns: 1fr; }
  .r-grid-3 { grid-template-columns: 1fr; }
  .r-grid-4 { grid-template-columns: 1fr 1fr; }
}

/* Pieni puhelin: 360px tai alle */
@media (max-width: 360px) {
  .r-grid-4 { grid-template-columns: 1fr; }
}

/* ============================================
   ISOT NÄYTÖT (1400px+)
   ============================================ */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
}

/* hero-stats mobiilissa */
@media (max-width: 480px) {
  .hero-stats {
    gap: 1.2rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  .hero-stats > * {
    min-width: 120px;
    text-align: center;
  }
}