:root {
    --bg: #ffffff;
    --bg-alt: #f5f5f5;
    --bg-dark: #111111;
    --text: #111111;
    --text-muted: #555555;
    --text-light: #ffffff;
    --border: #e0e0e0;
    --nav-height: 56px;
    --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

/* ── Scroll progress bar ── */

#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: var(--text);
    z-index: 200;
    transition: width 0.12s linear;
    pointer-events: none;
}

/* ── Nav ── */

#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 5%;
    z-index: 100;
}

#logo {
    font-size: 1.4rem;
    color: var(--text);
    text-decoration: none;
    margin-right: auto;
    display: flex;
    align-items: center;
}

#nav-links {
    display: flex;
    list-style: none;
}

#nav-links a {
    display: block;
    padding: 0.4rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    letter-spacing: 0.03em;
    transition: color 0.2s;
    position: relative;
}

#nav-links a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 1rem;
    right: 1rem;
    height: 1px;
    background: var(--text);
    transform: scaleX(0);
    transition: transform 0.25s;
    transform-origin: left;
}

#nav-links a:hover { color: var(--text); }

#nav-links a.active {
    color: var(--text);
}

#nav-links a.active::after {
    transform: scaleX(1);
}

#menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

#menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
}

#mobile-menu {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 99;
}

#mobile-menu ul { list-style: none; }

#mobile-menu ul li a {
    display: block;
    padding: 0.9rem 5%;
    color: var(--text);
    text-decoration: none;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

#mobile-menu ul li a:hover { background: var(--bg-alt); }

/* ── Section dot navigator (right side) ── */

#section-dots {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
}

#section-dots a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    text-decoration: none;
}

#section-dots a span {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c0c0c0;
    transition: background 0.3s, transform 0.3s;
}

#section-dots a.active span {
    background: var(--text);
    transform: scale(1.6);
}

/* Tooltip label */
#section-dots a::before {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 8px);
    white-space: nowrap;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    opacity: 0;
    transform: translateX(6px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

#section-dots a:hover::before {
    opacity: 1;
    transform: translateX(0);
}

/* Light variant (over dark sections) */
#section-dots.dots-light a span { background: rgba(255, 255, 255, 0.3); }
#section-dots.dots-light a.active span { background: var(--text-light); }
#section-dots.dots-light a::before {
    background: #1e1e1e;
    border-color: #333;
    color: #aaa;
}

/* ── Sections ── */

section {
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-height) + 2.5rem) 5% 2.5rem;
}

.section-inner {
    width: 100%;
    max-width: 860px;
}

section h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
}

/* alternating backgrounds */
#about      { background: var(--bg); }
#skills     { background: var(--bg-alt); }
#projects   { background: var(--bg); }
#education  { background: var(--bg-alt); }
#experience { background: var(--bg); }

/* ── Fade-in animation ── */

.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

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

/* ── Hero ── */

#hero {
    background: var(--bg-dark);
    color: var(--text-light);
    flex-direction: column;
    text-align: center;
    gap: 1rem;
    position: relative;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

#hero h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

#hero p {
    font-size: clamp(0.85rem, 2vw, 1rem);
    color: #888;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.scroll-hint {
    position: absolute;
    bottom: 2rem;
    color: #444;
    text-decoration: none;
    font-size: 1.1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(7px); }
}

/* ── About ── */

#about-content {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

#about-content img {
    width: 260px;
    min-width: 200px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.about-text {
    display: flex;
    flex-direction: column;
}

.about-text h2 {
    margin-bottom: 1rem;
}

.about-text p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.85;
}

/* ── Skills ── */

.skills-categories {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.skills-category {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.category-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.skills-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.skill-item {
    width: 96px;
    height: 96px;
    perspective: 800px;
}

.skill-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-item:hover .skill-card {
    transform: rotateY(180deg);
}

.skill-front,
.skill-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.skill-front {
    background: var(--bg);
}

.skill-front img {
    width: 38px;
    height: 38px;
}

.skill-front span {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0 4px;
}

.skill-back {
    background: var(--bg-dark);
    border-color: var(--bg-dark);
    transform: rotateY(180deg);
    text-align: center;
    padding: 0.5rem;
    gap: 0.3rem;
}

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

.skill-level {
    font-size: 0.66rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* ── Projects ── */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* 3 cards on top row, 2 centred on bottom */
.project-card:nth-child(1) { grid-column: 1 / 3; }
.project-card:nth-child(2) { grid-column: 3 / 5; }
.project-card:nth-child(3) { grid-column: 5 / 7; }
.project-card:nth-child(4) { grid-column: 2 / 4; }
.project-card:nth-child(5) { grid-column: 4 / 6; }

.project-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    transition: border-color 0.2s, box-shadow 0.25s, transform 0.25s;
}

.project-card:hover {
    border-color: #c8c8c8;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07);
    transform: translateY(-3px);
}

.project-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-header i {
    font-size: 1.3rem;
    color: var(--text-muted);
}

.project-header a {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
    text-align: right;
}

.project-header a:hover { color: var(--text); }

.project-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.project-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.65;
    flex: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.project-tags span {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-alt);
    padding: 0.18rem 0.55rem;
    border-radius: 99px;
    border: 1px solid var(--border);
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: background 0.2s, border-color 0.2s;
}

.github-link:hover {
    background: var(--bg-alt);
    border-color: #ccc;
}

.github-link i { font-size: 1.2rem; }

/* ── Entry list — timeline style (education & experience) ── */

.entry-list {
    position: relative;
    padding-left: 1.75rem;
    border-left: 2px solid var(--border);
}

.entry-item {
    display: flex;
    gap: 2rem;
    padding: 1.2rem 0;
    position: relative;
}

/* Timeline dot */
.entry-item::before {
    content: '';
    position: absolute;
    left: calc(-1.75rem - 4px);
    top: 1.5rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-alt);    /* matches education bg */
    z-index: 1;
}

/* Experience section has white bg */
#experience .entry-item::before {
    background: var(--bg);
}

.entry-item + .entry-item {
    border-top: 1px solid var(--border);
}

.entry-period {
    min-width: 160px;
    flex-shrink: 0;
    font-size: 0.83rem;
    color: var(--text-muted);
    padding-top: 0.1rem;
}

.entry-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.entry-details strong {
    font-size: 1rem;
    font-weight: 600;
}

.entry-details span {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.entry-details p {
    margin-top: 0.5rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ── Languages ── */

.lang-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-top: 1.5rem;
}

section h3.lang-heading {
    margin-top: 2rem;
}

.lang-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.92rem;
    color: var(--text-muted);
}

/* ── Contact ── */

#contact {
    background: var(--bg-dark);
    color: var(--text-light);
}

#contact h2 { color: var(--text-light); }

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 1.3rem;
    margin-bottom: 4rem;
}

.contact-list a,
.contact-list div {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #888;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s;
}

.contact-list a:hover { color: var(--text-light); }

.contact-list i {
    font-size: 1.2rem;
    width: 1.5rem;
    text-align: center;
}

.footer-note {
    font-size: 0.75rem;
    color: #333;
    letter-spacing: 0.02em;
}

/* ── Responsive ── */

@media (max-width: 700px) {
    #nav-links { display: none; }
    #menu-btn  { display: flex; }
    #section-dots { display: none; }

    #about-content {
        flex-direction: column;
        align-items: center;
    }

    #about-content img { width: 180px; }

    .about-text h2 { text-align: center; }

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

    /* Reset nth-child column placement for mobile */
    .project-card:nth-child(n) { grid-column: auto; }

    .entry-item {
        flex-direction: column;
        gap: 0.3rem;
    }

    .entry-period { min-width: unset; }

    .skill-item { width: 82px; height: 82px; }
}

@media (min-width: 701px) and (max-width: 960px) {
    /* Collapse to 2-column grid on tablet; reset nth-child placement */
    .projects-grid { grid-template-columns: repeat(2, 1fr); }
    .project-card:nth-child(n) { grid-column: auto; }
}
