@font-face {
    font-family: "Exo 2";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("../fonts/exo2-latin.woff2") format("woff2");
}

:root {
    --bg: #f4f7fb;
    --bg-glow: #ffffff;
    --text: #1d2533;
    --muted: #5f6b7d;
    --rule: #dbe2ec;
    --accent: #0a5bd3;
    --surface: #ffffff;
    --spark-glow: rgba(10, 91, 211, 0.16);
    --spark-glow-2: rgba(56, 189, 248, 0.14);
    --logo-shadow: drop-shadow(0 12px 24px rgba(10, 40, 90, 0.18));
    --heading-font: "Exo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a1020;
        --bg-glow: #15233f;
        --text: #e4e9f2;
        --muted: #97a3b6;
        --rule: #26324a;
        --accent: #6ea8ff;
        --surface: #121b2e;
        --spark-glow: rgba(64, 140, 255, 0.28);
        --spark-glow-2: rgba(56, 189, 248, 0.18);
        --logo-shadow: drop-shadow(0 0 28px rgba(120, 170, 255, 0.35));
        color-scheme: dark;
    }
}

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

html, body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(ellipse at 50% 40%, var(--bg-glow) 0%, var(--bg) 70%);
    background-attachment: fixed;
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
}

a { color: var(--accent); }

/* Home: logo only, centred */
.hero {
    position: relative;
    flex: 1;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    overflow: hidden;
    isolation: isolate;
}

/* Slowly drifting glow behind the logo */
.hero::before {
    content: "";
    position: absolute;
    inset: -20%;
    z-index: -1;
    background:
        radial-gradient(circle at 40% 45%, var(--spark-glow) 0%, transparent 35%),
        radial-gradient(circle at 62% 55%, var(--spark-glow-2) 0%, transparent 30%);
    animation: drift 18s ease-in-out infinite alternate;
}

.hero h1 {
    position: relative;
    margin: 0;
    animation: rise-in 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.hero img {
    display: block;
    width: min(300px, 31vw);
    height: auto;
    filter: var(--logo-shadow);
}

/* Twinkle over the star in the logo (top right of the image) */
.hero h1::after {
    content: "";
    position: absolute;
    left: 83.5%;
    top: 21%;
    width: 22%;
    aspect-ratio: 1;
    translate: -50% -50%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(140, 200, 255, 0.55) 22%, transparent 60%);
    mix-blend-mode: screen;
    pointer-events: none;
    opacity: 0;
    animation: twinkle 4s ease-in-out 1.2s infinite;
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
@keyframes drift {
    from { transform: translate(-4%, -3%) rotate(0deg); }
    to   { transform: translate(4%, 3%) rotate(8deg); }
}
@keyframes twinkle {
    0%, 70%, 100% { opacity: 0; transform: scale(0.6); }
    80%           { opacity: 1; transform: scale(1.1); }
    88%           { opacity: 0.4; transform: scale(0.9); }
}

@media (prefers-reduced-motion: reduce) {
    .hero::before, .hero h1, .hero h1::after { animation: none; }
}

/* Document pages */
.doc-page {
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 16px 56px;
}
.doc-page h1, .doc-page h2, .doc-page h3 { font-family: var(--heading-font); letter-spacing: -0.01em; }
.doc-page h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.25rem; }
.doc-page h2 {
    font-size: 1.35rem;
    margin: 2.5rem 0 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    scroll-margin-top: 16px;
}
.doc-page h3 { font-size: 1.05rem; margin: 1.5rem 0 0.4rem; }
.doc-page p, .doc-page li { font-size: 1rem; }
.meta { color: var(--muted); margin-top: 0; }
.back { font-size: 0.9rem; margin: 0 0 1.5rem; }
.back a { text-decoration: none; }

.summary {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 4px solid var(--accent);
    border-radius: 6px;
    padding: 14px 16px;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 0.95rem;
}

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td {
    text-align: left;
    vertical-align: top;
    padding: 8px 10px;
    border-bottom: 1px solid var(--rule);
}
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
td:first-child { white-space: nowrap; font-weight: 500; }
@media (max-width: 560px) {
    td:first-child { white-space: normal; }
}

/* Footer */
.site-footer {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 18px 16px 24px;
    font-size: 0.85rem;
    color: var(--muted);
}
.site-footer a { color: var(--muted); }
