/* ── Computer Modern Fonts ─────────────────────────────────────────── */
@font-face {
  font-family: "Computer Modern";
  src: url("/fonts/computer-modern/Serif/cmunrm.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "Computer Modern";
  src: url("/fonts/computer-modern/Serif/cmunbx.woff") format("woff");
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: "Computer Modern";
  src: url("/fonts/computer-modern/Serif/cmunti.woff") format("woff");
  font-weight: normal;
  font-style: italic;
}
@font-face {
  font-family: "Computer Modern";
  src: url("/fonts/computer-modern/Serif/cmunbi.woff") format("woff");
  font-weight: bold;
  font-style: italic;
}
@font-face {
  font-family: "Computer Modern Typewriter";
  src: url("/fonts/computer-modern/Typewriter/cmuntt.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "Computer Modern Typewriter";
  src: url("/fonts/computer-modern/Typewriter/cmuntb.woff") format("woff");
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: "Computer Modern Typewriter";
  src: url("/fonts/computer-modern/Typewriter/cmunit.woff") format("woff");
  font-weight: normal;
  font-style: italic;
}

/* ── CSS Counters ──────────────────────────────────────────────────── */
body {
  counter-reset: section theorem lemma definition remark corollary figure-counter;
}
article {
  counter-reset: subsection;
}

/* ── Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Computer Modern", "Latin Modern", Georgia, serif;
  background-color: #f2ece0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
  color: #1a1208;
  line-height: 1.75;
  margin: 0;
  padding: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  position: relative;
}
body.loaded { opacity: 1; }

/* ── Layout ────────────────────────────────────────────────────────── */
.page-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

@media (min-width: 1100px) {
  .page-wrap { max-width: 700px; margin: 0 auto; }
}

/* ── Navigation ────────────────────────────────────────────────────── */
nav.site-nav {
  border-bottom: 2px solid #1a1208;
  border-top: 2px solid #1a1208;
  padding: 0.5rem 0;
  margin-bottom: 3rem;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  background: #ede8d8;
}
nav.site-nav .nav-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 1.8rem;
  align-items: baseline;
  flex-wrap: wrap;
}
nav.site-nav .site-title {
  font-weight: bold;
  margin-right: auto;
  text-decoration: none;
  color: #1a1208;
}
nav.site-nav a {
  color: #1a1208;
  text-decoration: none;
}
nav.site-nav a:hover { text-decoration: underline; }
nav.site-nav a.active { text-decoration: underline; }

/* ── Title Block (mimics \maketitle) ───────────────────────────────── */
.title-block {
  text-align: center;
  margin: 3rem 0 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #c8b080;
}
.title-block h1 {
  font-size: 2rem;
  font-weight: bold;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}
.title-block .author-line {
  font-size: 1rem;
  margin: 0.2rem 0;
}
.title-block .affiliation {
  font-style: italic;
  font-size: 0.95rem;
  margin: 0.1rem 0;
}
.title-block .email {
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.9rem;
  color: #00008B;
  text-decoration: none;
}
.title-block .email:hover { text-decoration: underline; }

/* ── Headings with section counters ───────────────────────────────── */
h1, h2, h3, h4 {
  font-family: "Computer Modern", serif;
  font-weight: bold;
  line-height: 1.3;
}

.prose h2 {
  counter-increment: section;
  counter-reset: subsection;
}
.prose h2::before {
  content: counter(section) ". ";
}
.prose h3 {
  counter-increment: subsection;
}
.prose h3::before {
  content: counter(section) "." counter(subsection) ". ";
}

/* ── Abstract ──────────────────────────────────────────────────────── */
.abstract {
  margin: 2rem 0;
  padding: 0 2rem;
  border-left: none;
}
.abstract .abstract-title {
  text-align: center;
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.abstract p:first-of-type::first-letter {
  font-size: 3.2em;
  line-height: 0.8;
  float: left;
  margin: 0.05em 0.06em 0 0;
  font-weight: bold;
}

/* ── Body Text ─────────────────────────────────────────────────────── */
p { margin: 0 0 1rem; }

a {
  color: #00008B;
  text-decoration: underline;
}
a:hover { color: #0000cc; }

code, kbd, samp {
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.88em;
  background: #ede8d8;
  padding: 0.1em 0.3em;
  border-radius: 2px;
}

pre {
  background: #ede8d8;
  border: 1px solid #c8b080;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
pre code { background: none; padding: 0; }

blockquote {
  border-left: 3px solid #c8b080;
  margin: 1.5rem 0;
  padding: 0.2rem 1.2rem;
  color: #444;
  font-style: italic;
}

/* ── LaTeX Environment Blocks ─────────────────────────────────────── */
.env-block {
  background: #ece6d4;
  border-left: 3px solid #aaa;
  margin: 1.5rem 0;
  padding: 0.8rem 1rem 0.8rem 1.2rem;
}
.env-block .env-label {
  font-weight: bold;
  font-style: italic;
}
.env-block .env-name {
  font-weight: normal;
  font-style: normal;
}
.env-block.theorem { border-left-color: #3a2e00; }
.env-block.lemma   { border-left-color: #5a4800; }
.env-block.corollary { border-left-color: #5a4800; }
.env-block.definition { border-left-color: #888; background: #f0f5c0; }
.env-block.remark  { border-left-color: #c8b080; }

/* proof block */
.proof-block {
  margin: 1.5rem 0;
  padding: 0 0 0 1.2rem;
}
.proof-block .proof-label {
  font-style: italic;
  font-weight: bold;
}
.proof-block .qed {
  float: right;
  font-style: normal;
  font-size: 1.1em;
  line-height: 1;
  margin-top: 0.1em;
}

/* ── Sidenotes ─────────────────────────────────────────────────────── */
.sidenote-ref {
  font-size: 0.7em;
  vertical-align: super;
  color: #555;
  cursor: default;
}
.sidenote {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #555;
  font-style: italic;
  margin: 0.5rem 0 0.5rem 1.5rem;
  padding-left: 0.8rem;
  border-left: 1px solid #c8b080;
}
@media (min-width: 1100px) {
  .sidenote-wrap { position: relative; }
  .sidenote {
    position: absolute;
    right: -260px;
    width: 220px;
    margin: 0;
    border-left: none;
    padding-left: 0;
    top: 0;
  }
}

/* ── Section page heading (non-counter pages) ──────────────────────── */
.page-heading {
  margin: 2rem 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #c8b080;
}
.page-heading h1 { font-size: 1.6rem; margin: 0; }
.page-heading .page-date {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

/* ── Blog / Notes list ─────────────────────────────────────────────── */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  counter-reset: toc-item;
}
.toc-list li {
  counter-increment: toc-item;
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px dotted #c8b080;
}
.toc-list li::before {
  content: counter(toc-item);
  font-size: 0.8rem;
  color: #888;
  min-width: 1.5rem;
  text-align: right;
  flex-shrink: 0;
}
.toc-list .post-title { flex: 1; }
.toc-list .post-date {
  font-size: 0.8rem;
  color: #888;
  font-style: italic;
  white-space: nowrap;
}
.toc-list a { color: #111; text-decoration: none; }
.toc-list a:hover { text-decoration: underline; }

.section-heading {
  font-size: 1.3rem;
  font-weight: bold;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #c8b080;
}

/* ── CV ────────────────────────────────────────────────────────────── */
.cv-section { margin: 2rem 0; }
.cv-section h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid #c8b080;
  padding-bottom: 0.2rem;
  margin-bottom: 1rem;
}
.cv-page h2::before { content: none !important; }
.cv-page h3::before { content: none !important; }

.cv-entry {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.3rem 1rem;
  margin-bottom: 1rem;
}
.cv-entry .cv-year { color: #666; font-size: 0.9rem; padding-top: 0.1rem; }
.cv-entry .cv-body { }
.cv-entry .cv-title { font-weight: bold; }
.cv-entry .cv-sub { font-style: italic; color: #444; font-size: 0.95rem; }


/* ── Photos section ───────────────────────────────────────────────── */
.photos-label {
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8a6030;
  margin-bottom: 2rem;
}
.canisters-grid {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin: 1rem 0 3rem;
}
.canister-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  transition: transform 0.2s;
}
.canister-wrap:hover { transform: translateY(-4px); }
.canister-wrap:hover svg { filter: drop-shadow(0 6px 14px rgba(0,0,0,0.3)); }
.canister-wrap svg { display: block; width: 80px; transition: filter 0.2s; }
.canister-meta { text-align: center; }
.canister-name  { font-size: 0.8rem; font-weight: bold; color: #1a1208; }
.canister-stock { font-family: "Computer Modern Typewriter", monospace; font-size: 0.62rem; color: #8a6030; margin-top: 0.1rem; }
.canister-count { font-family: "Computer Modern Typewriter", monospace; font-size: 0.55rem; color: #aaa; margin-top: 0.1rem; }

/* ── Film overlay ─────────────────────────────────────────────────── */
.film-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(6,4,2,0.94);
  z-index: 100; flex-direction: column; justify-content: center;
}
.film-overlay.open { display: flex; }
.film-overlay-header {
  flex-shrink: 0; display: flex; align-items: baseline; justify-content: space-between;
  padding: 1rem 2rem 0.6rem; border-bottom: 1px solid #2a2010;
}
.film-ol-title { font-family: "Computer Modern Typewriter", monospace; font-size: 0.7rem; color: #c8a050; letter-spacing: 0.12em; text-transform: uppercase; }
.film-ol-stock  { font-family: "Computer Modern Typewriter", monospace; font-size: 0.62rem; color: #666; }
.film-close-btn {
  background: none; border: 1px solid #444; color: #888;
  padding: 0.25rem 0.7rem; cursor: pointer;
  font-family: "Computer Modern Typewriter", monospace; font-size: 0.68rem; letter-spacing: 0.08em;
}
.film-close-btn:hover { border-color: #888; color: #ccc; }
.film-strip-scroll {
  flex: 1; overflow-x: scroll; overflow-y: hidden;
  display: flex; align-items: center; padding: 1.5rem 2rem;
  cursor: grab; user-select: none; scrollbar-width: none;
}
.film-strip-scroll::-webkit-scrollbar { display: none; }
.film-strip-scroll.dragging { cursor: grabbing; }
.film-strip {
  display: inline-flex; flex-direction: column; flex-shrink: 0;
  background: #0d0d0d;
  animation: film-unroll 0.55s cubic-bezier(0.2,0,0.2,1);
}
@keyframes film-unroll {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0% 0 0); }
}
.film-sprocket {
  height: 20px; background: #111;
  background-image: repeating-linear-gradient(90deg, #111 0px, #111 6px, #000 6px, #000 16px, #111 16px, #111 26px);
  background-size: 26px 100%;
  border-top: 2px solid #1a1a1a; border-bottom: 2px solid #1a1a1a;
}
.film-frames-row { display: flex; gap: 0; background: #080808; padding: 6px 0; }
.film-frame {
  flex-shrink: 0; width: 150px; display: flex; flex-direction: column;
  border-right: 2px solid #1a1a1a; cursor: zoom-in;
}
.film-frame:last-child { border-right: none; }
.film-frame:hover .film-frame-img { filter: brightness(1.2); }
.film-frame-img {
  width: 150px; height: 100px; display: block; flex-shrink: 0;
  background: #1a1a1a; overflow: hidden; transition: filter 0.15s;
}
.film-frame-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.film-frame-meta { padding: 4px 6px 3px; background: #080808; display: flex; align-items: baseline; gap: 4px; }
.film-frame-num { font-family: "Computer Modern Typewriter", monospace; font-size: 0.48rem; color: rgba(200,160,60,0.7); flex-shrink: 0; }
.film-frame-cap { font-family: "Computer Modern Typewriter", monospace; font-size: 0.5rem; color: #666; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.film-drag-hint { flex-shrink: 0; padding: 0.4rem 2rem 0; font-family: "Computer Modern Typewriter", monospace; font-size: 0.58rem; color: #333; letter-spacing: 0.08em; text-align: center; transition: opacity 0.4s; }
.film-drag-hint.hidden { opacity: 0; }

/* ── Zoom lightbox ────────────────────────────────────────────────── */
.film-zoom {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(2,1,0,0.96);
  align-items: center; justify-content: center; flex-direction: column; gap: 1.2rem;
  cursor: zoom-out;
}
.film-zoom.open { display: flex; }
.film-zoom-frame {
  background: #0d0d0d; padding: 8px 8px 0;
  border: 1px solid #2a2a2a;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
  animation: film-zoom-in 0.2s ease;
  cursor: default;
}
@keyframes film-zoom-in { from { transform: scale(0.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.film-zoom-img {
  width: min(70vw, 560px); height: min(47vw, 374px);
  display: block; background: #0d0d0d; overflow: hidden;
}
.film-zoom-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.film-zoom-caption { font-family: "Computer Modern Typewriter", monospace; font-size: 0.72rem; color: #888; font-style: italic; }
.film-zoom-num { color: #c8a050; margin-right: 0.4rem; }
.film-zoom-nav { display: flex; gap: 1rem; }
.film-zoom-nav button {
  background: none; border: 1px solid #333; color: #666;
  padding: 0.3rem 1rem; cursor: pointer;
  font-family: "Computer Modern Typewriter", monospace; font-size: 0.7rem; letter-spacing: 0.1em;
  transition: border-color 0.15s, color 0.15s;
}
.film-zoom-nav button:hover { border-color: #888; color: #ccc; }
.film-zoom-nav button:disabled { opacity: 0.2; cursor: default; }
/* ── Tags ──────────────────────────────────────────────────────────── */
.tags {
  font-size: 0.82rem;
  color: #666;
  font-family: "Computer Modern Typewriter", monospace;
}
.tags::before { content: "["; }
.tags::after  { content: "]"; }
.tag-sep::after { content: ", "; }

/* ── Post metadata ─────────────────────────────────────────────────── */
.post-meta {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #c8b080;
}

/* ── Footer ────────────────────────────────────────────────────────── */
footer.site-footer {
  border-top: 2px solid #1a1208;
  margin-top: 4rem;
  padding: 1rem 0 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: #888;
  background: #ede8d8;
}
footer.site-footer .footer-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.build-status { font-family: "Computer Modern Typewriter", monospace; }

.hidden-formula {
  display: none;
  margin-top: 0.5rem;
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.78rem;
  color: #aaa;
  letter-spacing: 0.03em;
}

/* ── KaTeX display math ────────────────────────────────────────────── */
.katex-display {
  margin: 1.5rem 0;
  overflow-x: auto;
}


/* ── Big title (playful academic) ────────────────────────────────── */
.big-title {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 2rem 0 1.5rem;
  font-weight: bold;
}

/* ── Music section ────────────────────────────────────────────────── */
.music-header {
  background: #1a1208;
  color: #f2ece0;
  padding: 1.2rem 1.5rem 1rem;
  margin: 2rem -1.5rem 1.5rem;
  position: relative;
}
.music-header .music-label {
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #c8a050;
  margin-bottom: 0.3rem;
}
.music-header h1 {
  font-size: 2.8rem;
  font-weight: bold;
  color: #f2ece0;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}
.music-stamp {
  position: absolute;
  bottom: 8rem;
  right: 2rem;
  z-index: 50;
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.6rem;
  color: #c8a050;
  letter-spacing: 0.12em;
  border: 1px solid #c8a050;
  padding: 0.15rem 0.4rem;
  transform: rotate(-2deg);
}
.music-quote {
  background: #fdf8e0;
  border: 1px solid #d4c090;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  color: #2c2010;
  font-style: italic;
  transform: rotate(-1.5deg);
  display: inline-block;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.12);
  margin: 0 0 2rem 0.5rem;
  max-width: 80%;
  line-height: 1.5;
}
.music-tracklist {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: track;
}
.music-tracklist li {
  counter-increment: track;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.35rem 0;
  border-bottom: 1px dotted #c8b080;
}
.music-tracklist li::before {
  content: counter(track, decimal-leading-zero);
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.72rem;
  color: #c8a050;
  min-width: 1.8rem;
  flex-shrink: 0;
}
.music-tracklist .track-title { flex: 1; }
.music-tracklist .track-title a { color: #1a1208; text-decoration: none; }
.music-tracklist .track-title a:hover { text-decoration: underline; }
.music-tracklist .track-date {
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.7rem;
  color: #a08050;
  white-space: nowrap;
}

/* ── Dancing section ──────────────────────────────────────────────── */
.dance-ticket {
  border: 2px solid #1a1208;
  position: relative;
  margin: 2rem 0 1.5rem;
  background: #f5f0e4;
  box-shadow: 3px 3px 10px rgba(0,0,0,0.12);
  display: flex;
  min-height: 90px;
}
.dance-ticket::before {
  content: '';
  position: absolute;
  left: 28%;
  top: 0;
  bottom: 0;
  border-left: 1px dashed #c8b080;
}
.dance-ticket-stub {
  width: 28%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-right: none;
}
.dance-ticket-stub span {
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8a6030;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.dance-ticket-main {
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.dance-ticket-main h1 {
  font-size: 2.8rem;
  font-weight: bold;
  color: #1a1208;
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}
.dance-ticket-main .dance-styles {
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8a6030;
}
.dance-prose {
  font-style: italic;
  color: #3a2c18;
  margin: 0 0 1.2rem;
  padding-left: 0.5rem;
  border-left: 2px solid #c8b080;
  line-height: 1.7;
}
.dance-cutouts {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.dance-cutout {
  font-family: "Computer Modern Typewriter", monospace;
  font-size: 0.65rem;
  color: #2c2010;
  background: #ede8d0;
  border: 1px solid #c8b080;
  padding: 0.25rem 0.5rem;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.1);
}
.dance-cutout:nth-child(odd)  { transform: rotate(-1.5deg); }
.dance-cutout:nth-child(even) { transform: rotate(1deg); }
/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .title-block h1 { font-size: 1.5rem; }
  .cv-entry { grid-template-columns: 1fr; }
  .cv-entry .cv-year { color: #888; font-size: 0.82rem; }
  nav.site-nav .nav-inner { gap: 1rem; }
  .photo-album-wrap { margin: 1.5rem -1rem; padding: 1.5rem 1rem 2rem; }
}

/* ── Typewriter cursor ─────────────────────────────────────────────── */
.typewriter::after {
  content: "|";
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Section § hover hint ──────────────────────────────────────────── */
.prose h2:hover::before,
.prose h3:hover::before {
  color: #888;
}
