@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Gentium+Book+Basic:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=STIX+Two+Text:ital,wght@0,400;0,500;1,400;1,500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* ── CSS VARIABLES ───────────────────────────────────────────── */
:root {
    --bg: #e1e1e1;
    --fg: #222222;
    --base-fs: 1;
}

/* ── DARK MODE ───────────────────────────────────────────────── */
body.dark-mode,
html.dark-mode {
    --bg: #111111;
    --fg: #d4d4d4;
    background-color: #111111;
    color: #d4d4d4;
}

/* ── BASE ────────────────────────────────────────────────────── */
html, body {
    overflow-x: hidden;
    max-width: 100%;
    margin: 10px;
    margin-top: 2px;
    background-color: var(--bg);
    color: var(--fg);
    font-family: 'alda', serif !important;
    transition: background-color 0.4s ease, color 0.4s ease;
}

a { color: var(--fg); text-decoration: none; }
td { vertical-align: top; overflow-x: hidden; }
img { display: block; }

/* ── LOGO / LEFT COLUMN ──────────────────────────────────────── */
#sandbank2 {
    height: 100vh;
    position: fixed;
    left: 10px;
    top: 10px;
    width: 20vw;
}

#zandbank { position: fixed; }

.front {
    font-size: 45px;
    font-family: 'MedievalSharp', sans-serif !important;
    -webkit-text-stroke: 4px var(--fg);
    color: var(--fg);
    line-height: 1;
}

#about {
    opacity: 0;
    transition: opacity 1s;
    font-family: 'alda', serif;
    height: 0;
    overflow: hidden;
    padding-right: 25px;
}

#sandbank2:hover > #about { height: auto; opacity: 1; }

/* ── ARTICLES COLUMN ─────────────────────────────────────────── */
#articles {
    font-family: 'alda', serif;
    font-size: calc(25px * var(--base-fs));
    font-weight: 300;
    width: calc(100vw - 250px);
    overflow-x: hidden;
    position: absolute;
    left: 250px;
    top: 0;
    margin-top: 0;
}

/* ── TYPOGRAPHY ──────────────────────────────────────────────── */
.fronthead {
    font-family: 'MedievalSharp', sans-serif !important;
    -webkit-text-stroke: 4px var(--fg);
    color: var(--fg);
    font-size: calc(45px * var(--base-fs));
    line-height: 1;
    display: inline;
}

.frontcat { font-size: calc(20px * var(--base-fs)); line-height: 1; }
.frontcat a { text-decoration: underline dotted; }

H1 {
    font-family: 'MedievalSharp', sans-serif !important;
    -webkit-text-stroke: 2.5px var(--fg);
    color: var(--fg);
    font-size: 25px !important;
    line-height: 0;
}
H2 {
    font-family: 'MedievalSharp', sans-serif !important;
    -webkit-text-stroke: 17px var(--fg);
    color: var(--fg);
    font-size: 200px !important;
    line-height: 1; margin: 0;
}
H3 {
    font-family: 'MedievalSharp', sans-serif !important;
    -webkit-text-stroke: 12px var(--fg);
    color: var(--fg);
    font-size: 100px !important;
    line-height: 1; margin: 0;
}

/* ── BOTTOM FADE ─────────────────────────────────────────────── */
.effect {
    background-image: linear-gradient(to top, var(--bg), transparent);
    width: 100vw;
    height: 10vh;
    position: fixed;
    bottom: 0; left: 0;
    z-index: 12;
    pointer-events: none;
    transform: translate(0, 2vh);
    transition: background-image 0.4s;
}

/* ── CAROUSEL OUTER ──────────────────────────────────────────── */
.carousel-outer {
    position: relative;
    padding: 0 36px;
    margin: 0 -36px;
    /* fade-in state */
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.carousel-outer.visible {
    opacity: 1;
    transform: translateY(0);
}

.carousel-wrap { overflow: visible;}

.carousel-track {
    display: flex;
    gap: 10px;
}

/* ── CAROUSEL ITEMS ──────────────────────────────────────────── */
.carousel-item {
    flex: 0 0 calc(25% - 8px);
    min-width: 0;
    vertical-align: top;
    text-align: center;
    font-weight: bold;
}

.carousel-item a { text-decoration: none; }
.carousel-item sup { font-size: calc(12px * var(--base-fs)); }
.carousel-item img { width: 100%; margin-top: 3px; display: block; }

/* ── SINUSOIDAL FLOAT — 1 min ────────────────────────────────── */
@keyframes float0 {
    0%,100% { transform: translateY(0px); }
    50%      { transform: translateY(-12px); }
}
@keyframes float1 {
    0%,100% { transform: translateY(-5px); }
    50%      { transform: translateY(10px); }
}
@keyframes float2 {
    0%,100% { transform: translateY(4px); }
    50%      { transform: translateY(-14px); }
}
@keyframes float3 {
    0%,100% { transform: translateY(-9px); }
    50%      { transform: translateY(8px); }
}

.carousel-item:nth-child(4n+1) { animation: float0 20s ease-in-out infinite 0s; }
.carousel-item:nth-child(4n+2) { animation: float1 20s ease-in-out infinite 2.5s; }
.carousel-item:nth-child(4n+3) { animation: float2 20s ease-in-out infinite 5s; }
.carousel-item:nth-child(4n+4) { animation: float3 20s ease-in-out infinite 7.5s; }

/* ── CAROUSEL BUTTONS ────────────────────────────────────────── */
.carousel-btn {
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    color: var(--fg);
    font-size: 20px;
    font-family: 'alda', serif;
    cursor: pointer;
    z-index: 10;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

/* JS adds .active when needed — on mobile always shown via CSS */
.carousel-btn.active { display: flex; }
.carousel-btn:disabled { opacity: 0.2; cursor: default; }
.carousel-btn-prev { left: 0; }
.carousel-btn-next { right: 0; }

/* ── PAGE CONTROLS (dark / font) ─────────────────────────────── */
.page-controls {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 1px solid var(--fg);
    background: var(--bg);
    color: var(--fg);
    font-family: 'alda', serif;
    font-size: 25px;
    cursor: pointer;
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    opacity: 0.75;
    transition: opacity 0.3s, background-color 0.4s, color 0.4s, border-color 0.4s;
    user-select: none;
    line-height: 1;
}

.ctrl-btn:hover { opacity: 1; }

/* ── DESKTOP ─────────────────────────────────────────────────── */
@media only screen and (min-width: 601px) {
    #sandbank2 { width: 20vw; }
    #articles {
        width: calc(100vw - 250px);
        left: 250px;
    }
    #articles > div:first-child {
        font-size: calc(45px * var(--base-fs));
        line-height: 1.1;
    }
}

/* ── MOBILE ──────────────────────────────────────────────────── */
@media only screen and (max-width: 600px) {
    html, body { margin: 0; padding: 0 10px; box-sizing: border-box; }

    /* Logo: centered, NO background */
    #sandbank2 {
        position: fixed;
        left: 0;
        top: 10px;
        width: 100vw;
        text-align: center;
        background: none;
        z-index: 10;
        height: auto;
    }

    #zandbank { position: static; display: inline-block; }
    .front { font-size: 28px; -webkit-text-stroke: 2.5px var(--fg); }

    /* Articles column: below fixed header, centered text */
    #articles {
        width: 100%;
        left: 0;
        top: 55px;
        padding: 0 10px;
        box-sizing: border-box;
        text-align: center;
    }

    #articles > div:first-child {
        font-size: calc(18px * var(--base-fs));
        line-height: 1.2;
        text-align: center;
    }

    .frontcat { text-align: left; }
    .fronthead { font-size: calc(22px * var(--base-fs)); -webkit-text-stroke: 2px var(--fg); }
    .frontcat  { font-size: calc(15px * var(--base-fs)); }

    /* Carousel items: 75vw on mobile */
    .carousel-item {
        flex: 0 0 75vw;
        min-width: 75vw;
    }

    .carousel-outer { padding: 0 24px; margin: 0 -24px; }

    /* Always show buttons on mobile regardless of item count */
    .carousel-btn { display: flex !important; }
}