/* Mobile first */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Cormorant+Garamond:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@400;500;600&display=swap');

:root{
    --surface-bg: #050505;
    --text-primary: #ffffff;
    --text-inverse: #000000;
    --border-color: rgba(255, 255, 255, 0.14);
    --active-bg: #ffffff;
    --active-text: #000000;
    --headline-font: 'Cinzel', serif;
    --display-font: 'Space Grotesk', sans-serif;
    --body-font: 'Manrope', sans-serif;
    --accent-crimson: #7a1428;
    --accent-moon: #dbdeeb;
    --mobile-nav-height: 4.25rem;
}

html[data-theme="light"],
body[data-theme="light"]{
    --surface-bg: rgba(236, 236, 236, 0.92);
    --text-primary: #111111;
    --text-inverse: #ffffff;
    --border-color: #646464;
    --active-bg: #111111;
    --active-text: #ffffff;
}

body{
    margin: 0;
    background-color: var(--surface-bg);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100vh;
    position: relative;
    padding-bottom: 0;
}

html,
body {
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(circle at 8% 12%, rgba(122, 20, 40, 0.16), transparent 38%),
        radial-gradient(circle at 84% 84%, rgba(195, 198, 215, 0.09), transparent 42%),
        radial-gradient(circle at 56% 28%, rgba(96, 98, 115, 0.08), transparent 40%);
}

.heading{
    margin: 2vh;
}

main{
    margin-top: 0;
    flex: 1;
}

a{
    text-decoration: none;
    color: inherit;
}

h1, h2, h3, summary{
    font-family: var(--headline-font);
    font-weight: 600;
    font-style: normal;
}

a{
    font-family: var(--display-font);
    font-weight: 500;
    font-style: normal;
}

p, li, figcaption{
    font-family: var(--body-font);
    font-style: normal;
}

header{
    display: none;
}

/* Top nav (desktop only) */
.top-nav {
    display: none;
}

/* Bottom nav (mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--surface-bg) 92%, transparent);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.14rem;
    height: var(--mobile-nav-height);
    padding: 0 0.28rem calc(env(safe-area-inset-bottom, 0px) + 0.1rem);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.34), 0 0 14px rgba(122, 20, 40, 0.1);
    animation: nav-bottom-enter 550ms ease forwards;
    animation-delay: 300ms;
}

.nav-link {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    gap: 0.24rem;
    padding: 0.34rem 0.2rem;
    border-radius: 0.9rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    transition: color 200ms ease, transform 200ms ease, background 200ms ease;
}

.nav-icon {
    display: block;
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.42;
    transition: opacity 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.nav-icon-image {
    width: 1.02rem;
    height: 1.02rem;
    border-radius: 0;
    background: none;
    background-image: var(--nav-icon-url);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.8;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.2));
}

.nav-label {
    font-size: 0.56rem;
    font-family: var(--display-font);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-link:active,
.nav-link:focus-visible {
    background: rgba(234, 233, 239, 0.07);
    color: var(--text-primary);
    transform: translateY(-2px);
    outline: none;
}

.nav-link.is-active {
    background: linear-gradient(180deg, rgba(234, 233, 239, 0.14), rgba(234, 233, 239, 0.06));
    color: #ffffff;
}

.nav-link.is-active .nav-icon {
    opacity: 1;
    transform: scale(1.14);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08), 0 0 10px rgba(255, 255, 255, 0.28), 0 0 16px rgba(122, 20, 40, 0.22);
}

.nav-link.is-active .nav-icon-image {
    box-shadow: none;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.34)) drop-shadow(0 0 14px rgba(122, 20, 40, 0.25));
}

.footercontainer{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.95rem;
    background:
        linear-gradient(to bottom, transparent 0%, rgba(5, 5, 5, 0.68) 20%, var(--surface-bg) 42%),
        radial-gradient(circle at 50% 0%, rgba(122, 20, 40, 0.14), transparent 46%);
    padding: 1.65rem 1rem 2.1rem;
    margin-top: 2.5rem;
    width: 100%;
    color: var(--text-primary);
    text-align: center;
}

.footer-copy {
    display: grid;
    gap: 0.28rem;
    max-width: 34rem;
}

.footer-kicker {
    margin: 0;
    font-family: var(--headline-font);
    font-size: 0.88rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(242, 244, 252, 0.78);
}

.footer-brand-link {
    color: rgba(242, 244, 252, 0.82);
    text-decoration: none;
    display: inline;
    transition: transform 180ms ease, color 180ms ease, text-shadow 220ms ease;
}

.footer-brand-link:hover,
.footer-brand-link:focus-visible {
    color: #ffffff;
    transform: scale(1.03);
    text-shadow: 0 0 9px rgba(255, 255, 255, 0.34), 0 0 15px rgba(122, 20, 40, 0.34);
    outline: none;
}

.footer-text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.6;
    color: rgba(234, 233, 239, 0.7);
    text-wrap: balance;
}

.footer-links {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
}

.footer-links a {
    width: 2.2rem;
    height: 2.2rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid rgba(234, 233, 239, 0.14);
    background: rgba(234, 233, 239, 0.03);
    transition: transform 220ms ease, border-color 220ms ease, background 220ms ease;
}

.footer-links a[aria-label="Email David"] {
    background: rgba(122, 20, 40, 0.08);
}

.footericon{
    width: 1.3rem;
    height: 1.3rem;
    object-fit: contain;
    display: block;
    filter:
        drop-shadow(0 0 5px rgba(255, 255, 255, 0.92))
        drop-shadow(0 0 14px rgba(255, 255, 255, 0.55));
    transition: filter 260ms ease, transform 260ms ease;
}

a:has(.footericon):hover .footericon,
a:has(.footericon):focus-visible .footericon {
    filter:
        drop-shadow(0 0 8px #fff)
        drop-shadow(0 0 20px rgba(255, 255, 255, 0.88))
        drop-shadow(0 0 42px rgba(122, 20, 40, 0.7));
    transform: scale(1.1) translateY(-2px);
}

.footer-links a:hover,
.footer-links a:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(234, 233, 239, 0.3);
    background: rgba(234, 233, 239, 0.07);
}

.subpage-shell {
    padding-bottom: 0;
}

.mini-shell {
    position: fixed;
    top: 0.55rem;
    left: 0.6rem;
    display: flex;
    gap: 0.35rem;
    z-index: 60;
}

.mini-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2rem;
    padding: 0.34rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(234, 233, 239, 0.16);
    background: rgba(10, 10, 12, 0.35);
    backdrop-filter: blur(8px);
    color: rgba(234, 233, 239, 0.78);
    font-family: var(--headline-font);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    opacity: 0.66;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.mini-btn-home {
    color: rgba(244, 244, 248, 0.84);
    background: rgba(14, 12, 20, 0.58);
    border-color: rgba(255, 255, 255, 0.34);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2), 0 0 18px rgba(124, 98, 172, 0.18);
    opacity: 0.86;
}

.mini-btn-home:hover,
.mini-btn-home:focus-visible {
    transform: translateY(-1px);
    color: #ffffff;
    opacity: 0.96;
    background: rgba(21, 18, 28, 0.68);
    border-color: rgba(255, 255, 255, 0.56);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.42), 0 0 24px rgba(126, 98, 178, 0.28);
    outline: none;
}

.mini-btn-icon {
    font-size: 0.74rem;
    line-height: 1;
}

.mini-btn-icon-only {
    min-height: 2.3rem;
    min-width: 2.3rem;
    padding: 0.3rem;
    justify-content: center;
    gap: 0;
}

.mini-btn-image {
    width: 1.14rem;
    height: 1.14rem;
    object-fit: contain;
    display: block;
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.2));
}

.mini-btn-home:hover .mini-btn-image,
.mini-btn-home:focus-visible .mini-btn-image {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.62)) drop-shadow(0 0 12px rgba(126, 98, 178, 0.32));
}

@media (min-width: 900px) {
    .subpage-shell {
        padding-bottom: 0;
    }

    .mini-shell {
        top: 0.75rem;
        left: 0.85rem;
        bottom: auto;
    }

    .mini-btn-icon-only {
        min-height: 2.8rem;
        min-width: 2.8rem;
        padding: 0.36rem;
    }

    .mini-btn-image {
        width: 1.42rem;
        height: 1.42rem;
    }

    .footercontainer {
        padding-top: 2rem;
    }

    .footer-text {
        font-size: 0.98rem;
    }
}

@keyframes nav-enter {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes nav-bottom-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Desktop: show top nav, hide bottom nav */
@media (min-width: 900px) {
    body {
        padding-bottom: 0;
    }

    header {
        display: none;
        position: fixed;
        width: 100%;
        z-index: 20;
        justify-content: center;
        padding-top: 0.7rem;
    }

    .top-nav {
        display: flex;
        background: color-mix(in srgb, var(--surface-bg) 84%, transparent);
        backdrop-filter: blur(10px);
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 0.55rem;
        flex-wrap: wrap;
        border-radius: 999px;
        padding: 0.55rem 0.7rem;
        min-height: 2.3rem;
        width: min(94vw, 540px);
        z-index: 10;
        opacity: 0;
        transform: translateY(-10px);
        animation: nav-enter 650ms ease forwards;
        animation-delay: 450ms;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.48), 0 0 14px rgba(122, 20, 40, 0.22), 0 0 10px rgba(255, 255, 255, 0.08);
    }

    .top-nav a {
        color: var(--text-primary);
        padding: 0.35rem 0.78rem;
        border-radius: 999px;
        letter-spacing: 0.1em;
        font-size: 0.78rem;
        font-family: var(--headline-font);
        font-weight: 500;
        text-transform: uppercase;
        transition: all 200ms ease;
    }

    .top-nav a:hover {
        background: linear-gradient(135deg, #ffffff, #f0f0f0);
        color: var(--active-text);
        box-shadow: 0 0 14px rgba(255, 255, 255, 0.34), 0 0 18px rgba(122, 20, 40, 0.28);
    }

    .top-nav a.is-active {
        background: linear-gradient(135deg, #ffffff, #f0f0f0);
        color: var(--active-text);
        font-weight: 700;
        box-shadow: 0 0 14px rgba(255, 255, 255, 0.34), 0 0 20px rgba(122, 20, 40, 0.34);
    }

    .top-nav a:focus-visible {
        outline: 2px solid var(--text-primary);
        outline-offset: 2px;
    }

    main {
        margin-top: 0;
    }

    .bottom-nav {
        display: none;
    }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .bottom-nav,
    .top-nav {
        animation: none;
    }

    .nav-link {
        transition: none;
    }
}

/* för större skärm.
    header{
    display: flex;
    flex-flow: column nowrap;
    align-content: center;  
} */