/* ═══════════════════════════════════════════════════════════════
   Evästeet – asettelu
   FAB, modaalin runko, kaksipalstainen "asetukset-tyylinen" asettelu
   (pystysuora kategoriapalkki + sisältöpaneeli) ja responsiivisuus.
   ═══════════════════════════════════════════════════════════════ */

/* ── Kelluva keksi-painike (FAB) ───────────────────────────────── */

#evasteet-fab {
  position: fixed;
  left: 22px;
  bottom: 22px;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ev-choc-2);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--ev-border);
  cursor: pointer;
  z-index: var(--ev-z-fab);
  animation: ev-wobble 5s ease-in-out infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#evasteet-fab:hover,
#evasteet-fab:focus-visible {
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--ev-border);
  outline: none;
}

#evasteet-fab:focus-visible {
  outline: 2px solid var(--ev-amber);
  outline-offset: 3px;
}

@keyframes ev-wobble {
  0%, 82%, 100% { transform: rotate(0deg); }
  86%           { transform: rotate(-6deg); }
  90%           { transform: rotate(5deg); }
  94%           { transform: rotate(-3deg); }
}

/* ── Modaali – taustakerros ────────────────────────────────────── */

#evasteet-modal {
  position: fixed;
  inset: 0;
  z-index: var(--ev-z-modal);
  overflow-y: auto;
  overscroll-behavior: contain;
}

#evasteet-modal.ev-hidden {
  display: none;
}

.ev-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 2, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

body.ev-modal-open {
  overflow: hidden !important;
}

/* ── Kortti ────────────────────────────────────────────────────── */

.ev-card {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 5vh auto 5vh;
  padding: 30px 30px 26px;
  border-radius: var(--ev-radius-lg);
  border: 1px solid var(--ev-border);
  color: var(--ev-cream);
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.05) 0 2px, transparent 2.5px) 0 0 / 46px 46px,
    radial-gradient(circle at 68% 62%, rgba(255,255,255,0.04) 0 2px, transparent 2.5px) 0 0 / 58px 58px,
    linear-gradient(160deg, var(--ev-choc-1) 0%, var(--ev-choc-3) 100%);
  box-shadow: var(--ev-shadow-lg);
}

/* ── Otsikkoalue ───────────────────────────────────────────────── */

.ev-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding-right: 34px;
}

.ev-header-badge {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, var(--ev-dough-2), var(--ev-caramel));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.ev-header-title {
  margin: 0 0 2px;
  font-size: 21px;
  font-weight: 800;
  color: #fff;
}

.ev-header-subtitle {
  margin: 0;
  font-size: 12.5px;
  color: var(--ev-cream-dim);
}

/* ── Sulkunappi ────────────────────────────────────────────────── */

#ev-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ev-cream);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 10;
}

#ev-close:hover,
#ev-close:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  outline: 2px solid var(--ev-amber);
  outline-offset: 2px;
}

/* ── Runko: palkki + paneelit ──────────────────────────────────── */

.ev-body {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 18px;
  min-height: 260px;
}

.ev-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: var(--ev-radius-md);
  background: rgba(0, 0, 0, 0.18);
}

.ev-rail-indicator {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 6px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ev-caramel), #8b5a26);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.28s cubic-bezier(.4,.0,.2,1), height 0.28s ease;
  z-index: 0;
}

.ev-panels {
  min-width: 0;
}

.ev-panel {
  display: none;
}

.ev-panel.active {
  display: block;
  animation: ev-fade-in 0.25s ease;
}

@keyframes ev-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.ev-panel,
.ev-panel * {
  color: rgba(253, 241, 224, 0.92);
  line-height: 1.75;
  font-size: 14px;
}

.ev-card h1, .ev-card h2, .ev-card h3, .ev-card h4, .ev-card h5, .ev-card h6 {
  color: #fff !important;
  margin-top: 0;
}

.ev-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--ev-border);
}

/* ── Toimintopalkki ────────────────────────────────────────────── */

.ev-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--ev-border);
  justify-content: flex-end;
}

/* ── Mobiili ───────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .ev-card {
    margin: 0;
    min-height: 100dvh;
    border-radius: 0;
    padding: 54px 18px 24px;
  }

  .ev-body {
    grid-template-columns: 1fr;
  }

  .ev-rail {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ev-rail-indicator {
    display: none;
  }

  .ev-actions {
    flex-direction: column;
  }

  .ev-actions .ev-btn {
    width: 100%;
    text-align: center;
  }
}
