/* High-Fidelity Gwern.net Replica Stylings */

@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro&family=Source+Serif+4:ital,opsz,wght@0,8..60,400..700;1,8..60,400..700&display=swap');

:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --muted-color: #777777;
    --border-color: #dddddd;
    --link-underline: #bbbbbb;
    --accent-bg: #f5f5f5;
    --nav-bg: #f0f0f0;
    --font-serif: "Source Serif 4", "Apple Garamond", "Baskerville", serif;
    --font-mono: "Source Code Pro", "Consolas", monospace;
    --max-content-width: 935px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-serif);
    line-height: 1.6;
    font-size: 17px;
    padding: 2rem 1rem;
    hyphens: auto;
    overflow-x: hidden;
}

.container {
    max-width: var(--max-content-width);
    margin: 0 auto;
    position: relative;
    padding: 0 1rem;
}

/* Minimalist Top Navigation */
nav#top-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 3rem;
    font-size: 0.85rem;
}

nav#top-nav a {
    text-decoration: none;
    color: var(--text-color);
    background: var(--nav-bg);
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
}

nav#top-nav a:hover {
    background: #e5e5e5;
}

/* Header & Title */
header#main-header {
    text-align: center;
    margin-bottom: 4rem;
}

h1 {
    font-size: 2.8rem;
    font-weight: 300;
    font-variant: small-caps;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* Metadata Header Block */
.metadata-header {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.85rem;
    color: var(--muted-color);
    margin-bottom: 2rem;
    border-top: 1px dotted var(--border-color);
    border-bottom: 1px dotted var(--border-color);
    padding: 0.5rem 0;
}

.metadata-item span {
    color: var(--text-color);
    font-weight: 500;
}

/* Dashboard Grid Layout (Multi-column) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.dashboard-column h2 {
    font-size: 1.1rem;
    font-variant: small-caps;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    color: var(--accent-color);
}

.dashboard-column ul {
    list-style: none;
}

.dashboard-column li {
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.dashboard-column li a {
    text-decoration: underline dotted var(--link-underline);
    color: var(--text-color);
}

.dashboard-column li .date {
    font-size: 0.8rem;
    color: var(--muted-color);
    font-family: var(--font-mono);
    margin-right: 0.5rem;
}

/* Link Annotations & Icons */
a[href*="wikipedia.org"]::after {
    content: " ʷ";
    font-size: 0.7rem;
    color: #666;
    vertical-align: super;
}

a[href*="google.com"]::after {
    content: " ᵍ";
    font-size: 0.7rem;
    color: #666;
    vertical-align: super;
}

a[href$=".pdf"]::after {
    content: " 📄";
    font-size: 0.7rem;
    vertical-align: middle;
}

/* Sidenotes (Precise Tufte-style) */
.sidenote {
    float: right;
    clear: right;
    margin-right: -320px;
    width: 280px;
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
    line-height: 1.35;
    color: #444;
    position: relative;
    border-left: 1px solid #eee;
    padding-left: 10px;
}

.sidenote-number {
    vertical-align: super;
    font-size: 0.7rem;
    color: var(--muted-color);
    cursor: help;
}

/* Floating Sidebar (Right) */
#floating-sidebar {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    z-index: 1000;
}

.sidebar-icon {
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.sidebar-icon:hover {
    background: var(--accent-bg);
}

/* Code & Pre Blocks */
pre,
code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: #fafafa;
}

pre {
    padding: 1rem;
    border: 1px solid #efefef;
    border-radius: 3px;
    margin: 1.5rem 0;
    overflow-x: auto;
}

/* Mobile Adjustments */
@media (max-width: 1400px) {
    .sidenote {
        float: none;
        margin: 1rem 0;
        width: 100%;
        margin-right: 0;
        background: var(--accent-bg);
        border-left: 3px solid var(--border-color);
        padding: 0.8rem;
    }
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    #floating-sidebar {
        display: none;
    }
}