/* ============================================================
   Bryan Tang — Portfolio  (2026 redesign)
   ============================================================ */

:root {
    --bg: #0b0b0f;
    --bg-elev: #121218;
    --surface: #15151d;
    --surface-2: #1c1c26;
    --border: #26263300;
    --border-solid: #272733;
    --text: #f4f4f6;
    --text-dim: #a3a3b2;
    --text-faint: #6b6b7b;

    --accent: #a78bfa;          /* violet */
    --accent-2: #22d3ee;        /* cyan   */
    --accent-3: #fb7185;        /* coral  */
    --gradient: linear-gradient(115deg, #a78bfa 0%, #22d3ee 55%, #34d399 100%);
    --gradient-warm: linear-gradient(115deg, #a78bfa 0%, #fb7185 100%);

    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --radius: 16px;
    --radius-sm: 10px;
    --maxw: 1140px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

::selection { background: rgba(167, 139, 250, 0.32); color: #fff; }

a { color: inherit; text-decoration: none; }

/* ---------- Ambient background ---------- */
.grain {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.glow {
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    opacity: 0.5;
}

.glow-1 {
    top: -180px;
    left: -120px;
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.45), transparent 70%);
}

.glow-2 {
    top: 40%;
    right: -200px;
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.28), transparent 70%);
}

main, .header, .footer { position: relative; z-index: 1; }

/* ---------- Header ---------- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
    border-bottom: 1px solid transparent;
}

.header.scrolled {
    background: rgba(11, 11, 15, 0.72);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-solid);
}

.header-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.logo span { color: var(--accent); }

.nav { display: flex; align-items: center; gap: 4px; }

.nav-link {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-dim);
    padding: 8px 12px;
    border-radius: 8px;
    transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.nav-link span { color: var(--accent); margin-right: 4px; }

.nav-link:hover { color: var(--text); }

.nav-link.active { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.btn-resume {
    margin-left: 10px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent);
    padding: 8px 16px;
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 9px;
    transition: all 0.2s var(--ease);
}

.btn-resume:hover {
    background: rgba(167, 139, 250, 0.12);
    transform: translateY(-2px);
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 6px;
}

.hamburger span {
    width: 26px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}

.hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-active span:nth-child(2) { opacity: 0; }
.hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 0 28px;
    max-height: 0;
    overflow: hidden;
    background: rgba(11, 11, 15, 0.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: max-height 0.35s var(--ease), padding 0.35s var(--ease);
}

.mobile-menu.open {
    max-height: 360px;
    padding: 10px 28px 24px;
    border-bottom: 1px solid var(--border-solid);
}

.mobile-menu .nav-link { padding: 12px 4px; font-size: 1rem; }
.mobile-menu .btn-resume { margin-left: 0; width: fit-content; margin-top: 8px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}

.btn-primary {
    color: #0b0b0f;
    background: var(--gradient);
    background-size: 160% 160%;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(167, 139, 250, 0.35);
}

.btn-ghost {
    color: var(--text);
    border: 1px solid var(--border-solid);
    background: rgba(255, 255, 255, 0.02);
}

.btn-ghost:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    color: var(--accent);
}

/* ---------- Sections ---------- */
.section {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 110px 28px;
}

.section-head { margin-bottom: 56px; }

.section-kicker {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 14px;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.9rem, 4.4vw, 3rem);
    letter-spacing: -0.025em;
    line-height: 1.08;
    max-width: 16ch;
}

/* ---------- Hero ---------- */
.hero {
    max-width: var(--maxw);
    margin: 0 auto;
    min-height: 100vh;
    padding: 120px 28px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    width: fit-content;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-dim);
    padding: 8px 16px;
    border: 1px solid var(--border-solid);
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 30px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
    70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3.6rem, 15vw, 11rem);
    line-height: 0.92;
    letter-spacing: -0.04em;
    margin-bottom: 28px;
}

.hero-title .line { display: block; }

.hero-title .outline {
    color: transparent;
    -webkit-text-stroke: 1.6px var(--text-dim);
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 0;
}

.hero-sub {
    font-size: clamp(1.05rem, 2.2vw, 1.4rem);
    color: var(--text-dim);
    max-width: 46ch;
    line-height: 1.55;
    margin-bottom: 22px;
}

.hero-sub em {
    font-style: normal;
    color: var(--text);
    font-weight: 500;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-faint);
    margin-bottom: 38px;
}

.hero-meta .dot { color: var(--accent); }

.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 70px; }

/* Marquee */
.marquee {
    position: relative;
    overflow: hidden;
    margin: 0 -28px;
    padding: 18px 0;
    border-top: 1px solid var(--border-solid);
    border-bottom: 1px solid var(--border-solid);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee-track {
    display: flex;
    gap: 48px;
    width: max-content;
    animation: scroll 26s linear infinite;
}

.marquee-track span {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--text-faint);
    white-space: nowrap;
}

@keyframes scroll {
    to { transform: translateX(-50%); }
}

/* ---------- Stats ---------- */
.stats {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 28px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius);
    padding: 30px 26px;
    text-align: left;
    transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.stat:hover { transform: translateY(-4px); border-color: rgba(167, 139, 250, 0.4); }

.stat-num {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-faint);
}

/* ---------- About ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 60px;
    align-items: start;
}

.about-text p {
    color: var(--text-dim);
    font-size: 1.08rem;
    margin-bottom: 20px;
}

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

.skill-block { margin-bottom: 26px; }

.skill-block h3 {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 14px;
}

.chips { display: flex; flex-wrap: wrap; gap: 9px; }

.chips span {
    font-size: 0.85rem;
    color: var(--text-dim);
    padding: 7px 14px;
    border: 1px solid var(--border-solid);
    border-radius: 100px;
    background: var(--surface);
    transition: all 0.2s var(--ease);
}

.chips span:hover {
    color: var(--text);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ---------- Timeline ---------- */
.timeline {
    position: relative;
    padding-left: 34px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2), transparent);
}

.tl-item { position: relative; margin-bottom: 30px; }

.tl-marker {
    position: absolute;
    left: -34px;
    top: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.12);
}

.tl-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-faint);
    margin-bottom: 10px;
}

.tl-card {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius);
    padding: 26px 28px;
    transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.tl-card:hover {
    transform: translateY(-4px);
    border-color: rgba(167, 139, 250, 0.4);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.tl-top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.tl-top h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
}

.tl-org {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    background: var(--gradient-warm);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 500;
}

.tl-card > p { color: var(--text-dim); font-size: 0.98rem; margin-bottom: 14px; }

.tl-card ul { list-style: none; }

.tl-card li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 9px;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.tl-card li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.tl-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.tl-tags span {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent-2);
    padding: 4px 11px;
    border-radius: 100px;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.18);
}

/* ---------- Projects ---------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 22px;
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: rgba(167, 139, 250, 0.4);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.project-top { margin-bottom: 18px; }

.project-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.5rem;
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.25);
    color: var(--accent);
}

.project-card h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.project-card > p { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 14px; }

.project-card ul { list-style: none; margin-bottom: 18px; flex: 1; }

.project-card li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.project-card li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent-2);
}

.project-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

.project-tags span {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    padding: 4px 11px;
    border-radius: 100px;
    background: var(--surface-2);
    border: 1px solid var(--border-solid);
}

/* "More on GitHub" card */
.project-more {
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    background: linear-gradient(160deg, rgba(167, 139, 250, 0.1), rgba(34, 211, 238, 0.05));
    border-style: dashed;
}

.project-more .more-arrow {
    font-size: 2rem;
    color: var(--accent);
    transition: transform 0.3s var(--ease);
    margin-bottom: 12px;
}

.project-more:hover .more-arrow { transform: translateX(8px); }

/* ---------- Contact ---------- */
.contact { text-align: center; }

.contact .reveal { max-width: 640px; margin: 0 auto; }

.contact-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 4rem);
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin: 12px 0 22px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.contact-sub { color: var(--text-dim); font-size: 1.08rem; margin-bottom: 34px; }

.contact-btn { margin-bottom: 44px; }

.social-links { display: flex; justify-content: center; gap: 16px; }

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border-solid);
    color: var(--text-dim);
    transition: all 0.25s var(--ease);
}

.social-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(167, 139, 250, 0.25);
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 40px 28px 50px;
    border-top: 1px solid var(--border-solid);
}

.footer p {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-faint);
    margin-bottom: 6px;
}

/* ---------- Reveal animation ---------- */
.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
    will-change: opacity, transform;
}

.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
    .about-grid { grid-template-columns: 1fr; gap: 40px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    .nav { display: none; }
    .hamburger { display: flex; }
    .mobile-menu { display: flex; }
    .section { padding: 80px 22px; }
    .hero { padding: 110px 22px 50px; }
    .header-inner { padding: 16px 22px; }
    .marquee { margin: 0 -22px; }
}

@media (max-width: 460px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat { padding: 22px 18px; }
    .hero-cta { width: 100%; }
    .hero-cta .btn { flex: 1; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .marquee-track { animation: none; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
