/* Aspas Labs — medieval / illuminated-manuscript theme */

@font-face {
  font-family: "Dotted Pixel";
  src: url("assets/DottedPixel(1).ttf") format("truetype");
  font-display: block;
}

:root {
  --paper: #f9f8f6;
  --ink: #111;
  --ink-2: #4a4a4a;
  --oxblood: #f86917;
  --accent: #f86917;
  --font: "Jost", sans-serif;
  --pixel-font: "Jersey 10", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font);
  font-size: 21px; line-height: 1.2;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-ligatures: common-ligatures;
  font-feature-settings: "onum";
  overflow-x: hidden;
}
::selection { background: var(--oxblood); color: var(--paper); }

.skip {
  position: absolute; top: -80px; left: 16px; z-index: 30;
  background: var(--paper); color: var(--ink); padding: 8px 12px;
}
.skip:focus-visible { top: 12px; outline: 1px solid var(--ink); outline-offset: 3px; }

/* ---------- paper sheet ---------- */
.paper {
  position: relative; z-index: 1;
  background: var(--paper);
  padding: clamp(48px, 8vh, 96px) clamp(10px, 6vw, 96px) 96px;
}
.js .paper { opacity: 0; animation: paper-in .6s ease-out .05s forwards; }
@keyframes paper-in { to { opacity: 1; } }

.inner {
  display: flex; justify-content: center;
  gap: 64px;
}

/* ---------- sidebar ---------- */
.sidebar {
  flex: 0 0 180px;
  position: sticky; top: 40px;
  align-self: flex-start;
}
.s-brand {
  display: block;
  width: 26px; height: 24px;
  position: relative;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 2em;
  transition: width .45s cubic-bezier(.22, .61, .36, 1);
}
.s-brand-stage {
  display: block;
  width: 26px; height: 24px;
  position: relative;
  transition: width .45s cubic-bezier(.22, .61, .36, 1);
}
.s-brand-pair {
  position: absolute;
  top: 0;
  display: flex;
  gap: 2px;
  width: 26px; height: 24px;
  transition: opacity .25s ease, transform .45s cubic-bezier(.22, .61, .36, 1);
}
.s-brand-glyph {
  display: block;
  position: relative;
  flex: 0 0 12px;
  width: 12px; height: 24px;
  overflow: hidden;
}
.s-brand-glyph img {
  position: absolute;
  top: 0;
  width: 32px; height: 24px;
  max-width: none;
}
.s-brand-glyph--left img { left: 0; }
.s-brand-glyph--right img { left: -20px; }
.s-brand-pair--left { left: 0; }
.s-brand-pair--right {
  right: 0;
  opacity: 0;
  transform: translateX(-8px) scaleX(-1);
}
.s-brand-word {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-family: "Jersey 10", var(--pixel-font);
  font-weight: 400;
  font-size: 28px;
  line-height: 1;
  opacity: 0;
  transition: opacity .25s ease;
}
.home-page h2,
.home-page .foot-col h3 {
  font-family: "Dotted Pixel", sans-serif;
}
.home-page .s-brand-word { font-family: "Jersey 10", var(--pixel-font); }
.s-brand:hover, .s-brand:focus-visible,
.s-brand:hover .s-brand-stage, .s-brand:focus-visible .s-brand-stage { width: 148px; }
.s-brand:hover .s-brand-pair--right,
.s-brand:focus-visible .s-brand-pair--right {
  opacity: 1;
  transform: translateX(0) scaleX(-1);
}
.s-brand:hover .s-brand-word,
.s-brand:focus-visible .s-brand-word {
  opacity: 1;
  transition-delay: .18s;
}
.s-nav { display: flex; flex-direction: column; gap: .35em; }
.s-nav a {
  font-family: var(--font);
  font-size: 19px; color: var(--ink);
  text-decoration: none;
}
.s-nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.s-nav a.active { font-style: italic; }

.langs { display: flex; gap: 10px; margin-top: 2em; }
.langs button {
  background: none; border: 0; padding: 0 0 3px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.langs button svg { display: block; width: 18px; height: 18px; opacity: .45; }
.langs button[aria-pressed="true"] { border-bottom-color: var(--ink); }
.langs button[aria-pressed="true"] svg { opacity: 1; }
.langs button:focus-visible,
.s-nav a:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.msheet .langs button { min-width: 44px; min-height: 44px; display: grid; place-items: center; }

/* ---------- text column ---------- */
.column { flex: 0 1 auto; max-width: 30em; min-width: 0; }

p {
  margin: 0 0 .8em;
  text-align: justify;
  hyphens: auto;
  text-wrap: pretty;
}

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

.section { margin-bottom: 4.5em; }
.section:last-of-type { margin-bottom: 3em; }
h2 {
  font-family: var(--pixel-font);
  font-size: 28px; font-weight: 400;
  color: var(--accent);
  letter-spacing: 0;
  margin: 0 0 .6em;
}
/* hero lede */
.hero-art {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 1.4em;
}
.lede { text-align: justify; hyphens: auto; max-width: none; }
.lede h1 { display: inline; font: inherit; font-family: var(--font); font-weight: 400; margin: 0; }

.lede + .linklist { margin-top: 3em; }

.linklist { list-style: none; margin: 0; padding: 0; }
.linklist li { margin-bottom: .3em; }
.linklist a { font-size: 21px; }

/* ---------- footer ---------- */
.footer { margin-top: 5em; }
.foot-cols { display: flex; gap: 3em; flex-wrap: wrap; margin-bottom: 2em; }
.foot-col { display: flex; flex-direction: column; }
.foot-col h3 {
  font-family: var(--pixel-font);
  font-variant: small-caps; letter-spacing: .06em;
  font-size: 17px; font-weight: 400; margin: 0 0 .4em;
}
.foot-col a, .foot-col span { font-size: 17px; color: var(--ink-2); text-decoration: none; }
.foot-col a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.social-links { display: flex; align-items: center; gap: .9em; margin-top: .3em; }
.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  font-size: 20px;
  color: var(--ink-2);
  text-decoration: none;
}
.social-links a:hover { color: var(--accent); }
.social-links svg { display: block; width: 100%; height: 100%; }
.foot-bottom {
  border-top: 1px solid var(--ink);
  padding-top: .8em;
  font-size: 17px;
}
.foot-bottom p { margin: 0 0 .2em; text-align: left; }

/* ---------- mobile ---------- */
.fab {
  display: none;
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--ink);
  cursor: pointer;
  align-items: center; justify-content: center; flex-direction: column; gap: 5px;
}
.fab span { display: block; width: 18px; height: 1px; background: var(--ink); transition: transform .3s, opacity .3s; }
.fab[aria-expanded="true"] span:first-child { transform: translateY(3px) rotate(45deg); }
.fab[aria-expanded="true"] span:last-child { transform: translateY(-3px) rotate(-45deg); }

.msheet-backdrop {
  position: fixed; inset: 0; z-index: 49;
  background: rgba(0,0,0,.35);
}
.msheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--paper);
  border-radius: 12px 12px 0 0;
  border-top: 1px solid var(--ink);
  padding: 20px 28px 36px;
  transform: translateY(100%);
  transition: transform .4s ease;
}
.msheet.open { transform: translateY(0); }
.msheet-grab {
  width: 40px; height: 3px; background: var(--ink); opacity: .3;
  border-radius: 2px; margin: 0 auto 18px;
}
.msheet .s-nav a { font-size: 24px; }
.msheet .langs { margin-top: 1.5em; }

@media (max-width: 899px) {
  .paper { padding-top: 24px; }
  .sidebar { display: none; }
  .inner { display: block; }
  .fab { display: inline-flex; }
  body { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .paper { opacity: 1; animation: none; }
  .msheet { transition: none; }
  .fab span { transition: none; }
  .s-brand, .s-brand-stage, .s-brand-pair, .s-brand-word { transition: none; }
}

/* ---------- research note ---------- */
.note-page {
  background: var(--paper);
  color: var(--ink);
  color-scheme: light;
  --note-accent: #7e2f2b;
}
.note-shell {
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 84px;
}
.note-page .paper { padding: 48px clamp(16px, 4vw, 64px) 84px; }
.note-page .inner { max-width: 1244px; margin: 0 auto; gap: clamp(32px, 4vw, 64px); }
.note-page .note-shell { flex: 1; min-width: 0; width: 100%; max-width: 900px; margin: 0; padding: 0; container-type: inline-size; }
.note-header {
  width: min(900px, 100%);
  margin: 0 auto 72px;
}
.note-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  min-height: 34px;
  margin-bottom: 56px;
}
.note-back {
  display: inline-block;
  color: var(--note-accent);
  font-family: var(--pixel-font);
  font-size: 24px;
  text-decoration: none;
  margin-bottom: 56px;
}
.note-back:hover { text-decoration: underline; text-underline-offset: 5px; }
.note-meta {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 16px;
  letter-spacing: .03em;
  text-align: left;
}
.note-page .note-meta,
.note-page .note-deck,
.note-page .note-footer {
  color: var(--ink-2);
}
.note-header h1 {
  max-width: 820px;
  margin: 0;
  font-family: "Dotted Pixel", var(--pixel-font);
  font-size: clamp(48px, 8vw, 92px);
  font-weight: 400;
  line-height: .9;
  letter-spacing: -.02em;
  color: var(--accent);
  text-wrap: balance;
}
.note-header h1 span { color: var(--accent); }
.note-deck {
  max-width: 600px;
  margin: 26px 0 0;
  color: var(--ink-2);
  font-size: clamp(21px, 3vw, 28px);
  line-height: 1.18;
  text-align: left;
}
.research-note {
  width: min(900px, 100%);
  margin: 0 auto;
}
.research-note p {
  max-width: 760px;
  margin: 0 auto 1.35em;
  text-align: left;
  line-height: 1.45;
  text-wrap: pretty;
}
.note-page .research-note { color: var(--ink); }
.note-page .research-note figcaption,
.note-page .research-table caption { color: var(--ink-2); }
.note-page .research-table th { color: var(--ink); }
.note-page .research-table td { color: var(--ink-2); }
.research-note code {
  font-family: var(--pixel-font);
  font-size: .95em;
  color: var(--note-accent);
}
.research-note .equation {
  width: fit-content;
  max-width: calc(100% - 32px);
  margin: 30px auto 34px;
  padding: 15px 20px;
  border-left: 2px solid var(--note-accent);
  color: var(--note-accent);
  font-family: var(--pixel-font);
  font-size: clamp(21px, 3vw, 28px);
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
}
.research-figure {
  margin: 54px auto 58px;
  padding: 20px 0 0;
  border-top: 1px solid color-mix(in srgb, var(--note-accent) 35%, transparent);
}
.research-figure svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
}
.research-figure figcaption {
  max-width: 760px;
  margin: 16px auto 0;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.35;
  text-align: left;
}
.svg-box { fill: #f9f8f6; stroke: var(--note-accent); stroke-width: 1.25; }
.svg-input { fill: #f2e8dc; }
.svg-focus { fill: #f6c99d; stroke: var(--note-accent); }
.svg-label { fill: var(--note-accent); font-family: Jost, sans-serif; font-size: 15px; }
.svg-muted { fill: var(--note-accent); font-family: Jost, sans-serif; font-size: 13px; }
.svg-tiny { fill: var(--note-accent); font-family: Jost, sans-serif; font-size: 11px; letter-spacing: .02em; }
.svg-arrow { fill: none; stroke: var(--note-accent); stroke-width: 1.5; marker-end: url(#arrow-gold); }
.svg-callout { fill: none; stroke: var(--note-accent); stroke-width: 1.5; }
.svg-note { fill: #fff4e8; stroke: var(--note-accent); stroke-width: 1; }
.svg-cache { fill: none; stroke: var(--note-accent); stroke-width: 1.25; stroke-dasharray: 5 4; }
.svg-axis { stroke: var(--note-accent); stroke-width: 1.2; }
.svg-grid { stroke: color-mix(in srgb, var(--note-accent) 20%, transparent); stroke-width: 1; }
.svg-line { fill: none; stroke: var(--note-accent); stroke-width: 2.5; }
.svg-dash { stroke: var(--note-accent); stroke-width: 1; stroke-dasharray: 5 5; }
.svg-point { fill: var(--note-accent); stroke: #f9f8f6; stroke-width: 2; }
.svg-open { fill: #f9f8f6; stroke: var(--note-accent); stroke-width: 2; }
.svg-bar-dark { fill: var(--note-accent); }
.svg-bar { fill: var(--note-accent); opacity: .62; }
.svg-nota-line { fill: none; stroke: var(--note-accent); stroke-width: 2.3; opacity: .7; }
.svg-nota-light { stroke: var(--note-accent); opacity: .58; }
.svg-nota-dark { stroke: var(--note-accent); stroke-width: 3; }
.svg-nota-dashed { stroke: var(--note-accent); opacity: .62; stroke-dasharray: 6 5; }
.hbar rect { fill: var(--note-accent); }
.svg-invert { fill: var(--paper); }
.hbar-muted { opacity: .8; }
.research-table {
  width: min(900px, 100%);
  border-collapse: collapse;
  margin: 48px auto 58px;
  font-size: 15px;
  line-height: 1.3;
}
.research-table caption {
  margin-bottom: 13px;
  color: var(--ink-2);
  font-size: 16px;
  text-align: left;
}
.research-table th,
.research-table td {
  padding: 10px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--note-accent) 28%, transparent);
  vertical-align: top;
  text-align: left;
}
.research-table thead th {
  color: var(--ink);
  border-bottom: 1px solid var(--note-accent);
  font-weight: 400;
}
.research-table tbody th { font-weight: 400; }
.research-table td { color: var(--ink-2); }
.research-table-wide { font-size: 14px; }
.research-table-wide th,
.research-table-wide td { padding: 9px 8px; }
.note-footer {
  width: min(900px, 100%);
  margin: 84px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--note-accent);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  color: var(--ink-2);
  font-size: 16px;
}
.note-footer a { color: var(--ink); }

@media (max-width: 760px) {
  .note-shell { width: min(100% - 32px, 680px); padding-top: 28px; }
  .note-header { margin-bottom: 48px; }
  .note-header-top { margin-bottom: 42px; }
  .note-meta { font-size: 13px; }
  .note-back { margin-bottom: 42px; }
  .note-header h1 { font-size: clamp(48px, 15vw, 78px); }
  .research-note p { line-height: 1.42; }
  .research-figure { margin-top: 42px; margin-bottom: 46px; overflow: hidden; }
  .research-figure svg { min-width: 0; width: 100%; overflow: hidden; }
  .research-figure figcaption { font-size: 15px; }
  .note-footer { flex-direction: column; gap: 10px; }
}

@media (max-width: 899px) {
  .note-page .paper { padding: 28px 16px 100px; }
  .note-page .note-shell { max-width: 900px; margin: 0 auto; }
}

@container (max-width: 760px) {
  .research-table,
  .research-table-wide {
    display: table;
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 12px;
  }
  .research-table th,
  .research-table td {
    padding: 8px 6px;
    overflow-wrap: anywhere;
  }
  .research-table-wide { font-size: 11px; }
  .research-table-wide th,
  .research-table-wide td { padding: 7px 5px; }
}
