/* Paleta elegante */
:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --glass: rgba(255, 255, 255, 0.85);
    --border: #e4e7ec;
    --text: #1b1f24;
    --text-soft: #657084;
    --accent: #176f63;
    --shadow: 0 18px 40px rgba(27, 31, 36, 0.07);
}

body.dark-mode {
    --bg: #08090c;
    --surface: #11151b;
    --glass: rgba(8, 9, 12, 0.8);
    --border: #20262f;
    --text: #e6eaef;
    --text-soft: #8f9bb2;
    --accent: #36d6bd;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

/* Reset esencial */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.35s ease, color 0.35s ease;
}

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

/* Header translucido */
.header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--glass);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.75rem 2rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-title {
    font-size: clamp(1.35rem, 2.5vw, 1.8rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.toggle-button {
    border: none;
    background: transparent;
    padding: 0.6rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.75;
}

.toggle-button:hover {
    background: rgba(23, 111, 99, 0.08);
    transform: translateY(-1px);
    opacity: 1;
}

body.dark-mode .toggle-button:hover {
    background: rgba(54, 214, 189, 0.12);
}

.toggle-button img {
    width: 18px;
    height: 18px;
    filter: brightness(0);
}

body.dark-mode .toggle-button img {
    filter: brightness(2.5);
}

/* Buscador minimalista */
.search-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem 1.5rem;
}

.search-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 0.85rem 1.1rem;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: var(--text-soft);
}

.search-input:focus {
    border-color: rgba(23, 111, 99, 0.5);
    box-shadow: 0 0 0 4px rgba(23, 111, 99, 0.08);
}

body.dark-mode .search-input:focus {
    border-color: rgba(54, 214, 189, 0.6);
    box-shadow: 0 0 0 4px rgba(54, 214, 189, 0.15);
}

/* Contenido principal */
.main-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 3.5rem 2rem 4rem;
}

/* Grilla de herramientas */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
}

.tool-card {
    display: grid;
    place-items: center;
    gap: 0.9rem;
    padding: 1.85rem 1.25rem;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    border-radius: 18px;
    border: 1px solid transparent;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border 0.25s ease;
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: rgba(23, 111, 99, 0.2);
    box-shadow: 0 20px 40px rgba(17, 24, 39, 0.12);
}

.tool-card:active {
    transform: translateY(-2px);
}

.tool-icon {
    font-size: 2.1rem;
}

.tool-title {
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: -0.015em;
}

.doc-card {
    border-style: dashed;
}

/* Mensaje sin resultados */
.no-results {
    display: none;
    text-align: center;
    margin-top: 2.5rem;
    padding: 2.5rem 1rem;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 0.95rem;
}

/* Footer limpio */
.footer {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 2rem 3rem;
    border-top: 1px solid var(--border);
}

.contact-info {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.contact-link {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid transparent;
    opacity: 0.7;
    transition: transform 0.2s ease, border 0.2s ease, opacity 0.2s ease;
}

.contact-link:hover {
    transform: translateY(-2px);
    border-color: rgba(23, 111, 99, 0.25);
    opacity: 1;
}

.contact-link img {
    width: 21px;
    height: 21px;
    filter: brightness(0.1);
}

body.dark-mode .contact-link img {
    filter: brightness(2.6);
}

/* Responsivo */
@media (max-width: 768px) {
    .header-content {
        padding: 1.5rem 1.4rem 0.9rem;
    }

    .search-container {
        padding: 0 1.4rem 1.25rem;
    }

    .main-content {
        padding: 2.8rem 1.4rem 3.2rem;
    }
}

@media (max-width: 520px) {
    .header-content {
        padding: 1.3rem 1.1rem 0.8rem;
    }

    .main-title {
        font-size: 1.35rem;
    }

    .search-container {
        padding: 0 1.1rem 1rem;
    }

    .main-content {
        padding: 2.4rem 1.1rem 3rem;
    }

    .tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .tool-card {
        padding: 1.6rem 0.8rem;
        border-radius: 16px;
    }

    .tool-icon {
        font-size: 1.9rem;
    }

    .tool-title {
        font-size: 0.87rem;
    }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.tool-card:focus-visible,
.toggle-button:focus-visible,
.search-input:focus-visible,
.contact-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
