/* Shared tokens, base type, header, and glass panels for every page. */
:root {
    /* One dark theme: the glass reads best over the dark cell background */
    color-scheme: dark;
    --text: #e6eef1;
    --text-2: #9fb1ba;
    --accent: #8cc3d6;
    --glass: rgba(10, 22, 26, 0.62);
    --glass-strong: rgba(14, 26, 33, 0.88);
    --rule: rgba(255, 255, 255, 0.09);
    --hover: rgba(255, 255, 255, 0.06);
    --page-bg: #0c1a21;

    --serif: 'Source Serif 4', Georgia, serif;
    --sans: 'Schibsted Grotesk', system-ui, sans-serif;

    --page-width: 960px;
    --gutter: 20px;
    --radius: 22px;
    --radius-inner: 12px;

    /* Kept in sync with the cell colors in assets/js/site.js */
    --cell-deep: #008c8c;
    --cell-pale: #f2e735;
}
@media (max-width: 600px) {
    :root { --gutter: 12px; }
}

html { background-color: var(--page-bg); }
body {
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
}
/* Background sits at layer 0 with the page above it at layer 1. A negative z-index would put it
   under the body, and extensions such as Dark Reader paint the body a solid color that hides it. */
#vanta-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    /* Shown when the animation is off (reduced motion) or fails to load */
    background: radial-gradient(circle at 30% 20%, var(--cell-pale), var(--cell-deep) 75%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Glass panel after Apple's Liquid Glass: strong blur and color boost,
   a bright top edge (the specular line), and a rim that catches light at the top left. */
.glass {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)), var(--glass);
    backdrop-filter: blur(22px) saturate(170%);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    border-radius: var(--radius);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04),
        0 12px 32px rgba(0, 0, 0, 0.35);
}
.glass::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.06) 35%, rgba(255, 255, 255, 0.03) 65%, rgba(255, 255, 255, 0.14));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
@media (prefers-reduced-transparency: reduce) {
    .glass { background: var(--glass-strong); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Header and page body share one width so their edges line up */
.site-header,
.container {
    position: relative;
    z-index: 1;
    width: min(var(--page-width), 100% - 2 * var(--gutter));
    margin-inline: auto;
    box-sizing: border-box;
}
.site-header {
    margin-block: var(--gutter);
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    flex-wrap: wrap;
}
.site-name {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.15;
    margin: 0;
}
.site-name a { color: var(--text); text-decoration: none; }
.site-role { color: var(--text-2); font-size: 0.875rem; margin-top: 2px; }

.main-nav { display: flex; gap: 2px; margin-left: -12px; }
.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-2);
    padding: 6px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--hover); text-decoration: none; }
/* Current page: a small glass pill, like Apple's tab bars */
.nav-link.active {
    color: var(--text);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 4px rgba(0, 0, 0, 0.25);
}

@media (max-width: 600px) {
    /* Phones: header content stacks and centers */
    .site-header { padding: 14px 16px 12px; flex-direction: column; text-align: center; gap: 10px; }
    .site-name { font-size: 1.4rem; }
    .main-nav { margin-left: 0; justify-content: center; }
    .nav-link { font-size: 0.875rem; }
}

.section { padding: 20px 24px 24px; margin-bottom: var(--gutter); }
.section h2 {
    font-family: var(--serif);
    font-size: 1.375rem;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 12px;
}
.section h1 {
    font-family: var(--serif);
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 8px;
}
.section p { margin: 0 0 12px; }
.section p:last-child { margin-bottom: 0; }
.section-intro { color: var(--text-2); font-size: 0.9rem; }
@media (max-width: 600px) {
    .section { padding: 16px 16px 20px; }
}
