/* ============================================================
   Rakennuspalvelu Koistinen Oy — Main Stylesheet
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --primary: #E85D04;
  --primary-dark: #c44d03;
  --secondary: #1A1A2E;
  --accent: #F8C537;
  --dark: #0D0D1A;
  --light: #F5F5F0;
  --white: #ffffff;
  --text: #1A1A2E;
  --text-muted: #6b7280;
  --text-light: rgba(255,255,255,0.85);

  --font-heading: 'Oswald', sans-serif;
  --font-body: 'Instrument Sans', sans-serif;

  --radius: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);

  --container: 1200px;
  --gap: clamp(1rem, 3vw, 2rem);
  --section-pad: clamp(4rem, 8vw, 7rem);

  --transition: 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--white);
  overflow-x: hidden;
}

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

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

ul { list-style: none; }

address { font-style: normal; }

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.4rem, 5.5vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.75rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }

p { max-width: 65ch; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border-color: rgba(255,255,255,0.6);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--white);
  color: var(--white);
}

.btn-accent {
  background: var(--accent);
  color: var(--dark);
  border-color: var(--accent);
}
.btn-accent:hover {
  background: #e6b320;
  border-color: #e6b320;
  color: var(--dark);
}

.btn-sm { padding: 0.6rem 1.4rem; font-size: 0.875rem; }
.btn-lg { padding: 1.1rem 2.8rem; font-size: 1.125rem; }

/* --- Section Header --- */
.section-header {
  text-align: center;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-eyebrow {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.75rem;
  max-width: none;
}

.section-eyebrow.light { color: var(--accent); }

.section-desc {
  margin: 0.75rem auto 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 0;
  background: transparent;
  transition: background var(--transition), box-shadow var(--transition), padding var(--transition);
}

.site-header.scrolled {
  background: var(--secondary);
  box-shadow: 0 2px 20px rgba(0,0,0,0.25);
  padding: 0.65rem 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  color: var(--white);
}

.logo-main {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.logo-sub {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.main-nav a {
  color: rgba(255,255,255,0.85);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}

.main-nav a:hover { color: var(--white); background: rgba(255,255,255,0.08); }

.main-nav .nav-cta {
  background: var(--primary);
  color: var(--white);
  padding: 0.5rem 1.25rem;
}

.main-nav .nav-cta:hover {
  background: var(--primary-dark);
  color: var(--white);
}

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

.hamburger span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  background-image: url(images/hero.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--white);
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(13, 13, 26, 0.88) 0%,
    rgba(26, 26, 46, 0.75) 50%,
    rgba(13, 13, 26, 0.65) 100%
  );
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(13,13,26,0.6) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 8rem 0 5rem;
  max-width: 780px;
}

.hero-eyebrow {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  max-width: none;
}

.hero-headline {
  color: var(--white);
  margin-bottom: 1.25rem;
  text-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

.hero-headline span { color: var(--primary); }

.hero-sub {
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  color: rgba(255,255,255,0.9);
  margin-bottom: 2rem;
  max-width: 55ch;
}

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

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.hero-trust li {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.8);
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255,255,255,0.5);
  animation: bounce 2s ease-in-out infinite;
  transition: color var(--transition);
}

.hero-scroll:hover { color: var(--white); }

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* Clip divider at bottom of hero */
.hero::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--primary);
  clip-path: polygon(0 100%, 100% 0%, 100% 100%);
  z-index: 2;
}

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
  background: var(--primary);
  padding: 3rem 0;
  position: relative;
}

.stats-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.5rem 3rem;
  flex: 1;
  min-width: 180px;
}

.stat-number {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  color: var(--white);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.4rem;
}

.stat-divider {
  width: 1px;
  height: 60px;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

/* ============================================================
   PAIN POINTS
   ============================================================ */
.pain-points {
  background: var(--light);
  padding: var(--section-pad) 0;
  position: relative;
}

.pain-points::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--light);
  clip-path: polygon(0 0, 100% 100%, 100% 0);
}

.pain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

.pain-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary);
  transition: transform var(--transition), box-shadow var(--transition);

  animation: fadeInUp linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 80%;
}

.pain-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.pain-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.pain-card h3 {
  margin-bottom: 0.75rem;
  color: var(--secondary);
}

.pain-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: none;
}

/* ============================================================
   SERVICES
   ============================================================ */
.services {
  background: var(--white);
  padding: var(--section-pad) 0;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: var(--gap);
}

.service-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);

  animation: fadeInUp linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 80%;
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.service-img-wrap {
  height: 220px;
  overflow: hidden;
  flex-shrink: 0;
}

.service-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.service-card:hover .service-img-wrap img {
  transform: scale(1.06);
}

.service-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.75rem;
}

.service-body h3 {
  color: var(--secondary);
}

.service-body p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: none;
  flex: 1;
}

.service-price {
  font-size: 1rem;
  color: var(--text);
  max-width: none;
  flex: unset !important;
}

.service-price strong {
  color: var(--primary);
  font-size: 1.2rem;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about {
  background: var(--secondary);
  color: var(--white);
  padding: var(--section-pad) 0;
  position: relative;
  overflow: hidden;
}

.about::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--secondary);
  clip-path: polygon(0 100%, 100% 0, 0 0);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: center;
}

.about-img-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);

  animation: fadeInUp linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 80%;
}

.about-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4/3;
}

.about-badge {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.badge-year {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
}

.badge-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.about-content {
  animation: fadeInUp linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 80%;
}

.about-content .section-eyebrow { color: var(--accent); }

.about-content h2 {
  color: var(--white);
  margin-bottom: 1.25rem;
}

.about-content p {
  color: rgba(255,255,255,0.8);
  margin-bottom: 1rem;
}

.about-features {
  margin: 1.5rem 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.about-features li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.feature-icon {
  color: var(--primary);
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.about-features strong {
  display: block;
  color: var(--white);
  font-family: var(--font-heading);
  font-weight: 600;
}

.about-features span {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.65);
}

/* ============================================================
   TESTIMONIALS
   ============================================================ */
.testimonials {
  background: var(--dark);
  padding: var(--section-pad) 0;
  position: relative;
}

.testimonials .section-header h2 { color: var(--white); }
.testimonials .section-eyebrow { color: var(--accent); }

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap);
}

.testimonial-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform var(--transition), background var(--transition);

  animation: fadeInUp linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 80%;
}

.testimonial-card:hover {
  transform: translateY(-6px);
  background: rgba(255,255,255,0.07);
}

.testimonial-stars {
  color: var(--accent);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

.testimonial-text {
  color: rgba(255,255,255,0.85);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.7;
  flex: 1;
  max-width: none;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.author-name {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--white);
  font-style: normal;
}

.author-location {
  display: block;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
}

/* ============================================================
   CTA SECTION
   ============================================================ */
.cta-section {
  position: relative;
  background-image: url(images/cta-bg.jpg);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  padding: var(--section-pad) 0;
  color: var(--white);
  text-align: center;
  overflow: hidden;
}

.cta-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(232, 93, 4, 0.92) 0%,
    rgba(13, 13, 26, 0.9) 100%
  );
  z-index: 1;
}

.cta-content {
  position: relative;
  z-index: 2;
}

.cta-content h2 {
  color: var(--white);
  margin-bottom: 1rem;
}

.cta-content p {
  color: rgba(255,255,255,0.85);
  font-size: 1.1rem;
  margin: 0 auto 2.5rem;
  max-width: 55ch;
}

.cta-contacts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.cta-contact-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 0.85rem 1.5rem;
  color: var(--white);
  transition: background var(--transition), transform var(--transition);
  text-align: left;
}

.cta-contact-item:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-3px);
  color: var(--white);
}

.cta-contact-icon { font-size: 1.3rem; }

.cta-contact-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}

.cta-contact-value {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,0.7);
  padding: clamp(3rem, 6vw, 5rem) 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr;
  gap: clamp(2rem, 4vw, 4rem);
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-brand .logo-main { color: var(--white); }
.footer-brand p {
  margin-top: 1rem;
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 32ch;
}

.footer-nav h3,
.footer-contact h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.footer-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-nav a {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.65);
  transition: color var(--transition);
}

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

.footer-contact address p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  max-width: none;
}

.footer-contact a {
  color: rgba(255,255,255,0.65);
  transition: color var(--transition);
}

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

.footer-bottom {
  padding: 1.25rem 0;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
  text-align: center;
  max-width: none;
}

/* ============================================================
   SCROLL-DRIVEN ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fallback for browsers without animation-timeline */
@supports not (animation-timeline: view()) {
  .pain-card,
  .service-card,
  .about-img-wrap,
  .about-content,
  .testimonial-card {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-img-wrap {
    max-height: 360px;
  }

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

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .hamburger { display: flex; }

  .main-nav {
    position: fixed;
    inset: 0;
    background: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    z-index: 999;
  }

  .main-nav.open {
    opacity: 1;
    pointer-events: all;
  }

  .main-nav ul {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .main-nav a {
    font-size: 1.5rem;
    padding: 0.75rem 2rem;
  }

  .stat-divider { display: none; }

  .stats-grid {
    gap: 1.5rem;
  }

  .stat-item {
    flex: 0 0 45%;
    padding: 0.5rem 1rem;
  }

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

  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .cta-contacts {
    flex-direction: column;
    align-items: center;
  }

  .cta-contact-item {
    width: 100%;
    max-width: 320px;
  }
}
