/* ============================================
   VARIABLES & RESET
   ============================================ */

:root {
    --bg-primary: #111111;
    --bg-secondary: #191919;
    --bg-card: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #999;
    --text-muted: #666;
    --accent: #64b5f6;
    --border: #2a2a2a;
    --border-hover: #3a3a3a;
    --nav-bg: rgba(17, 17, 17, 0.9);
    --tag-bg: #191919;
    --nav-height: 56px;
    --radius: 8px;
    --radius-sm: 5px;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.2s ease;
}

[data-theme="light"] {
    --bg-primary: #fafafa;
    --bg-secondary: #f0f0f0;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #555;
    --text-muted: #888;
    --accent: #2979ff;
    --border: #e0e0e0;
    --border-hover: #ccc;
    --nav-bg: rgba(250, 250, 250, 0.9);
    --tag-bg: #f0f0f0;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: #90caf9;
}

img {
    max-width: 100%;
    display: block;
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
}

.section {
    padding: 80px 0;
}

.section__title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 40px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.section__title::after {
    display: none;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    white-space: nowrap;
}

.btn--primary {
    background: var(--accent);
    color: #111;
}

.btn--primary:hover {
    background: #90caf9;
    color: #111;
}

.btn--outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn--outline:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 1000;
    transition: background var(--transition);
}

.nav--scrolled {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav__container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav__logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nav__logo:hover {
    color: var(--text-primary);
}

.nav__logo .accent {
    color: var(--accent);
}

.nav__links {
    display: flex;
    list-style: none;
    gap: 4px;
}

.nav__link {
    display: block;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color var(--transition);
}

.nav__link:hover,
.nav__link--active {
    color: var(--text-primary);
}

.nav__toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 1001;
}

.nav__toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition);
}

.nav__toggle--active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav__toggle--active span:nth-child(2) {
    opacity: 0;
}

.nav__toggle--active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Theme Toggle */

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.theme-toggle__icon--moon {
    display: none;
}

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

[data-theme="light"] .theme-toggle__icon--moon {
    display: block;
}

/* ============================================
   HERO
   ============================================ */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-height) + 40px) 24px 80px;
}

.hero__bg-grid {
    display: none;
}

.hero__content {
    max-width: 640px;
    text-align: center;
}

.hero__greeting {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    color: var(--accent);
    margin-bottom: 12px;
}

.hero__name {
    font-size: clamp(2.5rem, 7vw, 4rem);
    font-weight: 700;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.hero__title-wrapper {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--text-secondary);
    margin-bottom: 24px;
    min-height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hero__title-dynamic {
    color: var(--accent);
    font-weight: 500;
    font-family: var(--font-mono);
    min-width: 1ch;
}

.hero__cursor {
    display: inline-block;
    color: var(--accent);
    font-weight: 300;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero__summary {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 520px;
    margin: 0 auto 32px;
}

.hero__cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   ABOUT
   ============================================ */

.about__grid {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 48px;
    align-items: start;
}

.about__text p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.about__text p:last-of-type {
    margin-bottom: 24px;
}

.about__links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.about__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
}

.about__link:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.about__stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
    transition: border-color var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
}

.stat-card__number {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 2px;
}

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

/* ============================================
   SKILLS
   ============================================ */

.skills__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.skills__category {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color var(--transition);
}

.skills__category:hover {
    border-color: var(--border-hover);
}

.skills__category-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.skills__category-title svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.skills__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--tag-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color var(--transition);
}

.tag:hover {
    color: var(--text-primary);
}

.tag--sm {
    padding: 3px 8px;
    font-size: 0.7rem;
}

/* ============================================
   PROJECTS
   ============================================ */

.projects__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.project-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color var(--transition);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    border-color: var(--border-hover);
}

.project-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.project-card__icon {
    color: var(--text-muted);
}

.project-card__year {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.project-card__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    line-height: 1.4;
}

.project-card__desc {
    flex: 1;
    margin-bottom: 16px;
}

.project-card__desc p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.7;
}

.project-card__desc strong {
    color: var(--accent);
    font-weight: 600;
}

.project-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.project-card__actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* Demo links hidden until live demos are wired up */
.project-card__actions > .project-card__btn:nth-child(2) {
    display: none;
}

.project-card__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.project-card__btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* ============================================
   JOURNEY / TIMELINE
   ============================================ */

.timeline {
    position: relative;
    padding-left: 36px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--border);
}

.timeline__item {
    position: relative;
    padding-bottom: 32px;
}

.timeline__item:last-child {
    padding-bottom: 0;
}

.timeline__dot {
    position: absolute;
    left: -36px;
    top: 8px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--text-muted);
    z-index: 1;
}

.timeline__item:first-child .timeline__dot {
    background: var(--accent);
    border-color: var(--accent);
}

.timeline__content {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    transition: border-color var(--transition);
}

.timeline__content:hover {
    border-color: var(--border-hover);
}

.timeline__year {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.timeline__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.timeline__place {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 6px;
}

.timeline__desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ============================================
   CERTIFICATIONS
   ============================================ */

.certs__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.cert-card {
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    transition: border-color var(--transition);
}

.cert-card:hover {
    border-color: var(--border-hover);
}

.cert-card__badge {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    padding: 0;
}

.cert-card__badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cert-card__info {
    flex: 1;
    min-width: 0;
}

.cert-card__title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1px;
}

.cert-card__issuer {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.cert-card__date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.cert-card__link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.cert-card__link:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* ============================================
   COURSEWORK / GRADES
   ============================================ */

.coursework__intro {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 52rem;
    margin: -12px 0 28px;
    line-height: 1.65;
}

.coursework__intro strong {
    color: var(--text-primary);
    font-weight: 600;
}

.coursework__table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    overflow-x: auto;
}

.course-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.course-table thead {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.course-table th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 16px;
}

.course-table th:last-child {
    text-align: right;
}

.course-table td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.course-table tbody tr:last-child td {
    border-bottom: none;
}

.course-table tbody tr:hover {
    background: var(--tag-bg);
}

.course-table__code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    width: 1%;
}

.course-table__grade {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}

.course-table td:nth-child(2) {
    color: var(--text-primary);
    min-width: 200px;
}

.grade-pill {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.grade-pill--high {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.grade-pill--mid {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--bg-secondary);
}

/* ============================================
   CONTACT
   ============================================ */

.contact {
    text-align: center;
}

.contact .section__title {
    display: block;
}

.contact__subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 480px;
    margin: -20px auto 32px;
    line-height: 1.7;
}

.contact__links {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    padding: 28px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */

.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-up:nth-child(2) { transition-delay: 0.06s; }
.fade-up:nth-child(3) { transition-delay: 0.12s; }
.fade-up:nth-child(4) { transition-delay: 0.18s; }
.fade-up:nth-child(5) { transition-delay: 0.24s; }
.fade-up:nth-child(6) { transition-delay: 0.30s; }
.fade-up:nth-child(7) { transition-delay: 0.36s; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .about__grid {
        grid-template-columns: 1fr;
    }

    .about__stats {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .stat-card {
        flex: 1;
        min-width: 120px;
    }

    .skills__grid {
        grid-template-columns: 1fr;
    }

    .projects__grid {
        grid-template-columns: 1fr;
    }

    .certs__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 60px 0;
    }

    .nav__toggle {
        display: flex;
    }

    .nav__links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 260px;
        height: 100vh;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 80px 24px 24px;
        gap: 2px;
        transition: right var(--transition);
        border-left: 1px solid var(--border);
    }

    .nav__links--open {
        right: 0;
    }

    .nav__link {
        font-size: 0.95rem;
        padding: 10px 14px;
    }

    .hero {
        padding-top: calc(var(--nav-height) + 20px);
    }

    .hero__name {
        letter-spacing: -1px;
    }

    .course-table th,
    .course-table td {
        padding: 10px 12px;
    }

    .course-table {
        font-size: 0.85rem;
    }

    .cert-card {
        flex-wrap: wrap;
    }

    .cert-card__link {
        width: 100%;
        justify-content: center;
    }

    .contact__links {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        justify-content: center;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .hero__title-wrapper {
        flex-direction: column;
        gap: 4px;
    }

    .about__links {
        flex-direction: column;
    }

    .about__link {
        justify-content: center;
    }

    .about__stats {
        flex-direction: column;
    }

    .stat-card {
        min-width: auto;
    }
}
