/* ==========================================================================
   Sebastian García Muñoz — Estilo Apple/Google Mejorado
   ========================================================================== */

/* Variables */
:root {
    --bg: #0a0a0a;
    --bg-soft: #111111;
    --bg-card: #1a1a1a;
    --text: #f5f5f7;
    --text-muted: #86868b;
    --accent: #c9a961;
    --accent-warm: #b8754a;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);
    --easing: cubic-bezier(0.22, 1, 0.36, 1);
    --easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --focus-ring: 0 0 0 3px rgba(201, 169, 97, 0.5);
}

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

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    line-height: 1.5;
    overflow-x: hidden;
    cursor: none;
    transition: background-color 0.3s var(--easing);
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s var(--easing);
}

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

ul {
    list-style: none;
}

button {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: all 0.3s var(--easing);
}

/* Focus visible accesible (teclado) */
*:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 4px;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Section label */
.section-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* ==========================================================================
   Imágenes fallback (cuando falla onerror)
   ========================================================================== */
.img-fallback {
    background: linear-gradient(135deg, #1a1a1a 0%, var(--accent) 100%);
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.img-fallback::after {
    content: 'Imagen no disponible';
    color: var(--text);
    font-size: 14px;
    opacity: 0.5;
}

/* ==========================================================================
   Custom cursor (solo desktop)
   ========================================================================== */
.cursor, .cursor-follower {
    position: fixed;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
}
.cursor {
    width: 8px; height: 8px;
    background: var(--text);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s var(--easing), opacity 0.2s;
}
.cursor-follower {
    width: 40px; height: 40px;
    border: 1px solid var(--text);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.4s var(--easing), width 0.3s, height 0.3s, border-color 0.3s;
}
.cursor-follower.is-hover {
    width: 70px; height: 70px;
    background: rgba(201, 169, 97, 0.15);
    border-color: var(--accent);
}

@media (max-width: 1024px), (hover: none) {
    body { cursor: auto; }
    .cursor, .cursor-follower { display: none; }
}

/* ==========================================================================
   Loader
   ========================================================================== */
.loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    transition: opacity 0.8s var(--easing), visibility 0.8s;
}
.loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-text {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3em;
}
.loader-bar {
    width: 200px;
    height: 1px;
    background: rgba(255,255,255,0.1);
    overflow: hidden;
}
.loader-progress {
    width: 0%;
    height: 100%;
    background: var(--accent);
    transition: width 0.3s var(--easing);
}

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 20px 32px;
    transition: all 0.4s var(--easing);
}
.navbar.is-scrolled {
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 14px 32px;
}
.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
    transition: color 0.2s;
}
.nav-logo:hover { color: var(--accent); }
.nav-links {
    display: flex;
    gap: 36px;
}
.nav-links a {
    font-size: 14px;
    color: var(--text-muted);
    position: relative;
    padding: 8px 0;
}
.nav-links a:hover {
    color: var(--text);
}
.nav-links a::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 0; height: 1px;
    background: var(--accent);
    transition: width 0.3s var(--easing);
}
.nav-links a:hover::after { width: 100%; }

/* Nav toggle (hamburguesa móvil) */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 32px;
    height: 32px;
    padding: 6px;
    align-items: center;
    justify-content: center;
}
.nav-toggle span {
    width: 100%;
    height: 1px;
    background: var(--text);
    transition: transform 0.3s var(--easing), opacity 0.3s;
}
.nav-toggle.is-active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Nav móvil (oculto por defecto) */
.nav-mobile {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(20px);
    padding: 80px 32px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s var(--easing), opacity 0.4s var(--easing);
    z-index: 99;
}
.nav-mobile.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.nav-mobile a {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-muted);
}
.nav-mobile a:hover { color: var(--accent); }

@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-toggle { display: flex; }
}

@media (min-width: 769px) {
    .nav-mobile { display: none !important; }
}

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.hero-bg img {
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.45;
    will-change: transform;
}
.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 50%, transparent 0%, var(--bg) 90%),
        linear-gradient(180deg, transparent 0%, var(--bg) 100%);
}
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 32px;
    max-width: 1100px;
}
.hero-title {
    font-size: clamp(3rem, 10vw, 9rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.045em;
    margin-bottom: 32px;
}
.hero-title .line {
    display: block;
    overflow: hidden;
}
.hero-title .line span {
    display: inline-block;
    will-change: transform;
}
.hero-tagline {
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.hero-tagline span {
    color: var(--text);
}
.hero-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 40px;
    letter-spacing: 0.05em;
}
.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    border: 1px solid var(--text);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    color: var(--text);
    will-change: transform;
}
.hero-cta:hover {
    background: var(--text);
    color: var(--bg);
    transform: translateY(-2px);
}
.hero-cta svg {
    transition: transform 0.3s var(--easing);
}
.hero-cta:hover svg {
    transform: translate(2px, -2px);
}

.hero-scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.3em;
    text-transform: uppercase;
}
.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(180deg, var(--text) 0%, transparent 100%);
    animation: scrollLine 2s ease-in-out infinite;
}
@keyframes scrollLine {
    0%, 100% { transform: scaleY(1); opacity: 1; }
    50% { transform: scaleY(0.3); opacity: 0.3; }
}

/* ==========================================================================
   SOBRE MÍ
   ========================================================================== */
.sobre-mi {
    padding: 160px 0;
    border-top: 1px solid var(--border);
}
.sobre-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 80px;
    align-items: start;
}
.sobre-img {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: var(--bg-card);
}
.sobre-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--easing), filter 0.4s;
    filter: grayscale(10%);
}
.sobre-img:hover img {
    transform: scale(1.04);
    filter: grayscale(0%);
}
.sobre-img::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid var(--border);
    z-index: 1;
    pointer-events: none;
    border-radius: 4px;
}
.sobre-titulo {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 32px;
}
.sobre-text p {
    font-size: 17px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}
.sobre-text p strong {
    color: var(--text);
    font-weight: 600;
}
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 56px;
    padding-top: 56px;
    border-top: 1px solid var(--border);
}
.stat-num {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

@media (max-width: 768px) {
    .sobre-mi { padding: 100px 0; }
    .sobre-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

/* ==========================================================================
   BOOK
   ========================================================================== */
.book {
    padding: 160px 0;
    border-top: 1px solid var(--border);
}
.book-titulo {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    margin-bottom: 80px;
}
.book-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}
.book-card {
    grid-column: span 2;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    transition: transform 0.4s var(--easing), border-color 0.4s, box-shadow 0.4s;
    will-change: transform;
}
.book-card-lg {
    grid-column: span 3;
}
.book-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}
.book-img {
    aspect-ratio: 3/4;
    overflow: hidden;
    background: var(--bg-card);
}
.book-card-lg .book-img {
    aspect-ratio: 4/5;
}
.book-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.7s var(--easing), filter 0.4s;
}
.book-card:hover .book-img img {
    transform: scale(1.08);
}
.book-info {
    padding: 24px;
}
.book-info h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    transition: color 0.3s;
}
.book-card:hover .book-info h3 { color: var(--accent); }
.book-info p {
    font-size: 14px;
    color: var(--text-muted);
}

@media (max-width: 1024px) {
    .book-grid { grid-template-columns: repeat(4, 1fr); }
    .book-card { grid-column: span 2; }
    .book-card-lg { grid-column: span 2; }
}
@media (max-width: 640px) {
    .book-grid { grid-template-columns: 1fr; }
    .book-card, .book-card-lg { grid-column: span 1; }
    .book-img { aspect-ratio: 16/10; }
    .book-card-lg .book-img { aspect-ratio: 16/10; }
}

/* ==========================================================================
   SERVICIOS
   ========================================================================== */
.servicios {
    padding: 160px 0;
    border-top: 1px solid var(--border);
}
.servicios-titulo {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    margin-bottom: 80px;
}
.servicios-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.servicio-card {
    padding: 40px 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-soft);
    transition: all 0.4s var(--easing);
    position: relative;
    overflow: hidden;
}
.servicio-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(201, 169, 97, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s var(--easing);
}
.servicio-card:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(201, 169, 97, 0.08);
}
.servicio-card:hover::before { opacity: 1; }
.servicio-num {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.1em;
}
.servicio-card h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
    position: relative;
}
.servicio-card p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
    position: relative;
}
.servicio-list li {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
    border-top: 1px solid var(--border);
    position: relative;
    padding-left: 16px;
    transition: color 0.3s;
}
.servicio-list li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--accent);
}
.servicio-card:hover .servicio-list li { color: var(--text); }

@media (max-width: 1024px) {
    .servicios-grid { grid-template-columns: 1fr; }
    .servicios, .book { padding: 100px 0; }
}

/* ==========================================================================
   SKILLS
   ========================================================================== */
.skills {
    padding: 160px 0;
    border-top: 1px solid var(--border);
}
.skills-titulo {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 64px;
}
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.skill {
    padding: 14px 28px;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    will-change: transform;
}
.skill:hover {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(201, 169, 97, 0.2);
}

/* ==========================================================================
   CONTACTO
   ========================================================================== */
.contacto {
    padding: 160px 0 80px;
    border-top: 1px solid var(--border);
}
.contacto-titulo {
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.05em;
    margin-bottom: 80px;
}
.contacto-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border);
}
.contacto-link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 32px 0;
    border-bottom: 1px solid var(--border);
    transition: padding 0.4s var(--easing), color 0.4s;
}
.contacto-link:hover {
    padding-left: 16px;
}
.contacto-label {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: color 0.3s;
}
.contacto-valor {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    transition: color 0.3s;
}
.contacto-link:hover .contacto-valor { color: var(--accent); }
.contacto-link:hover .contacto-label { color: var(--accent); }

.footer {
    margin-top: 80px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ==========================================================================
   Reveal animation (CSS fallback)
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s var(--easing), transform 1s var(--easing);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Reduced motion (accesibilidad)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1; transform: none; }
    .scroll-line { animation: none; }
    .hero-bg img { transform: none !important; }
}

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 768px) {
    .container { padding: 0 20px; }
    .sobre-mi, .book, .servicios, .skills, .contacto {
        padding: 80px 0;
    }
    .navbar { padding: 14px 20px; }
    .navbar.is-scrolled { padding: 10px 20px; }
    .hero-scroll-hint { display: none; }
}

/* ==========================================================================
   Impresión
   ========================================================================== */
@media print {
    .navbar, .loader, .cursor, .cursor-follower, .hero-scroll-hint,
    .nav-toggle, .nav-mobile, .hero-cta {
        display: none !important;
    }
    body { background: white; color: black; }
    .hero-bg img { opacity: 0.2; }
}