/* ================================
   Refined Minimalist — Tom Huynh
================================== */
:root {
    --bg: #f8f7f4;
    --surface: #ffffff;
    --text-1: #0f0e0d;
    --text-2: #6b6860;
    --text-3: #9c9a96;
    --accent: #1a1a1a;
    --accent-warm: #c2410c;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.14);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.07), 0 2px 6px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.09);
    --radius: 10px;
    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ---- Grain Texture ---- */
.grain {
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    animation: grain 8s steps(10) infinite;
}

@keyframes grain {

    0%,
    100% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-2%, -3%);
    }

    20% {
        transform: translate(1%, 2%);
    }

    30% {
        transform: translate(-1%, 1%);
    }

    40% {
        transform: translate(2%, -1%);
    }

    50% {
        transform: translate(-2%, 2%);
    }

    60% {
        transform: translate(1%, -2%);
    }

    70% {
        transform: translate(-1%, 3%);
    }

    80% {
        transform: translate(2%, 1%);
    }

    90% {
        transform: translate(-2%, -1%);
    }
}

/* ---- Typography ---- */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-1);
    letter-spacing: -0.03em;
}

p {
    color: var(--text-2);
}

/* ---- Navbar ---- */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 0;
    transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.navbar.scrolled {
    background: rgba(248, 247, 244, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 var(--border);
}

.nav-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'DM Mono', monospace;
    font-size: 1.1rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-1);
    letter-spacing: 0.02em;
}

.logo-dot {
    color: var(--accent-warm);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
    letter-spacing: -0.01em;
}

.nav-links a:hover {
    color: var(--text-1);
    background: rgba(0, 0, 0, 0.05);
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
}

.hamburger span {
    display: block;
    height: 1.5px;
    width: 100%;
    background: var(--text-1);
    transition: transform 0.3s var(--ease), opacity 0.2s;
    transform-origin: center;
}

.hamburger.open span:first-child {
    transform: translateY(6.5px) rotate(45deg);
}

.hamburger.open span:last-child {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* Mobile menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 99;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
}

.mobile-menu.open {
    opacity: 1;
    pointer-events: all;
}

.mobile-link {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    text-decoration: none;
    color: var(--text-1);
    padding: 8px 24px;
    transition: color 0.2s;
}

.mobile-link:hover {
    color: var(--accent-warm);
}

/* ---- Layout ---- */
main {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

section {
    padding-top: 100px;
}

/* ---- Scroll Reveal ---- */
.reveal,
.reveal-stagger {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.visible,
.reveal-stagger.visible {
    opacity: 1;
    transform: none;
}

/* ---- Section Header ---- */
.section-header {
    display: flex;
    align-items: baseline;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 40px;
}

.section-num {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent-warm);
    font-weight: 500;
    letter-spacing: 0.05em;
}

.section-header h3 {
    font-size: 1.5rem;
    letter-spacing: -0.04em;
}

/* ---- Hero ---- */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 120px;
    padding-bottom: 60px;
    position: relative;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-3);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
    animation: pulse 2.5s ease infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.1);
    }
}

.hero-content {
    max-width: 700px;
}

.hero h1 {
    font-size: clamp(3.5rem, 9vw, 7rem);
    letter-spacing: -0.05em;
    line-height: 0.95;
    margin-bottom: 20px;
}

/* Cursor blink */
.cursor {
    color: var(--accent-warm);
    transition: opacity 0.1s;
}

.cursor.hidden {
    opacity: 0;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.hero-role {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-2);
    letter-spacing: -0.01em;
}

.divider-dot {
    color: var(--border-strong);
    font-size: 1.2rem;
}

.hero p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-2);
    max-width: 560px;
    margin-bottom: 36px;
    font-weight: 300;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s var(--ease);
    cursor: pointer;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--text-1);
    color: #fff;
    border: 1.5px solid var(--text-1);
}

.btn-primary:hover {
    background: #2c2b29;
    border-color: #2c2b29;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary i {
    font-size: 0.8rem;
    transition: transform 0.2s var(--ease-spring);
}

.btn-primary:hover i {
    transform: translateX(3px);
}

/* Social icon links */
.hero-socials {
    display: flex;
    gap: 4px;
}

.social-link {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1.5px solid var(--border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s var(--ease);
}

.social-link:hover {
    color: var(--text-1);
    border-color: var(--text-1);
    background: rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}

/* Scroll indicator */
.hero-scroll {
    position: absolute;
    bottom: 40px;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.hero-scroll span {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-3);
    writing-mode: horizontal-tb;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--text-3), transparent);
    animation: scrollDown 2s ease infinite;
}

@keyframes scrollDown {
    0% {
        transform: scaleY(0);
        transform-origin: top;
    }

    50% {
        transform: scaleY(1);
        transform-origin: top;
    }

    51% {
        transform: scaleY(1);
        transform-origin: bottom;
    }

    100% {
        transform: scaleY(0);
        transform-origin: bottom;
    }
}

/* ---- Skills ---- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 36px;
}

.skill-group h4 {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 14px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--surface);
    border: 1.5px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.825rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-1);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--ease-spring);
}

.tag:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* ---- Projects ---- */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.project-card {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    align-items: start;
    gap: 20px;
    padding: 28px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    position: relative;
}

.project-card:first-child {
    border-top: 1px solid var(--border);
}

.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.025);
    opacity: 0;
    margin: 0 -16px;
    transition: opacity 0.2s;
    pointer-events: none;
}

.project-card:hover::before {
    opacity: 1;
}

.project-index {
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-3);
    padding-top: 4px;
    letter-spacing: 0.05em;
}

.project-content h4 {
    font-size: 1.15rem;
    margin-bottom: 6px;
    letter-spacing: -0.03em;
    transition: color 0.2s;
}

.project-card:hover .project-content h4 {
    color: var(--accent-warm);
}

.project-content p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-2);
    max-width: 520px;
}

.project-tech {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.project-tech span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-3);
    background: rgba(0, 0, 0, 0.04);
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.project-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

.project-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-3);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.project-link:hover {
    color: var(--text-1);
    border-color: var(--border-strong);
    background: var(--surface);
}

/* ---- Timeline ---- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 24px;
    padding: 28px 0;
    border-bottom: 1px solid var(--border);
}

.timeline-item:first-child {
    border-top: 1px solid var(--border);
}

.timeline-date {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-3);
    padding-top: 3px;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.5;
}

.timeline-content h4 {
    font-size: 1.05rem;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    font-weight: 600;
    line-height: 1.4;
}

.timeline-sep {
    color: var(--text-3);
    font-weight: 300;
    margin: 0 2px;
}

.org {
    color: var(--accent-warm);
    font-weight: 500;
}

.timeline-content p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-2);
}

.cert-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cert-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-2);
}

.cert-list i {
    color: #f59e0b;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ---- Footer ---- */
footer {
    border-top: 1px solid var(--border);
    padding: 32px 24px;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.footer-logo {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    font-size: 1rem;
}

footer p {
    font-size: 0.825rem;
    color: var(--text-3);
}

.footer-socials {
    display: flex;
    gap: 12px;
}

.footer-socials a {
    color: var(--text-3);
    font-size: 0.95rem;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-socials a:hover {
    color: var(--text-1);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .hero h1 {
        font-size: clamp(3rem, 14vw, 5rem);
    }

    .project-card {
        grid-template-columns: 40px 1fr;
        grid-template-rows: auto auto;
    }

    .project-links {
        grid-column: 2;
        flex-direction: row;
        align-items: flex-start;
    }

    .timeline-item {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .timeline-date {
        padding-top: 0;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .section-header {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    main {
        padding: 0 16px 60px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== Certifications accordion fix ===== */
.cert-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    padding: 0;
    margin: 0;
}

.cert-list .cert-item {
    display: block !important;
    width: 100%;
    color: var(--text-2);
}

.cert-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    cursor: pointer;
    background: var(--surface);
    border-radius: 8px;
}

.cert-header span {
    flex: 1;
    min-width: 0;
    line-height: 1.5;
}

.cert-arrow {
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.cert-item.active .cert-arrow {
    transform: rotate(180deg);
}

.cert-preview {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    margin-top: 8px;
}

.cert-preview img {
    display: block;
    width: 100%;
    max-width: 720px;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
}