/* style.css — Shared responsive styles for maksym.info
   Color scheme matches photos.maksym.info gallery */

/* ---- Custom Properties ---- */
:root {
    --color-bg: #faebd7;
    --color-surface: #f5deb3;
    --color-text: #4b0082;
    --color-accent: #b8860b;
    --color-heading: #0000ff;
    --font-family: Arial, sans-serif;
    --max-width: 960px;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: 0.2s ease;
    --sidebar-width: 220px;
}

/* ---- Reset ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---- Base ---- */
body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 1rem;
    line-height: 1.7;
}

/* Scroll lock when mobile nav is open */
body.nav-open {
    overflow: hidden;
}

h1, h2, h3 {
    color: var(--color-heading);
    line-height: 1.3;
    letter-spacing: 0.01em;
}

h1 { font-size: 1.7rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.3rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--color-heading);
    transition: color var(--transition);
}
a:hover { color: var(--color-text); }
a:focus-visible {
    outline: 2px solid var(--color-heading);
    outline-offset: 2px;
}

/* ---- Site Header ---- */
.site-header {
    text-align: center;
    padding: 2.5rem 1rem 1.5rem;
}

.portrait {
    display: block;
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--color-accent);
    margin: 0 auto 1.25rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.site-header h1 {
    margin-bottom: 0.75rem;
}

.site-header .quote {
    font-style: italic;
    font-size: 0.85rem;
    opacity: 0.75;
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.site-header .quote:last-of-type {
    margin-bottom: 0;
}

/* ---- Page Layout ---- */
.page-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
    flex: 1;
    align-items: start;
}

/* Single-column override (pages without sidebar) */
.page-content--full {
    grid-template-columns: 1fr !important;
}

/* ---- Sidebar ---- */
.sidebar {
    background-color: var(--color-surface);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.sidebar h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-accent);
}

/* ---- Nav Links (main page) ---- */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.35rem;
    border-radius: var(--radius);
    border-left: 3px solid transparent;
    text-decoration: none;
    font-size: 0.95rem;
    color: var(--color-heading);
    transition:
        background-color var(--transition),
        border-color var(--transition),
        color var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
    /* Entrance animation — initially hidden, JS reveals */
    opacity: 0;
    transform: translateY(8px);
}

/* Once JS runs, links animate in via .nav-ready class */
.nav-ready .nav-link {
    animation: navSlideIn 0.35s ease forwards;
}

.nav-link:last-of-type { margin-bottom: 0; }

.nav-link:hover {
    background-color: var(--color-bg);
    border-left-color: var(--color-accent);
    color: var(--color-text);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(75, 0, 130, 0.1);
}

.nav-link:focus-visible {
    outline: 2px solid var(--color-heading);
    outline-offset: 2px;
}

/* Active link (set by JS) */
.nav-link.is-active {
    background-color: var(--color-bg);
    border-left-color: var(--color-accent);
    color: var(--color-text);
    font-weight: 600;
}

/* Label fills remaining space */
.nav-label {
    flex: 1;
    min-width: 0;
}

/* Arrow indicator */
.nav-arrow {
    font-size: 1.1rem;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity var(--transition), transform var(--transition);
    color: var(--color-accent);
    flex-shrink: 0;
}

.nav-link:hover .nav-arrow {
    opacity: 1;
    transform: translateX(0);
}

.nav-link.is-active .nav-arrow {
    opacity: 0.6;
    transform: translateX(0);
}

/* ---- Entrance Animation Keyframes ---- */
@keyframes navSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* List sidebar (research page) */
.sidebar ul {
    list-style: none;
    padding-left: 0;
}
.sidebar > ul > li {
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(184, 134, 11, 0.25);
}
.sidebar > ul > li:last-child { border-bottom: none; }
.sidebar li {
    font-size: 0.9rem;
    line-height: 1.5;
}
.sidebar ul ul {
    margin-top: 0.25rem;
    padding-left: 1rem;
}
.sidebar ul ul li {
    font-size: 0.82rem;
    padding: 0.15rem 0;
}

/* ---- Mobile Nav Toggle (FAB) ---- */
.nav-toggle {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background-color: var(--color-heading);
    color: var(--color-bg);
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: background-color var(--transition), transform var(--transition);
    line-height: 1;
}

.nav-toggle:hover {
    background-color: var(--color-text);
    transform: scale(1.05);
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

/* Hamburger icon lines drawn with box-shadow trick */
.nav-toggle-icon {
    display: block;
    position: relative;
    width: 20px;
    height: 2px;
    margin: 0 auto;
    background-color: var(--color-bg);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-bg);
    transition: transform 0.15s ease;
}

.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after  { top: 6px; }

/* ---- Mobile Nav Panel Close Button ---- */
.nav-close {
    display: none;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background-color: transparent;
    color: var(--color-text);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: background-color var(--transition);
}

.nav-close:hover {
    background-color: rgba(75, 0, 130, 0.1);
}

.nav-close:focus-visible {
    outline: 2px solid var(--color-heading);
    outline-offset: 2px;
}

/* ---- Backdrop Overlay ---- */
.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 998;
    background-color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-backdrop.is-visible {
    display: block;
    opacity: 1;
}

/* ---- Main Content ---- */
main {
    min-width: 0;
}

main section {
    background-color: var(--color-surface);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

main section:last-child {
    margin-bottom: 0;
}

main h2 {
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--color-accent);
    margin-bottom: 1rem;
}

main p {
    font-size: 0.95rem;
    text-align: justify;
}

/* Research page article (no card wrapper) */
main article {
    background-color: var(--color-surface);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

/* Skills pills */
.skills {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.skills li {
    font-size: 0.85rem;
    padding: 0.25rem 0.7rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-accent);
    border-radius: 1rem;
    color: var(--color-text);
}

/* Research page list (inside article) */
main ul:not(.skills) {
    list-style: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

main ul:not(.skills) li {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    text-align: justify;
}

/* ---- Embed Container ---- */
.embed-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--color-accent);
    background-color: var(--color-surface);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.embed-container iframe {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    border: none;
}

.embed-container--slides iframe {
    aspect-ratio: 860 / 640;
}

/* ---- Site Footer ---- */
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.85rem;
    border-top: 2px solid var(--color-accent);
    margin-top: auto;
}

.footer-icons {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer-icon-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition);
}

.footer-icon-link:hover {
    color: var(--color-accent);
}

.footer-icon-link:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
    border-radius: var(--radius);
}

/* ---- Desktop (768px+) ---- */
@media (min-width: 768px) {
    .page-content {
        grid-template-columns: var(--sidebar-width) 1fr;
        padding: 1.5rem;
        gap: 2rem;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.4rem; }

    .site-header {
        padding: 3rem 1rem 1.5rem;
    }

    .portrait {
        width: 200px;
        height: 200px;
    }

    /* Sticky sidebar on desktop */
    .sidebar {
        position: sticky;
        top: 1.5rem;
    }
}

/* ---- Mobile (below 768px) ---- */
@media (max-width: 767px) {
    /* Hide sidebar in normal flow; it becomes an overlay panel */
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(300px, 85vw);
        z-index: 999;
        border-radius: 0;
        border: none;
        border-left: 2px solid var(--color-accent);
        padding: 3.5rem 1.25rem 1.25rem;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    /* Show toggle button on mobile */
    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Show close button inside panel on mobile */
    .nav-close {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Nav links are visible by default on mobile panel (no entrance anim) */
    .nav-link {
        opacity: 1;
        transform: none;
    }

    .nav-ready .nav-link {
        animation: none;
        opacity: 1;
        transform: none;
    }

    /* Always show arrow on mobile since there is no hover */
    .nav-arrow {
        opacity: 0.4;
        transform: translateX(0);
    }
}

/* ---- Small Phones (480px-) ---- */
@media (max-width: 480px) {
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.15rem; }

    .portrait {
        width: 140px;
        height: 140px;
    }

    .site-header {
        padding: 1.5rem 0.75rem 1rem;
    }

    .site-header .quote {
        font-size: 0.8rem;
    }

    .page-content {
        padding: 0.75rem;
        gap: 1rem;
    }

    main section,
    main article {
        padding: 1rem;
    }

    .site-footer {
        font-size: 0.8rem;
        padding: 1rem 0.75rem;
    }
}
