/* ─── fillaridata MVP — styles ─────────────────────────────────────────────
   Palette: bg #f4f6f5 · fg #1a1a1a · primary #00BFA5 · font: Inter
   Style: editorial hero (A) + bento highlights (C) hybrid
   ──────────────────────────────────────────────────────────────────────── */

:root {
  --bg:           #f4f6f5;
  --fg:           #1a1a1a;
  --primary:      #00BFA5;
  --primary-dk:   #009688;
  --primary-xdk:  #004D40;
  --muted:        #6b7280;
  --border:       #e0e0e0;
  --card-bg:      #ffffff;
  --shadow:       0 2px 8px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.14);

}

* { box-sizing: border-box; }

/* HTML5-hidden-attribuutti voitaa custom display-arvon (inline-block ym.).
   Tämä yksi sääntö varmistaa, että .hidden-elementit todella piiloutuvat. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* ─── NAVBAR ───────────────────────────────────────────────────────────── */
.navbar {
  background: #1a1a1a;
  border-bottom: 3px solid var(--primary);
  min-height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.6rem;
  position: sticky; top: 0; z-index: 1200;
}
.navbar-brand { display: flex; align-items: center; gap: 1.6rem; color: #fff; }
.navbar-subtitle { font-size: .9rem; color: #bbb; letter-spacing: .01em; white-space: nowrap; }
.navbar-tabs { list-style: none; margin: 0; padding: 0; display: flex; gap: .2rem; }
.nav-link {
  background: transparent; border: 0; color: #fff;
  padding: .55rem 1.1rem; border-radius: 4px;
  font: inherit; font-weight: 500;
  cursor: pointer; transition: color .15s, background .15s;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--primary); }
.nav-link.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── KIELENVALITSIN (FI / EN) ────────────────────────────────────────── */
.lang-switcher {
  display: flex; gap: .15rem; margin-left: .8rem;
  align-items: center;
}
.lang-btn {
  background: transparent; border: 1px solid #444; color: #aaa;
  padding: .3rem .5rem; min-width: 32px;
  border-radius: 4px; font: inherit; font-size: .78rem; font-weight: 600;
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.lang-btn:hover { color: #fff; border-color: var(--primary); }
.lang-btn.active {
  color: #fff; border-color: var(--primary);
  background: rgba(0, 191, 165, .15);
}

/* ─── HAMPURILAISNAPPI (vain mobiilissa) ──────────────────────────────── */
.navbar-toggle {
  display: none;       /* desktopilla piilossa */
  background: transparent; border: 0; cursor: pointer;
  padding: .5rem; margin-left: auto;
  width: 44px; height: 44px;       /* riittavan suuri sormella osumiseen */
  flex-direction: column; justify-content: center; gap: 5px;
}
.navbar-toggle span {
  display: block; height: 2px; background: #fff; border-radius: 1px;
  transition: transform .2s, opacity .2s;
}
/* Avoinna: kolme viivaa muuttuvat X-merkiksi */
.navbar-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.navbar-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.navbar-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ─── MOBIILI-NAVIGAATIO (< 900 px) ───────────────────────────────────── */
@media (max-width: 900px) {
  .navbar {
    flex-wrap: wrap;
    padding: 0 1rem;
  }
  .navbar-toggle { display: flex; }
  .navbar-tabs {
    /* Suljettu oletuksena. Avautuu kun nappia painetaan. */
    display: none;
    flex-direction: column;
    width: 100%;
    background: #1a1a1a;
    border-top: 1px solid #333;
    padding: .5rem 0;
    gap: 0;
  }
  .navbar-tabs.open { display: flex; }
  .navbar-tabs li { width: 100%; }
  .nav-link {
    width: 100%; text-align: left;
    padding: .9rem 1.2rem; border-radius: 0;
    border-bottom: 1px solid #2a2a2a;
  }
  .nav-link.active {
    border-bottom-color: #2a2a2a;
    background: rgba(0, 191, 165, .08);
  }
}

/* ─── TAB PANELS ──────────────────────────────────────────────────────── */
.tab-panel        { display: none; }
.tab-panel.active { display: block; }

/* ─── HERO (simple — tilastot / prediction / availability -välilehteä varten) ───────── */
.hero {
  background: linear-gradient(135deg, #1a1a1a 60%, var(--primary-xdk));
  color: #fff; padding: 2rem 2rem 1.6rem; margin-bottom: 1.2rem;
}
.hero h2 { margin: 0 0 .3rem; font-size: 1.9rem; font-weight: 700; color: var(--primary); }
.hero p  { margin: 0; color: #bbb; font-size: .98rem; }

/* ─── HERO MAGAZINE (Etusivu) ─────────────────────────────────────── */
.hero-magazine {
  display: grid;
  grid-template-columns: 2fr 0.85fr;
  align-items: stretch;
  gap: 0;
  min-height: 220px;
  max-height: 280px;
  overflow: hidden;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #1a1a1a 60%, var(--primary-xdk));
}
.hero-content {
  padding: 2.5rem 2.8rem 2.5rem 3rem;
  color: #fff;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.hero-content h1 {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 .5rem;
}
.hero-accent { color: var(--primary); }
.hero-lead {
  font-size: .92rem;
  color: #ccc;
  margin: 0 0 .8rem;
  max-width: 32rem;
  line-height: 1.55;
}
.hero-cta { display: flex; gap: .7rem; flex-wrap: wrap; }
.hero-cta .btn-teal.btn-inline { width: auto; padding: .7rem 1.4rem; margin-top: 0; }

.btn-ghost-light {
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  padding: .7rem 1.3rem; border-radius: 5px;
  font: inherit; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-ghost-light:hover { background: rgba(255,255,255,.1); border-color: #fff; }

.hero-photo {
  background: #0a0a0a; position: relative; overflow: hidden;
  min-height: 0; min-width: 0;
}

@media (max-width: 900px) {
  .hero-magazine { grid-template-columns: 1fr; min-height: auto; max-height: none; }
  .hero-content { padding: 2rem 1.4rem; min-width: 0; }
  .hero-content h1 { font-size: 2.2rem; overflow-wrap: break-word; word-break: break-word; hyphens: auto; }
  .hero-photo { min-height: 220px; }
}

@media (max-width: 400px) {
  .hero-content h1 { font-size: 1.7rem; }
}

/* ─── LAYOUT ──────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px; margin: 0 auto; padding: 0 1.2rem 1.6rem;
  display: flex; flex-direction: column; gap: 1.2rem;
}
.container.two-cols {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 2fr;
  gap: 1.2rem;
}
@media (max-width: 900px) {
  .container.two-cols { grid-template-columns: 1fr; }
}

/* ─── KPI BAND ────────────────────────────────────────────────────────── */
.kpi-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.kpi {
  background: #fff;
  padding: 1.5rem 1.4rem;
  border-radius: 6px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--primary);
  display: flex; flex-direction: column;
}
.kpi-num {
  font-size: 2.6rem; font-weight: 800;
  color: var(--fg); line-height: 1;
  letter-spacing: -0.025em;
}
.kpi-label {
  margin-top: .45rem;
  font-size: .78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
@media (max-width: 700px) {
  .kpi-band { grid-template-columns: repeat(2, 1fr); }
  .kpi-num { font-size: 2rem; }
}

/* ─── PROJECT / OPINNÄYTETYÖ -HUOMAUTUS (Etusivu) ─────────────────────── */
.note-project {
  background: rgba(0, 191, 165, .08);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: .65rem 1.2rem;
  margin: 1rem auto 0;
  max-width: 32rem;
  width: fit-content;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--fg);
  text-align: center;
  text-wrap: balance;
}
.note-project a {
  color: var(--primary-dk);
  font-weight: 700;
  text-decoration: underline;
}
.note-project a:hover { color: var(--primary-xdk); }
@media (max-width: 700px) {
  .note-project { max-width: 100%; text-align: left; margin: 1rem 0 0; }
}

/* ─── SECTION TITLE ──────────────────────────────────────────────────── */
.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: .5rem 0 .3rem;
  letter-spacing: -0.01em;
}

/* ─── BENTO GRID ──────────────────────────────────────────────────────── */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(150px, auto);
  gap: 1rem;
}
.bento-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
  overflow: hidden;
}
.bento-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.bento-card h3 {
  font-size: 1.85rem;
  font-weight: 700;
  margin: .3rem 0 .55rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.bento-card p {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.55;
}
.bento-eyebrow {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: .1em;
  margin-bottom: .1rem;
}

.bento-large { grid-column: span 2; grid-row: span 1; }
.bento-wide  { grid-column: span 2; }

.bento-dark {
  background: #1a1a1a;
  color: #fff;
}
.bento-dark p          { color: #bbb; }
.bento-dark h3         { color: var(--primary); }
.bento-dark .bento-eyebrow { color: var(--primary); }

.bento-photo {
  padding: 0;
  background: #0a0a0a;
  min-height: 200px;
}
.bento-photo .photo-placeholder { min-height: 200px; }

@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento-large, .bento-wide { grid-column: span 2; }
  .bento-card h3 { font-size: 1.5rem; }
}
@media (max-width: 500px) {
  .bento { grid-template-columns: 1fr; }
  .bento-large, .bento-wide { grid-column: span 1; }
}

.note-update {
  margin-top: 1rem; text-align: center;
  font-style: italic; font-size: .8rem;
}

/* ─── CARDS  ──────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  background: #1a1a1a;
  color: var(--primary);
  font-weight: 600;
  border-bottom: 2px solid var(--primary);
  padding: .7rem 1.1rem;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.card-header .header-right {
  display: flex; align-items: center; gap: .8rem;
  color: #bbb; font-weight: 400; font-size: .85rem;
}
.card-body { padding: 1.1rem 1.2rem; }
.card-body.no-padding { padding: 0; }

/* ─── FORM ────────────────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-weight: 600; font-size: .87rem; color: #444;
  margin: .65rem 0 .25rem;
}
.form-input {
  width: 100%;
  padding: .45rem .65rem;
  border: 1px solid #d0d0d0; border-radius: 4px;
  font: inherit; font-size: .95rem;
  background: #fff;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,191,165,.18);
}

/* ─── BUTTONS ─────────────────────────────────────────────────────────── */
.btn-teal {
  background: var(--primary); border: 0; color: #fff;
  font: inherit; font-weight: 600; font-size: 1rem;
  padding: .6rem 1.2rem; border-radius: 5px;
  width: 100%; margin-top: .8rem; cursor: pointer;
  transition: background .15s;
}
.btn-teal:hover  { background: var(--primary-dk); }
.btn-teal:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent; color: var(--primary);
  border: 1px solid var(--primary); border-radius: 4px;
  padding: .25rem .7rem; font: inherit; font-size: .85rem;
  cursor: pointer; transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--primary); color: #fff; }

/* ─── RESULT BOX (matka-aika) ─────────────────────────────────────────── */
.result-box {
  background: #1a1a1a; color: #fff;
  border-left: 5px solid var(--primary);
  padding: .85rem 1.2rem; border-radius: 5px;
  font-size: 1.55rem; font-weight: 700;
  margin: 1rem 0 .6rem;
  display: flex; align-items: baseline; gap: .4rem;
}
.result-unit { font-size: 1rem; color: #bbb; font-weight: 400; }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chip {
  display: inline-block; background: #e0f2f1; color: #00695C;
  border-radius: 20px; padding: 3px 12px;
  font-size: .85rem; font-weight: 600;
}
.chip-warn {
  display: inline-block; background: #FFF3E0; color: #E65100;
  border-radius: 20px; padding: 3px 12px;
  font-size: .85rem; font-weight: 600;
}
.chip-fallback {
  display: inline-block; background: #ECEFF1; color: #455A64;
  border: 1px dashed #90A4AE;
  border-radius: 20px; padding: 3px 12px;
  font-size: .85rem; font-weight: 600;
}
.muted-small { color: var(--muted); font-size: .82rem; margin-top: .8rem; line-height: 1.45; }
.muted-small em { color: var(--fg); font-style: normal; font-weight: 600; }

/* ─── META TABLE ──────────────────────────────────────────────────────── */
.meta-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.meta-table th, .meta-table td {
  padding: .55rem .8rem; text-align: left;
  border-bottom: 1px solid var(--border);
}
.meta-table th {
  background: #fafafa; color: #444; font-weight: 600;
  font-size: .82rem; text-transform: uppercase; letter-spacing: .03em;
}

/* ─── MAP ─────────────────────────────────────────────────────────────── */
.map       { height: 520px; width: 100%; }
.map-tall  { height: 640px; }
.map-short { height: 320px; }

/* ─── LEGEND ──────────────────────────────────────────────────────────── */
.legend-bar {
  display: flex; flex-wrap: wrap; gap: 1.2rem;
  padding: .8rem 1.1rem;
  background: #fff; border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: .85rem;
}
.legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.dot {
  width: 14px; height: 14px; border-radius: 50%;
  display: inline-block;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15);
}

/* ─── PBI iframe ──────────────────────────────────────────────────────── */
.pbi-frame {
  position: relative; width: 100%;
  aspect-ratio: 16 / 10;
  background: #f0f0f0;
  border-radius: 4px; overflow: hidden;
}
.pbi-frame iframe { width: 100%; height: 100%; border: 0; }

/* ─── Flowmap.blue iframe ─────────────────────────────────────────────── */
.flowmap-frame {
  position: relative; width: 100%;
  height: 720px;
  background: #f0f0f0;
  overflow: hidden;
}
.flowmap-frame iframe { width: 100%; height: 100%; border: 0; }
.pbi-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2rem;
  color: var(--muted); background: #f0f0f0;
}
.pbi-placeholder p { margin: .4rem 0; }
.pbi-placeholder code {
  background: #fff; padding: 2px 6px; border-radius: 3px;
  font-family: 'Consolas', 'Menlo', monospace; font-size: .85rem;
  border: 1px solid var(--border);
}

/* ─── FOOTER ──────────────────────────────────────────────────────────── */
.footer {
  margin-top: 2rem;
  padding: 1rem 1.6rem;
  background: #1a1a1a; color: #aaa;
  font-size: .82rem;
  display: flex; justify-content: center; flex-wrap: wrap; gap: .5rem;
}

/* ─── POPUP (leaflet override) ────────────────────────────────────────── */
.leaflet-popup-content { font-family: inherit; font-size: .88rem; margin: .55rem .7rem; }
.leaflet-popup-content strong { color: var(--primary-xdk); }
.bat-list { margin-top: .4rem; font-size: .82rem; color: #444; line-height: 1.5; }


.hero-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* ─── Matka-aikaennusteen historiavertailu ─────────────────────────────── */
.result-note {
  margin: .35rem 0 .6rem;
  font-size: .85rem; color: var(--primary-dk); font-weight: 600;
}
.hist-box {
  margin-top: .7rem; padding-top: .7rem;
  border-top: 1px solid var(--border);
}
.hist-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .22rem 0; font-size: .9rem;
}
.hist-label { color: var(--muted); }
.hist-value { font-weight: 700; color: var(--fg); }
/* ─── Saatavuustilastot ────────────────────────────────────────────────── */
.avail-controls {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
}
.avail-control-group { display: flex; flex-direction: column; gap: .3rem; }
.avail-control-group label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.avail-control-group select {
  padding: .4rem .7rem; border: 1px solid var(--border); border-radius: 6px;
  font-size: .9rem; background: var(--bg); color: var(--fg); cursor: pointer;
}
.avail-agg-btns { display: flex; gap: .4rem; flex-wrap: wrap; }
.agg-btn {
  padding: .35rem .85rem; border: 1px solid var(--border); border-radius: 20px;
  font-size: .85rem; font-weight: 600; background: var(--bg); color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.agg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.agg-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* Filter bar — pysyy nakyvilla sivua selattaessa */
.avail-sticky-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  /* peittaa kortin pyoristetyt kulmat oikein */
  border-radius: inherit; border-bottom: 1px solid var(--border);
}

/* Skrollattava sailio: kun selailet alaspain, taulukko skrollaa sisaltaan ja
   tuntien otsikkorivi pysyy yla-osassa kiinnitettyna. */
.avail-scroll {
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.avail-heatmap { border-collapse: separate; border-spacing: 0;
                 font-size: .78rem; white-space: nowrap; }

/* Tuntien otsikkorivi — sticky ylhaalla skrollausvyohykkeen sisalla */
.avail-heatmap thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--bg);
  padding: .3rem .5rem; font-weight: 700; color: var(--muted);
  border-bottom: 2px solid var(--border); text-align: center;
}
/* Vasemman ylanurkan solu — sticky molempiin suuntiin */
.avail-heatmap thead th.station-col {
  left: 0; z-index: 4;
  text-align: left; min-width: 140px;
}

.avail-heatmap td { padding: .25rem .4rem; text-align: center; border: 1px solid #f0f0f0; }
.avail-heatmap td.station-name {
  position: sticky; left: 0; background: var(--bg);
  font-weight: 600; text-align: left; border-right: 2px solid var(--border);
  z-index: 2; min-width: 140px; padding-left: .7rem;
}

/* Talvikauden banneri Saatavuus- ja Ennuste-välilehdille */
.off-season-banner {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffe69c;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 16px 0;
  font-size: .95rem;
  line-height: 1.45;
}
