/* ── Reset ── */

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

/* ── Tokens ── */

:root {
    --green:       #1A3A2A;
    --green-deep:  #0f2218;
    --cream:       #FFFCF5;
    --gold:        #D4B576;
    --gold-light:  #E5CA92;
    --gold-faint:  rgba(212, 181, 118, 0.14);
    --muted:       #8a9e90;
    --dim:         #c8c0b0;
    --rule:        rgba(255, 252, 245, 0.08);
    --font-serif:  'Instrument Serif', Georgia, serif;
    --font-sans:   'Outfit', system-ui, sans-serif;
    --font-mono:   'IBM Plex Mono', monospace;

    /* aliases — cv.html, abuseipdb.html */
    --bg:           var(--green);
    --text:         var(--cream);
    --soft:         #e8e0d0;
    --accent:       var(--gold);
    --accent-hover: var(--gold-light);
    --line:         var(--rule);
    --content-max:  720px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--green-deep);
    color: var(--cream);
    line-height: 1.6;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ── Shell ── */

.shell {
    min-height: 100dvh;
    display: grid;
    grid-template-rows: 1fr auto;
    position: relative;
    overflow: hidden;
}

.shell::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--green-deep);
    z-index: 0;
}

/* ── Animated background ── */

.ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(72px);
    will-change: transform;
}

.orb-a {
    width: min(70vmax, 640px);
    height: min(70vmax, 640px);
    top: -18%;
    right: -12%;
    background: radial-gradient(circle, rgba(212, 181, 118, 0.22) 0%, transparent 68%);
    animation: drift-a 24s ease-in-out infinite;
}

.orb-b {
    width: min(55vmax, 520px);
    height: min(55vmax, 520px);
    bottom: -22%;
    left: -18%;
    background: radial-gradient(circle, rgba(36, 82, 58, 0.55) 0%, transparent 70%);
    animation: drift-b 30s ease-in-out infinite;
}

.orb-c {
    width: min(40vmax, 380px);
    height: min(40vmax, 380px);
    top: 38%;
    left: 22%;
    background: radial-gradient(circle, rgba(212, 181, 118, 0.1) 0%, transparent 72%);
    animation: drift-c 20s ease-in-out infinite;
}

@keyframes drift-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    40%       { transform: translate(-6%, 10%) scale(1.06); }
    70%       { transform: translate(4%, -5%) scale(0.96); }
}

@keyframes drift-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    35%       { transform: translate(8%, -6%) scale(1.04); }
    65%       { transform: translate(-5%, 8%) scale(0.97); }
}

@keyframes drift-c {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.7; }
    50%       { transform: translate(-8%, -6%) scale(1.08); opacity: 1; }
}

/* ── Main layout ── */

.layout {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: clamp(3rem, 8vh, 6rem) clamp(1.5rem, 5vw, 3rem);
    display: flex;
    flex-direction: column;
    gap: clamp(2.5rem, 6vh, 4rem);
}

/* ── Hero ── */

.hero {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero-name {
    font-family: var(--font-serif);
    font-size: clamp(1.875rem, 5.5vw, 3rem);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--cream);
}

.hero-name em {
    font-style: italic;
    color: var(--gold);
}

.hero-name--domain {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 4.5vw, 2.25rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.hero-name--domain .hero-domain-tld {
    color: var(--gold);
}

.hero-rule {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--gold) 4rem, var(--rule) 4rem);
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 1.25rem;
}

.hero-role {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
}

.hero-bio {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--dim);
    max-width: 54ch;
}

.hero-bio strong {
    color: var(--cream);
    font-weight: 500;
}

.hero-bio a {
    color: var(--gold);
    text-decoration: none;
    border-bottom: 1px solid rgba(212, 181, 118, 0.4);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    border-radius: 2px;
    padding: 0 0.1em;
    margin: 0 -0.1em;
}

.hero-bio a:hover {
    color: var(--gold-light);
    border-bottom-color: var(--gold-light);
    background: var(--gold-faint);
}

.hero-bio mark {
    background: none;
    color: var(--cream);
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

/* ── Blocks ── */

.block {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.block-head {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1rem;
}

.block-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.block-line {
    height: 1px;
    background: var(--rule);
}

/* ── Link list ── */

.links {
    list-style: none;
}

/* Connect — fila compacta con borde */

.links--connect {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.links--connect .link-item {
    flex: 1 1 0;
    min-width: 5.5rem;
}

.links--connect .link-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.4rem 0.6rem;
    margin: 0;
    border: 1px solid var(--rule);
    border-radius: 3px;
    text-decoration: none;
    color: var(--dim);
    font-size: 0.75rem;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.links--connect .link-item a::before {
    display: none;
}

.links--connect .link-item a:hover {
    color: var(--gold);
    border-color: rgba(212, 181, 118, 0.45);
    background: var(--gold-faint);
}

.links--connect .link-label {
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 420px) {
    .links--connect {
        flex-direction: column;
    }

    .links--connect .link-item {
        flex: 1 1 auto;
        min-width: 0;
    }

    .links--connect .link-item a {
        justify-content: flex-start;
    }
}

.link-num {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--muted);
}

.link-label {
    font-weight: 500;
}

.link-arrow {
    font-size: 0.6875rem;
    color: var(--gold);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.link-hint {
    display: none;
}

/* ── CV highlight ── */

.block--cv {
    gap: 0;
}

.cv-btn-main {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.65rem;
    text-decoration: none;
    color: var(--cream);
    border: 1px solid rgba(212, 181, 118, 0.4);
    border-radius: 3px;
    background: rgba(212, 181, 118, 0.1);
    box-shadow: 0 0 24px rgba(212, 181, 118, 0.06);
    transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s, padding-left 0.25s;
}

.cv-btn-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gold-faint);
    border-radius: 3px;
    opacity: 0.35;
    z-index: -1;
}

.cv-btn-main:hover {
    padding-left: 0.85rem;
    border-color: rgba(212, 181, 118, 0.65);
    background: rgba(212, 181, 118, 0.16);
    box-shadow: 0 0 32px rgba(212, 181, 118, 0.12);
}

.cv-btn-main:hover::before {
    opacity: 0.55;
}

.cv-btn-main .link-label {
    color: var(--gold);
    font-weight: 600;
    font-size: 0.9375rem;
}

.cv-btn-main .link-hint {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--green);
    background: var(--gold);
    padding: 0.2rem 0.45rem;
    border-radius: 2px;
    line-height: 1;
}

.cv-btn-main .link-arrow {
    font-size: 0.6875rem;
    color: var(--gold-light);
}

@media (prefers-reduced-motion: no-preference) {
    .cv-btn-main {
        animation: cv-pulse 3.5s ease-in-out infinite;
    }

    @keyframes cv-pulse {
        0%, 100% {
            border-color: rgba(212, 181, 118, 0.35);
            box-shadow: 0 0 20px rgba(212, 181, 118, 0.05);
        }
        50% {
            border-color: rgba(212, 181, 118, 0.55);
            box-shadow: 0 0 28px rgba(212, 181, 118, 0.1);
        }
    }
}

/* ── Work list ── */

.work {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.work-item a {
    position: relative;
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 1rem;
    row-gap: 0.2rem;
    padding: 0.875rem 0.35rem;
    margin: 0 -0.35rem;
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    color: inherit;
    border-radius: 3px;
    transition: padding-left 0.25s ease;
}

.work-item a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gold-faint);
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: -1;
}

.work-item:first-child a {
    border-top: 1px solid var(--rule);
}

.work-item a:hover {
    padding-left: 0.5rem;
}

.work-item a:hover::before {
    opacity: 1;
}

.work-item a:hover .work-title {
    color: var(--gold);
}

.work-item a:hover .work-num {
    color: var(--gold);
}

.work-item a:hover .work-go {
    opacity: 1;
}

.work-num {
    grid-row: 1 / 3;
    align-self: start;
    padding-top: 0.15rem;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--muted);
}

.work-title {
    grid-column: 2;
    grid-row: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--cream);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.work-desc {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.45;
}

.work-go {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
    font-size: 0.75rem;
    color: var(--gold);
    opacity: 0;
    transition: opacity 0.2s;
}

.badge {
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--green);
    background: var(--gold);
    padding: 0.15rem 0.35rem;
    border-radius: 2px;
    line-height: 1;
    vertical-align: middle;
}

/* ── Footer ── */

.site-foot {
    position: relative;
    z-index: 1;
    padding: 1.25rem clamp(1.5rem, 5vw, 3rem) 1.75rem;
    border-top: 1px solid var(--rule);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1.5rem;
    max-width: var(--content-max);
    margin: 0 auto;
    width: 100%;
}

.site-foot p {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

/* ── Toast ── */

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    background: var(--gold);
    color: var(--green);
    padding: 0.625rem 1.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Entry animation ── */

@media (prefers-reduced-motion: no-preference) {
    .layout > * {
        animation: enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .layout > *:nth-child(1) { animation-delay: 0.05s; }
    .layout > *:nth-child(2) { animation-delay: 0.12s; }
    .layout > *:nth-child(3) { animation-delay: 0.19s; }
    .layout > *:nth-child(4) { animation-delay: 0.26s; }

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }

    .orb {
        animation: none !important;
        opacity: 0.6;
    }
}

/* ── Focus ── */

a:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

/* ── Print ── */

@media print {
    .shell::before,
    .ambient { display: none; }
    body { background: var(--green); }
    .link-arrow, .work-go { opacity: 1 !important; }
    .toast { display: none; }
}
