/* ---------- Design tokens ---------- */
:root {
    --bg: #0b1220;
    --surface: #131c2e;
    --surface-2: #1b2740;
    --border: #26344f;
    --text: #e6ebf5;
    --muted: #9aa8c2;
    --accent: rgb(88, 160, 232);
    --accent-strong: #7bb8f2;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --max-width: 87.5rem;   /* 1400px at normal size; grows with the font-size bumps below */
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Scale the whole page up on big screens (sizes in rem grow with this) */
@media (min-width: 1600px) {
    html {
        font-size: 112.5%;
    }
}

@media (min-width: 2200px) {
    html {
        font-size: 125%;
    }
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(1200px 600px at 50% -200px, #16233d 0%, var(--bg) 60%);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent-strong);
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* ---------- Header ---------- */
.header-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    /* Side padding grows on wide screens so the header lines up with the content below */
    padding: 18px max(clamp(16px, 4vw, 48px), calc((100% - var(--max-width)) / 2 + 32px));
    background: rgba(19, 28, 46, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    /* Lets the enlarged headshot draw on top of the sticky nav below the header */
    position: relative;
    z-index: 101;
}

.headline-div {
    text-align: center;
}

.headline {
    margin: 0;
    font-size: clamp(1.25rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: 0 0 12px rgba(88, 160, 232, 0.55), 0 0 28px rgba(88, 160, 232, 0.3);
}

.subheadline {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.headshot-div {
    justify-self: start;
}

.headshot {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--accent);
    box-shadow: 0 0 18px rgba(88, 160, 232, 0.45);
    cursor: zoom-in;
    transform-origin: top left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Only on devices that hover (mouse). Phones use click-to-enlarge instead. */
@media (hover: hover) {
    .headshot:hover {
        transform: scale(3.5);   /* 72px becomes about 250px */
        box-shadow: 0 0 30px rgba(88, 160, 232, 0.6), 0 12px 40px rgba(0, 0, 0, 0.5);
    }
}

/* ---------- Main ---------- */
.total-visual {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px clamp(16px, 4vw, 32px) 56px;
}

.hero {
    margin: 0 auto 48px;
    max-width: 53rem;   /* text stays at a readable width even on huge screens */
}

.greeting {
    margin: 0;
    padding: 24px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    font-size: 1.1rem;
    color: var(--text);
    box-shadow: var(--shadow);
}

.section-title {
    margin: 0 0 20px;
    font-size: 1.5rem;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 14px;
}

.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border), transparent);
}

section {
    margin-bottom: 56px;
}

/* ---------- Gallery ---------- */
.main-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.main-div {
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    aspect-ratio: 4 / 3;
}

.main-images {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.main-div:hover .main-images {
    transform: scale(1.07);
    filter: brightness(1.08);
}

.hint {
    margin: 12px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---------- Footer ---------- */
footer {
    margin: 0;
    padding: 28px 16px 24px;
    text-align: center;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-div {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 28px;
    margin-bottom: 14px;
}

.footlink {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.footlink:hover,
.footlink:focus-visible {
    color: var(--accent-strong);
    border-bottom-color: var(--accent);
}

.copyright {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---------- Inner-page header (About Me, etc.) ---------- */
.page-header {
    padding: 22px max(clamp(16px, 4vw, 48px), calc((100% - var(--max-width)) / 2 + 32px));
    text-align: center;
    background: rgba(19, 28, 46, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.page-title {
    margin: 0;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: 0 0 12px rgba(88, 160, 232, 0.55), 0 0 28px rgba(88, 160, 232, 0.3);
}

.page-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------- About Me page ---------- */
.about-main {
    max-width: 62rem;
}

.about-profile {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 32px;
}

.about-photo {
    width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--accent);
    box-shadow: 0 0 28px rgba(88, 160, 232, 0.45);
}

.about-card {
    padding: 24px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 1.1rem;
}

.about-card p {
    margin: 0 0 1em;
}

.about-card p:last-child {
    margin-bottom: 0;
}

.tag-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tag-list li {
    padding: 10px 18px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-weight: 500;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tag-list li:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 0 14px rgba(88, 160, 232, 0.3);
}

.about-closing {
    margin: 0 0 28px;
    text-align: center;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--muted);
}

.about-actions {
    text-align: center;
}

.return-btn,
.pill-btn {
    display: inline-block;
    padding: 12px 28px;
    color: var(--text);
    background: linear-gradient(145deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.return-btn:hover,
.return-btn:focus-visible,
.pill-btn:hover,
.pill-btn:focus-visible {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 10px 28px rgba(88, 160, 232, 0.25);
}

.pill-btn.primary {
    background: linear-gradient(145deg, #3f86cf, #2c5f9a);
    border-color: var(--accent);
    color: #fff;
}

/* Placeholder state until a real resume file exists */
.pill-btn.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.4);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

/* Skills + education */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.skill-group {
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.skill-group h3 {
    margin: 0 0 14px;
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

.skill-group .tag-list li {
    padding: 7px 14px;
    font-size: 0.95rem;
}

.edu-school {
    font-size: 1.3rem;
    font-weight: 700;
}

.edu-status {
    color: var(--muted);
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

@media (max-width: 700px) {
    .about-profile {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 24px;
    }

    .about-photo {
        width: 180px;
        height: 180px;
    }

    .about-card {
        padding: 18px 20px;
        font-size: 1rem;
    }
}

/* ---------- Pandora's Jar page ---------- */
.pandora-main {
    max-width: var(--max-width);
}

.pandora-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: start;
    margin-bottom: 48px;
}

.pandora-col {
    padding: 22px 24px 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.pandora-col.highlight {
    background: var(--surface-2);
}

.pandora-col h2 {
    margin: 0 0 14px;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
}

.pandora-col p,
.pandora-col li {
    font-size: 1rem;
}

.pandora-col p {
    margin: 0 0 1em;
}

.pandora-col ul {
    margin: 0 0 1em;
    padding-left: 1.3em;
}

.pandora-col li {
    margin-bottom: 6px;
}

.pandora-img {
    width: 100%;
    height: 240px;
    margin-bottom: 18px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.pandora-img.portrait {
    object-position: top;
}

.pdf-section {
    margin-bottom: 40px;
    text-align: center;
}

.pdf-note {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 1.05rem;
}

button.pill-btn {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 900px) {
    .pandora-container {
        grid-template-columns: 1fr;
    }

    .pandora-img {
        height: 220px;
    }
}

/* ---------- Project cards (home page) ---------- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 22px;
}

.project-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--text);
    text-decoration: none;
    background: linear-gradient(145deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover,
.project-card:focus-visible {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 16px 40px rgba(88, 160, 232, 0.25);
}

/* Cover area. Swap the <div> for an <img class="project-thumb"> to use a screenshot instead. */
.project-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 8.5rem;
    width: 100%;
    object-fit: cover;
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.35);
    background: linear-gradient(135deg, #1b3157, #2c5f9a 55%, #58a0e8);
}

.project-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 18px 22px 22px;
}

.project-body h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.project-body p {
    flex: 1;
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 0.98rem;
}

.project-link {
    color: var(--accent-strong);
    font-weight: 600;
    font-size: 0.95rem;
}

.project-link::after {
    content: " \2192";
    display: inline-block;
    transition: transform 0.25s ease;
}

.project-card:hover .project-link::after,
.project-card:focus-visible .project-link::after {
    transform: translateX(5px);
}

/* ---------- Math Magic page ---------- */
.math-main {
    max-width: 62rem;
}

.strip-note {
    margin: 0 0 14px;
    text-align: center;
    color: var(--muted);
}

.cross-strip {
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.cross-strip li {
    padding: 10px 20px;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent-strong);
    text-shadow: 0 0 12px rgba(88, 160, 232, 0.55);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.worked-example {
    padding: 24px 28px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.we-title {
    margin: 0 0 18px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
}

.digit-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.digit-step {
    padding: 18px 14px;
    text-align: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.digit-step .digit {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--accent-strong);
    text-shadow: 0 0 16px rgba(88, 160, 232, 0.6);
}

.digit-step .why {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.95rem;
}

.we-result {
    margin: 20px 0 0;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.we-result span {
    color: var(--accent-strong);
    text-shadow: 0 0 14px rgba(88, 160, 232, 0.6);
}

.inside-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.inside-card {
    padding: 20px 22px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.inside-card h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.inside-card p {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.98rem;
}

.inside-card .eg {
    margin: 0;
    color: var(--accent-strong);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.paper-box {
    text-align: center;
}

.paper-box .section-title {
    text-align: left;
}

.paper-meta {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

@media (max-width: 600px) {
    .inside-grid {
        grid-template-columns: 1fr;
    }

    .digit-steps {
        grid-template-columns: 1fr;
    }

    .worked-example {
        padding: 18px 16px 22px;
    }
}

/* ---------- Resume page ---------- */
.resume-main { max-width: 53rem; }
.resume-contact { text-align: center; color: var(--muted); margin: 0.5rem 0 1.5rem; }
.resume-contact a { color: var(--accent-strong); }
.resume-sheet {
    margin-bottom: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(1.25rem, 4vw, 2.5rem);
}
.resume-sheet h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent-strong);
    margin: 1.75rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.resume-sheet h2:first-child { margin-top: 0; }
.resume-sheet p { margin: 0 0 0.6rem; line-height: 1.65; }
.resume-sheet ul { margin: 0.25rem 0 0.75rem; padding-left: 1.25rem; line-height: 1.6; }
.resume-sheet li { margin-bottom: 0.35rem; }
.resume-sheet .entry { margin-bottom: 1rem; }
.resume-sheet .row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; }
.resume-sheet .row span { color: var(--muted); }
.resume-sheet ul.skills { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.resume-sheet ul.skills li {
    margin: 0; padding: 0.3rem 0.8rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
}

/* ---------- Embedded presentation ---------- */
.embed-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 1rem 0 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    background: var(--surface);
}
.embed-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------- Lightbox ---------- */
#lightbox {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    max-width: min(92vw, 1000px);
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

#lightbox::backdrop {
    background: rgba(5, 9, 18, 0.8);
    backdrop-filter: blur(4px);
}

#lightboxImg {
    max-width: 100%;
    max-height: 90vh;
    margin: 0 auto;
    object-fit: contain;
}

#lightboxClose {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(11, 18, 32, 0.8);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

#lightboxClose:hover {
    background: var(--accent);
}

/* ---------- Scroll reveal (added by JS) ---------- */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    .header-container {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 12px;
    }

    .headshot-div {
        justify-self: center;
    }

    .headshot {
        transform-origin: top center;
    }

    .greeting {
        padding: 18px 20px;
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ---------- Guardian accent ---------- */
.guardian {
    color: #A37E22;
}