/**
 * Rautakirja — Esittelysivun tyylitiedosto (CSS)
 *
 * Sisältää Material 3 -värijärjestelmän, vaalean ja tumman teeman määrittelyt,
 * responsiivisen asettelun sekä virallisen ja selkeän typografian.
 */

/* ─── 1. CSS-muuttujat ja teemat ─── */
:root {
  /* Fonttiperheet */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Vaalean teeman oletusvärit */
  --bg-color: #f8fafc;
  --surface-color: #ffffff;
  --surface-variant: #f1f5f9;
  --surface-container-high: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  
  --primary-color: #1e88e5;
  --primary-hover: #1976d2;
  --primary-container: #e0f2fe;
  --primary-container-border: #bae6fd;
  --on-primary: #ffffff;
  --on-primary-container: #0369a1;

  /* Kaavion väripaletti (Vaalea) */
  --chart-actual: #1e88e5;
  --chart-actual-alpha: rgba(30, 136, 229, 0.22);
  --chart-epley: #dc2626;
  --chart-nuzzo: #d97706;
  --chart-nuzzo-alpha: rgba(217, 119, 6, 0.14);
  --chart-development: #059669;
  --chart-grid: rgba(226, 232, 240, 0.8);

  /* Siirtymäajat */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;

  /* Varjot */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* Tumman teeman värit (Neutraali musta-harmaa / monokromi) */
[data-theme='dark'] {
  --bg-color: #09090b;
  --surface-color: #121215;
  --surface-variant: #18181b;
  --surface-container-high: #202024;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border-color: #27272a;
  --border-subtle: #1f1f23;

  --primary-color: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-container: #27272a;
  --primary-container-border: #3f3f46;
  --on-primary: #ffffff;
  --on-primary-container: #e4e4e7;

  /* Kaavion väripaletti (Tumma) */
  --chart-actual: #3b82f6;
  --chart-actual-alpha: rgba(59, 130, 246, 0.22);
  --chart-epley: #f87171;
  --chart-nuzzo: #fbbf24;
  --chart-nuzzo-alpha: rgba(251, 191, 36, 0.14);
  --chart-development: #34d399;
  --chart-grid: rgba(63, 63, 70, 0.4);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
}

/* ─── 2. Perusasetukset ja Reset ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── 3. Sivun päärunko ja layout ─── */
.site-wrapper {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem 3rem 1rem;
  flex: 1;
}

.site-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-top: 1.5rem;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* ─── 4. Banner ja Yläpalkin ohjaimet ─── */
.banner-container {
  position: relative;
  width: 100%;
  height: 220px;
  background-color: var(--surface-variant);
  overflow: hidden;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  display: block;
}

.banner-gradient-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.45) 0%,
    rgba(0, 0, 0, 0.05) 50%,
    rgba(0, 0, 0, 0.65) 100%
  );
  pointer-events: none;
}

/* Yläpalkin kelluvat napit (Kielivalitsin & Teematoggle) */
.header-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.segmented-button-group {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  padding: 2px;
}

.segmented-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.segmented-btn:hover {
  color: #ffffff;
}

.segmented-btn.active {
  background-color: var(--primary-color);
  color: var(--on-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.icon-toggle-btn {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  border-color: rgba(255, 255, 255, 0.4);
}

.icon-toggle-btn .material-symbols-rounded {
  font-size: 18px;
}

/* ─── 5. Hero-osio ja Karuselli ─── */
.hero-section {
  padding: 2.25rem 2rem 2rem 2rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 2.5rem;
}

.hero-text-col {
  display: flex;
  flex-direction: column;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 0.875rem;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

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

.google-play-btn-link {
  display: inline-block;
  text-decoration: none;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  border-radius: 8px;
  line-height: 0;
}

.google-play-btn-link:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}

.google-play-badge {
  height: 52px;
  width: auto;
  display: block;
}

.hero-lang-note {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  width: 100%;
}

.hero-lang-icon {
  font-size: 17px;
  color: var(--primary-color);
}

/* ─── 5.1 Hero-Kuvakaruselli ─── */
.hero-carousel-col {
  display: flex;
  justify-content: center;
  align-items: center;
}

.carousel-container {
  position: relative;
  width: 100%;
  max-width: 290px;
  margin: 0 auto;
  user-select: none;
}

.carousel-viewport {
  overflow: hidden;
  border-radius: 24px;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.16), 0 4px 12px -2px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  background-color: var(--surface-color);
  aspect-ratio: 1216 / 2562;
  position: relative;
}

[data-theme='dark'] .carousel-viewport {
  box-shadow: 0 16px 40px -6px rgba(0, 0, 0, 0.7), 0 6px 16px -2px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
}

.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  will-change: transform;
}

.carousel-slide {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
}

.carousel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Karusellin sivunapit */
.carousel-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.carousel-nav-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-50%) scale(1.08);
}

.carousel-btn--prev {
  left: -16px;
}

.carousel-btn--next {
  right: -16px;
}

.carousel-nav-btn .material-symbols-rounded {
  font-size: 22px;
}

/* Karusellin sivutuspisteet */
.carousel-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 1rem;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  opacity: 0.35;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.carousel-dot:hover {
  opacity: 0.7;
}

.carousel-dot.active {
  width: 22px;
  border-radius: 4px;
  background-color: var(--primary-color);
  opacity: 1;
}

/* ─── 6. Ominaisuusosio (Features) ─── */
.features-section {
  padding: 0 2rem 2.5rem 2rem;
}

.section-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0 0 2rem 0;
}

.features-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.feature-cards-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.feature-card {
  background-color: var(--surface-variant);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all var(--transition-fast);
}

.feature-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.feature-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.feature-icon-circle .material-symbols-rounded {
  font-size: 24px;
}

/* 1. Käsipaino-kuvake (Sininen - referenssin koti-näkymän mukainen) */
.feature-icon-circle--blue {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
}

[data-theme='dark'] .feature-icon-circle--blue {
  background-color: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}

/* 2. Pokaali-kuvake (Kultainen / Keltainen) */
.feature-icon-circle--gold {
  background-color: #fefce8;
  border: 1px solid #fde68a;
  color: #d97706;
}

[data-theme='dark'] .feature-icon-circle--gold {
  background-color: rgba(217, 119, 6, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

/* 3. Chart-kuvake (Vihreä) */
.feature-icon-circle--green {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
}

[data-theme='dark'] .feature-icon-circle--green {
  background-color: rgba(22, 163, 74, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #4ade80;
}

.feature-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.feature-desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.feature-body {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.feature-body p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.feature-bullet-list-wrap {
  margin: 0.25rem 0;
  padding: 0.75rem 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.feature-bullet-list-intro {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.feature-bullet-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.feature-bullet-list li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.feature-bullet-list li::before {
  content: "•";
  position: absolute;
  left: 0.25rem;
  top: 0;
  color: var(--primary-color);
  font-size: 1.1rem;
  font-weight: bold;
  line-height: 1.2;
}

/* ─── 6.1 Kaavion ohjelaatikko (Callout) ─── */
.chart-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  margin-top: 1.25rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: 8px;
}

.chart-callout-icon {
  color: var(--primary-color);
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.chart-callout-text {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ─── 7. Interaktiivinen Kaaviokortti ─── */
.chart-container-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 1.25rem;
}

.chart-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.chart-header .material-symbols-rounded {
  font-size: 18px;
  color: var(--primary-color);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

/* Kaavion kustomoitu Legenda */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-top: 0.875rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.775rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.legend-sample {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.legend-sample--actual {
  background-color: var(--chart-actual);
}

.legend-sample--epley {
  background-color: var(--chart-epley);
}

.legend-sample--nuzzo {
  background-color: var(--chart-nuzzo);
  height: 8px;
  border-radius: 3px;
  opacity: 0.85;
}

.legend-sample--regression {
  background: repeating-linear-gradient(
    to right,
    var(--chart-development),
    var(--chart-development) 4px,
    transparent 4px,
    transparent 7px
  );
  height: 3px;
}

/* Kaavion Zoom-painikkeet */
.chart-zoom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.chart-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background-color: var(--surface-variant);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chart-btn:hover {
  background-color: var(--border-color);
}

.chart-btn .material-symbols-rounded {
  font-size: 16px;
}

/* ─── 8. Sarjan infolaatikko (Spot Details Card) ─── */
.spot-card {
  margin-top: 0.875rem;
  padding: 0.875rem 1rem;
  background-color: var(--surface-container-high);
  border: 1.5px solid var(--primary-container-border);
  border-radius: 12px;
  transition: all var(--transition-fast);
}

.spot-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.spot-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), opacity var(--transition-fast);
}

.spot-nav-btn:hover:not(:disabled) {
  background-color: var(--surface-variant);
}

.spot-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.spot-card__title-wrap {
  flex: 1;
  text-align: left;
  padding-left: 0.25rem;
}

.spot-card__date {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.spot-card__counter {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.spot-card__divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0.625rem 0;
}

.spot-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.spot-metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.metric-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.metric-val {
  color: var(--text-primary);
  text-align: right;
}

.metric-extra {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.text-muted {
  color: var(--text-muted);
}

/* ─── 9. Alatunniste (Footer) ─── */
.site-footer {
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.footer-copyright {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─── 10. Responsiivisuus ─── */
@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.25rem;
  }

  .hero-text-col {
    align-items: center;
    text-align: center;
  }

  .hero-subtitle {
    max-width: 600px;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-lang-note {
    justify-content: center;
  }

  .carousel-container {
    max-width: 280px;
  }
}

@media (max-width: 640px) {
  .site-wrapper {
    padding: 0 0.5rem 2rem 0.5rem;
  }

  .site-card {
    border-radius: 16px;
    margin-top: 0.5rem;
  }

  .banner-container {
    height: 170px;
  }

  .hero-section {
    padding: 1.5rem 1.25rem 1.5rem 1.25rem;
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .hero-subtitle {
    font-size: 0.9375rem;
  }

  .google-play-badge {
    height: 46px;
  }

  .carousel-container {
    max-width: 250px;
  }

  .carousel-btn--prev {
    left: -12px;
    width: 34px;
    height: 34px;
  }

  .carousel-btn--next {
    right: -12px;
    width: 34px;
    height: 34px;
  }

  .features-section {
    padding: 0 1.25rem 1.75rem 1.25rem;
  }

  .feature-card {
    padding: 1.125rem;
  }

  .chart-wrapper {
    height: 230px;
  }

  .chart-legend {
    gap: 0.5rem 0.875rem;
    font-size: 0.725rem;
  }
}
