@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ============================================
   Modern CV — minimal palette: ink, paper, one accent
   Dark mode: terminal-inspired, toggled via [data-theme]
   ============================================ */
:root {
    --ink: #1a1625;
    --paper: #dbd7e9;
    --paper-raised: #f2f0f8;
    --muted: #6b6478;
    --line: #c7c1dc;

    --accent: #0d9488;
    --accent-light: #fbbf24;
    --accent-soft: rgba(13, 148, 136, 0.10);

    --tok-kw: #c026d3;
    --tok-str: #15803d;
    --tok-punct: #94a3b8;

    --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --max: 860px;
}

/* ---------- Dark mode (terminal-inspired) ---------- */
:root[data-theme="dark"] {
    --ink: #d1dae7;
    --paper: #0a0d10;
    --paper-raised: #12161a;
    --muted: #8a929b;
    --line: #23272d;

    --accent: #2dd4bf;
    --accent-light: #fbbf24;
    --accent-soft: rgba(45, 212, 191, 0.12);

    --tok-kw: #e879f9;
    --tok-str: #4ade80;
    --tok-punct: #64748b;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--paper);
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 48px 48px;
    background-position: center top;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    color: var(--accent);
}

/* ---------- Ambient background motion (subtle, top-left) ---------- */
.ambient-blob {
    position: fixed;
    top: -160px;
    left: -160px;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0.10;
    filter: blur(50px);
    z-index: 0;
    pointer-events: none;
    animation: drift 24s ease-in-out infinite alternate;
}

:root[data-theme="dark"] .ambient-blob {
    opacity: 0.18;
}

@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(60px, 90px) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
    .ambient-blob {
        animation: none;
    }
}

.bg-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

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

/* Blinking terminal-style cursor next to the role */
.cursor {
    display: inline-block;
    margin-left: 0.15em;
    color: var(--accent);
    animation: blink 1.1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .cursor {
        animation: none;
    }
}

hr {
    border: none;
    border-top: 1px solid var(--line);
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10;
}

.header-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.4rem 1.5rem 1.1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    line-height: 1.2;
}

.brand-name {
    display: inline-block;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}

.brand-role {
    margin: 0.2rem 0 0;
    font-family: var(--mono);
    font-size: 0.95rem;
    color: var(--accent);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.4rem;
}

.site-nav a,
.site-nav button.nav-link-btn {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--sans);
    transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav button.nav-link-btn:hover,
.site-nav button.nav-link-btn:focus-visible {
    color: var(--ink);
}

.code-mark {
    font-family: var(--mono);
    color: var(--accent);
    opacity: 0.55;
    margin-left: 0.1em;
    font-size: 0.85em;
    transition: opacity 0.15s ease;
}

.site-nav a:hover .code-mark,
.site-nav a:focus-visible .code-mark,
.site-nav button.nav-link-btn:hover .code-mark,
.site-nav button.nav-link-btn:focus-visible .code-mark {
    opacity: 1;
}

.site-nav .btn-outline {
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--paper);
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.site-nav .btn-outline:hover,
.site-nav .btn-outline:focus-visible {
    background: var(--accent);
    border-color: var(--accent);
}

/* Theme toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: none;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    flex: none;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
}

.theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

/* ---------- Page / sections ---------- */
.page {
    max-width: var(--max);
    margin: 0 auto;
    padding: 3.5rem 1.5rem 4rem;
}

/* ---------- Hero ---------- */
.lead-section {
    margin-bottom: 3.5rem;
}

.eyebrow {
    margin: 0 0 0.8rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.hero-title {
    margin: 0 0 1.3rem;
    font-size: clamp(2.1rem, 4.4vw + 1rem, 3.4rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.02em;
    max-width: 18ch;
}

.lead-quote {
    margin: 0 0 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--accent);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
}

.lead-quote span {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
    font-weight: 400;
    font-family: var(--mono);
    color: var(--muted);
}

.intro-text {
    margin: 0 0 1.8rem;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--ink);
    max-width: 62ch;
}

.code-card {
    margin: 0 0 1.8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper-raised);
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(20, 22, 26, 0.06);
}

:root[data-theme="dark"] .code-card {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.code-card-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--line);
}

.code-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--line);
}

.code-dot-red { background: #f87171; }
.code-dot-yellow { background: #fbbf24; }
.code-dot-green { background: #4ade80; }

.code-card-title {
    margin-left: 0.5rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
}

.code-card-body {
    margin: 0;
    padding: 1rem 1.2rem 1.2rem;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--ink);
}

.tok-kw { color: var(--tok-kw); }
.tok-str { color: var(--tok-str); }
.tok-punct { color: var(--tok-punct); }
.tok-key { color: var(--accent); }
.tok-var { color: var(--ink); }

.scroll-cue {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.scroll-cue:hover,
.scroll-cue:focus-visible {
    color: var(--accent);
}

.scroll-cue svg {
    width: 1rem;
    height: 1rem;
    animation: bob 1.6s ease-in-out infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .scroll-cue svg {
        animation: none;
    }
}

section + section {
    margin-top: 3.6rem;
}

.section-heading {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 0.5rem;
    margin-bottom: 1.4rem;
}

.section-index {
    position: absolute;
    left: 0;
    bottom: 100%;
    font-family: var(--mono);
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.section-heading h2 {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

/* ---------- Reveal on scroll ---------- */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ---------- Timeline (education / career history) ---------- */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.timeline-item {
    display: flex;
    gap: 1.2rem;
    padding: 0.9rem 0.6rem;
    margin: 0 -0.6rem;
    border-bottom: 1px solid var(--line);
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

.timeline-item:hover {
    background: var(--accent-soft);
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-date {
    flex: 0 0 150px;
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--muted);
    padding-top: 0.15rem;
}

.timeline-text {
    flex: 1;
    font-weight: 500;
}

.timeline-content {
    flex: 1;
}

.timeline-content h3 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: left;
}

.timeline-meta {
    margin: 0.1rem 0 0.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.timeline-content .plain-list {
    margin: 0;
}

/* ---------- Plain lists ---------- */
.plain-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.45rem;
}

.plain-list li {
    position: relative;
    padding-left: 1.1rem;
    color: var(--ink);
    line-height: 1.5;
}

.plain-list li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* ---------- Skill groups ---------- */
.skill-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.6rem;
}

.skill-group h3 {
    margin: 0 0 0.6rem;
    padding: 0;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
}

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

.tag {
    font-family: var(--mono);
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    transition: border-color 0.15s ease, color 0.15s ease;
}

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

/* ---------- Footer ---------- */
.site-footer {
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.2rem 1.5rem 2.5rem;
    border-top: 1px solid var(--line);
    text-align: center;
}

.site-footer p {
    margin: 0;
    font-size: 0.85rem;
    font-family: var(--mono);
    color: var(--muted);
}

/* ---------- Contact modal ---------- */
#contactModal .modal-content {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(20, 22, 26, 0.16);
    color: var(--ink);
}

#contactModal .modal-header,
#contactModal .modal-footer {
    border-color: var(--line);
}

#contactModal .modal-title {
    color: var(--ink);
    font-weight: 700;
}

#contactModal .modal-body {
    font-size: 1.05rem;
}

#contactModal .modal-body a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

#contactModal .modal-body a:hover {
    text-decoration: underline;
}

#contactModal .btn-secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 999px;
}

#contactModal .btn-secondary:hover {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

#contactModal .btn-close {
    opacity: 0.6;
}

#contactModal .btn-close:hover {
    opacity: 1;
}

:root[data-theme="dark"] #contactModal .btn-close {
    filter: invert(1);
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.2rem 1.2rem 1rem;
    }

    .site-nav {
        gap: 0.9rem;
        width: 100%;
        justify-content: space-between;
    }

    .brand-name {
        font-size: 1.4rem;
    }

    .timeline-item {
        flex-direction: column;
        gap: 0.2rem;
    }

    .timeline-date {
        flex: none;
    }

    .section-index {
        font-size: 1.8rem;
    }

    .section-heading h2 {
        font-size: 1.15rem;
    }

    .page {
        padding: 2.4rem 1.2rem 3rem;
    }
}
