/* ============================================================
   Shar Mountain MK – Animationen "Die Pässe vor der Haustür"
   Wird nur aktiv, wenn js/paesse-anim.js läuft (Klasse .sm-anim am <html>).
   Ohne JavaScript bleibt alles sichtbar wie bisher.
   ============================================================ */

/* 1) Karten: kommen beim Scrollen nacheinander von unten herein */
.sm-anim .sm-pass {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
    transition:
        opacity 0.6s ease,
        transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-color 0.25s,
        box-shadow 0.25s;
    transition-delay: var(--sm-delay, 0ms);
}
.sm-anim .sm-pass.sm-sichtbar {
    opacity: 1;
    transform: none;
}

/* Hover: anheben + Schatten (nach dem Einblenden ohne Verzögerung) */
.sm-anim .sm-pass.sm-fertig { transition-delay: 0ms; }
.sm-anim .sm-pass.sm-sichtbar:hover {
    transform: translateY(-5px);
    border-color: var(--sm-akzent);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
}

/* 2) Höhenbalken: füllt sich von links */
.sm-anim .sm-pass-balken span {
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition-delay: calc(var(--sm-delay, 0ms) + 250ms);
}
.sm-anim .sm-pass.sm-sichtbar .sm-pass-balken span { transform: scaleX(1); }

/* Glanz, der einmal über den gefüllten Balken läuft */
.sm-anim .sm-pass-balken span { position: relative; overflow: hidden; }
.sm-anim .sm-pass-balken span::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
    transform: translateX(-100%);
}
.sm-anim .sm-pass.sm-sichtbar .sm-pass-balken span::after {
    animation: sm-glanz 0.9s ease calc(var(--sm-delay, 0ms) + 1.3s) 1 forwards;
}
.sm-anim .sm-pass.sm-fertig .sm-pass-balken span::after { animation: none; }
.sm-anim .sm-pass.sm-fertig:hover .sm-pass-balken span::after {
    animation: sm-glanz 0.8s ease 0s 1;
}
@keyframes sm-glanz {
    to { transform: translateX(100%); }
}

/* 3) Berg-Icon: springt beim Einblenden kurz, wippt beim Hover */
.sm-anim .sm-pass.sm-sichtbar .sm-pass-kopf i {
    animation: sm-gipfel 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) calc(var(--sm-delay, 0ms) + 200ms) both;
}
.sm-anim .sm-pass.sm-fertig .sm-pass-kopf i { animation: none; }
.sm-anim .sm-pass.sm-fertig:hover .sm-pass-kopf i {
    animation: sm-wippen 0.6s ease;
}
@keyframes sm-gipfel {
    0%   { transform: translateY(8px) scale(0.4); opacity: 0; }
    100% { transform: none; opacity: 1; }
}
@keyframes sm-wippen {
    0%, 100% { transform: none; }
    30%      { transform: translateY(-4px) rotate(-8deg); }
    60%      { transform: translateY(0) rotate(6deg); }
}

/* Höhe zählt hoch – feste Ziffernbreite, damit nichts wackelt */
.sm-pass-hoehe { font-variant-numeric: tabular-nums; }

/* Wer Bewegung reduziert haben will, sieht alles sofort */
@media (prefers-reduced-motion: reduce) {
    .sm-anim .sm-pass,
    .sm-anim .sm-pass-balken span { opacity: 1; transform: none; transition: none; }
    .sm-anim .sm-pass-balken span::after,
    .sm-anim .sm-pass .sm-pass-kopf i { animation: none !important; }
}

/* ============================================================
   Umdrehen: Vorderseite = Pass, Rückseite = Route / Foto
   (Aufbau wird von js/paesse-anim.js erzeugt)
   ============================================================ */
.sm-pass.sm-flip {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    perspective: 1100px;
    cursor: pointer;
    outline: none;
}
.sm-flip-innen {
    position: relative;
    height: 100%;
    min-height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.75s cubic-bezier(0.3, 0.9, 0.3, 1);
}
.sm-flip-vorne,
.sm-flip-hinten {
    border-radius: var(--sm-radius);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.sm-flip-vorne {
    height: 100%;
    padding: 1.2rem 1.2rem 1.1rem;
    background: var(--sm-card);
    border: 1px solid var(--sm-border);
    box-shadow: var(--sm-shadow-klein);
    transition: border-color 0.25s;
}
.sm-flip-hinten {
    position: absolute;
    inset: 0;
    overflow: hidden;
    display: flex;
    transform: rotateY(180deg);
    background: #141416 center / cover no-repeat;
    border: 1px solid var(--sm-akzent);
    color: #fff;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
}
/* dunkler Verlauf über dem Foto, damit Text lesbar bleibt */
.sm-flip-hinten.mit-foto::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.55) 45%, rgba(0,0,0,0.88) 100%);
}
.sm-flip-hinten-inhalt {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0.9rem 0.95rem 0.85rem;
    min-width: 0;
}
.sm-flip-kicker {
    font-size: 0.66rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--sm-akzent);
    font-weight: 600;
}
.sm-flip-hinten h3 {
    margin: 0.15rem 0 0.25rem;
    font-size: 0.92rem;
    color: #fff;
}
.sm-flip-strecke {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.4rem;
    font-size: 0.78rem;
    line-height: 1.3;
    color: rgba(255,255,255,0.85);
}
.sm-flip-strecke i { color: var(--sm-akzent); font-size: 0.75rem; }
.sm-profil-box { position: relative; flex: 1 1 auto; min-height: 22px; margin: 0.45rem 0; }
.sm-profil { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sm-profil-flaeche { fill: rgba(211, 47, 47, 0.22); }
.sm-profil-linie {
    fill: none;
    stroke: var(--sm-akzent);
    stroke-width: 2.2;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
}
.sm-flip-fuss { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 0.8rem; }
.sm-flip-fakten { font-size: 0.72rem; font-variant-numeric: tabular-nums; color: rgba(255,255,255,0.7); white-space: nowrap; }
.sm-flip-link {
    font-size: 0.76rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid var(--sm-akzent);
    white-space: nowrap;
}
.sm-flip-link:hover { color: var(--sm-akzent); }

/* Drehen: Maus darüber, Tastatur-Fokus oder angetippt */
@media (hover: hover) {
    .sm-flip:hover .sm-flip-innen { transform: rotateY(180deg); }
}
.sm-flip:focus-visible .sm-flip-innen,
.sm-flip.sm-gedreht .sm-flip-innen { transform: rotateY(180deg); }

/* Profil zeichnet sich, sobald die Rückseite sichtbar wird */
@media (hover: hover) {
    .sm-flip:hover .sm-profil-linie { animation: sm-profil-zeichnen 1s ease 0.35s forwards; }
}
.sm-flip:focus-visible .sm-profil-linie,
.sm-flip.sm-gedreht .sm-profil-linie { animation: sm-profil-zeichnen 1s ease 0.35s forwards; }
@keyframes sm-profil-zeichnen { to { stroke-dashoffset: 0; } }

/* Hover-Rahmen jetzt auf der Vorderseite statt der ganzen Karte */
.sm-flip:hover .sm-flip-vorne { border-color: var(--sm-akzent); }
.sm-anim .sm-pass.sm-flip.sm-sichtbar:hover { box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
    .sm-flip-innen { transition: none; }
    .sm-profil-linie { stroke-dashoffset: 0; animation: none !important; }
}
