/* ============================================
   Bright Editorial Aesthetic — Marc Manzano
   (Apple / IBM iX inspired, via Lovable)
   ============================================ */

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

/* Prevent text overflow on mobile */
p, h1, h2, h3, h4, h5, h6, li, span, a {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

code, pre {
    overflow-x: auto;
}

:root {
    /* Surfaces */
    --bg-primary: #ffffff;          /* pure white */
    --bg-light: #f6f6f7;            /* light fills / stats band */
    --ink: #1a1d29;                 /* near-black foreground + inverted bg */
    --ink-soft: #2a2e3c;

    /* Text */
    --text-primary: #1a1d29;
    --text-secondary: #5b6170;
    --text-muted: #8a8f9c;

    /* Accent — IBM iX electric blue, used sparingly */
    --accent: #3056ff;
    --accent-hover: #1f3fe0;

    /* Lines */
    --border: rgba(26, 29, 41, 0.10);
    --border-strong: rgba(26, 29, 41, 0.18);
    --border-dark: rgba(255, 255, 255, 0.12);

    /* On dark (inverted) sections */
    --on-dark: #f4f4f5;
    --on-dark-muted: rgba(244, 244, 245, 0.62);
    --on-dark-faint: rgba(244, 244, 245, 0.42);

    /* Fonts */
    --font-display: "Inter Tight", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "JetBrains Mono", monospace;

    --radius: 0.5rem;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
    min-width: 320px;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(48, 86, 255, 0.18);
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
}

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

/* ============================================
   Navigation
   ============================================ */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
}

/* legacy terminal prompt — neutralized */
.terminal-prompt {
    display: none;
}

.nav-links {
    display: flex;
    gap: 2.25rem;
    align-items: center;
}

.nav-links a {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--ink);
}

.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    background: var(--ink);
    color: #fff !important;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--ink);
    transition: background 0.2s ease, transform 0.2s ease;
}

.nav-cta:hover {
    background: var(--ink-soft);
}

/* mobile-only "Get in touch" inside the dropdown */
.nav-links-cta { display: none; }

/* Hamburger toggle (hidden on desktop) */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 0 auto;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   Buttons (pill)
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.6rem;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* light surfaces */
.btn-primary {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-soft); }

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--border-strong);
}
.btn-secondary:hover {
    border-color: var(--ink);
    background: rgba(26, 29, 41, 0.04);
}

/* on inverted/dark surfaces */
.btn-on-dark {
    background: transparent;
    color: var(--on-dark);
    border-color: var(--border-dark);
}
.btn-on-dark:hover {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================
   Section scaffolding
   ============================================ */

section {
    position: relative;
    z-index: 1;
}

.section-pad {
    padding: 7rem 0;
}

/* inverted (ink) sections */
.section-dark {
    background: var(--ink);
    color: var(--on-dark);
}

/* Section marker:  01 —— Label */
.section-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
}

.section-dark .section-title {
    color: var(--on-dark-muted);
}

.section-number {
    font-family: var(--font-mono);
    color: inherit;
}

.section-rule {
    height: 1px;
    width: 3rem;
    background: var(--border-strong);
}

.section-dark .section-rule {
    background: var(--border-dark);
}

.section-text {
    color: inherit;
}

/* The big display heading that follows a section marker */
.section-heading {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.05;
    font-size: clamp(2rem, 5vw, 3.75rem);
    margin-bottom: 4rem;
    max-width: 24ch;
}

/* Subsection label within a section (e.g. Scientific Articles / Patents) */
.subsection-heading {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    font-size: 1.5rem;
    color: var(--ink);
    padding-bottom: 1.25rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-strong);
}

.subsection-heading + .rows .row:first-child { padding-top: 0; }

/* spacing between the two subsections */
.subsection-gap { margin-top: 5rem; }

/* ============================================
   Hero
   ============================================ */

.hero {
    padding: 9rem 0 5rem;
}

.hero-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 4rem;
    align-items: center;
}

.hero-image {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 60px -20px rgba(26, 29, 41, 0.25);
    background: var(--bg-light);
}

.hero-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.hero-text h1 {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 6vw, 5rem);
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: -0.03em;
    color: var(--ink);
    margin-bottom: 1.5rem;
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 1.75rem;
    color: var(--text-muted);
}

.subtitle .bracket { display: none; }

.role-text {
    color: var(--accent);
}

.hero-description {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 2.25rem;
    max-width: 56ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ============================================
   Stats band
   ============================================ */

.stats-band {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 1120px;
    margin: 0 auto;
    padding: 3.5rem 1.5rem;
}

.stat-number {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 3.25rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
    line-height: 1;
}

.stat-label {
    margin-top: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-muted);
}

/* legacy stat icon — hidden in editorial look */
.stat-icon { display: none; }

/* ============================================
   Grid rows (Career, Research, Patents, Education)
   ============================================ */

.rows {
    display: flex;
    flex-direction: column;
}

.row {
    display: grid;
    grid-template-columns: 3fr 9fr;
    gap: 3rem;
    padding: 2.75rem 0;
    border-bottom: 1px solid var(--border);
}

.row:first-child { padding-top: 0; }
.row:last-child { border-bottom: 0; }

.section-dark .row {
    border-bottom-color: var(--border-dark);
}

.row-meta-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-muted);
}

.section-dark .row-meta-label {
    color: var(--on-dark-faint);
}

.row-org {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-top: 0.65rem;
    color: var(--ink);
}

.section-dark .row-org {
    color: var(--on-dark);
}

.row-loc {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-top: 0.4rem;
    color: var(--text-muted);
}

.section-dark .row-loc {
    color: var(--on-dark-faint);
}

.row-role {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}

.section-dark .row-role {
    color: var(--on-dark);
}

.row-summary {
    margin-top: 0.85rem;
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 62ch;
}

.section-dark .row-summary {
    color: var(--on-dark-muted);
}

/* tag pills */
.row-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.row-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text-secondary);
}

.section-dark .row-tag {
    border-color: var(--border-dark);
    color: var(--on-dark-muted);
}

/* ============================================
   Research / Patents — clickable rows
   ============================================ */

.pub-row {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.pub-venue {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.pub-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.pub-type {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text-muted);
}

.pub-year {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

.pub-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.025em;
    color: var(--ink);
    max-width: 28ch;
    transition: color 0.2s ease;
}

.pub-row:hover .pub-title {
    color: var(--text-secondary);
}

.pub-desc {
    margin-top: 1rem;
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 60ch;
}

/* featured (Nature) — slightly larger title */
.pub-row.featured .pub-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
}

/* ============================================
   About
   ============================================ */

.about-grid {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 3.5rem;
    align-items: center;
}

.about-portrait {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 1rem;
    background: var(--bg-light);
    display: block;
}

.about-blocks {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.about-block h3 {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.about-block ul {
    list-style: none;
}

.about-block li {
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--text-primary);
    padding: 0.5rem 0;
}

.about-block a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.about-block a:hover {
    color: var(--text-secondary);
}

/* ============================================
   Contact
   ============================================ */

.contact-lead {
    font-size: 1.2rem;
    line-height: 1.7;
    color: var(--on-dark-muted);
    max-width: 56ch;
    margin-bottom: 2.5rem;
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    background: var(--ink);
    color: var(--on-dark);
    border-top: 1px solid var(--border-dark);
    padding: 3rem 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-terminal {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--on-dark-muted);
    margin-bottom: 0.4rem;
}

.footer-copyright {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--on-dark-faint);
}

.footer-links {
    display: flex;
    gap: 1.75rem;
}

.footer-links a {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--on-dark-muted);
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--on-dark);
}

/* ============================================
   Accessibility
   ============================================ */

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 2000;
    padding: 0.6rem 1rem;
    background: var(--ink);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border-radius: 6px;
    transition: top 0.2s ease;
}

.skip-link:focus { top: 1rem; }

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ============================================
   Reveal animation
   ============================================ */

@keyframes reveal {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.reveal {
    opacity: 0;
    transform: translateY(16px);
}

.reveal.visible {
    animation: reveal 0.9s var(--ease-out-expo) both;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 900px) {
    .hero-container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .hero-image { order: 2; }
    .hero-text { order: 1; }

    .row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .about-portrait {
        max-width: 460px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .container { padding: 0 1.25rem; }

    .nav-container { padding: 0 1.25rem; }

    .nav-toggle { display: flex; }

    .nav-cta { display: none; }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem 1.25rem 1rem;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 0.9rem 0;
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .nav-links-cta {
        display: block;
        margin-top: 0.5rem;
        color: var(--ink) !important;
        font-weight: 600;
    }

    .hero { padding: 7rem 0 3rem; }
    .hero-container { padding: 0 1.25rem; }

    .section-pad { padding: 4.5rem 0; }

    .section-heading {
        margin-bottom: 2.5rem;
        font-size: clamp(1.8rem, 7vw, 2.5rem);
    }

    .hero-actions,
    .contact-actions {
        width: 100%;
    }

    .btn {
        flex: 1;
        justify-content: center;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .hero-text h1 { font-size: 2.3rem; }
    .pub-title { font-size: 1.5rem; }
    .row-org { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}
