@import "colors.css";

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--polar1);
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--snow1);
    line-height: 1.7;
    font-size: 1rem;
}

/* ── Topbar ── */

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--polar2);
    border-bottom: 1px solid var(--polar3);
}

.topbar-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.topbar-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--snow3);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.topbar-name:hover {
    color: var(--lightblue);
}

.topbar-back {
    font-size: 0.8rem;
    color: var(--snow1);
    opacity: 0.4;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: opacity 0.15s;
}

.topbar-back:hover { opacity: 0.8; }

.topbar-home {
    display: flex;
    align-items: center;
    color: var(--snow1);
    opacity: 0.45;
    transition: opacity 0.15s, color 0.15s;
}

.topbar-home:hover {
    opacity: 1;
    color: var(--lightblue);
}

.topbar-home svg {
    width: 1rem;
    height: 1rem;
}

/* ── Footer ── */

footer {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.75rem 2rem;
    border-top: 1px solid var(--polar3);
    font-size: 0.8rem;
    color: var(--snow1);
    opacity: 0.35;
}

/* ── Index page ── */

.index-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--snow1);
    opacity: 0.45;
    margin-bottom: 1.75rem;
}

.note-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.note-item {
    border-bottom: 1px solid var(--polar3);
}

.note-item:first-child {
    border-top: 1px solid var(--polar3);
}

.note-item a {
    display: block;
    padding: 1rem 0;
    color: var(--snow3);
    text-decoration: none;
    font-size: 0.975rem;
    font-weight: 400;
    transition: color 0.15s, padding-left 0.15s;
}

.note-item a:hover {
    color: var(--lightblue);
    padding-left: 0.5rem;
}

/* ── Article page ── */

article {
    max-width: 720px;
    margin: 0 auto;
    padding: 3.5rem 2rem 6rem;
}

article h1 {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--snow3);
    line-height: 1.15;
    margin-bottom: 2.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--polar3);
}

article h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--snow3);
    margin-top: 2.75rem;
    margin-bottom: 0.75rem;
}

article h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--snow2);
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

article h4, article h5, article h6 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--snow1);
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
}

article p {
    margin-bottom: 1.25rem;
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.85;
}

article a {
    color: var(--lightblue);
    text-decoration: none;
}

article a:hover {
    text-decoration: underline;
}

article ul, article ol {
    padding-left: 1.6rem;
    margin-bottom: 1.25rem;
}

article li {
    margin-bottom: 0.35rem;
    font-weight: 300;
    line-height: 1.75;
}

article blockquote {
    border-left: 3px solid var(--polar4);
    padding: 0.1rem 0 0.1rem 1.25rem;
    margin: 1.5rem 0;
    color: var(--snow1);
    opacity: 0.75;
}

article code {
    font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
    font-size: 0.85em;
    background-color: var(--polar2);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--turquoise);
}

article pre {
    background-color: var(--polar2);
    border: 1px solid var(--polar3);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 0 0 1.5rem;
}

article pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: var(--snow1);
    font-size: 0.875rem;
}

article hr {
    border: none;
    border-top: 1px solid var(--polar3);
    margin: 2.5rem 0;
}

article table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

article th {
    text-align: left;
    padding: 0.6rem 1rem;
    border-bottom: 2px solid var(--polar3);
    color: var(--snow3);
    font-weight: 600;
}

article td {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--polar3);
}

article .footnotes {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--polar3);
    font-size: 0.875rem;
    opacity: 0.7;
}

/* ── Mobile ── */

@media (max-width: 640px) {
    .topbar-inner {
        padding: 0 1.25rem;
    }

    .index-main {
        padding: 2.5rem 1.25rem 4rem;
    }

    article {
        padding: 2.5rem 1.25rem 4rem;
    }

    article h1 {
        font-size: 1.9rem;
    }

    footer {
        padding: 1.75rem 1.25rem;
    }
}
