/* ═══════════════════════════════════════════════════════════════
   Evästeet — tietosuojakeskus (korvaa "Evästeet"-lisäosan kolme
   tyylitiedostoa: variables.css + layout.css + components.css,
   yhdistettynä yhdeksi tiedostoksi, sisältö käytännössä muuttamaton).
   Teema: "leivottu keksi" — lämmin taikina/karamelli/suklaa-paletti.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ev-cream:      #fdf1e0;
  --ev-cream-dim:  rgba(253, 241, 224, 0.72);
  --ev-cream-faint:rgba(253, 241, 224, 0.45);

  --ev-dough:      #e8b165;
  --ev-dough-2:    #f3c37c;
  --ev-caramel:    #c9873f;

  --ev-choc-1:     #2c1810;
  --ev-choc-2:     #1b0f08;
  --ev-choc-3:     #150a05;
  --ev-choc-chip:  #4a2c1a;

  --ev-amber:      #f0a93c;
  --ev-amber-2:    #ffcf7a;

  --ev-border:     rgba(255, 255, 255, 0.09);
  --ev-radius-lg:  22px;
  --ev-radius-md:  14px;
  --ev-radius-sm:  10px;

  --ev-shadow-lg:  0 24px 64px rgba(0, 0, 0, 0.55);
  --ev-shadow-btn: 0 4px 16px rgba(0, 0, 0, 0.35);

  --ev-z-fab:      999990;
  --ev-z-modal:    2147483000;
  --ev-z-toast:    2147483100;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --ev-motion-safe: none;
  }
}

/* ── 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;
  }
}

/* ── Palkin painikkeet ─────────────────────────────────────────── */

.ev-rail-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ev-cream-dim);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.ev-rail-btn:hover {
  color: #fff;
}

.ev-rail-btn.active {
  color: #fff;
}

.ev-rail-btn:focus-visible {
  outline: 2px solid var(--ev-amber);
  outline-offset: 2px;
}

.ev-rail-icon {
  font-size: 15px;
}

/* ── Vaihtokytkin ──────────────────────────────────────────────── */

.ev-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex: none;
}

.ev-switch-locked {
  cursor: default;
}

.ev-switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.ev-switch-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--ev-border);
  transition: background 0.2s ease;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  box-sizing: border-box;
}

.ev-switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ev-cream);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
}

.ev-switch-input:checked ~ .ev-switch-track,
.ev-switch-track.is-on {
  background: linear-gradient(135deg, var(--ev-amber), var(--ev-caramel));
  border-color: transparent;
}

.ev-switch-input:checked ~ .ev-switch-track .ev-switch-thumb,
.ev-switch-track.is-on .ev-switch-thumb {
  transform: translateX(18px);
}

.ev-switch-input:focus-visible ~ .ev-switch-track {
  outline: 2px solid var(--ev-amber);
  outline-offset: 2px;
}

.ev-lock-label {
  margin-left: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ev-cream-dim);
}

/* ── Toimintonapit ─────────────────────────────────────────────── */

.ev-btn {
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid var(--ev-border);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ev-cream);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ev-btn:hover,
.ev-btn:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.11);
}

.ev-btn:focus-visible {
  outline: 2px solid var(--ev-amber);
  outline-offset: 2px;
}

.ev-btn-primary {
  position: relative;
  overflow: visible;
  background: linear-gradient(135deg, var(--ev-amber-2), var(--ev-caramel));
  border-color: transparent;
  color: #241407;
  box-shadow: var(--ev-shadow-btn);
}

.ev-btn-primary:hover,
.ev-btn-primary:focus-visible {
  box-shadow: 0 10px 26px rgba(240, 169, 60, 0.35);
}

/* ── Toast-ilmoitus ────────────────────────────────────────────── */

.ev-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: var(--ev-z-toast);
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ev-choc-1), var(--ev-choc-3));
  border: 1px solid var(--ev-border);
  color: var(--ev-cream);
  font-size: 13.5px;
  font-weight: 600;
  display: none;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
}

/* ── Murupurske (Hyväksy kaikki -mikroanimaatio) ──────────────── */

.ev-crumb {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--ev-dough);
  pointer-events: none;
  z-index: var(--ev-z-toast);
  animation: ev-crumb-fly 0.7s ease-out forwards;
}

@keyframes ev-crumb-fly {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--ev-tx, 0), var(--ev-ty, 40px)) rotate(220deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #evasteet-fab,
  .ev-panel.active,
  .ev-crumb {
    animation: none !important;
  }

  .ev-rail-indicator,
  .ev-switch-thumb,
  .ev-btn {
    transition: none !important;
  }
}
