/* ============================================
   Portfolio - Juan Lizcano Barbosa
   styles.css
   --------------------------------------------
   Editorial look: serif body (Source Serif 4) at a
   comfortable reading size, Inter for UI labels,
   warm dark palette with a single muted-gold accent.
   ============================================ */

/* --- Design Tokens --- */
:root {
    --bg-primary: #1a1815;
    --bg-secondary: #201d19;
    --bg-card: #262219;
    --bg-glass: rgba(245, 240, 232, 0.05);
    --bg-glass-hover: rgba(245, 240, 232, 0.1);
    --text-primary: #e6e2da;
    --text-secondary: #a9a397;
    --text-highlight: #f7f4ee;
    --accent: #d4a24e;
    --accent-hover: #ba8a35;
    --accent-glow: rgba(212, 162, 78, 0.35);
    --border-subtle: rgba(245, 240, 232, 0.09);
    --border-hover: rgba(245, 240, 232, 0.22);
    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 0.3s ease;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-serif);
    font-size: 1.0625rem; /* 17px — comfortable reading size */
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.75;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* --- Particles Background --- */
#particles-js {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* --- Main Container --- */
.main-container {
    position: relative;
    z-index: 1;
}

/* ============================================
   NAVIGATION
   ============================================ */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    font-family: var(--font-sans);
    transition: background-color var(--transition), padding var(--transition);
}
nav.scrolled {
    background-color: rgba(26, 24, 21, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 50px;
    border-bottom: 1px solid var(--border-subtle);
}
.nav-logo {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--text-highlight);
    letter-spacing: -0.02em;
}
.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}
.nav-links a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: color var(--transition);
    position: relative;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--text-highlight);
}
.nav-links a.active::after,
.nav-links a:hover::after {
    width: 100%;
}

/* LinkedIn icon link (no underline effect) */
.nav-linkedin {
    display: inline-flex;
    align-items: center;
}
.nav-linkedin::after { display: none; }
.nav-linkedin svg { display: block; }
.nav-linkedin:hover { color: var(--accent); }

/* Right-side nav cluster: language toggle + hamburger */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}
.lang-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}
.lang-opt {
    background: none;
    border: none;
    padding: 2px 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    transition: color var(--transition);
}
.lang-opt:hover { color: var(--text-highlight); }
.lang-opt.active { color: var(--accent); }
.lang-sep { color: var(--border-hover); font-size: 0.8rem; }

/* ============================================
   SECTIONS - COMMON
   ============================================ */
section {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 120px 40px;
    position: relative;
}
.content-wrapper {
    max-width: 1000px;
    width: 100%;
    text-align: center;
}
h2 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
    color: var(--text-highlight);
}
.section-subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-secondary);
    font-size: 1.15rem;
    margin-bottom: 60px;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}
h3 {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--text-highlight);
    margin-bottom: 16px;
}

/* Previously an animated silver gradient — now calm, plain text. */
.gradient-text {
    color: var(--text-highlight);
}

/* ============================================
   HERO SECTION
   ============================================ */
#home {
    padding: 0;
    overflow: hidden;
}
#vanta-hero {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.hero-text {
    position: relative;
    z-index: 2;
    text-align: center;
}
.hero-text h1 {
    font-family: var(--font-serif);
    font-size: 4.2rem;
    font-weight: 600;
    color: var(--text-highlight);
    margin: 0;
    text-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    letter-spacing: -0.015em;
}
.hero-text p {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.45rem;
    color: var(--text-primary);
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
    min-height: 2.2rem;
    margin-top: 12px;
}
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1.4rem;
    background-color: var(--accent);
    margin-left: 2px;
    animation: blink 0.7s infinite;
    vertical-align: text-bottom;
}
@keyframes blink { 50% { opacity: 0; } }

/* Hero CV button */
.hero-cv {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 28px;
    padding: 12px 26px;
    border-radius: 30px;
    background: rgba(245, 240, 232, 0.06);
    border: 1px solid var(--border-hover);
    color: var(--text-highlight);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    backdrop-filter: blur(6px);
    transition: all var(--transition);
}
.hero-cv:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(212, 162, 78, 0.35);
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    animation: bounce 2s infinite;
    opacity: 0.6;
}
.scroll-indicator svg {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
}
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* ============================================
   ABOUT SECTION
   ============================================ */
#about .intro-text {
    font-size: 1.2rem;
    line-height: 1.85;
    color: var(--text-primary);
    max-width: 680px;
    margin: 0 auto 56px auto;
    text-align: center;
}

/* Coverflow photo carousel (3D ring painted from js/main.js) */
.coverflow {
    position: relative;
    max-width: 760px;
    margin: 0 auto;
    /* Card width drives pitch, depth and perspective. */
    --cf-card: clamp(190px, 28vw, 300px);
}
.coverflow-frame {
    position: relative;
    overflow: hidden;
    padding: 36px 0 26px;
    cursor: grab;
    outline: none;
    perspective: calc(var(--cf-card) * 3);
    touch-action: pan-y; /* horizontal drag is ours; the page keeps scrolling */
}
.coverflow-frame:active { cursor: grabbing; }
.coverflow-frame:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: var(--radius-md);
}
.coverflow-stage {
    position: relative;
    height: var(--cf-card);
    transform-style: preserve-3d;
    user-select: none;
}
.coverflow-card {
    position: absolute;
    left: 50%;
    top: 0;
    width: var(--cf-card);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
    will-change: transform;
}
.coverflow-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}
.coverflow-caption {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.98rem;
    min-height: 1.6em;
}
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: rgba(26, 24, 21, 0.6);
    color: var(--text-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: all var(--transition);
}
.carousel-btn:hover {
    border-color: var(--accent);
    background: rgba(212, 162, 78, 0.35);
}
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: rgba(247, 244, 238, 0.45);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}
.carousel-dot.active {
    background: var(--accent);
    transform: scale(1.25);
}

/* ============================================
   EXPERIENCE TIMELINE
   ============================================ */
#experience {
    min-height: auto;
    padding: 100px 40px;
}
.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--accent), var(--accent), transparent);
    opacity: 0.55;
}
.timeline-item {
    position: relative;
    width: 50%;
    padding: 0 40px 50px;
}
.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
    padding-right: 50px;
    padding-left: 0;
}
.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
    padding-left: 50px;
    padding-right: 0;
}
.timeline-dot {
    position: absolute;
    top: 5px;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: 3px solid var(--bg-primary);
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 10px var(--accent-glow);
}
.timeline-item:nth-child(odd) .timeline-dot {
    right: -7px;
}
.timeline-item:nth-child(even) .timeline-dot {
    left: -7px;
}
.timeline-content {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all var(--transition);
}
.timeline-content:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.timeline-date {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}
.timeline-content h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}
.timeline-company {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 10px;
}
.timeline-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
    margin: 0;
}
.timeline-content .project-tags {
    margin-top: 12px;
}

/* ============================================
   PROJECTS SECTION
   ============================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    width: 100%;
}
.project-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
}
.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--border-hover);
}

/* Icon header */
.project-icon-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 0;
}
.project-status {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 20px;
}
.project-status.live {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}
.project-status.dev {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}
.project-status.research {
    background: rgba(212, 162, 78, 0.12);
    color: var(--accent);
    border: 1px solid rgba(212, 162, 78, 0.3);
}
.project-status.complete {
    background: rgba(169, 163, 151, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(169, 163, 151, 0.3);
}

.project-info {
    padding: 18px 24px 24px;
    text-align: left;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.project-info h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    line-height: 1.3;
}
.project-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
    flex-grow: 1;
}
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
}
.project-tag {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    padding: 3px 9px;
    border-radius: 20px;
    background: rgba(212, 162, 78, 0.1);
    color: #e2c07c;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: 1px solid rgba(212, 162, 78, 0.18);
}
.project-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 16px;
    padding: 9px 18px;
    align-self: flex-start;
    background: rgba(212, 162, 78, 0.12);
    border: 1px solid rgba(212, 162, 78, 0.3);
    color: var(--accent);
    border-radius: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.82rem;
    transition: all var(--transition);
}
.project-link:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 162, 78, 0.3);
}
.project-info-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 16px;
}
.project-info-footer .case-cue { margin-top: 0; }
.project-ext-links {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
}
.project-ext {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color var(--transition);
}
.project-ext:hover { color: var(--accent); }
.project-ext svg { flex-shrink: 0; }

/* Clickable card + "View case study" cue */
.project-card.clickable { cursor: pointer; }
.project-card.clickable:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.case-cue {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    align-self: flex-start;
    color: var(--accent);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.8rem;
    opacity: 0.85;
    transition: gap var(--transition), opacity var(--transition);
}
.project-card:hover .case-cue { opacity: 1; gap: 10px; }

/* ============================================
   CASE STUDY MODAL
   ============================================ */
.case-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.case-modal.open { display: flex; }
.case-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    animation: fade-in 0.25s ease;
}
.case-modal-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    animation: modal-rise 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.case-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}
.case-modal-close:hover {
    color: var(--text-highlight);
    border-color: var(--accent);
    transform: rotate(90deg);
}
.case-modal-status {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(212, 162, 78, 0.12);
    color: var(--accent);
    border: 1px solid rgba(212, 162, 78, 0.25);
    margin-bottom: 14px;
}
.case-modal-content h2 {
    font-size: 1.7rem;
    margin: 0 0 24px 0;
    line-height: 1.25;
    padding-right: 40px;
}
.case-block { margin-bottom: 22px; }
.case-block h4 {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin: 0 0 8px 0;
}
.case-block p {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.7;
    margin: 0;
    text-align: left;
}
.case-block ul {
    margin: 0;
    padding-left: 20px;
    text-align: left;
}
.case-block li {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 6px;
}
.case-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 24px 0 0;
    padding-top: 22px;
    border-top: 1px solid var(--border-subtle);
}
.case-modal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.case-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    padding: 11px 22px;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.88rem;
    transition: all var(--transition);
}
.case-modal-link:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 162, 78, 0.3);
}

/* ============================================
   CERTIFICATIONS (certificados.html)
   ============================================ */
#certificates {
    min-height: auto;
    padding: 150px 40px 80px;
}
.certs-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 40px;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition);
}
.certs-back:hover { color: var(--accent); }
.certs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    text-align: left;
}
.cert-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
}
.cert-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}
.cert-card .cert-issuer {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.cert-card h4 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-highlight);
    margin-bottom: 6px;
    line-height: 1.4;
}
.cert-card .cert-date {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
/* PDF slot: a muted "coming soon" span, or a live link once the PDF exists */
.cert-pdf {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: auto;
    padding-top: 12px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}
a.cert-pdf:hover { text-decoration: underline; }
/* Second PDF link in the same card stacks right below the first */
.cert-pdf + .cert-pdf {
    margin-top: 0;
    padding-top: 6px;
}
.cert-pdf.pending {
    color: var(--text-secondary);
    opacity: 0.7;
}
/* Certificate preview thumbnail: first page of the PDF, links to the file */
.cert-thumb {
    display: block;
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: #f7f4ee;
    margin-bottom: 16px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.cert-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition);
}
a.cert-thumb:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
a.cert-thumb:hover img { transform: scale(1.03); }
/* Two PDFs in one card: thumbnails sit side by side */
.cert-thumb-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.cert-thumb-row .cert-thumb { margin-bottom: 0; }
/* Card whose PDF is not published yet: quiet placeholder panel */
.cert-thumb.placeholder {
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ============================================
   AI CHAT SECTION
   ============================================ */
#ai-chat {
    min-height: auto;
    padding: 100px 40px;
}
.chat-wrapper {
    max-width: 720px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    font-family: var(--font-sans);
}

/* Terminal header bar */
.chat-terminal-header {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    background: rgba(245, 240, 232, 0.03);
    border-bottom: 1px solid var(--border-subtle);
    gap: 14px;
}
.terminal-dots {
    display: flex;
    gap: 7px;
}
.terminal-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }
.terminal-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    flex-grow: 1;
}
.terminal-title svg { color: var(--accent); }
.terminal-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}
.status-dot-live {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #febc2e;
    animation: pulse-status 1.5s infinite;
}
.status-dot-live.online { background: #28c840; }
.status-dot-live.offline { background: #ff5f57; animation: none; }
.status-text {
    color: var(--text-secondary);
    font-weight: 500;
}
@keyframes pulse-status {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* Messages area */
.chat-messages {
    height: 420px;
    overflow-y: auto;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-primary);
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(245, 240, 232, 0.12);
    border-radius: 4px;
}
.chat-msg {
    display: flex;
    max-width: 85%;
}
.chat-msg.user { align-self: flex-end; justify-content: flex-end; }
.chat-msg.bot { align-self: flex-start; }
.chat-bubble {
    padding: 11px 16px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.chat-msg.bot .chat-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}
.chat-msg.user .chat-bubble {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-bubble.typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}
.chat-bubble.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing-bounce 1.2s infinite ease-in-out;
}
.chat-bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Input bar */
.chat-input-bar {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(245, 240, 232, 0.02);
}
.chat-input-bar input {
    flex-grow: 1;
    padding: 12px 16px;
    border-radius: 24px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}
.chat-input-bar input:focus { border-color: var(--accent); }
.chat-input-bar input:disabled { opacity: 0.5; }
.chat-input-bar button {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}
.chat-input-bar button:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: scale(1.05);
}
.chat-input-bar button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Suggested prompts */
.chat-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(245, 240, 232, 0.02);
}
.chat-prompt-chip {
    font-size: 0.78rem;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(212, 162, 78, 0.1);
    border: 1px solid rgba(212, 162, 78, 0.2);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: default;
    transition: all var(--transition);
}
.chat-prompt-chip:hover {
    background: rgba(212, 162, 78, 0.2);
    color: var(--text-highlight);
    border-color: var(--accent);
}

/* ============================================
   VISION LAB SECTION (on-device computer vision)
   ============================================ */
#vision-lab {
    min-height: auto;
    padding: 100px 40px;
}
.vision-wrapper {
    max-width: 920px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    font-family: var(--font-sans);
}
.vision-body {
    display: flex;
    align-items: stretch;
}

/* --- Left: camera stage --- */
.vision-stage {
    position: relative;
    flex: 1 1 60%;
    background: #000;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-right: 1px solid var(--border-subtle);
}
.vision-stage video,
.vision-stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* selfie mirror; canvas overlay mirrors with it */
}
.vision-stage canvas { pointer-events: none; }

/* Reticle corner brackets */
.vision-bracket {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 2px solid var(--accent);
    opacity: 0.55;
    z-index: 3;
    pointer-events: none;
}
.vision-bracket.tl { top: 14px; left: 14px; border-right: none; border-bottom: none; }
.vision-bracket.tr { top: 14px; right: 14px; border-left: none; border-bottom: none; }
.vision-bracket.bl { bottom: 14px; left: 14px; border-right: none; border-top: none; }
.vision-bracket.br { bottom: 14px; right: 14px; border-left: none; border-top: none; }

/* Scanning line (only animates while live) */
.vision-scanline {
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    z-index: 3;
    pointer-events: none;
}
.vision-stage.live .vision-scanline {
    opacity: 0.8;
    animation: vision-scan 3.2s linear infinite;
}
@keyframes vision-scan {
    0% { top: 4%; }
    50% { top: 96%; }
    100% { top: 4%; }
}

/* FPS chip + stop button: only while live */
.vision-fps-chip,
.vision-stop {
    position: absolute;
    z-index: 4;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(26, 24, 21, 0.65);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(6px);
    color: var(--text-highlight);
    opacity: 0;
    transition: opacity var(--transition);
}
.vision-fps-chip { top: 12px; left: 50%; transform: translateX(-50%); color: #28c840; }
.vision-stop {
    bottom: 12px; left: 50%; transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer;
}
.vision-stop:hover { border-color: var(--accent); background: rgba(212, 162, 78, 0.25); }
.vision-stage.live .vision-fps-chip,
.vision-stage.live .vision-stop { opacity: 1; }

/* Idle / boot overlay */
.vision-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    text-align: center;
    background: radial-gradient(circle at center, rgba(212, 162, 78, 0.1), rgba(0, 0, 0, 0.85));
    transition: opacity var(--transition);
}
.vision-stage.live .vision-overlay { opacity: 0; pointer-events: none; }
.vision-boot {
    font-family: 'Courier New', monospace;
    font-size: 0.74rem;
    line-height: 1.5;
    color: #28c840;
    text-align: left;
    min-height: 18px;
    margin: 0;
    white-space: pre-wrap;
    text-shadow: 0 0 8px rgba(40, 200, 64, 0.4);
}
.vision-activate {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 13px 26px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.vision-activate:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 0 45px var(--accent-glow);
}
.vision-activate:disabled { opacity: 0.6; cursor: wait; }
.vision-overlay.loading .vision-activate { display: none; }
.vision-privacy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin: 0;
}
.vision-privacy svg { color: var(--accent); }

/* --- Right: telemetry panel --- */
.vision-panel {
    flex: 1 1 40%;
    min-width: 240px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(245, 240, 232, 0.015);
}
.vision-panel-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.vision-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}
.vision-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
    align-self: center;
    text-align: center;
}
.vision-bar {
    display: grid;
    grid-template-columns: 70px 1fr 38px;
    align-items: center;
    gap: 10px;
}
.vision-bar-label {
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.vision-bar-track {
    height: 8px;
    border-radius: 6px;
    background: rgba(245, 240, 232, 0.07);
    overflow: hidden;
}
.vision-bar-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--accent), #e8cd8f);
    transition: width 0.09s linear;
}
.vision-bar-val {
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    text-align: right;
}
.vision-readout {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.vision-dominant {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-highlight);
}
.vision-icon {
    display: inline-flex;
    align-items: center;
    color: var(--accent);
}
.vision-icon svg { display: block; }
.vision-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

/* ============================================
   CONTACT SECTION
   ============================================ */
#contact {
    padding: 0;
    overflow: hidden;
}
#vanta-contact {
    position: absolute;
    inset: 0;
    z-index: 0;
}
#contact .content-wrapper {
    position: relative;
    z-index: 2;
    background: rgba(26, 24, 21, 0.6);
    backdrop-filter: blur(10px);
    padding: 50px;
    border-radius: var(--radius-lg);
    max-width: 700px;
    border: 1px solid var(--border-subtle);
}
#contact p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.7;
}
/* Contact CTAs (Schedule + CV) */
.contact-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 40px;
}
.cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 30px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition);
}
.cta-primary {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}
.cta-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(212, 162, 78, 0.4);
}
.cta-secondary {
    background: transparent;
    color: var(--text-highlight);
    border: 1px solid var(--border-hover);
}
.cta-secondary:hover {
    border-color: var(--accent);
    background: rgba(212, 162, 78, 0.12);
    transform: translateY(-3px);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 24px;
}
.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition);
}
.social-link:hover {
    transform: translateY(-4px) scale(1.1);
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 8px 25px rgba(212, 162, 78, 0.3);
}
.social-link svg {
    width: 22px;
    height: 22px;
    fill: var(--text-primary);
    transition: fill var(--transition);
}
.social-link:hover svg {
    fill: var(--text-highlight);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    padding: 40px;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
    position: relative;
    z-index: 1;
    font-family: var(--font-sans);
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}
.footer-links a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color var(--transition);
}
.footer-links a:hover { color: var(--text-highlight); }
.footer-copy {
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }

/* No-JS fallback */
.no-js .reveal { opacity: 1; transform: none; }

/* ============================================
   SCROLL "WRITE-IN" TEXT EFFECTS
   Section titles type out with a caret; prose
   writes itself in word by word (js/main.js).
   ============================================ */
/* An element being written owns its own entrance — kill the container fade. */
.write-host {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}
.write-word {
    display: inline-block;
    opacity: 0;
    animation: write-word-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes write-word-in {
    from { opacity: 0; transform: translateY(0.4em); filter: blur(6px); }
    to { opacity: 1; transform: none; filter: none; }
}
.type-caret {
    display: inline-block;
    width: 3px;
    height: 0.85em;
    margin-left: 5px;
    background: var(--accent);
    animation: blink 0.7s infinite;
    vertical-align: -0.08em;
}

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

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

/* Mobile */
@media (max-width: 768px) {
    nav { padding: 15px 20px; }
    nav.scrolled { padding: 12px 20px; }

    /* Few links now — keep them inline instead of a drawer menu */
    .nav-links { gap: 16px; }
    .nav-links a { font-size: 0.82rem; }
    .nav-actions { gap: 12px; }

    section { padding: 80px 24px; }
    h1, .hero-text h1 { font-size: 2.6rem !important; }
    h2 { font-size: 2rem; }
    .section-subtitle { font-size: 1.05rem; }

    #about .intro-text { font-size: 1.1rem; }
    .coverflow { --cf-card: clamp(150px, 46vw, 240px); }
    .carousel-btn { width: 34px; height: 34px; }

    /* Timeline mobile: single column */
    .timeline::before { left: 20px; }
    .timeline-item,
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        width: 100%;
        left: 0;
        text-align: left;
        padding-left: 50px;
        padding-right: 0;
    }
    .timeline-item:nth-child(odd) .timeline-dot,
    .timeline-item:nth-child(even) .timeline-dot {
        left: 13px;
        right: auto;
    }

    .projects-grid { grid-template-columns: 1fr; }
    .certs-grid { grid-template-columns: 1fr; }
    #certificates { padding: 120px 24px 60px; }

    .chat-messages { height: 360px; }
    .chat-prompts { justify-content: center; }
    .chat-msg { max-width: 92%; }

    .vision-body { flex-direction: column; }
    .vision-stage { flex-basis: auto; border-right: none; border-bottom: 1px solid var(--border-subtle); }
    .vision-panel { flex-basis: auto; }

    #contact .content-wrapper { padding: 30px 24px; margin: 0 16px; }
    .footer-links { flex-wrap: wrap; gap: 16px; }
}

/* Small Mobile */
@media (max-width: 480px) {
    h1, .hero-text h1 { font-size: 2.1rem !important; }
    h2 { font-size: 1.7rem; }
    .hero-text p { font-size: 1.1rem; }
}
