@font-face {
    font-family: "Maison Neue";
    src: url("https://linkin.se/files/MaisonNeueWEB-Book.woff2") format("woff2"),
         url("https://linkin.se/files/MaisonNeueWEB-Book.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Maison Neue";
    src: url("https://linkin.se/files/MaisonNeueWEB-Demi.woff2") format("woff2"),
         url("https://linkin.se/files/MaisonNeueWEB-Demi.woff") format("woff");
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Alterra Display";
    src: url("https://linkin.se/files/AlterraDisplay-Regular.woff2") format("woff2"),
         url("https://linkin.se/files/AlterraDisplay-Regular.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

:root {
    --position: 50%;
    --linkin-dark: #133037;
    --linkin-heading: #063038;
    --linkin-mint: #9ff9d4;
    --linkin-mint-hover: #ccf1e3;
    --linkin-text: #333;
    --linkin-bg: #f6f8ff;
}

body {
    font-family: "Maison Neue", 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: var(--linkin-bg);
    color: var(--linkin-text);
}

.container {
    text-align: center;
    width: 95%;
    max-width: 900px;
}

h1 {
    font-family: "Alterra Display", "Maison Neue", sans-serif;
    color: var(--linkin-heading);
    margin-bottom: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comparison-slider {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 8px solid #fff;
    box-shadow: 0 20px 40px rgba(19, 48, 55, 0.15);
    border-radius: 24px;
    user-select: none;
}

.image-after, .image-before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.image-after img, .image-before img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: translateZ(0);
}

.image-before {
    z-index: 1;
    clip-path: inset(0 calc(100% - var(--position)) 0 0);
    will-change: clip-path;
}

.slider {
    position: absolute;
    top: 0;
    left: -20px;
    width: calc(100% + 40px);
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    outline: none;
    margin: 0;
    z-index: 10;
    cursor: ew-resize;
    touch-action: none;
}

.slider:active {
    cursor: grabbing;
}

.slider:active ~ .slider-button {
    background: var(--linkin-mint-hover);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 15px rgba(19, 48, 55, 0.4);
}

/* Reglagets vertikala linje */
.comparison-slider::after {
    content: '';
    position: absolute;
    top: 0;
    left: var(--position);
    width: 2px;
    height: 100%;
    background: #fff;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
}

/* Reglagets knapp/cirkel */
.slider-button {
    position: absolute;
    top: 50%;
    left: var(--position);
    width: 44px;
    height: 44px;
    background: var(--linkin-mint);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(19, 48, 55, 0.3);
    transition: background-color 0.2s, transform 0.2s;
}

.slider-button::before {
    content: '';
    width: 12px;
    height: 12px;
    border-top: 3px solid var(--linkin-dark);
    border-left: 3px solid var(--linkin-dark);
    transform: rotate(-45deg) translateX(2px);
}

.slider-button::after {
    content: '';
    width: 12px;
    height: 12px;
    border-top: 3px solid var(--linkin-dark);
    border-right: 3px solid var(--linkin-dark);
    transform: rotate(45deg) translateX(-2px);
    position: absolute;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 40px;
    height: 1000px; /* Gör tummen mycket hög för att täcka hela ytan */
    background: transparent;
    cursor: ew-resize;
}

.slider::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.slider::-moz-range-thumb {
    width: 40px;
    height: 1000px;
    background: transparent;
    cursor: ew-resize;
    border: none;
}

.slider::-moz-range-thumb:active {
    cursor: grabbing;
}

.slider::-webkit-slider-runnable-track {
    background: transparent;
    height: 100%;
}

.slider::-moz-range-track {
    background: transparent;
    height: 100%;
}

p {
    margin-top: 25px;
    color: var(--linkin-text);
    font-size: 1.1rem;
    font-weight: normal;
    letter-spacing: 0.01em;
}
