/* ═══════════════════════════════════════════════
   Matías Matzkin — Portfolio
   Dark editorial design system
   ═══════════════════════════════════════════════ */

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Design tokens ── */
:root {
    /* Palette */
    --accent: #C8FF00;
    --accent-dim: rgba(200, 255, 0, 0.15);

    /* Dark theme (default) */
    --bg: #0A0A0A;
    --bg-elevated: #111111;
    --fg: #E8E4DE;
    --fg-muted: rgba(232, 228, 222, 0.55);
    --fg-subtle: rgba(232, 228, 222, 0.3);
    --border-color: rgba(232, 228, 222, 0.12);

    /* Typography */
    --font-body: "Google Sans Flex", Arial, sans-serif;
    --font-heading: "Google Sans Flex", Arial, sans-serif;
    --font-mono: "Google Sans Flex", Arial, sans-serif;

    /* Spacing */
    --space-xs: 0.375rem;
    --space-sm: 0.75rem;
    --space-md: 1.5rem;
    --space-lg: 3rem;
    --space-xl: 5rem;
    --space-2xl: 8rem;

    /* Layout */
    --gutter: 2.5rem;
    --topbar-h: 4.5rem;

    /* Transitions */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --dur: 0.35s;
}

/* ── Light theme overrides ── */
[data-theme="light"] {
    --bg: #F2F0EC;
    --bg-elevated: #E8E4DE;
    --fg: #111111;
    --fg-muted: rgba(17, 17, 17, 0.55);
    --fg-subtle: rgba(17, 17, 17, 0.25);
    --border-color: rgba(17, 17, 17, 0.12);
}

/* ── Base ── */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
    overflow-x: hidden;
}

::selection {
    background: var(--accent);
    color: #000;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

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

ul, ol {
    list-style: none;
}


/* ═══════════════════════════════════════════════
   TYPOGRAPHY — Utility classes
   ═══════════════════════════════════════════════ */

.label-mono {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-muted);
    line-height: 1.2;
}

.label-mono--accent {
    color: var(--accent);
}

.body-text {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    font-weight: 300;
    line-height: 1.7;
    color: var(--fg);
    max-width: 48ch;
}


/* ═══════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════ */

.topbar {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding-inline: var(--gutter);
    background-color: transparent;
    transition: background-color var(--dur) var(--ease);
}

.topbar--scrolled {
    background-color: var(--bg);
    border-bottom: 1px solid var(--border-color);
}

.topbar__left {
    display: flex;
    align-items: center;
}

.topbar__back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    padding-block: var(--space-xs);
    transition: color var(--dur) var(--ease);
}

.topbar__back-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width var(--dur) var(--ease);
}

.topbar__back-link:hover {
    color: var(--accent);
}

.topbar__back-link:hover::after {
    width: 100%;
}

.topbar__nav ul {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 1.4vw, var(--space-md));
}

.topbar__nav a {
    position: relative;
    padding-block: var(--space-xs);
    transition: color var(--dur) var(--ease);
}

.topbar__nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width var(--dur) var(--ease);
}

.topbar__nav a:hover {
    color: var(--fg);
}

.topbar__nav a:hover::after {
    width: 100%;
}

.topbar__right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.team-nav {
    display: flex;
    gap: var(--space-sm);
}

.team-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.625rem;
    letter-spacing: 0.05em;
    color: var(--fg-muted);
    transition: all var(--dur) var(--ease);
}

.team-nav a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.team-nav a[aria-current="page"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}


/* ── Theme toggle button ── */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: border-color var(--dur) var(--ease);
}

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

.theme-toggle__icon {
    position: relative;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--fg-muted);
    transition: all var(--dur) var(--ease);
}

[data-theme="dark"] .theme-toggle__icon {
    box-shadow: inset 4px -2px 0 0 var(--bg);
    background: var(--fg-muted);
}

[data-theme="light"] .theme-toggle__icon {
    box-shadow: none;
    background: var(--fg);
}


/* ═══════════════════════════════════════════════
   HERO — Split screen
   ═══════════════════════════════════════════════ */

.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

.hero__left {
    display: flex;
    align-items: center;
    padding: var(--space-2xl) var(--space-xl) var(--space-xl) var(--gutter);
}

.hero__content {
    max-width: 520px;
}

.hero__label {
    margin-bottom: var(--space-md);
}

.hero__name {
    font-family: var(--font-heading);
    font-size: clamp(3.5rem, 7vw, 6.5rem);
    font-weight: 600;
    line-height: 0.92;
    letter-spacing: -0.03em;
    color: var(--fg);
    margin-bottom: var(--space-lg);
}

.hero__name--accent {
    color: var(--accent);
}

.hero__intro {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    font-weight: 300;
    line-height: 1.7;
    color: var(--fg-muted);
    max-width: 42ch;
    margin-bottom: var(--space-lg);
}

.hero__meta {
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.meta-grid {
    display: flex;
    gap: var(--space-lg);
}

.meta-grid__item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.meta-grid__item dd {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--fg);
}

/* Hero right — dither canvas */
.hero__right {
    position: relative;
    overflow: hidden;
    background: var(--bg);
    -webkit-mask-image:
        linear-gradient(to right,  transparent 0%, black 18%, black 82%, transparent 100%),
        linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-composite: destination-in;
    mask-image:
        linear-gradient(to right,  transparent 0%, black 18%, black 82%, transparent 100%),
        linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    mask-composite: intersect;
}

.dither-canvas {
    display: block;
    width: 100%;
    height: 100%;
}


/* ═══════════════════════════════════════════════
   SECTIONS — Editorial grid
   ═══════════════════════════════════════════════ */

.section {
    padding: var(--space-2xl) var(--gutter);
}

.section--border {
    border-top: 1px solid var(--border-color);
}

.section__grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: var(--space-xl);
    max-width: 1200px;
    margin-inline: auto;
}

.section__label-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding-top: 0.25rem;
    position: sticky;
    top: calc(var(--topbar-h) + var(--space-lg));
    align-self: start;
}


/* ═══════════════════════════════════════════════
   PROFILE BLOCK
   ═══════════════════════════════════════════════ */

.profile-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.profile-block__item {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.profile-block__item h3 {
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

/* ── Profile photo ── */
.profile-photo-wrapper {
    margin-top: var(--space-md);
    width: 160px;
    height: 160px;
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    overflow: hidden;
    position: relative;
    border-radius: 2px;
}

.profile-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(15%);
    transition: transform var(--dur) var(--ease), filter var(--dur) var(--ease);
}

.profile-photo-wrapper:hover .profile-photo-img {
    transform: scale(1.04);
    filter: grayscale(0%);
}

/* -- Luz verde que gira por el borde de la foto -- */
.profile-photo-wrapper {
    border: none;
    padding: 2px;                       /* grosor del borde animado */
    background: var(--border-color);
}

.profile-photo-wrapper::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 160%;
    height: 160%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 250deg,
        rgba(200, 255, 0, 0.25) 300deg,
        #C8FF00 355deg,
        transparent 360deg
    );
    transform: translate(-50%, -50%) rotate(0deg);
    animation: foto-borde-giro 4s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.profile-photo-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 1px;
}

@keyframes foto-borde-giro {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .profile-photo-wrapper::before { animation: none; }
}


/* ── Tag list ── */

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    color: var(--fg-muted);
    transition: all var(--dur) var(--ease);
}

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


/* ═══════════════════════════════════════════════
   CURRENT COURSES STATUS
   ═══════════════════════════════════════════════ */

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    box-shadow: 0 0 8px var(--accent);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.85); }
}

/* ═══════════════════════════════════════════════
   STATS ROW
   ═══════════════════════════════════════════════ */

.stats-row {
    display: flex;
    gap: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-xl);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat__number {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--accent);
}

.stat__bar {
    width: 100%;
    min-width: 160px;
    max-width: 220px;
    height: 3px;
    background: var(--border-color);
    margin-top: var(--space-xs);
    overflow: hidden;
}

.stat__bar-fill {
    height: 100%;
    background: var(--accent);
    width: 0;                               /* arranca en 0, el JS la llena junto con el contador */
}


/* ═══════════════════════════════════════════════
   SUBJECT LIST
   ═══════════════════════════════════════════════ */

.subject-list__heading {
    margin-bottom: var(--space-md);
}

.subject-list__items {
    display: flex;
    flex-direction: column;
}

.subject-list__item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--dur) var(--ease);
}

.subject-list__item:first-child {
    border-top: 1px solid var(--border-color);
}

.subject-list__item:hover {
    padding-left: var(--space-sm);
}

.subject-list__name {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    font-weight: 400;
    color: var(--fg);
    transition: color var(--dur) var(--ease);
}

.subject-list__item:hover .subject-list__name {
    color: var(--accent);
}

.subject-list__detail {
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Current subjects highlight (verde) ── */
.subject-list__item--current .subject-list__name {
    color: var(--accent);
    font-weight: 500;
}

.subject-list__item--current .subject-list__detail {
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 500;
}


/* ═══════════════════════════════════════════════
   CONTACT
   ═══════════════════════════════════════════════ */

.contact-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.contact-block__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.contact-link {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-md);
    border: 1px solid var(--border-color);
    transition: all var(--dur) var(--ease);
}

.contact-link:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.contact-link__value {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--fg);
    transition: color var(--dur) var(--ease);
}

.contact-link:hover .contact-link__value {
    color: var(--accent);
}


/* ═══════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════ */

.footer {
    border-top: 1px solid var(--border-color);
    padding: var(--space-lg) var(--gutter);
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin-inline: auto;
}


/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */

@media (max-width: 1024px) {
    :root {
        --gutter: 1.75rem;
    }

    .hero {
        grid-template-columns: 1fr;
        grid-template-rows: auto 50vh;
    }

    .hero__left {
        padding: calc(var(--topbar-h) + var(--space-xl)) var(--gutter) var(--space-xl);
    }

    .hero__right {
        max-height: 50vh;
    }

    .section__grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .section__label-col {
        position: static;
    }
}

@media (max-width: 640px) {
    :root {
        --gutter: 1.25rem;
        --space-2xl: 4rem;
        --space-xl: 3rem;
    }


    .topbar__nav ul {
        gap: var(--space-sm);
    }

    .team-nav {
        display: none;
    }

    .hero__name {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .hero__intro {
        font-size: 0.9375rem;
    }

    .meta-grid {
        gap: var(--space-md);
    }

    .stats-row {
        flex-wrap: wrap;
        gap: var(--space-lg);
    }

    .subject-list__item {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .footer__inner {
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
    }
}


/* ═══════════════════════════════════════════════
   CUSTOM CURSOR — Dither dot with difference blend
   ═══════════════════════════════════════════════ */

@media (hover: hover) and (pointer: fine) {
    body,
    a,
    button,
    [role="button"],
    input,
    select,
    textarea {
        cursor: none !important;
    }
}

.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
    mix-blend-mode: difference;
    opacity: 0;
    overflow: hidden;
    transition: opacity 0.25s ease;
}

.custom-cursor__dot,
.custom-cursor__tail {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 4px;
    background-color: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity, filter;
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-cursor__tail {
    opacity: 0;
}

.custom-cursor__tail--1 {
    filter: blur(1.5px);
}

.custom-cursor__tail--2 {
    filter: blur(2.8px);
}

.custom-cursor__tail--3 {
    filter: blur(4.2px);
}

.custom-cursor--hover .custom-cursor__dot,
.custom-cursor--hover .custom-cursor__tail {
    width: 26px;
    height: 26px;
}

@media (hover: none), (pointer: coarse) {
    .custom-cursor {
        display: none !important;
    }
}


/* ═══════════════════════════════════════════════
   SCROLL REVEAL & HERO MOTION
   ═══════════════════════════════════════════════ */

/* ── Hero entrance animations (triggered on load) ── */
.hero-reveal {
    opacity: 0;
    transform: translateY(22px);
    filter: blur(4px);
    transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.85s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.85s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

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

/* ── Scroll reveal classes (triggered on scroll) ── */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(4px);
    transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.75s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

.reveal--left {
    opacity: 0;
    transform: translateX(-28px);
    filter: blur(4px);
    transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.75s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

.reveal--right {
    opacity: 0;
    transform: translateX(28px);
    filter: blur(4px);
    transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.75s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

.reveal--scale {
    opacity: 0;
    transform: scale(0.94) translateY(14px);
    filter: blur(4px);
    transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.75s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

.reveal.is-visible,
.reveal--left.is-visible,
.reveal--right.is-visible,
.reveal--scale.is-visible {
    opacity: 1;
    transform: none;
    filter: none;
}

/* Tabular numbers for clean counting without layout jitter */
.stat__number {
    font-variant-numeric: tabular-nums;
    display: inline-block;
}

.stat__bar-fill {
    box-shadow: 0 0 10px rgba(200, 255, 0, 0.3);
}

@media (prefers-reduced-motion: reduce) {
    .reveal, .reveal--left, .reveal--right, .reveal--scale, .hero-reveal {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        transition: none !important;
    }
    .stat__bar-fill {
        transition: none !important;
    }
}

