/* =====================================================================
 * PLRN — Pentad Labs Research Notes
 * Press-roman reading stylesheet. Rhymes with the WunderOS front page
 * (IBM Plex, vermillion, #F5F5F3, hairline rules) but recomposed for
 * long-form reading: one narrow column, airier leading, academic
 * section typography rather than the spec-sheet grid.
 * ===================================================================== */

:root {
    --bg: #F5F6F8;
    --ink: #16161D;
    --dim: #787B82;
    --rule: #D6D8DD;
    --vermillion: #E8471B;
    --code-bg: #EBEDF1;

    --font-body: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
    --font-label: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;

    --measure: 64rem;        /* reading column (~96 chars at 20px serif) */
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 20px;
    line-height: 1.66;       /* raised with the wider measure (~96 CPL) */
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* =========================================
 * MASTHEAD — slim letterpress band
 * ========================================= */

.plrn-masthead {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    max-width: var(--measure);
    margin: 0 auto;
    padding: 1.8rem 1.5rem 1.1rem 1.5rem;
    border-bottom: 1px solid var(--ink);
    font-family: var(--font-label);
    font-size: 0.86rem;      /* header block +20% */
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.plrn-mark { width: 22px; height: 22px; flex-shrink: 0; }

.plrn-home {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}
.plrn-home:hover { color: var(--vermillion); }

.plrn-id {
    margin-left: auto;
    color: var(--vermillion);
    font-weight: 600;
}
.plrn-id a { color: inherit; text-decoration: none; }
.plrn-id a:hover { text-decoration: underline; }

/* =========================================
 * ARTICLE COLUMN
 * ========================================= */

.plrn {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 2.75rem 1.5rem 4rem 1.5rem;
}

/* Title block (the leading # H1 and **byline**) */
.plrn > h1 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.95em;       /* em-based: relative to the 20px body */
    line-height: 1.12;
    letter-spacing: -0.015em;
    margin-bottom: 1rem;
}

/* The byline. Tagged explicitly with {: .plrn-byline} in each note so the
   rule never leaks onto an ordinary first paragraph (e.g. the catalog intro). */
.plrn .plrn-byline {
    font-family: var(--font-label);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dim);
    margin-bottom: 1.75rem;
}
.plrn .plrn-byline strong { font-weight: 500; color: var(--dim); }
.plrn .plrn-byline a { color: inherit; text-decoration-color: var(--rule); }

/* Horizontal rules become quiet section breaks */
.plrn hr {
    border: 0;
    height: 1px;
    background: var(--rule);
    margin: 2.5rem 0;
}

/* =========================================
 * SECTION HEADINGS
 * ========================================= */

.plrn h2 {
    font-family: var(--font-label);
    font-weight: 600;
    font-size: 1.32em;       /* 26px on 20px body */
    letter-spacing: -0.005em;
    margin: 2.75rem 0 1.1rem 0;
    padding-top: 0.9rem;
    border-top: 1px solid var(--rule);
}

/* No doubled rule where an author's --- precedes a heading
 * (e.g. the Abstract directly under the title block). */
.plrn hr + h2 {
    border-top: none;
    padding-top: 0;
    margin-top: 1.7rem;
}

.plrn h3 {
    font-family: var(--font-label);
    font-weight: 600;
    font-size: 1.12em;       /* 22px on 20px body */
    color: var(--ink);
    margin: 1.9rem 0 0.7rem 0;
}

.plrn h4 {
    font-family: var(--font-label);
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dim);
    margin: 1.5rem 0 0.5rem 0;
}

/* =========================================
 * PROSE
 * ========================================= */

.plrn p { margin-bottom: 1.15rem; }

.plrn a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-color: var(--rule);
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}
.plrn a:hover { text-decoration-color: var(--vermillion); }

.plrn strong { font-weight: 600; }
.plrn em { font-style: italic; }

.plrn ul, .plrn ol {
    margin: 0 0 1.15rem 1.4rem;
    padding: 0;
}
.plrn li { margin-bottom: 0.4rem; }
.plrn ul { list-style: none; }
.plrn ul > li { position: relative; }
.plrn ul > li::before {
    content: "\2013";
    position: absolute;
    left: -1.2em;
    color: var(--vermillion);
}

/* =========================================
 * CALLOUT — blockquote rhymes with front page
 * ========================================= */

.plrn blockquote {
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    padding: 1.25rem 0;
    margin: 2rem 0;
    font-weight: 600;
    line-height: 1.45;
}
.plrn blockquote p:last-child { margin-bottom: 0; }

/* =========================================
 * CODE
 * ========================================= */

.plrn code {
    font-family: var(--font-mono);
    font-size: 0.84em;
    background: rgba(22, 22, 29, 0.06);
    padding: 0.1em 0.35em;
    letter-spacing: -0.02em;
}

/* Fenced code blocks (language-tagged): a light frame for legibility,
   no orange accent. */
.plrn pre {
    background: var(--code-bg);
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: 1.1rem 1.25rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    font-size: 1rem;
    line-height: 1.5;
}

/* Plain indented blocks (no language) — the existing notes use these for
   display math. Academic treatment: a left indent only, no frame, no fill. */
.plrn pre:not(:has(code[class*="language-"])) {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 1.5rem 0 1.5rem 2rem;
    font-size: 1.1rem;
}
.plrn pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: var(--ink);
}

/* highlight.js — muted press-roman theme. Restrained on purpose:
 * keyword in vermillion, comment dim-italic, string/number in quiet
 * green/blue, everything else ink. Code reads as document, not screenshot. */
.plrn .hljs { color: var(--ink); background: transparent; }
.plrn .hljs-comment,
.plrn .hljs-quote { color: var(--dim); font-style: italic; }
.plrn .hljs-keyword,
.plrn .hljs-selector-tag,
.plrn .hljs-literal,
.plrn .hljs-section,
.plrn .hljs-doctag { color: var(--vermillion); }
.plrn .hljs-string,
.plrn .hljs-regexp,
.plrn .hljs-symbol,
.plrn .hljs-char { color: #3F6E3A; }
.plrn .hljs-number,
.plrn .hljs-bullet { color: #2B5F9E; }
.plrn .hljs-title,
.plrn .hljs-name,
.plrn .hljs-type,
.plrn .hljs-built_in,
.plrn .hljs-class .hljs-title,
.plrn .hljs-function .hljs-title { color: var(--ink); font-weight: 600; }
.plrn .hljs-attr,
.plrn .hljs-attribute { color: var(--ink); }
.plrn .hljs-variable,
.plrn .hljs-template-variable,
.plrn .hljs-params { color: #2B5F9E; }
.plrn .hljs-operator,
.plrn .hljs-punctuation { color: var(--vermillion); }
.plrn .hljs-meta { color: var(--dim); }
.plrn .hljs-emphasis { font-style: italic; }
.plrn .hljs-strong { font-weight: 700; }

/* =========================================
 * TABLES
 * ========================================= */

.plrn table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.86rem;
}
.plrn thead th {
    font-family: var(--font-label);
    text-align: left;
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dim);
    padding: 0.45rem 0.7rem 0.45rem 0;
    border-bottom: 2px solid var(--ink);
}
.plrn td {
    padding: 0.5rem 0.7rem 0.5rem 0;
    vertical-align: top;
    border-bottom: 1px solid var(--rule);
}
.plrn tbody tr:last-child td { border-bottom: 2px solid var(--vermillion); }
.plrn td:first-child {
    font-family: var(--font-label);
    font-weight: 600;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* =========================================
 * MATH — KaTeX, rendered client-side
 * ========================================= */

.plrn .katex { font-size: 1.21em; }   /* KaTeX native ratio */

.plrn .katex-display {
    margin: 1.5rem 0 1.5rem 2rem;   /* academic inset: a left indent, no rule, no fill */
    overflow-x: auto;
    overflow-y: hidden;
    text-align: left;               /* override KaTeX's centered display */
}
.plrn .katex-display > .katex { text-align: left; }

/* =========================================
 * FOOTER
 * ========================================= */

.plrn-foot {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 1.25rem 1.5rem 3rem 1.5rem;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    font-family: var(--font-label);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--dim);
}
.plrn-foot a { color: var(--dim); text-decoration: none; }
.plrn-foot a:hover { color: var(--vermillion); }

/* =========================================
 * CATALOG — the /PLRN/ index list
 * ========================================= */

.plrn-list {
    list-style: none;
    margin: 2.25rem 0 0 0;
    padding: 0;
}

.plrn-list li {
    display: flex;
    align-items: baseline;
    gap: 1.25rem;
    padding: 0.45rem 0;
}

.plrn a.plrn-list-link {
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 1rem;
    text-decoration: none;
    color: var(--ink);
}

.plrn-list-num {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--vermillion);
    white-space: nowrap;
}

.plrn-list-title {
    font-family: var(--font-body);
    font-size: 1.25rem;
    line-height: 1.3;
}
.plrn-list-link:hover .plrn-list-title { color: var(--vermillion); }

.plrn-list-date {
    font-family: var(--font-label);
    font-size: 0.78rem;
    color: var(--dim);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 640px) {
    .plrn-list li { flex-direction: column; gap: 0.35rem; }
    .plrn-list-date { order: -1; }
}

/* =========================================
 * RESPONSIVE
 * ========================================= */

@media (max-width: 640px) {
    body { font-size: 18px; line-height: 1.55; }
    .plrn > h1 { font-size: 1.7rem; }
    .plrn { padding: 2rem 1.15rem 3rem 1.15rem; }
}

/* =========================================
 * PRINT
 * ========================================= */

@media print {
    body { background: #fff; color: #000; }
    .plrn-masthead, .plrn-foot { color: #000; }
    .plrn pre { background: #f0f0f0; }
    .plrn a { text-decoration: none; color: #000; }
}

/* ---- Global nav (shared _includes/nav.html) — matches wos.css ---- */
.site-nav {
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 0 0 clamp(1.75rem, 4vh, 3rem) 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    font-size: 19.25px;   /* match wos.css base so em-sized nav text aligns */
}
.site-nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.7rem clamp(1.25rem, 3.5vw, 3rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.site-nav .brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--ink);
    font-family: var(--font-label);
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: -0.01em;
}
.site-nav .brand svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}
.nav-sep {
    color: var(--rule);
    font-size: 0.85em;
    user-select: none;
    line-height: 1;
}
.nav-links a {
    color: var(--dim);
    text-decoration: none;
    padding-bottom: 3px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.14s, border-color 0.14s;
}
.nav-links a:hover { color: var(--vermillion); }
.nav-links a.active { color: var(--ink); border-bottom-color: var(--vermillion); }

/* ---- Shared global footer (DRY: _includes/footer.html) ----------- */
.site-foot {
    max-width: var(--measure);
    margin: clamp(3rem, 6vh, 5rem) auto 0 auto;
    padding: 1.2rem 1.5rem 3rem 1.5rem;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dim);
}
.site-foot a { color: var(--dim); text-decoration: none; }
.site-foot a:hover { color: var(--vermillion); }
