/* =========================================================
   Base
   ========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    color: #222;
    background: #fff;
}

/* =========================================================
   Fuente Portada
   ========================================================= */
@font-face {
    font-family: "Nasalization";
    src: url("/mat/assets/fonts/nasalization.ttf") format("truetype");
    font-display: swap;
}

/* =========================================================
   Topbar
   ========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;

    height: 60px;

    display: flex;
    align-items: center;
    gap: 18px;

    padding: 0 20px;

    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
}

.topbar a {
    color: #222;
    text-decoration: none;
    font-weight: 600;
}

.topbar-title {
    color: #222;
    text-decoration: none;
    font-weight: 600;
}

.topbar-brand {
    margin-left: auto;

    color: #666;
    font-size: 0.85rem;
    white-space: nowrap;
}

.topbar-brand span {
    font-family: "Nasalization", sans-serif;

    color: #0088cc;
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: lowercase;

    text-shadow:
        0 0 4px rgba(0, 136, 204, 0.45),
        0 0 10px rgba(0, 136, 204, 0.25);
}

.topbar-brand::before {
    content: "";
    display: inline-block;

    width: 8px;
    height: 8px;
    margin-right: 10px;

    background: #0088cc;
    border-radius: 50%;

    box-shadow:
        0 0 4px rgba(0, 136, 204, 0.7),
        0 0 10px rgba(0, 136, 204, 0.35);
}

.menu-toggle {
    display: none;

    margin-left: auto;

    background: none;
    border: none;

    color: #222;
    font-size: 1.8rem;
    line-height: 1;

    cursor: pointer;
}


/* =========================================================
   Layout
   ========================================================= */

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - 60px);
}

.sidebar {
    position: sticky;
    top: 60px;

    height: calc(100vh - 60px);
    overflow-y: auto;

    padding: 24px 18px;

    background: #f5f7fa;
    border-right: 1px solid #e1e5ea;
}

.content {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 48px 28px;
}


/* =========================================================
   Sidebar navigation
   ========================================================= */

.book-nav h2 {
    margin: 24px 0 8px;

    color: #555;
    font-size: 0.85rem;
}

.book-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.book-nav li {
    margin: 2px 0;
}

.nav-link {
    display: block;

    padding: 7px 10px;

    color: #333;
    text-decoration: none;

    border-left: 3px solid transparent;
    border-radius: 4px;
}

.nav-link:hover {
    background: #eaf0f8;
}

.nav-link.active {
    color: #1e5cb3;
    font-weight: 600;

    background: #eef4ff;
    border-left-color: #1e5cb3;
}


/* =========================================================
   Topic header and content
   ========================================================= */

.topic-header {
    margin-bottom: 24px;
}

.topic-block {
    margin: 0 0 10px;

    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.topic-header h1 {
    margin: 0;

    font-size: 3rem;
    line-height: 1.1;
}

.content h2 {
    margin-top: 2.4rem;
    margin-bottom: 0.8rem;

    font-size: 1.8rem;
    line-height: 1.25;
}

.content h3 {
    margin-top: 1.8rem;
    margin-bottom: 0.6rem;

    font-size: 1.25rem;
    line-height: 1.3;
}

.content p,
.content li {
    line-height: 1.65;
}

.content a {
    color: #1e5cb3;
}


/* =========================================================
   Topic table of contents
   ========================================================= */

.topic-toc {
    margin: 32px 0 40px;
    padding: 22px 26px;

    background: #f5f7fa;
    border: 1px solid #e1e5ea;
    border-radius: 10px;
}

.topic-toc h2 {
    margin: 0 0 14px;

    font-size: 1.15rem;
}

.topic-toc ul {
    margin: 0;
    padding-left: 1.2rem;
}

.topic-toc li {
    margin: 6px 0;
}

.topic-toc a {
    color: #1e5cb3;
    text-decoration: none;
}

.topic-toc a:hover {
    text-decoration: underline;
}


/* =========================================================
   Previous / next navigation
   ========================================================= */

.prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;

    margin-top: 56px;
    padding-top: 28px;

    border-top: 1px solid #e1e5ea;
}

.prev-next a {
    display: block;

    padding: 18px 20px;

    color: #222;
    text-decoration: none;

    background: #f5f7fa;
    border: 1px solid #e1e5ea;
    border-radius: 10px;
}

.prev-next a:hover {
    background: #eef4ff;
    border-color: #1e5cb3;
}

.prev-next span {
    display: block;

    margin-bottom: 6px;

    color: #666;
    font-size: 0.85rem;
}

.prev-next strong {
    color: #1e5cb3;
    font-size: 1rem;
}

.next-link {
    text-align: right;
}


/* =========================================================
   Figures and tables
   ========================================================= */

figure {
    margin: 32px auto;
    text-align: center;
}

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

figcaption {
    margin-top: 8px;

    color: #666;
    font-size: 0.9rem;
}

.content table {
    width: 100%;
    margin: 28px 0;

    border-collapse: collapse;
    font-size: 0.98rem;
}

.content th,
.content td {
    padding: 12px 14px;

    text-align: left;
    border: 1px solid #d8dee8;
}

.content th {
    color: #222;
    font-weight: 600;

    background: #f5f7fa;
}

.content tr:nth-child(even) td {
    background: #fafbfc;
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .menu-toggle {
        display: block;
    }

    .sidebar {
        display: none;

        position: static;

        height: auto;

        border-right: none;
        border-bottom: 1px solid #e1e5ea;
    }

    .sidebar.open {
        display: block;
    }

    .content {
        padding: 32px 20px;
    }

    .topic-header h1 {
        font-size: 2.2rem;
    }

    .prev-next {
        grid-template-columns: 1fr;
    }

    .next-link {
        text-align: left;
    }
}


/* =========================================================
   Home page
   ========================================================= */

.home {
    font-family: "Nasalization", sans-serif;

    margin: 0;

    color: #ffffff;
    background: #050b14;
}

.home-hero {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 40px 24px;

    background:
        radial-gradient(circle at 20% 20%, rgba(0, 212, 255, 0.18), transparent 28%),
        radial-gradient(circle at 80% 30%, rgba(79, 124, 255, 0.16), transparent 30%),
        linear-gradient(135deg, #050b14, #08111f);
}

.home-hero-content {
    max-width: 900px;
    text-align: center;
}

.home-kicker {
    color: #00d4ff;

    font-size: 0.8rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

.home-hero h1 {
    margin: 24px 0;

    font-size: clamp(3rem, 8vw, 6.5rem);
    line-height: 0.95;
    text-transform: uppercase;
}

.home-hero h1 span {
    display: block;

    margin-top: 18px;

    color: #b8c6d8;

    font-size: 0.28em;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: none;
}

.home-subtitle {
    color: #b8c6d8;
    font-size: 1.1rem;
}

.home-button {
    display: inline-block;

    margin-top: 36px;
    padding: 14px 30px;

    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.12em;

    background: rgba(0, 212, 255, 0.08);
    border: 1px solid #00d4ff;
    border-radius: 999px;
}

.home-button:hover {
    background: rgba(0, 212, 255, 0.18);
}

.home-blocks {
    padding: 70px 24px;

    color: #222;
    background: #ffffff;
}

.home-blocks h2 {
    max-width: 1100px;
    margin: 0 auto 28px;
}

.home-block-grid {
    max-width: 1100px;
    margin: 0 auto;

    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.home-block-card {
    display: block;

    padding: 24px;

    color: #222;
    text-decoration: none;

    background: #f5f7fa;
    border: 1px solid #e1e5ea;
    border-radius: 14px;
}

.home-block-card:hover {
    background: #eef4ff;
    border-color: #1e5cb3;
}

.home-block-card span {
    display: block;

    margin-bottom: 10px;

    font-weight: 600;
}

.home-block-card strong {
    color: #1e5cb3;
    font-size: 0.9rem;
}

.center {
    text-align: center;
    white-space: pre-line;
}

.example {
    margin: 24px 0;
    padding: 20px 24px;

    background: #f5f7fa;
    border: 1px solid #d8dee8;
    border-radius: 10px;
}

.xlop {
    text-align: center;
    margin: 1.5rem 0;
}

.xlop img {
    width: auto;
    height: auto;
    max-width: 100%;
    transform: scale(1.45);
    transform-origin: center;
    margin: 1.2rem 0;
    vertical-align: middle;
}
