/*
  ===================================================================
    Global Site Styles (sneivandt.github.io)

    Philosophy: lightweight, no build step, accessible, responsive.
  ===================================================================
*/

/* Font Face */
@font-face {
    font-family: 'OpenSans';
    src: url('../font/OpenSans/OpenSans-Regular.ttf') format('truetype');
    font-display: swap;
}

/* Design Tokens: Dark Theme (default scope via :root) ---------------- */
:root {
    /* Primary brand + base colors */
    --primary-color: #E07A5F;
    --text-color: #EEECEC;
    --bg-dark: #121516;
    --bg-gradient-start: #1C2022;
    --bg-gradient-end: #121516;
    /* Focus ring + button surfaces */
    --focus-outline: 2px solid var(--primary-color);
    --button-bg: rgba(255, 255, 255, 0.06);
    --button-border: rgba(255, 255, 255, 0.25);
    --button-hover-bg: rgba(255, 255, 255, 0.12);
    --button-icon: var(--text-color);
}

/* Light Theme Overrides (activated by [data-theme="light"]) --------- */
[data-theme="light"] {
    --text-color: #1E1F21;
    --bg-dark: #F5F7F9;
    --bg-gradient-start: #ffffff;
    --bg-gradient-end: #E7EBEF;
    --button-bg: rgba(0, 0, 0, 0.05);
    --button-border: rgba(0, 0, 0, 0.15);
    --button-hover-bg: rgba(0, 0, 0, 0.1);
    --button-icon: #1E1F21;
}

/* Minimal Reset / Box Sizing ----------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Full-Height Root to allow flex centering --------------------------- */
html,
body {
    height: 100%;
    overflow: auto;
}

/* Body: gradient background + flex vertical layout ------------------ */
body {
    background-attachment: fixed;
    background: linear-gradient(to bottom, var(--bg-gradient-start), var(--bg-gradient-end));
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: 100%;
    margin: 0;
    font-family: OpenSans, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    transition: background-color 0.6s ease, color 0.4s ease, background 0.8s ease;
}

/* Accessibility Utility: Visually Hidden (still readable by AT) ------ */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* Skip Link: keyboard jump to main content -------------------------- */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: #000;
    padding: 0.5rem 1rem;
    z-index: 999;
    text-decoration: none;
    transition: top 0.2s ease;
    font-weight: 600;
}

.skip-link:focus-visible {
    top: 0;
}

/* Decorative Particle Canvas (layered behind content) ---------------- */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Main Centered Container -------------------------------------------- */
.container {
    max-width: 800px;
    width: 90%;
    padding: 2rem 2rem 0;
    text-align: center;
    /* Let height grow naturally so content can't be clipped */
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* remove space-between pushing first child upward */
    align-items: center;
    position: relative;
    z-index: 2;
    /* Adaptive top spacing scaled by viewport height, but never excessive */
    padding-top: clamp(2.5rem, 11vh, 6.5rem);
}

.container>*:not(.source-link) {
    margin-bottom: 1rem;
}

/* Ensure natural flow; no forced upward shift */
.container > *:first-child { margin-top: 0; }

/* Flexible content region grows to fill vertical space --------------- */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

/* Profile Image + Hover Accent --------------------------------------- */
.profile-container {
    display: flex;
    justify-content: center;
    margin-bottom: 0.8rem;
}

.profile-image {
    /* Fluid sizing: shrinks smoothly on short viewports */
    width: clamp(110px, 22vh, 180px);
    height: clamp(110px, 22vh, 180px);
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--primary-color);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-image:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.4);
}

#profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hero Heading ------------------------------------------------------- */
h1 {
    color: var(--primary-color);
    font-size: 4em;
    margin: 0.2em 0 0.15em 0;
    text-align: center;
    font-family: OpenSans, sans-serif;
}

/* Removed stepped low-height overrides in favor of fluid clamp sizing */

/* Typed Text Intro (height reserved to prevent layout shift) --------- */
.typed-container {
    margin: 0.6em 0 1.2em 0;
    min-height: 2em;
}

#typed-strings {
    display: none;
}

.typed {
    font-size: 1.5em;
    color: var(--text-color);
    text-align: center;
    opacity: 0.9;
}

/* Blinking Cursor Animation ------------------------------------------ */
.typed-cursor {
    color: var(--primary-color);
    font-size: 1.5em;
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Social Icon List --------------------------------------------------- */
ul.social-links {
    text-align: center;
    list-style-type: none;
    padding-left: 0;
    margin: 0.8rem 0;
    padding-inline-start: 0;
}

ul.social-links li {
    display: inline-block;
    margin: 0 0.5em;
    transition: transform 0.3s ease;
}

ul.social-links li:hover {
    transform: translateY(-5px);
}

/* Icon Base (font-awesome classes already present) ------------------- */
.fa {
    color: var(--text-color);
    text-decoration: none;
    font-size: 2em;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.fa:hover {
    color: var(--primary-color);
    opacity: 1;
}

/* Theme Toggle Wrapper (layout only) --------------------------------- */
.theme-toggle-wrapper {
    display: inline-block;
}

/* Shared Footer Icon Button Styling ---------------------------------- */
.footer-icon-btn {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--button-icon);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
    padding: 0.35rem 0.65rem;
    /* horizontal breathing room */
    border-radius: 8px;
    transition: color 0.25s ease, transform 0.25s ease;
}

.footer-icon-btn:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.footer-icon-btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}


/* Theme toggle variant subtle rotation */
#theme-toggle:hover {
    transform: rotate(-10deg) translateY(-2px);
}

#theme-toggle:focus-visible {
    outline: var(--focus-outline);
}

/* Icon Swapping logic based on current theme ------------------------- */
[data-theme="light"] .fa-moon {
    display: inline;
}

[data-theme="light"] .fa-sun {
    display: none;
}

[data-theme="dark"] .fa-moon {
    display: none;
}

[data-theme="dark"] .fa-sun {
    display: inline;
}

/* Accessible, consistent focus outlines for links -------------------- */
.social-links a:focus-visible,
.source-link a:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

/* Footer Layout ------------------------------------------------------ */
.site-footer {
    width: 100%;
    margin-top: auto;
    padding: 10px 5px 20px;
    font-size: 0.8em;
    z-index: 10;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.footer-left,
.footer-right {
    display: flex;
    align-items: center;
}

/* Source Code Link (GitHub) subtle until hover ----------------------- */
.source-link {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.source-link a {
    color: var(--text-color);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
}

.source-link a:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* Breakpoint ≤768px: tablet adjustments ------------------------------ */
@media (max-width:768px) {
    h1 {
        font-size: 3em;
    }

    .bio {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .profile-image {
        width: 150px;
        height: 150px;
    }

    .container {
        justify-content: flex-start;
        padding-top: 4rem;
    }

    .typed {
        font-size: 1.3em;
    }
}

/* Breakpoint ≤480px: small phone layout & scroll handling ------------ */
@media (max-width:480px) {

    html,
    body {
        overflow: auto;
        /* Allow body to expand so top content can always scroll fully into view */
        height: auto;
        min-height: 100%;
    }

    body {
        height: auto;
        /* release strict viewport lock */
        overflow-x: hidden;
        padding-top: env(safe-area-inset-top, 0px);
        /* respect notches / safe areas */
    }

    .container {
        padding: 1rem;
        /* Allow natural document flow & scrolling */
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: flex-start; /* start so content flows, footer follows */
        /* Reduced bottom padding now that footer is not fixed */
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
        /* Provide additional top breathing room above profile image */
        padding-top: clamp(2.5rem, 14vh, 6rem);
    }

    h1 {
        font-size: 2.2em;
        margin-top: 0.3em;
        margin-bottom: 0.3em;
    }

    .profile-image {
        width: 100px;
        height: 100px;
    }

    .main-content {
        flex-grow: 0;
        /* Slight downward shift after centering for improved visual balance */
        margin-top: 0;
    }

    .fa {
        font-size: 1.5em;
    }

    ul.social-links {
        margin: 0.6rem 0;
    }

    .profile-container {
        margin-bottom: 0.6rem;
    }

    .typed {
        font-size: 1.1em;
    }

    .typed-container {
        margin: 0.4em 0 0.8em 0;
    }

    .source-link {
        font-size: 0.7em;
    }

    .footer-icon-btn,
    #quick-nav-toggle {
        font-size: 1.05rem;
        /* down from ~1.3rem */
        padding: 0.3rem 0.55rem;
    }

    /* Reset first child margin since we now control spacing with padding-top */
    .container>*:first-child { margin-top: 0; }

    /* Footer now participates in normal flow (no overlap); retain compact spacing */
    .site-footer {
        position: static;
        padding: 0.75rem 0.75rem calc(env(safe-area-inset-bottom, 0px) + 0.5rem);
        background: none;
        background-color: transparent;
        box-shadow: none;
        border: 0;
    }

    /* Tweak inner alignment for compact fixed bar */
    .footer-inner { gap: 1.1rem; }
}

/* Ultra-small width (≤360px) or low-height (≤480px) adjustments ------ */
@media (max-width:360px),
(max-height:480px) {
    .container {
        padding-top: clamp(1.5rem, 12vh, 4rem); /* maintain breathing room even on very small screens */
        min-height: 100dvh;
        justify-content: center;
    }

    .main-content { margin-top: 0; }

    .profile-image {
        width: 80px;
        height: 80px;
        border-width: 2px;
    }

    h1 {
        font-size: 1.8em;
    }

    .typed {
        font-size: 0.9em;
    }

    .typed-container {
        margin: 0.3em 0 0.6em 0;
        min-height: 1.6em;
    }

    .fa {
        font-size: 1.3em;
        padding: 0.3rem;
    }

    ul.social-links li {
        margin: 0 0.3em;
    }

    .footer-icon-btn,
    #quick-nav-toggle {
        font-size: 0.95rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Reduced Motion Preference: remove non-essential animation ---------- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .profile-image:hover {
        transform: none;
    }
}

/* Quick Nav Component (footer dropdown menu) ------------------------- */
.footer-inner {
    gap: 1.75rem;
}

@media (max-width: 420px) {
    .footer-inner {
        gap: 1rem;
    }
}

.footer-center {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.quick-nav {
    position: relative;
    display: flex;
    align-items: center;
}

.footer-right {
    margin-left: 1rem;
}

@media (min-width: 640px) {
    .footer-right {
        margin-left: 1.25rem;
    }
}

@media (max-width: 480px) {
    .footer-right {
        margin-left: 0.7rem;
    }
}

#quick-nav-toggle {
    font-size: 1.3rem;
}

#quick-nav-toggle:hover {
    color: var(--primary-color);
}

.quick-nav-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    /* sits above toggle with spacing */
    left: 50%;
    transform: translateX(-50%);
    background: var(--button-bg);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid var(--button-border);
    border-radius: 12px;
    padding: 0.6rem 0.5rem;
    min-width: 180px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    transform-origin: bottom center;
    /* Keep popup static horizontally (include translateX in keyframes) */
    animation: quick-nav-in 0.25s ease;
    z-index: 40;
    text-align: center; /* ensure link text visually centered */
}

@keyframes quick-nav-in {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.9) translateY(6px);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1) translateY(0);
    }
}

.quick-nav-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.quick-nav-menu li {
    margin: 0;
}

.quick-nav-menu a {
    display: block;
    padding: 0.45rem 0.75rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.2;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

.quick-nav-menu a:hover,
.quick-nav-menu a:focus-visible {
    background: var(--button-hover-bg);
    color: var(--primary-color);
    outline: none;
}

.quick-nav-noscript-inline a {
    background: var(--button-bg);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.75rem;
}

.quick-nav-noscript-inline a:hover {
    background: var(--button-hover-bg);
    color: var(--primary-color);
}

@media (max-width: 600px) {
    .quick-nav-menu {
        min-width: 160px;
        bottom: 48px;
    }
}

/* Reduced Motion override for Quick Nav animation -------------------- */
@media (prefers-reduced-motion: reduce) {
    .quick-nav-menu {
        animation: none !important;
    }

    #quick-nav-toggle {
        transition: none !important;
    }
}