/* --- CSS VARIABLES (MATCHING RESUME DESIGN) --- */
:root {
    /* Resume color palette - flat blue */
    --primary-blue: #2196F3;
    --dark-blue: #1976D2;
    --light-blue: #E3F2FD;
    --accent-blue: #2196F3;
    --text-dark: #1a1a1a;
    --text-light: #ffffff;
    --text-muted: #555555;
    --bg-white: #ffffff;
    --bg-gray: #f8f9fa;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 20px rgba(33, 150, 243, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    display: flex;
    height: 100vh;
    background: var(--bg-white);
    color: var(--text-dark);
    overflow: hidden;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    line-height: 1.6;
}

/* --- SIDEBAR (Flat blue matching resume) --- */
aside {
    width: 320px;
    background: var(--primary-blue);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 2rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.profile-section {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.profile-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.5);
    margin-bottom: 1.5rem;
    background-color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.profile-img:hover {
    transform: scale(1.05);
    border-color: rgba(255,255,255,0.8);
}

.name {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.02em;
    color: white;
}

.role {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: white;
}

/* --- NAVIGATION --- */
nav {
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

nav button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    width: 100%;
    text-align: left;
    padding: 14px 18px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
}

nav button::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: white;
    transform: scaleY(0);
    transition: transform 0.25s ease;
}

nav button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

nav button:hover::before {
    transform: scaleY(1);
}

nav button.active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--dark-blue);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

nav button.active::before {
    transform: scaleY(1);
    background: var(--dark-blue);
}

/* --- SIDEBAR CONTACT (compact) --- */
.sidebar-contact {
    padding-bottom: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.sidebar-contact a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-contact a:hover {
    opacity: 1;
    text-decoration: underline;
}

.sidebar-contact a:not(:hover) {
    opacity: 0.9;
}

/* --- MAIN CONTENT AREA --- */
main {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2.5rem 3rem;
    scroll-behavior: smooth;
    position: relative;
    background: var(--bg-white);
}

.page {
    display: none;
    max-width: 1100px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease;
}

.page.active-page {
  display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    letter-spacing: -0.03em;
    position: relative;
    padding-bottom: 12px;
    -webkit-text-fill-color: var(--text-dark);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--primary-blue);
    border-radius: 2px;
}

p.intro {
    font-size: 1.2rem;
    line-height: 1.7;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 850px;
    font-weight: 400;
}

/* --- HERO SECTION --- */
.hero-section {
    margin-bottom: 3rem;
}

#home .hero-section {
    margin-bottom: 1.25rem;
}

.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

#home .hero-header {
    margin-bottom: 1rem;
}

.hero-badge {
    display: inline-block;
    background: var(--light-blue);
    color: var(--dark-blue);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(33, 150, 243, 0.3);
    letter-spacing: 0.02em;
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    display: block;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    -webkit-text-fill-color: var(--text-dark);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
}

#home .hero-title {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

#home .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 0;
}

/* --- CTA BUTTONS --- */
.cta-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.btn-primary:hover {
    background: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.btn-primary svg {
    transition: transform 0.25s ease;
}

.btn-primary:hover svg {
    transform: translateX(4px);
}

.btn-secondary {
    background: white;
    color: var(--primary-blue);
    border: 2px solid rgba(33, 150, 243, 0.3);
}

#home .btn-secondary {
    padding: 9px 20px;
    font-size: 0.88rem;
    border-radius: 8px;
}

.btn-secondary:hover {
    background: var(--light-blue);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
}

/* --- STATS GRID --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
    padding: 2rem 0;
    border-top: 2px solid var(--light-blue);
    border-bottom: 2px solid var(--light-blue);
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-blue);
    font-family: 'Inter', sans-serif;
    line-height: 1;
    margin-bottom: 0.5rem;
    -webkit-text-fill-color: var(--primary-blue);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- GRID SYSTEM FOR PORTFOLIO ITEMS --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

/* Portfolio tabs: consistent header/intro across graphics, presentations, web */
#graphics h1,
#presentations h1,
#web h1 {
  margin-bottom: 0.75rem;
  font-size: 2.2rem;
}

#graphics p.intro,
#presentations p.intro,
#web p.intro {
  margin-bottom: 1rem;
  font-size: 1rem;
}

/* Presentations & Web: fit in one fold, consistent card styles */
#presentations .grid,
#web .grid {
  margin-top: 1rem;
  gap: 1.25rem;
}

#presentations .card-img-container,
#web .card-img-container {
  height: 160px;
}

#presentations .card-body,
#web .card-body {
  padding: 1rem;
}

#presentations .card-title,
#web .card-title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

#presentations .card-desc,
#web .card-desc {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Social Media tab: consistent spacing with other portfolio tabs */
#graphics .social-grid {
  margin-top: 1rem;
}

#graphics .social-row {
  margin-bottom: 1.25rem;
}

/* Web tab: compact GitHub link to fit in one fold */
#web .web-github-link {
  margin-top: 2rem;
}

#web .web-github-link .btn-secondary {
    padding: 8px 18px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid #e8e8e8;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-blue);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(33, 150, 243, 0.3);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-img-container {
  height: 200px;
  background-color: #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Play badge — bottom-left of any card that contains a video */
.card-img-container:has(video)::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 28px;
    height: 28px;
    background-color: rgba(33, 150, 243, 0.88);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px;
    border-radius: 50%;
    backdrop-filter: blur(4px);
    z-index: 1;
    pointer-events: none;
}

.card-img-container img,
.card-img-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 1.5rem;
}

.card-title {
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.01em;
}

.card-desc {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
    background: var(--light-blue);
    color: var(--dark-blue);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(33, 150, 243, 0.2);
    transition: all 0.25s ease;
}

.tag:hover {
    background: rgba(33, 150, 243, 0.2);
    transform: translateY(-1px);
}

/* Visit Site link inside website cards */
.card-visit-link {
    display: inline-block;
    color: var(--primary-blue);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    margin-top: 0.75rem;
    transition: color 0.2s ease;
}
.card-visit-link:hover {
    color: var(--dark-blue);
    text-decoration: underline;
}

/* Top Skills (overview) - compact */
.top-skills {
    margin-bottom: 1.5rem;
}

.top-skills-title {
    margin-bottom: 0.6rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
}

.top-skills-tags {
    gap: 0.5rem;
}

.top-skills-tags .tag {
    padding: 6px 14px;
    font-size: 0.9rem;
}

#home .top-skills {
    margin-bottom: 0.75rem;
}

#home .top-skills-title {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

#home .top-skills-tags {
    gap: 0.6rem;
}

#home .top-skills-tags .tag {
    padding: 5px 12px;
    font-size: 0.8rem;
}

/* --- VIDEO SPECIFIC --- */
.video-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
}

.vertical-video {
  aspect-ratio: 9/16;
  background: #000;
}

.square-image {
  aspect-ratio: 1/1;
}

/* --- SOCIAL MEDIA TAB LAYOUT --- */
.social-grid {
  margin-top: 2rem;
}

.social-row {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}

.social-row-1 {
  grid-template-columns: repeat(3, 1fr);
}

.social-row-2 {
  grid-template-columns: repeat(3, 1fr);
}

#graphics .card-img-container {
  height: auto;
  min-height: 0;
}

#graphics .social-row-1 .card-img-container.vertical-video {
  aspect-ratio: 9/16;
}

#graphics .social-row-2 .card-img-container.square-image {
  aspect-ratio: 1/1;
}

@media (max-width: 1200px) {
  .social-row-1 { grid-template-columns: repeat(2, 1fr); }
  .social-row-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .social-row-1,
  .social-row-2 { grid-template-columns: 1fr; }

  #graphics .social-row {
    margin-bottom: 1rem;
  }

  #graphics .social-grid {
    margin-top: 1rem;
  }
}

/* --- SCROLL REVEAL ANIMATIONS --- */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation delays */
.card:nth-child(1) { transition-delay: 0.1s; }
.card:nth-child(2) { transition-delay: 0.2s; }
.card:nth-child(3) { transition-delay: 0.3s; }
.card:nth-child(4) { transition-delay: 0.4s; }

.stat-item:nth-child(1) { transition-delay: 0.1s; }
.stat-item:nth-child(2) { transition-delay: 0.2s; }
.stat-item:nth-child(3) { transition-delay: 0.3s; }

/* --- LIGHTBOX MODAL --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    background: white;
    border-radius: 16px;
    width: 95vw;
    height: 95vh;
    max-width: none;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.35s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    z-index: 10;
}

.lightbox-close:hover {
    background: var(--primary-blue);
    transform: rotate(90deg);
}

.lightbox-media {
    position: relative;
    background: #000;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image,
.lightbox-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 16px 16px 0 0;
    display: block;
}

.lightbox-pdf {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: none;
}

.lightbox-body {
    padding: 2rem;
    flex-shrink: 0;
}

.lightbox-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
    -webkit-text-fill-color: var(--text-dark);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
}

.lightbox-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.lightbox-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.lightbox-metrics {
    background: var(--light-blue);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(33, 150, 243, 0.2);
    margin-top: 1.5rem;
}

.metrics-text {
    color: var(--dark-blue);
    font-weight: 600;
    margin: 0;
}

/* --- SKILLS SHOWCASE --- */
.skills-section {
    margin: 4rem 0;
}

#home .skills-section {
    margin: 3rem 0 0;
}

#home .skills-section h1 {
    font-size: 1.6rem;
    margin-bottom: 0.4rem;
    padding-bottom: 6px;
}

#home .skills-section h1::after {
    width: 40px;
    height: 3px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

#home .skills-grid {
    gap: 1.25rem;
    margin-top: 0.35rem;
}

.skill-category h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
}

#home .skill-category h3 {
    font-size: 0.95rem;
    margin-bottom: 0.6rem;
}

.skill-item {
    margin-bottom: 1.5rem;
}

#home .skill-item {
    margin-bottom: 0.5rem;
}

.skill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

#home .skill-header {
    margin-bottom: 0.3rem;
}

.skill-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
}

.skill-level {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.skill-bar {
    height: 8px;
    background: var(--light-blue);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

#home .skill-bar {
    height: 6px;
}

#home .skill-name {
    font-size: 0.9rem;
}

#home .skill-level {
    font-size: 0.8rem;
}

.skill-progress {
    height: 100%;
    background: var(--primary-blue);
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0;
}

.skill-progress.animate {
    width: var(--progress);
}

/* --- CONTACT FORM --- */
.contact-form {
    background: var(--bg-white);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-top: 2rem;
    border: 1px solid #e8e8e8;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.25s ease;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.form-submit {
    background: var(--primary-blue);
    color: white;
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
    width: 100%;
}

.form-submit:hover {
    background: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.3);
}

.form-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    display: none;
}

.form-success {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.form-error {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- CONTACT SECTION --- */
.contact-box {
    background: var(--bg-white);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-top: 2rem;
    border: 1px solid #e8e8e8;
}

.contact-link {
    display: block;
    margin-bottom: 1.25rem;
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 500;
    transition: all 0.25s ease;
    padding: 8px 0;
}

.contact-link:hover {
    color: var(--dark-blue);
    transform: translateX(5px);
    text-decoration: none;
}

/* --- MOBILE RESPONSIVENESS --- */

/* Tablet: sidebar stays but tighter layout */
@media (max-width: 1024px) {
  aside {
    width: 280px;
    padding: 2rem 1.5rem;
  }

  main {
    padding: 2rem;
  }

  .hero-title {
    font-size: 2.75rem;
  }
}

/* Mobile: stacked layout */
@media (max-width: 768px) {
  body {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  aside {
    width: 100%;
    padding: 1.5rem 1.25rem 1.5rem;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    position: static;
    flex-shrink: 0;
    gap: 0;
  }

  .profile-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    margin-bottom: 0;
    gap: 1rem;
    padding-bottom: 1rem;
  }

  .profile-img {
    width: 56px;
    height: 56px;
    margin-bottom: 0;
    margin-right: 0;
    flex-shrink: 0;
  }

  .name {
    font-size: 1.15rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
  }

  .role {
    font-size: 0.85rem;
    opacity: 0.95;
    white-space: nowrap;
  }

  .sidebar-contact {
    order: 3;
    width: 100%;
    margin: 0;
    padding: 1rem 0 0;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
  }

  .sidebar-contact a {
    font-size: 0.8rem;
    white-space: nowrap;
  }

  nav {
    order: 2;
    width: 100%;
    flex-grow: 0;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding: 0.75rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  nav button {
    width: auto;
    min-width: max-content;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  main {
    padding: 1.5rem 1.5rem;
    flex: 1;
  }

  /* Hero mobile */
  .hero-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  #home .hero-header {
    margin-bottom: 0.75rem;
  }

  .hero-title {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  #home .hero-title {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  #home .hero-subtitle {
    font-size: 0.9rem;
  }

  .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  #home .btn-secondary {
    width: 100%;
  }

  .cta-buttons {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  h1 {
    font-size: 1.75rem;
    padding-bottom: 8px;
  }

  #graphics h1,
  #presentations h1,
  #web h1 {
    font-size: 1.5rem;
  }

  p.intro {
    font-size: 0.95rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 1.25rem 0;
    margin: 2rem 0;
  }

  .grid {
    gap: 1.25rem;
    margin-top: 1.25rem;
  }

  #presentations .grid,
  #web .grid {
    gap: 1rem;
  }

  .card-body {
    padding: 1rem;
  }

  .card-title {
    font-size: 1.1rem;
  }

  .card-desc {
    font-size: 0.9rem;
  }

  .top-skills-tags .tag,
  #home .top-skills-tags .tag {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .skills-section {
    margin: 2rem 0;
  }

  #home .skills-section {
    margin: 2rem 0 0;
  }

  #home .skills-section h1 {
    font-size: 1.35rem;
  }

  #home .skills-grid {
    gap: 1rem;
  }

  .skill-category h3 {
    font-size: 1.1rem;
  }

  #home .skill-category h3 {
    font-size: 0.9rem;
  }

  .skill-name {
    font-size: 0.9rem;
  }

  #home .skill-name {
    font-size: 0.85rem;
  }

  .web-github-link .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

/* Lightbox: mobile */
@media (max-width: 768px) {
  .lightbox-content {
    width: 100%;
    height: 100%;
    max-height: 100svh;
    border-radius: 0;
  }

  .lightbox-close {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .lightbox-body {
    padding: 1.25rem 1rem;
  }

  .lightbox-title {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
  }

  .lightbox-description {
    font-size: 0.95rem;
    margin-bottom: 1rem;
  }

  .lightbox-tags {
    margin-bottom: 1rem;
  }

  .lightbox-metrics {
    padding: 1rem;
    margin-top: 1rem;
  }
}

/* ============================================
   CV PAGE — cv.html
   ============================================ */

body.cv-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    display: block;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    background: #e8ecf0;
    min-height: 100vh;
}

/* --- TOP BAR --- */
.cv-topbar {
    background: white;
    border-bottom: 1px solid #d8dde3;
    padding: 13px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.cv-topbar-name {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.cv-name-break { display: none; }

@media (max-width: 520px) {
    .cv-name-break { display: inline; }
}

.cv-topbar-link {
    color: var(--primary-blue);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s ease;
    padding: 9px 20px;
    border-radius: 8px;
    border: 2px solid rgba(33, 150, 243, 0.3);
    background: white;
    line-height: 1;
    white-space: nowrap;
}

.cv-topbar-link:hover {
    background: var(--light-blue);
    border-color: var(--primary-blue);
    color: var(--dark-blue);
}

.cv-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cv-pdf-btn {
    background: var(--primary-blue);
    color: white;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 9px 20px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(33,150,243,0.28);
    white-space: nowrap;
    line-height: 1;
}

.cv-pdf-btn:hover:not(:disabled) {
    background: var(--dark-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(33,150,243,0.38);
}

.cv-pdf-btn:active:not(:disabled) {
    transform: translateY(0);
}

.cv-pdf-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

.cv-pdf-btn.cv-pdf-success {
    background: #16a34a;
    box-shadow: 0 2px 8px rgba(22,163,74,0.28);
}

/* --- WRAPPER & PAGE CARD --- */
.cv-wrapper {
    padding: 36px 20px 60px;
}

.cv-page {
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: white;
    box-shadow: 0 6px 32px rgba(0,0,0,0.13);
    border-radius: 6px;
    overflow: hidden;
}

/* Top row: sidebar + summary/experience */
.cv-top {
    display: flex;
    align-items: stretch;
}

/* Bottom row: full-width portfolio & skills (no sidebar) */
.cv-bottom {
    padding: 36px 28px 48px 28px; /* horizontal matches sidebar left padding */
}

/* Portfolio entries in two columns now that full width is available */
.cv-bottom .cv-portfolio-entries {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 48px;
    align-items: start;
}

/* Portfolio entry linked titles — subtle on screen, clean in print */
.cv-portfolio-entry h4 a {
    color: inherit;
    text-decoration: none;
}
.cv-portfolio-entry h4 a:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

/* Earlier roles: 2-column compact grid */
.cv-jobs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 48px;
}

/* Remove bottom border/padding from the last two items (final row) */
.cv-jobs-grid .cv-job:nth-last-child(-n+2) {
    border-bottom: none;
    padding-bottom: 0;
}

/* Skills grid: categories as direct grid children, aligned by row start */
.cv-bottom .cv-skills-grid {
    align-items: start;
    gap: 20px 36px;
}
.cv-bottom .cv-skills-grid > .cv-skills-category {
    margin-bottom: 0;
}

/* --- LEFT SIDEBAR --- */
.cv-sidebar {
    width: 272px;
    flex-shrink: 0;
    background: var(--primary-blue);
    color: white;
    padding: 44px 28px 56px;
    border-radius: 0 0 48px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cv-photo-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.cv-photo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.6);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}

.cv-sidebar-name {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-align: center;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    line-height: 1.3;
}

.cv-sidebar-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    text-align: center;
    letter-spacing: 0.01em;
    margin-bottom: 4px;
}

.cv-sidebar-location {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
    text-align: center;
    margin-bottom: 0;
}

.cv-sidebar-rule {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.25);
    margin: 18px 0;
}

.cv-sidebar-section-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255,255,255,0.75);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.cv-contact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cv-contact a {
    color: rgba(255,255,255,0.95);
    text-decoration: none;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: color 0.2s;
    line-height: 1.4;
    word-break: break-all;
}

.cv-contact a:hover {
    color: white;
    text-decoration: underline;
}

.cv-contact-icon {
    flex-shrink: 0;
    opacity: 0.85;
    vertical-align: middle;
}

.cv-skill-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cv-skill-list li {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cv-skill-list li::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    flex-shrink: 0;
}

.cv-edu-entry {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.95);
    line-height: 1.55;
}

.cv-edu-school {
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: white;
    margin-bottom: 1px;
}

.cv-edu-degree {
    color: rgba(255,255,255,0.9);
}

.cv-edu-dates {
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    margin-top: 2px;
}

/* --- RIGHT MAIN CONTENT --- */
.cv-main {
    flex: 1;
    min-width: 0;
    padding: 44px 40px 48px;
}

.cv-section {
    margin-bottom: 28px;
}

.cv-section:last-child {
    margin-bottom: 0;
}

.cv-section-heading {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 5px;
}

.cv-section-rule {
    border: none;
    border-top: 2.5px solid var(--text-dark);
    margin-bottom: 16px;
}

.cv-summary-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.cv-jobs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cv-job {
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.cv-job:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cv-job-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.cv-job-company {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.cv-job-dates {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.cv-job-title {
    font-size: 0.85rem;
    color: var(--primary-blue);
    font-weight: 500;
    margin-bottom: 5px;
}

.cv-job-bullets {
    margin: 0;
    padding-left: 16px;
}

.cv-job-bullets li {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.cv-portfolio-entries {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cv-portfolio-entry h4 {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.cv-portfolio-entry p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.cv-portfolio-github {
    font-size: 0.82rem;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.cv-portfolio-github:hover {
    text-decoration: underline;
}

.cv-skills-box {
    background: var(--primary-blue);
    border-radius: 16px;
    color: white;
    padding: 26px 28px;
}

.cv-skills-box .cv-section-heading {
    color: white;
    margin-bottom: 5px;
}

.cv-skills-box .cv-section-rule {
    border-top-color: rgba(255,255,255,0.3);
    margin-bottom: 18px;
}

.cv-skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 36px;
}

.cv-skills-category {
    margin-bottom: 12px;
}

.cv-skills-category:last-child {
    margin-bottom: 0;
}

.cv-skills-cat-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255,255,255,0.95);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.cv-skills-items {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cv-skills-item {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.9);
    line-height: 1.5;
}

.cv-skills-item strong {
    color: white;
    font-weight: 600;
}

/* Page-break hints for html2pdf.js multi-page rendering */
.cv-job,
.cv-portfolio-entry,
.cv-skills-category,
.cv-section-heading {
    page-break-inside: avoid;
    break-inside: avoid;
}

/* ============================================
   PRINT / SAVE AS PDF
   Triggered by window.print() in cv.html.
   "Save as PDF" in the browser print dialog
   produces a pixel-accurate, font-correct PDF.
   ============================================ */
@page {
    size: A4 portrait;
    margin: 0;
}

@media print {
    /* ── Color accuracy ─────────────────────────────── */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ── System fonts — guaranteed PDF embedding ─────
       Inter/Outfit from Google Fonts can fail to embed
       correctly in Chrome's PDF renderer, producing
       garbled text on coloured backgrounds.
       Arial is always natively embedded. ─────────── */
    .cv-page, .cv-page * {
        font-family: Arial, Helvetica, sans-serif !important;
    }

    body.cv-body {
        background: white;
        overflow: visible;
        margin: 0;
        padding: 0;
        min-height: unset;
    }

    .cv-topbar { display: none !important; }

    .cv-wrapper { padding: 0; margin: 0; background: white; }

    .cv-page {
        box-shadow: none;
        border-radius: 0;
        max-width: 100%;
        width: 100%;
        margin: 0;
    }

    /* Clip the sidebar's rounded corner against cv-top */
    .cv-top { display: flex; overflow: hidden; }

    /* Sidebar — keep natural border-radius (0 0 48px 0).
       28px left/right aligns sidebar content with cv-bottom content. */
    .cv-sidebar { padding: 32px 28px 40px; }

    /* Compact main column for page 1 */
    .cv-main { padding: 28px 28px 32px; }

    /* Tighter section and job spacing */
    .cv-section { margin-bottom: 16px; }
    .cv-job { padding-bottom: 9px; }
    .cv-jobs { gap: 9px; }

    /* 28px left/right matches sidebar print padding exactly */
    .cv-bottom { border-top: none; padding: 20px 28px 32px 28px; }

    /* Breathing room at top of page 2 */
    .cv-page-break { padding-top: 56px; }

    .cv-jobs-grid { grid-template-columns: 1fr 1fr; }

    /* Force page 2 to start at Website Portfolio */
    .cv-page-break {
        break-before: page;
        page-break-before: always;
    }

    /* Prevent content being cut mid-block */
    .cv-job,
    .cv-portfolio-entry,
    .cv-skills-category,
    .cv-edu-entry {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* Keep headings attached to their first content line */
    .cv-section-heading,
    .cv-job-header,
    .cv-skills-cat-title {
        page-break-after: avoid;
        break-after: avoid;
    }

    a { text-decoration: none !important; color: inherit; }
    .cv-portfolio-github { color: #2196F3; }
}

/* CV responsive */
@media (max-width: 768px) {
    .cv-sidebar { position: static; top: auto; z-index: auto; }
}

@media (max-width: 720px) {
    .cv-wrapper { padding: 0 0 40px; }
    .cv-page { border-radius: 0; box-shadow: none; }
    .cv-top { flex-direction: column; }
    /* Sidebar: full-width + centered content on mobile */
    .cv-sidebar { width: 100%; border-radius: 0; padding: 32px 28px 40px; text-align: center; }
    .cv-contact { align-items: center; }
    .cv-skill-list { align-items: center; }
    .cv-edu-entry { text-align: center; }
    .cv-main { padding: 32px 28px 40px; }
    .cv-bottom { padding: 24px 28px 40px; }
    .cv-bottom .cv-portfolio-entries { grid-template-columns: 1fr; }
    .cv-jobs-grid { grid-template-columns: 1fr; }
    .cv-jobs-grid .cv-job:nth-last-child(-n+2) { border-bottom: 1px solid #f0f0f0; padding-bottom: 16px; }
    .cv-jobs-grid .cv-job:last-child { border-bottom: none; padding-bottom: 0; }
    .cv-skills-grid { grid-template-columns: 1fr; }
    .cv-topbar { padding: 12px 16px; }
    .cv-topbar-actions { gap: 8px; }
    .cv-pdf-btn { padding: 7px 13px; font-size: 0.8rem; }
    .cv-job-header { flex-direction: column; gap: 2px; }
}

@media (max-width: 420px) {
    .cv-sidebar { padding: 24px 22px 32px; }
    .cv-main { padding: 24px 22px 32px; }
    .cv-bottom { padding: 20px 22px 32px; }
    .cv-pdf-btn span { display: none; }
    .cv-pdf-btn { padding: 8px 11px; }
}

/* Small phones */
@media (max-width: 380px) {
  aside {
    padding: 1.25rem 1rem;
  }

  main {
    padding: 1rem;
  }

  .profile-img {
    width: 48px;
    height: 48px;
  }

  .name {
    font-size: 1rem;
  }

  .role {
    font-size: 0.8rem;
  }

  nav button {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  #home .hero-title {
    font-size: 1.35rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  #graphics h1,
  #presentations h1,
  #web h1 {
    font-size: 1.35rem;
  }

  .card-body {
    padding: 0.875rem;
  }

  .card-title {
    font-size: 1rem;
  }

  .lightbox-title {
    font-size: 1.2rem;
  }
}
