/* ============================================================
   Luis Miguel Del Gallego Horta — personal site
   Aesthetic: engineering blueprint × terminal, dark mode only.
   ============================================================ */

:root {
    --bg: #0b0d0f;
    --bg-elevated: #14171a;
    --bg-card: #101315;
    --paper: #eae6dc;
    --muted: #9aa0a6;
    --muted-2: #676d74;
    --accent: #d7ff3f;
    --accent-dim: #9db32b;
    --rust: #ff6b45;
    --border: rgba(234, 230, 220, 0.12);
    --border-strong: rgba(234, 230, 220, 0.22);

    --font-display: "Fraunces", Georgia, serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

    --container: 1080px;
    --gutter: clamp(1.25rem, 4vw, 3rem);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

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

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

ul { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 1000;
    background: var(--accent);
    color: #0b0d0f;
    padding: 0.7em 1.2em;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 1rem;
}

/* subtle grain overlay for depth */
.noise {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.cursor {
    display: inline-block;
    color: var(--accent);
    animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------------- Nav ---------------- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem var(--gutter);
    background: rgba(11, 13, 15, 0.72);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav__logo {
    font-size: 0.9rem;
    color: var(--paper);
    font-weight: 500;
}

.nav__links {
    display: flex;
    gap: 2rem;
}
.nav__links a {
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: color 0.2s ease;
    position: relative;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--accent); }
.nav__links .idx {
    color: var(--muted-2);
    margin-right: 0.4em;
    font-size: 0.75rem;
}

.nav__toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.nav__toggle span {
    height: 1.5px;
    background: var(--paper);
    width: 100%;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* ---------------- Sidebar (wide desktop) ---------------- */
.sidebar { display: none; }

@media (min-width: 1100px) {
    .nav { display: none; }

    .sidebar {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 300px;
        padding: 3rem 2.25rem;
        border-right: 1px solid var(--border);
        background: var(--bg);
        z-index: 90;
    }

    main, .footer { margin-left: 300px; }
}

.sidebar__brand { display: block; }
.sidebar__name {
    display: block;
    font-family: var(--font-display);
    font-size: 1.5rem;
    line-height: 1.15;
    color: var(--paper);
}
.sidebar__role {
    display: block;
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: var(--accent);
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    margin-top: 3rem;
}
.sidebar__nav a {
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: color 0.2s ease, transform 0.2s ease;
    width: fit-content;
}
.sidebar__nav a:hover, .sidebar__nav a.is-active { color: var(--accent); transform: translateX(3px); }
.sidebar__nav .idx { color: var(--muted-2); margin-right: 0.5em; font-size: 0.75rem; }

.sidebar__bottom { display: flex; flex-direction: column; gap: 1.1rem; }
.sidebar__status {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.76rem;
    color: var(--muted-2);
}
.sidebar__status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(215, 255, 63, 0.18);
}
.sidebar__social { display: flex; gap: 0.7rem; }
.sidebar__social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.sidebar__social a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------- Hero ---------------- */
.hero {
    position: relative;
    min-height: 100svh;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    padding: 6rem var(--gutter) 4rem;
    max-width: 1280px;
    margin: 0 auto;
    overflow: hidden;
}

.hero__grid {
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(to right, var(--border) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 0%, transparent 70%);
    opacity: 0.5;
}

.hero__eyebrow {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 1.25rem;
    letter-spacing: 0.02em;
}

.hero__name {
    font-size: clamp(2.6rem, 6.5vw, 4.6rem);
    line-height: 1.02;
    color: var(--paper);
}

.hero__role {
    font-family: var(--font-mono);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--accent);
    margin-top: 1.4rem;
    min-height: 1.6em;
}

.hero__meta {
    color: var(--muted);
    max-width: 34em;
    margin-top: 1.1rem;
    font-size: 0.92rem;
}

.hero__cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2.2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.85em 1.4em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }

.btn--primary {
    background: var(--accent);
    color: #0b0d0f;
}
.btn--primary:hover { background: #e4ff70; }

.btn--ghost {
    border-color: var(--border-strong);
    color: var(--paper);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn .arrow { color: var(--accent); }

.hero__portrait { display: flex; justify-content: center; }

.portrait__frame {
    position: relative;
    width: min(300px, 65vw);
    aspect-ratio: 4 / 5;
}
.portrait__frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.08) contrast(1.05);
    border: 1px solid var(--border);
    box-shadow: 0 0 60px -12px rgba(60, 140, 220, 0.35);
}
.bracket {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid var(--accent);
    z-index: 2;
}
.bracket--tl { top: -8px; left: -8px; border-right: none; border-bottom: none; }
.bracket--tr { top: -8px; right: -8px; border-left: none; border-bottom: none; }
.bracket--bl { bottom: -8px; left: -8px; border-right: none; border-top: none; }
.bracket--br { bottom: -8px; right: -8px; border-left: none; border-top: none; }

.scroll-hint {
    position: absolute;
    bottom: 1.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted-2);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.scroll-hint svg { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------------- Sections ---------------- */
.section {
    max-width: var(--container);
    margin: 0 auto;
    padding: 6rem var(--gutter);
}

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

.section__head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 2.75rem;
    flex-wrap: wrap;
}
.section__num {
    font-size: 0.85rem;
    color: var(--accent-dim);
}
.section__head h2 {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    color: var(--paper);
}
.section__sub {
    color: var(--muted-2);
    font-size: 0.85rem;
    margin-left: auto;
}

/* ---------------- About ---------------- */
.about__body { max-width: 46em; }
.about__lede {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2.4vw, 1.55rem);
    line-height: 1.5;
    color: var(--paper);
    margin-bottom: 1.4rem;
}
.about__body p { color: var(--muted); margin-bottom: 1rem; }
.about__body strong { color: var(--accent); font-weight: 600; }

.stats {
    display: flex;
    gap: clamp(1.5rem, 5vw, 3.5rem);
    margin-top: 2.5rem;
    flex-wrap: wrap;
}
.stat { display: flex; flex-direction: column; }
.stat__num {
    font-family: var(--font-display);
    font-size: 2.4rem;
    color: var(--accent);
    line-height: 1;
}
.stat__label {
    color: var(--muted-2);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.5rem;
}

/* ---------------- Timeline / commit log ---------------- */
.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.commit {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 1.25rem;
}

.commit__rail {
    position: relative;
    display: flex;
    justify-content: center;
}
.commit__rail::before {
    content: "";
    position: absolute;
    top: 22px;
    bottom: -2rem;
    width: 1px;
    background: var(--border-strong);
}
.commit:last-child .commit__rail::before { display: none; }

.commit__dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--muted-2);
    margin-top: 8px;
    z-index: 1;
}
.commit__dot--head {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(215, 255, 63, 0.15);
}
.commit__dot--faded { border-color: var(--muted-2); opacity: 0.6; }

.commit__card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.6rem 1.8rem;
    transition: border-color 0.25s ease, transform 0.25s ease;
}
.commit__card:hover {
    border-color: var(--border-strong);
    transform: translateX(4px);
}
.commit__card--faded { background: transparent; }

.commit__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}
.branch {
    font-size: 0.78rem;
    color: var(--accent-dim);
}
.branch::before { content: "⎇ "; }
.commit__date {
    font-size: 0.78rem;
    color: var(--muted-2);
}

.commit__card h3 {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--paper);
    margin-bottom: 1rem;
}
.commit__card h3 .at { color: var(--accent); font-weight: 500; }
.commit__card h3 .loc {
    display: block;
    font-size: 0.78rem;
    color: var(--muted-2);
    font-weight: 400;
    margin-top: 0.3rem;
}

.commit__card ul {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 1.2rem;
}
.commit__card ul li {
    position: relative;
    padding-left: 1.1em;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
}
.commit__card ul li::before {
    content: "+";
    position: absolute;
    left: 0;
    color: var(--accent-dim);
}

.tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tech span {
    font-size: 0.72rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.3em 0.6em;
}

.squashed-list { gap: 0.4rem; margin-bottom: 0.8rem; }
.squashed-list li {
    font-size: 0.85rem;
    color: var(--muted);
    padding-left: 1.1em;
    position: relative;
}
.squashed-list li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: var(--muted-2);
}
.squashed-note {
    font-size: 0.78rem;
    color: var(--muted-2);
    font-style: italic;
}

/* ---------------- Skills (bento) ---------------- */
.skills {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(110px, auto);
    grid-auto-flow: dense;
    gap: 1.1rem;
}

.skill-tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem 1.7rem;
    transition: border-color 0.25s ease, transform 0.25s ease;
    grid-column: span 1;
}
.skill-tile:hover { border-color: var(--border-strong); transform: translateY(-2px); }

/* Frontend carries the most tags — the biggest tile, sized for content, not decoration */
.skill-tile--lg { grid-column: span 2; grid-row: span 2; }
/* Backend & Data is the next-largest set */
.skill-tile--wide { grid-column: span 2; }

/* AI & Agentic Coding — called out as the differentiator */
.skill-tile--accent {
    background: var(--accent);
    border-color: var(--accent);
}
.skill-tile--accent h3 { color: #0b0d0f; }
.skill-tile--accent .tags span {
    color: #0b0d0f;
    border-color: rgba(11, 13, 15, 0.35);
}
.skill-tile--accent .tags span:hover {
    background: #0b0d0f;
    color: var(--accent);
    border-color: #0b0d0f;
}

.skill-tile h3 {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-dim);
    margin-bottom: 1rem;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.tags span {
    font-size: 0.8rem;
    padding: 0.45em 0.8em;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tags span:hover {
    background: var(--accent);
    color: #0b0d0f;
    border-color: var(--accent);
}

@media (min-width: 761px) and (max-width: 1099px) {
    .skills { grid-template-columns: repeat(2, 1fr); }
    .skill-tile--lg { grid-row: span 1; }
}

@media (max-width: 760px) {
    .skills { grid-template-columns: 1fr; }
    .skill-tile, .skill-tile--lg, .skill-tile--wide {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* ---------------- Contact ---------------- */
.section--contact {
    text-align: center;
    padding-top: 4rem;
    padding-bottom: 7rem;
}
.contact__inner {
    max-width: 40em;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.section--contact .section__sub { margin: 0 0 1rem; }
.section--contact h2 {
    font-size: clamp(2.4rem, 6vw, 3.6rem);
    line-height: 1.05;
    margin-bottom: 1.4rem;
}
.contact__lede {
    color: var(--muted);
    margin-bottom: 2rem;
}
.section--contact .hero__cta { justify-content: center; margin-top: 0; }

/* ---------------- Footer ---------------- */
.footer {
    border-top: 1px solid var(--border);
    padding: 2rem var(--gutter);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--muted-2);
    font-size: 0.78rem;
}
.footer__top { color: var(--muted); transition: color 0.2s ease; }
.footer__top:hover { color: var(--accent); }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: left;
        padding-top: 7rem;
        gap: 3rem;
    }
    .hero__portrait { order: -1; justify-content: flex-start; }
    .portrait__frame { width: 150px; }

    .nav__toggle { display: flex; }
    .nav__links {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
        transform: translateY(-120%);
        opacity: 0;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }
    .nav__links.is-open { transform: translateY(0); opacity: 1; }
    .nav__links a { padding: 1rem var(--gutter); border-bottom: 1px solid var(--border); }

    .section__sub { margin-left: 0; }
    .commit { grid-template-columns: 18px 1fr; }
    .commit__card { padding: 1.3rem; }
}

@media (max-width: 480px) {
    .stats { gap: 1.5rem; }
    .hero__cta, .section--contact .hero__cta { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
    .reveal { transition: none; opacity: 1; transform: none; }
    .cursor, .scroll-hint svg { animation: none; }
    html { scroll-behavior: auto; }
}
