/* =========================================================
   base.css — shared by every page.
   Page-specific styles live in index.css, projects.css,
   journal.css and post.css.
   ========================================================= */

* {
    margin: 0;
    padding: 0;
    font-family: 'Georgia', serif;
    box-sizing: border-box;
}

::-webkit-scrollbar {
    display: none;
}

/* Default palette (green / light). js/palettes.js overrides these
   before the page paints, based on the visitor's saved choice. */
:root {
    --bg: #c8e6c9;
    --text: #1b5e20;
    --muted-text: rgba(27, 94, 32, 0.75);
    --accent: #44c24c;
    --toggle-bg: #1b5e20;
    --toggle-fg: #c8e6c9;
    --border: #1b5e20;
    --shadow: rgba(27, 94, 32, 0.35);

    --link: #ce7575;
    --link-hover: #ff9494;
    --line: rgba(0, 0, 0, 0.12);
    --button-size: 3.5rem;
}

.dark-theme {
    --line: rgba(255, 255, 255, 0.14);
}

html {
    background-color: var(--bg);
}

body {
    color: var(--text);
    background-color: var(--bg);
    font-size: clamp(1rem, 1.4vw, 1.75rem);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-bottom: 5rem;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* ---------- round icon buttons (palette, mail, theme) ---------- */

.icon-button {
    position: fixed;
    top: 1.5rem;
    width: var(--button-size);
    height: var(--button-size);
    border-radius: 50%;
    border: none;
    background: var(--toggle-bg);
    color: var(--toggle-fg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--button-size) * 0.55);
    text-decoration: none;
    z-index: 100;
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.icon-button:hover {
    transform: scale(1.08);
}

.palette-toggle {
    left: 1.5rem;
    font-size: calc(var(--button-size) * 0.48);
    z-index: 101;
}

.theme-toggle {
    right: 1.5rem;
}

.message {
    right: calc(1.5rem + var(--button-size) + 1rem);
}

/* ---------- palette panel ---------- */

.palette-panel {
    position: fixed;
    left: 1.25rem;
    top: calc(1.5rem + var(--button-size) + 0.75rem);
    width: 15.5rem;
    border-radius: 1.25rem;
    padding: 0.9rem;
    backdrop-filter: blur(10px);
    background: var(--toggle-bg);
    border: 1px solid rgba(0, 0, 0, 0.54);
    z-index: 101;
    transform: translateX(calc(-100% - 1.5rem));
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

.dark-theme .palette-panel {
    border-color: rgba(255, 255, 255, 0.12);
}

.palette-panel.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.25s ease;
}

.palette-swatches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
}

.palette-swatch {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 0.85rem;
    border: 2px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, border-color 0.3s ease;
}

.dark-theme .palette-swatch {
    border-color: rgba(255, 255, 255, 0.14);
}

.palette-swatch:hover { transform: translateY(-2px); }

.palette-swatch.active::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 0.85rem;
    border: 3px solid #707070;
    opacity: 0.95;
}

/* ---------- navigation ---------- */

.navigation-bar {
    position: relative;
    top: 1rem;
    text-align: center;
}

.navigation-bar ul {
    list-style: none;
}

.navigation-bar li {
    margin: 0 1rem;
    display: inline-block;
}

.navigation-bar a {
    text-decoration: none;
    padding: 10px 15px;
    display: block;
    color: var(--text);
    transition: color 0.3s ease;
}

.navigation-bar a:hover,
.navigation-bar a[aria-current="page"] {
    color: var(--accent);
}

/* ---------- social links (footer) ---------- */

.social-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: center;
    padding: 1.75rem 0 1.25rem;
    /* fades content out underneath so links stay readable while scrolling */
    background: linear-gradient(to bottom, transparent, var(--bg) 55%);
    pointer-events: none;
}

.social-buttons ul {
    pointer-events: auto;
}

.social-buttons ul {
    display: flex;
    align-items: center;
    list-style: none;
}

.social-buttons li {
    margin: 0 1rem;
}

.social-buttons .divider {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1;
}

.social-buttons a {
    text-decoration: none;
    color: var(--text);
    transition: color 0.3s ease;
}

.social-linkedin a:hover { color: #0090de; }
.social-github a:hover { color: #a9a9a9; }

.social-instagram a {
    background-size: 100% 200%;
    background-position: center 0%;
    transition: background-position 0.3s ease;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: linear-gradient(to bottom, var(--text) 0%, var(--text) 50%, #f9ce34 50%, #ee2a7b 75%, #6228d7 100%);
}

.social-instagram a:hover {
    background-position: center 100%;
}

/* ---------- scroll-reveal animation ---------- */

.reveal {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(2px);
    transition: opacity 0.65s ease, transform 0.65s ease, filter 0.65s ease;
    will-change: opacity, transform, filter;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.reveal-stagger .reveal {
    transition-delay: calc(var(--i, 0) * 120ms);
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        transition: none !important;
    }
}

/* ---------- phones & small tablets ---------- */

@media (max-width: 720px) {
    :root {
        --button-size: 2.6rem;
    }

    body {
        padding-bottom: 0;
    }

    /* buttons scroll away with the page instead of covering content */
    .icon-button,
    .palette-panel {
        position: absolute;
        top: 0.9rem;
    }

    .palette-toggle { left: 0.9rem; }
    .theme-toggle { right: 0.9rem; }
    .message { right: calc(0.9rem + var(--button-size) + 0.6rem); }

    .palette-panel {
        left: 0.9rem;
        top: calc(0.9rem + var(--button-size) + 0.6rem);
        width: min(15.5rem, calc(100vw - 1.8rem));
    }

    /* nav sits between the left button and the two right buttons */
    .navigation-bar {
        top: 0;
        padding: 0.9rem 6.6rem 0 4rem;
        min-height: calc(0.9rem + var(--button-size));
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .navigation-bar li {
        margin: 0;
    }

    .navigation-bar a {
        padding: 0.5rem 0.55rem;
        font-size: 1rem;
    }

    /* footer becomes part of the page instead of floating */
    .social-buttons {
        position: static;
        padding: 2.5rem 0 1.75rem;
        background: none;
    }

    .social-buttons li {
        margin: 0 0.7rem;
    }
}
