/* Shared by every Phasefield page: tokens, reset, header navigation, footer and common blocks. */
:root {
    --bg:        #0A0D13;
    --panel:     #121722;
    --panel-2:   #171D2A;
    --line:      #232A39;
    --text:      #E8EBF0;
    --soft:      #C3C9D4;
    --muted:     #8D95A5;
    --phase:     #5FD4C9;              /* accent: phase cyan */
    --phase-fog: rgba(95, 212, 201, 0.12);
    --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
    --sans:  "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    --mono:  "IBM Plex Mono", ui-monospace, Menlo, monospace;
    --wrap:  1120px;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }

body {
    background: var(--bg);
    color: var(--text);
    font: 16px/1.65 var(--sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
::selection { background: var(--phase); color: var(--bg); }
:focus-visible { outline: 2px solid var(--phase); outline-offset: 3px; border-radius: 3px; }

.container { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(10, 13, 19, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.site-header .container {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 38px; height: 38px; }
.brand span { font: 400 26px/1 var(--serif); letter-spacing: 0.01em; color: var(--text); }
.nav-links { display: flex; gap: 28px; }
.nav-links a {
    text-decoration: none; color: var(--soft);
    font: 500 14px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
    padding: 8px 0; border-bottom: 1px solid transparent;
    transition: color .2s, border-color .2s;
}
.nav-links a:hover { color: var(--text); border-color: var(--line); }
.nav-links a[aria-current="page"] { color: var(--phase); border-color: var(--phase); }
@media (max-width: 560px) {
    .brand span { font-size: 22px; }
    .nav-links { gap: 16px; }
    .nav-links a { font-size: 12px; }
}

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; text-wrap: balance; letter-spacing: 0.005em; }
h1 { font-size: clamp(40px, 6.4vw, 76px); line-height: 1.02; }
h2 { font-size: clamp(30px, 4vw, 44px); line-height: 1.1; }
h3 { font-size: 26px; line-height: 1.15; }
p { max-width: 68ch; color: var(--soft); }
.eyebrow { font: 500 12px/1.3 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--phase); }
.mono { font-family: var(--mono); }

/* ---------- Sections ---------- */
.section { padding-block: 88px; border-top: 1px solid var(--line); }
.section-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 40px; }
.page-head { padding-block: 72px 40px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Common blocks ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 26px; display: flex; flex-direction: column; gap: 12px;
}
.card p { font-size: 15px; }
.fig { font: 500 28px/1.1 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.fig small { font-size: 14px; color: var(--muted); font-weight: 400; }
.link-arrow { color: var(--phase); text-decoration: none; font: 500 14px/1 var(--mono); letter-spacing: 0.04em; }
.link-arrow:hover { text-decoration: underline; text-underline-offset: 4px; }
.btn {
    display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
    padding: 13px 20px; border-radius: 8px; font: 500 14px/1 var(--mono); letter-spacing: 0.04em;
    border: 1px solid var(--line); color: var(--text); background: var(--panel);
    transition: border-color .2s, background .2s;
}
.btn:hover { border-color: var(--phase); }
.btn.primary { background: var(--phase); color: #06231F; border-color: var(--phase); }
.btn.primary:hover { background: #7FE3D9; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 500 12px/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--panel); }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 40px 56px; color: var(--muted); font-size: 14px; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 16px 40px; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--soft); text-decoration: none; }
.site-footer a:hover { color: var(--phase); }
.site-footer nav { display: flex; gap: 22px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Articles (blog posts, research notes) ---------- */
.article { width: min(760px, 100% - 40px); margin-inline: auto; padding-block: 64px 96px; display: flex; flex-direction: column; gap: 22px; }
.article .meta { font: 13px/1.4 var(--mono); color: var(--muted); }
.article h1 { font-size: clamp(36px, 5.4vw, 58px); }
.article h2 { font-size: clamp(26px, 3.2vw, 34px); margin-top: 18px; }
.article p, .article li { font-size: 17.5px; line-height: 1.75; color: var(--soft); max-width: none; }
.article ul { display: flex; flex-direction: column; gap: 10px; padding-left: 20px; list-style: disc; }
.article strong { color: var(--text); font-weight: 600; }
.article figure { display: flex; flex-direction: column; gap: 10px; margin-block: 8px; }
.article figure img { border: 1px solid var(--line); border-radius: 10px; }
.article figcaption { font-size: 14px; color: var(--muted); }
.article .callout { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--phase); border-radius: 0 10px 10px 0; padding: 18px 22px; }
.article .callout p { font-size: 16px; }
.article a { color: var(--phase); text-underline-offset: 3px; }
.article code { font: 0.86em/1 var(--mono); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.article pre { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; overflow-x: auto; }
.article pre code { font-size: 14px; line-height: 1.6; background: none; border: 0; padding: 0; color: var(--soft); }
.article .math { font-family: var(--serif); font-size: 21px; color: var(--text); text-align: center; padding-block: 4px; }
.article figure svg { width: 100%; height: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.post-list { display: flex; flex-direction: column; gap: 16px; }
.post { display: grid; grid-template-columns: 140px 1fr; gap: 6px 28px; padding: 26px 0; border-top: 1px solid var(--line); text-decoration: none; }
.post:hover h3 { color: var(--phase); }
.post .date { font: 13px/1.6 var(--mono); color: var(--muted); }
.post h3 { transition: color .2s; }
.post p { font-size: 15.5px; grid-column: 2; }
@media (max-width: 640px) { .post { grid-template-columns: 1fr; } .post p { grid-column: 1; } }
