/* ==========================================================================
   DIRECTORIO EDITORIAL DE PROYECTOS — LINKS.LCZ.CL
   Luis Carrera · Fotografía · Arte · Tecnología · Cultura
   ========================================================================== */

:root {
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.2s ease;
}

/* Tema Oscuro Editorial ("Claroscuro" — Por defecto en armonía con LCZ) */
body.theme-dark {
    --bg-primary: #08080a;
    --bg-elevated: #0e0e12;
    --bg-elevated-hover: #14141a;
    --bg-featured: #111116;
    --text-primary: #f4f4f6;
    --text-secondary: #a1a1b0;
    --text-muted: #6e6e7e;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.22);
    --accent-focus: #ffffff;
    --tag-bg: rgba(255, 255, 255, 0.04);
    color-scheme: dark;
}

/* Tema Claro Editorial ("Papel / Albedo") */
body.theme-light {
    --bg-primary: #fafaf8;
    --bg-elevated: #ffffff;
    --bg-elevated-hover: #f3f3ef;
    --bg-featured: #ffffff;
    --text-primary: #121216;
    --text-secondary: #525260;
    --text-muted: #787886;
    --border-subtle: rgba(0, 0, 0, 0.09);
    --border-strong: rgba(0, 0, 0, 0.28);
    --accent-focus: #121216;
    --tag-bg: rgba(0, 0, 0, 0.04);
    color-scheme: light;
}

/* Reset selectivo sin bloquear herencia de componentes */
html, body, header, main, section, footer, div, h1, h2, h3, p, ul, li, a, button, span {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.55;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.35s ease, color 0.35s ease;
}

/* Enlace de salto accesible para teclado */
.skip-link:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

.skip-link:where(:focus-within, :active) {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 999;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
}

/* Indicadores visibles de foco por teclado (WCAG 2.4.7 / 2.4.11) */
:where(a:any-link, button):focus-visible {
    outline: 2px solid var(--accent-focus);
    outline-offset: 3px;
}

/* Contenedor principal de lectura controlada */
.editorial-shell {
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
    padding: 2.25rem 1.25rem 3rem;
}

/* Barra superior discreta (Índice editorial + selector de idioma y luz) */
.editorial-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

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

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Selector de Idiomas de 3 Estados (ES | EN | PT) */
.lang-selector-group {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 2px 4px;
}

.lang-select-btn {
    appearance: none;
    background: transparent;
    border: none;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-radius: 999px;
    min-block-size: 28px;
    min-inline-size: 28px;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.lang-select-btn:hover {
    color: var(--text-primary);
}

.lang-select-btn.active {
    color: var(--bg-primary);
    background-color: var(--text-primary);
}

/* Visibilidad por idioma activo */
body.lang-es :is(.lang-en, .lang-pt) { display: none !important; }
body.lang-en :is(.lang-es, .lang-pt) { display: none !important; }
body.lang-pt :is(.lang-es, .lang-en) { display: none !important; }

.theme-switch-btn {
    appearance: none;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: 999px;
    min-block-size: 34px;
    min-inline-size: 34px;
    padding: 0.35rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.theme-switch-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.theme-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
}

/* Encabezado Personal Compacto */
.profile-header {
    margin-bottom: 2.25rem;
}

.profile-identity {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.profile-name {
    font-family: var(--font-heading);
    font-size: clamp(1.85rem, 5vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text-primary);
}

.profile-disciplines {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.profile-bio {
    margin-top: 0.85rem;
    font-size: 0.96rem;
    font-weight: 300;
    color: var(--text-secondary);
    max-width: 52ch;
    line-height: 1.6;
    text-wrap: pretty;
}

/* Secciones del Directorio */
.directory-main {
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
}

.directory-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border-subtle);
}

.group-title {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.group-index {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

/* Lista semántica de proyectos */
.project-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

/* Tarjeta / Fila Editorial de Enlace */
.project-link {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-decoration: none;
    color: inherit;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 1.1rem 1.2rem;
    min-block-size: 72px;
    transition: var(--transition-smooth);
    position: relative;
}

/* Mayor presencia visual para Fotografía y Obra Artística */
.project-link.is-featured {
    background-color: var(--bg-featured);
    padding: 1.3rem 1.35rem;
    border-left: 2px solid var(--text-primary);
}

.project-link:hover {
    background-color: var(--bg-elevated-hover);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.project-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.project-title-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.project-name {
    font-family: var(--font-heading);
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.project-link.is-featured .project-name {
    font-size: 1.16rem;
}

.project-tag {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    background-color: var(--tag-bg);
    border: 1px solid var(--border-subtle);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}

/* Indicador discreto de navegación externa */
.project-arrow {
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.25s ease, color 0.25s ease;
}

.project-link:hover .project-arrow {
    color: var(--text-primary);
    transform: translate(2px, -2px);
}

.project-desc {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 54ch;
    text-wrap: pretty;
}

/* Pie de página discreto */
.editorial-footer {
    margin-top: 3.25rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-identity {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.footer-author {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.footer-tagline {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.footer-social {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-social-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.78rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
    transition: var(--transition-fast);
}

.footer-social-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* Optimización para pantallas táctiles (Mobile-first / Instagram in-app browser) */
@media (pointer: coarse) {
    .project-link {
        padding: 1.15rem 1.2rem;
        min-block-size: 76px;
    }

    .footer-social-link {
        padding: 0.4rem 0.2rem;
    }
}

@media (max-width: 480px) {
    .editorial-shell {
        padding: 1.5rem 1.1rem 2.5rem;
    }

    .editorial-topbar {
        margin-bottom: 1.35rem;
        padding-bottom: 0.9rem;
    }

    .profile-header {
        margin-bottom: 1.75rem;
    }

    .directory-main {
        gap: 1.85rem;
    }
}

/* Respeto por usuarios con preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    body,
    .project-link,
    .project-arrow,
    .theme-switch-btn,
    .footer-social-link {
        transition: none !important;
        transform: none !important;
    }
}

/* Soporte para Modo de Contraste Forzado (Accesibilidad) */
@media (forced-colors: active) {
    .project-link {
        border: 1px solid CanvasText;
    }

    .project-link.is-featured {
        border-left: 3px solid Highlight;
    }
}
