/* ELLIS site. Layout: one 1080px left-aligned column; hairline-ruled sections; figures on white paper panels. */
:root {
  --bg: #fbfbfd;
  --surface: #f2f3f7;
  --ink: #12141b;
  --muted: #5a5f6e;
  --faint: #8a8f9c;
  --line: #e2e4ea;
  --accent: #5a48d6;
  --accent-soft: #ecebfc;
  --teal: #16958c;
  --orange: #e2702f;
  --figure-bg: #ffffff;
  --nav-bg: rgba(251, 251, 253, .84);
  --nav-h: 88px;
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --step--1: .875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: clamp(1.8rem, 3.4vw, 2.25rem);
  --step-4: clamp(2.5rem, 6vw, 4.5rem);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0e13; --surface: #161821; --ink: #eceef4; --muted: #a0a5b4; --faint: #737887;
    --line: #262935; --accent: #9486ff; --accent-soft: #221f3d; --teal: #3cc0b5; --orange: #f08a4f;
    --figure-bg: #ffffff; --nav-bg: rgba(13, 14, 19, .82); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0e13; --surface: #161821; --ink: #eceef4; --muted: #a0a5b4; --faint: #737887;
  --line: #262935; --accent: #9486ff; --accent-soft: #221f3d; --teal: #3cc0b5; --orange: #f08a4f;
  --figure-bg: #ffffff; --nav-bg: rgba(13, 14, 19, .82); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: var(--step-0); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--bg);
}
img { max-width: 100%; }
a { color: inherit; }
a:focus-visible, button:focus-visible, video:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap {
  max-width: 1080px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap.narrow { max-width: 820px; }
h1, h2, h3 { text-wrap: balance; margin: 0; letter-spacing: -.02em; line-height: 1.15; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--font-mono); font-size: .9em; }
.eyebrow {
  font-family: var(--font-mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
}
.lede { color: var(--muted); font-size: var(--step-1); line-height: 1.55; max-width: 60ch; }
.prose { max-width: 66ch; color: var(--muted); }
.prose strong, .prose b { color: var(--ink); font-weight: 600; }
.grad {
  background: linear-gradient(90deg, var(--teal), var(--accent) 55%, var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Nav */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--nav-bg); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 24px; height: var(--nav-h); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.brand svg { width: 34px; height: 22px; flex: none; }
.brand-lockup {
  display: block; height: 64px; aspect-ratio: 217.25 / 100; background: currentColor;
  -webkit-mask: url(assets/ellis-lockup.svg) no-repeat center / contain; mask: url(assets/ellis-lockup.svg) no-repeat center / contain;
}
footer .brand-lockup { height: 34px; }
.proj-logo {
  display: block; width: 36px; aspect-ratio: 91.6 / 70.24; flex: none; background: currentColor;
  -webkit-mask: url(assets/ellis-mark.svg) no-repeat center / contain; mask: url(assets/ellis-mark.svg) no-repeat center / contain;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; font-size: var(--step--1); }
.nav-links a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.nav-links a:hover { color: var(--ink); background: var(--surface); }
.nav-links a[aria-current="page"] { color: var(--ink); font-weight: 500; }
.nav-gh {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: var(--step--1);
  font-weight: 500; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
}
.nav-gh:hover { border-color: var(--ink); }
@media (max-width: 640px) {
  :root { --nav-h: 72px; }
  .nav .brand-lockup { height: 50px; }
  .nav .wrap { gap: 10px; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 6px 7px; }
  .nav-links .opt { display: none; }
  .nav-gh span { display: none; }
}

/* Buttons */
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 500; font-size: var(--step--1);
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg);
}
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:hover { border-color: var(--ink); }
.btn.primary:hover { opacity: .88; }
.btn svg { width: 16px; height: 16px; }
.more { font-size: var(--step--1); font-weight: 500; text-decoration: none; color: var(--accent); white-space: nowrap; }
.more:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Sections */
section.block { padding-block: 96px 0; }
.sec-head { display: grid; gap: 14px; margin-bottom: 40px; }
.sec-head h2 { font-size: var(--step-3); max-width: 24ch; }
.sec-head.row { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
@media (max-width: 560px) { .sec-head.row { grid-template-columns: minmax(0, 1fr); } }

/* Code */
.code {
  background: var(--surface); border-radius: 12px; padding: 18px 20px; overflow-x: auto;
  font-family: var(--font-mono); font-size: .86rem; line-height: 1.75; position: relative;
}
.code pre { margin: 0; white-space: pre; }
.code .c { color: var(--faint); }
.code .p { color: var(--accent); user-select: none; }

/* Post list (shared by home preview and blog index) */
.posts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.post { border-bottom: 1px solid var(--line); }
.post a.post-link {
  display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 28px; align-items: start;
  padding: 26px 0; text-decoration: none;
}
.post a.post-link:hover h3 { color: var(--accent); }
.post .thumb { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.post .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post .thumb.paper { background: var(--figure-bg); }
.post .thumb.video { position: relative; }
.post .thumb.video::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; background: rgba(18, 20, 27, .62);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.post .thumb.video::before {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: 1; margin: -8px 0 0 -5px;
  border-style: solid; border-width: 8px 0 8px 13px; border-color: transparent transparent transparent #fff;
}
.post a.post-link:hover .thumb.video::after { background: var(--accent); }
.post .thumb.paper img { object-fit: contain; padding: 6px; }
.post .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-family: var(--font-mono); font-size: .76rem; color: var(--faint); }
.post .tag { color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.post h3 { font-size: var(--step-1); margin-top: 8px; transition: color .15s; }
.post p { color: var(--muted); font-size: .97rem; margin-top: 8px; max-width: 62ch; }
.post .arrow { color: var(--faint); font-size: 1.2rem; padding-top: 2px; }
@media (max-width: 760px) {
  .post a.post-link { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .post .arrow { display: none; }
  .post .thumb { max-width: 420px; }
}

/* Article */
.article-head { padding-block: 64px 32px; }
.article-head h1 { font-size: clamp(2rem, 4.6vw, 3rem); letter-spacing: -.03em; margin-top: 14px; }
.article-head .lede { margin-top: 18px; }
.article-head .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-family: var(--font-mono); font-size: .78rem; color: var(--faint); margin-top: 22px; }
.back { font-size: var(--step--1); text-decoration: none; color: var(--muted); }
.back:hover { color: var(--ink); }
.article h2 { font-size: var(--step-2); margin-top: 64px; margin-bottom: 14px; }
.article > .wrap > p, .article .para { color: var(--muted); max-width: 66ch; margin-top: 14px; }
.article .para b { color: var(--ink); }
.caption { color: var(--muted); font-size: var(--step--1); margin-top: 12px; max-width: 86ch; line-height: 1.55; }
.caption b { color: var(--ink); font-weight: 600; }

/* Figures */
.figure { margin: 28px 0 0; }
.figure .paper { background: var(--figure-bg); border: 1px solid var(--line); border-radius: 14px; padding: 18px; overflow-x: auto; }
.figure .paper img { display: block; width: 100%; min-width: 640px; height: auto; }
.shot { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--figure-bg); }
.shot img { display: block; width: 100%; height: auto; }
.video-frame { border-radius: 14px; overflow: hidden; background: #111214; border: 1px solid var(--line); aspect-ratio: 16 / 9; max-width: 100%; }
.video-frame video { width: 100%; height: 100%; display: block; object-fit: cover; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { padding: 26px 22px 24px 0; }
.stat + .stat { padding-left: 22px; border-left: 1px solid var(--line); }
.stat .num { font-size: var(--step-3); font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .num small { font-size: .55em; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat p { color: var(--muted); font-size: var(--step--1); margin-top: 8px; line-height: 1.45; }
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 460px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat, .stat + .stat { padding-left: 0; border-left: 0; }
  .stat + .stat { border-top: 1px solid var(--line); }
}
.note { color: var(--faint); font-size: .8rem; margin-top: 12px; }

/* Footer */
footer { margin-top: 112px; border-top: 1px solid var(--line); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; padding-block: 28px 40px; color: var(--muted); font-size: var(--step--1); }
footer .brand { color: var(--ink); }
footer nav { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
footer nav a { text-decoration: none; }
footer nav a:hover { color: var(--ink); }
