/* ==========================================================
   Portfolio stylesheet — mobile-first.
   Base styles = phone (single column).
   Media queries at 640px / 768px / 1024px reflow to multi-column.
   ========================================================== */

/* ---------- Theme tokens ---------- */
:root,
:root[data-theme="dark"] {
    --bg: #0e0f13;
    --bg-soft: #14161c;
    --surface: #181b22;
    --surface-2: #1f232c;
    --border: #2a2f3a;
    --text: #ece8e1;
    --muted: #9a9ba6;
    --accent: #ffb454;
    --accent-ink: #1a1203;
    --accent-2: #6ee7c8;
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
    --glow: radial-gradient(60% 50% at 80% 0%, rgba(255, 180, 84, .13), transparent 70%),
            radial-gradient(40% 40% at 0% 30%, rgba(110, 231, 200, .07), transparent 70%);
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f7f3ec;
    --bg-soft: #efe9de;
    --surface: #fffdf8;
    --surface-2: #f3ede2;
    --border: #ddd4c4;
    --text: #1c1a16;
    --muted: #6a665d;
    --accent: #c2410c;
    --accent-ink: #fff7ed;
    --accent-2: #0f766e;
    --shadow: 0 18px 36px -20px rgba(80, 55, 20, .35);
    --glow: radial-gradient(60% 50% at 80% 0%, rgba(194, 65, 12, .09), transparent 70%),
            radial-gradient(40% 40% at 0% 30%, rgba(15, 118, 110, .06), transparent 70%);
    color-scheme: light;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg) var(--glow) no-repeat;
    background-attachment: fixed;
    transition: background-color .3s ease, color .3s ease;
    overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; }

h1, h2, h3 {
    font-family: "Fraunces", Georgia, serif;
    line-height: 1.15;
    margin: 0 0 .6em;
    letter-spacing: -.01em;
    overflow-wrap: break-word;   /* text never breaks the layout */
}

h1 { font-size: clamp(2.1rem, 7vw, 3.8rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }

p { margin: 0 0 1em; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

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

.container { width: min(100% - 2.5rem, 72rem); margin-inline: auto; }

.skip-link {
    position: absolute; left: -999px; top: 0;
    background: var(--accent); color: var(--accent-ink);
    padding: .6rem 1rem; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.accent-text { color: var(--accent); }
.eyebrow {
    font-family: "JetBrains Mono", monospace;
    font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
    color: var(--accent); margin-bottom: .8rem;
}
.lead { font-size: 1.125rem; color: var(--muted); max-width: 40rem; }

/* ---------- Header / navigation (phone first) ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 4.2rem; }

.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; font-weight: 700; }
.brand-logo { display: block; width: 3rem; height: 3rem; object-fit: contain; }
.brand-name { display: inline; }

.header-actions { display: flex; gap: .5rem; align-items: center; }

.icon-btn {
    display: grid; place-items: center;
    width: 2.6rem; height: 2.6rem; border-radius: 12px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); cursor: pointer;
    transition: border-color .2s, transform .2s, background .2s;
}
.icon-btn:hover { border-color: var(--accent); transform: translateY(-1px); }

/* theme icon swap */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* hamburger */
.bars { position: relative; width: 18px; height: 14px; display: block; }
.bars i { position: absolute; left: 0; width: 100%; height: 2px; background: currentColor; border-radius: 2px; transition: transform .25s, opacity .2s, top .25s; }
.bars i:nth-child(1) { top: 0; }
.bars i:nth-child(2) { top: 6px; }
.bars i:nth-child(3) { top: 12px; }
.nav-open .bars i:nth-child(1) { top: 6px; transform: rotate(45deg); }
.nav-open .bars i:nth-child(2) { opacity: 0; }
.nav-open .bars i:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* mobile menu = dropdown panel */
.site-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden;
    transition: max-height .3s ease;
}
.nav-open .site-nav { max-height: 16rem; }
.site-nav ul { display: flex; flex-direction: column; padding: .5rem 1.25rem 1rem; }
.site-nav a {
    display: block; padding: .8rem .4rem; text-decoration: none;
    font-weight: 600; border-bottom: 1px solid var(--border);
    color: var(--muted); transition: color .2s;
}
.site-nav li:last-child a { border-bottom: 0; }
.site-nav a:hover, .site-nav a.is-active { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .85rem 1.4rem; border-radius: 12px;
    font-weight: 700; text-decoration: none; font-size: .98rem;
    border: 1px solid transparent; transition: transform .2s, box-shadow .2s, background .2s, border-color .2s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px -12px var(--accent); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -12px var(--accent); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.text-link { font-weight: 700; color: var(--accent); text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size .25s; }
.text-link:hover { background-size: 100% 2px; }

/* ---------- Sections ---------- */
.section { padding: 3.2rem 0; }
.section-head { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; margin-bottom: 1.8rem; }
.section-head h2 { margin-bottom: .2rem; }

.page-hero { padding: 3.5rem 0 1rem; }
.page-hero + .section { padding-top: .5rem; }

/* ---------- Hero (home) ---------- */
.hero { padding: 3rem 0 1.5rem; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
.hero h1 em { display: block; font-style: italic; font-weight: 400; font-size: .5em; color: var(--muted); margin-top: .6rem; }

/* profile portrait */
.portrait-card {
    position: relative;
    width: min(100%, 24rem);
    aspect-ratio: 1;
    justify-self: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface-2);
    box-shadow: var(--shadow);
}
.portrait-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.portrait-card figcaption {
    position: absolute;
    inset: auto 0 0;
    display: grid;
    gap: .25rem;
    padding: 2.5rem 1.4rem 1.3rem;
    color: #fff;
    background: linear-gradient(transparent, rgb(0 0 0 / 75%));
}
.portrait-card figcaption strong { font-size: 1.15rem; }
.portrait-card figcaption span { font-size: .88rem; color: rgb(255 255 255 / 80%); }

/* stats */
.stat-row { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.stat { padding: 1.3rem 1.5rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); display: flex; align-items: baseline; gap: 1rem; }
.stat strong { font-family: "Fraunces", serif; font-size: 2.2rem; color: var(--accent); line-height: 1; }
.stat-copy { display: grid; gap: .125rem; }
.stat-label { color: var(--text); font-size: .95rem; }
.stat-copy small { color: var(--muted); font-size: calc(.95rem - 2px); }

/* CTA */
.cta-band { text-align: center; padding: 2.5rem 1.5rem; border-radius: 24px; border: 1px solid var(--border); background: linear-gradient(135deg, var(--surface), var(--surface-2)); }
.cta-band p { color: var(--muted); }

/* ---------- Project grid + cards ---------- */
.project-grid { display: grid; grid-template-columns: 1fr; gap: 1.4rem; }

.project-card {
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 18px; overflow: hidden;
    transition: transform .25s, border-color .25s, box-shadow .25s;
}
.project-card:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: var(--shadow); }

/* The filter hides cards just by adding this class */
.project-card.is-hidden { display: none; }
.project-card.pop { animation: pop .35s ease both; }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }

.cover { position: relative; display: grid; place-items: center; height: 9.5rem; color: rgba(255, 255, 255, .92); overflow: hidden; }
.cover::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 2px, transparent 2px 14px); }
.cover svg { position: relative; z-index: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.3)); transition: transform .3s; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.project-card:hover .cover img { transform: scale(1.06); }
.cover:has(img)::after { display: none; }  /* removes the diagonal stripes over photos */
.project-card:hover .cover svg { transform: scale(1.12) rotate(-4deg); }
.cover--web    { background: linear-gradient(135deg, #f97316, #db2777); }
.cover--python { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.cover--games  { background: linear-gradient(135deg, #10b981, #0d9488 50%, #0891b2); }
.badge { position: absolute; z-index: 1; top: .8rem; left: .8rem; padding: .2rem .7rem; border-radius: 999px; font-family: "JetBrains Mono", monospace; font-size: .7rem; background: rgba(0,0,0,.35); color: #fff; backdrop-filter: blur(4px); }

.card-body { display: flex; flex-direction: column; flex: 1; padding: 1.3rem; }
.card-body h3 { margin-bottom: .4rem; }
.card-body p { color: var(--muted); font-size: .95rem; }
.card-body .text-link { margin-top: auto; align-self: flex-start; }

.tags { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.1rem; }
.tags li { padding: .2rem .65rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-family: "JetBrains Mono", monospace; font-size: .72rem; color: var(--muted); }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.filter-btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .6rem 1.1rem; border-radius: 999px;
    background: var(--surface); color: var(--muted);
    border: 1px solid var(--border);
    font: inherit; font-weight: 600; cursor: pointer;
    transition: all .2s;
}
.filter-btn:hover { color: var(--text); border-color: var(--accent); }
.filter-btn.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.filter-btn .count { font-family: "JetBrains Mono", monospace; font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: rgba(128,128,128,.2); }
.filter-status { color: var(--muted); font-size: .88rem; margin-bottom: 1.4rem; font-family: "JetBrains Mono", monospace; }

/* ---------- About page ---------- */
.about-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.info-card { padding: 1.6rem; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); align-self: start; }
.info-card h2 { font-size: 1.3rem; }
.info-card dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: .2rem; }
.info-card dt { font-family: "JetBrains Mono", monospace; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-top: .9rem; }
.info-card dd { margin: 0; overflow-wrap: anywhere; }
.info-card dd a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }

.skills-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
.skill-group { padding: 1.5rem; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.skill-group .tags { margin: 0; }

.timeline { position: relative; margin-left: .4rem; padding-left: 1.6rem; border-left: 2px solid var(--border); display: grid; gap: 2rem; }
.timeline li { position: relative; display: grid; gap: .3rem; }
.timeline li::before { content: ""; position: absolute; left: calc(-1.6rem - 7px); top: .45rem; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg); }
.timeline .year { font-family: "JetBrains Mono", monospace; color: var(--accent); font-size: .85rem; }
.timeline h3 { margin-bottom: .2rem; }
.timeline p { color: var(--muted); margin: 0; }

.education-timeline { gap: 1.2rem; }
.timeline.education-timeline li { grid-template-columns: 1fr; }  /* stops the 7rem column squeeze */
.education-heading { display: block; }
.education-heading h3 { margin: 0 0 .2rem; }
.education-degree { margin: 0; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 3rem; padding: 2rem 0; border-top: 1px solid var(--border); background: var(--bg-soft); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; flex-direction: column; gap: 1rem; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
/* keep cards hoverable after reveal */
.project-card.reveal.is-visible { transition: transform .25s, border-color .25s, box-shadow .25s, opacity .6s; }

/* ==========================================================
   MEDIA QUERIES — the layout reflows as the screen grows
   ========================================================== */

/* Large phones / small tablets: 2 columns */
@media (min-width: 640px) {
    .project-grid { grid-template-columns: repeat(2, 1fr); }
    .skills-grid  { grid-template-columns: repeat(2, 1fr); }
    .stat-row     { grid-template-columns: repeat(3, 1fr); }
    .stat         { flex-direction: column; gap: .3rem; align-items: flex-start; }
    .footer-inner { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* Tablets: inline nav replaces hamburger, hero becomes 2-col */
@media (min-width: 768px) {
    .nav-toggle { display: none; }
    .site-nav { position: static; max-height: none; overflow: visible; background: none; border: 0; }
    .site-nav ul { flex-direction: row; gap: .3rem; padding: 0; }
    .site-nav a { padding: .5rem 1rem; border: 0; border-radius: 10px; }
    .site-nav a:hover { background: var(--surface); }
    .site-nav a.is-active { background: var(--surface); }

    .hero { padding: 4.5rem 0 2rem; }
    .hero-grid { grid-template-columns: 1.15fr .85fr; gap: 3rem; }
    .about-grid { grid-template-columns: 1.6fr 1fr; gap: 3rem; }
    .section { padding: 4.2rem 0; }
    .section-head { flex-direction: row; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem; }
    .section-head .eyebrow { flex-basis: 100%; margin-bottom: 0; }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
    .project-grid { grid-template-columns: repeat(3, 1fr); gap: 1.8rem; }
    .skills-grid  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .cover { height: 11rem; }
    .timeline:not(.education-timeline) li { grid-template-columns: 7rem 1fr; align-items: baseline; gap: 1rem; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .reveal { opacity: 1; transform: none; }
}
/* Education: make each item a plain block so the timeline's 7rem column can't apply */
.timeline.education-timeline > li {
    display: block !important;
    grid-template-columns: none !important;
}
.section.about-intro-section { padding-bottom: 1.5rem; }
.section.about-followup-section { padding: 3rem 0; }