/* Blog styles (light). Colors and sizes are set once in :root below. */

/* Layout: a pale sidebar holds the name and the menu; a white reading column on the right
   carries the writing, with dates hung in the left margin. */
:root {
  --side: #eef1f7;        /* sidebar */
  --side-edge: #d8dde9;   /* sidebar border and lines */
  --paper: #fdfdfe;       /* page */
  --ink: #1d2233;         /* text */
  --ink-soft: #5b6378;    /* dates, captions, secondary text */
  --rule: #e3e6ee;
  --accent: #24489f;      /* links, current page */
  --accent-deep: #0f2f7a; /* links on hover */
  --tint: #f0f2f8;        /* code and notice ground */
  --select: #cfe3ff;

  --serif: "STIX Two Text Variable", "STIX Two Text", "Times New Roman", Times, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --step--1: 0.9375rem;
  --step-0: 1.1875rem;
  --step-1: 1.4375rem;
  --step-2: 1.75rem;
  --step-3: 2.375rem;

  --side-w: 19rem;
  --measure: 38rem;
  --hang: 9.5rem;
  --hang-gap: 2rem;
  --top: 4.5rem;
  color-scheme: light;
}

/* Body face: STIX Two Text, the typeface of physics journals. */
@font-face {
  font-family: "STIX Two Text Variable";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/stix-two-text-latin-wght-normal.woff2) format("woff2-variations"),
       url(fonts/stix-two-text-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "STIX Two Text Variable";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/stix-two-text-latin-wght-italic.woff2) format("woff2-variations"),
       url(fonts/stix-two-text-latin-wght-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "STIX Two Text Variable";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/stix-two-text-latin-ext-wght-normal.woff2) format("woff2-variations"),
       url(fonts/stix-two-text-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "STIX Two Text Variable";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/stix-two-text-latin-ext-wght-italic.woff2) format("woff2-variations"),
       url(fonts/stix-two-text-latin-ext-wght-italic.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "STIX Two Text Variable";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/stix-two-text-greek-wght-normal.woff2) format("woff2-variations"),
       url(fonts/stix-two-text-greek-wght-normal.woff2) format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: "STIX Two Text Variable";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/stix-two-text-greek-wght-italic.woff2) format("woff2-variations"),
       url(fonts/stix-two-text-greek-wght-italic.woff2) format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.65;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--select); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 0.9rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--side-edge);
  border-radius: 4px;
}
.skip:focus { top: 1rem; }

/* ---------- Page frame ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.side {
  background: var(--side);
  color: var(--ink);
  border-right: 1px solid var(--side-edge);
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
}

.side-inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-block: var(--top) 2.25rem;
  padding-left: max(2.75rem, env(safe-area-inset-left, 0px));
  padding-right: 2rem;
}

.brand {
  display: grid;
  color: inherit;
  text-decoration: none;
  width: fit-content;
}

.brand-text { display: grid; gap: 0.3rem; }

.brand-name {
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.brand:hover .brand-name { color: var(--accent); }

.brand-role {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.35;
}

.menu { display: grid; gap: 0.5rem; }

.menu-link {
  position: relative;
  width: fit-content;
  color: var(--ink);
  font-size: var(--step-1);
  line-height: 1.3;
  text-decoration: none;
}
.menu-link:hover { color: var(--accent); }
.menu-link[aria-current="page"] { color: var(--accent); }
.menu-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -1.15rem;
  top: 50%;
  width: 0.42rem;
  height: 0.42rem;
  border: 1.5px solid var(--accent);
  transform: translateY(-50%) rotate(45deg);
}

.recent {
  list-style: none;
  margin: 0.15rem 0 0.25rem;
  padding: 0 0 0 1rem;
  border-left: 1px solid var(--side-edge);
  display: grid;
  gap: 0.55rem;
}
.recent a {
  position: relative;
  display: block;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.35;
  text-decoration: none;
}
.recent a:hover { color: var(--accent); }
.recent a[aria-current="page"] { color: var(--ink); }
.recent a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: calc(-1rem - 0.5px - 0.2rem);
  top: calc(0.675em - 0.2rem);
  width: 0.4rem;
  height: 0.4rem;
  background: var(--accent);
  transform: rotate(45deg);
}

.side-links {
  margin: auto 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  font-size: 1rem;
}
.side-links a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--side-edge);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
.side-links a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ---------- Main column ---------- */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-block: var(--top) 2.5rem;
  padding-left: max(5rem, env(safe-area-inset-left, 0px));
  padding-right: max(2rem, env(safe-area-inset-right, 0px));
}

.col {
  flex: 1;
  width: 100%;
  max-width: calc(var(--hang) + var(--hang-gap) + var(--measure));
}

.foot {
  margin-top: 5rem;
  max-width: calc(var(--hang) + var(--hang-gap) + var(--measure));
  color: var(--ink-soft);
  font-size: var(--step--1);
}

/* ---------- Home ---------- */

.intro {
  max-width: 30em;
  margin-bottom: 4.25rem;
  font-size: var(--step-1);
  line-height: 1.5;
}

.section-title,
.page-title {
  margin: 0 0 2rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.section-title { font-size: var(--step-2); }
.page-title { font-size: var(--step-3); }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2.25rem;
}

.entry,
.year {
  display: grid;
  grid-template-columns: var(--hang) minmax(0, 1fr);
  column-gap: var(--hang-gap);
  align-items: baseline;
}

.entry-date {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.4;
  font-variant-numeric: lining-nums tabular-nums;
}
.entry-date a { color: inherit; text-decoration: none; }
.entry-date a:hover { color: var(--accent); }

.entry-body { min-width: 0; max-width: var(--measure); }

/* ---------- Posts list ---------- */

.archive { display: grid; gap: 2.75rem; }

.year h2 {
  margin: 0;
  font-size: var(--step-1);
  font-weight: 500;
  line-height: 1.3;
  font-variant-numeric: lining-nums;
}

.year ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.85rem;
  min-width: 0;
}

.year li {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
}

.year time {
  color: var(--ink-soft);
  font-size: 1rem;
  font-style: italic;
  font-variant-numeric: lining-nums tabular-nums;
}

.year a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.year a:hover { color: var(--accent); text-decoration-color: currentColor; }

.empty { color: var(--ink-soft); font-style: italic; }

/* ---------- Single post ---------- */

.post-head { max-width: var(--measure); margin-bottom: 2.5rem; }

.post-date {
  margin: 0 0 0.75rem;
  color: var(--ink-soft);
  font-size: 1.0625rem;
  font-style: italic;
  font-variant-numeric: lining-nums;
}

.post-head .page-title { margin: 0; }

.notice {
  max-width: var(--measure);
  margin: 0 0 2rem;
  padding: 0.75rem 1rem;
  background: var(--tint);
  border-radius: 4px;
  color: var(--ink-soft);
  font-size: 1rem;
}

.post-nav {
  max-width: var(--measure);
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.post-nav a {
  display: grid;
  gap: 0.2rem;
  align-content: start;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.35;
}
.post-nav a:hover .post-nav-title { text-decoration: underline; text-underline-offset: 0.2em; }
.post-nav-label { color: var(--ink-soft); font-size: var(--step--1); font-style: italic; }
.post-nav .later { grid-column: 2; text-align: right; }

/* ---------- Writing (Markdown output) ---------- */

.prose { max-width: var(--measure); overflow-wrap: break-word; }
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 1.1em; }

.prose h2 {
  margin-top: 2.1em;
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.2;
  text-wrap: balance;
}
.prose h3 {
  margin-top: 1.8em;
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}
.prose h4 { margin-top: 1.6em; font-size: var(--step-0); font-weight: 600; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.6em; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
.prose a:hover { color: var(--accent-deep); text-decoration-thickness: 2px; }

.prose strong { font-weight: 650; }

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.35em; }
.prose li > ul, .prose li > ol { margin-top: 0.35em; }
.prose ol { font-variant-numeric: lining-nums; }

.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
  color: var(--ink-soft);
  font-style: italic;
}
.prose blockquote > * + * { margin-top: 0.8em; }
.prose blockquote p { margin: 0; }

.prose code {
  font-family: var(--mono);
  font-size: 0.8em;
  background: var(--tint);
  padding: 0.12em 0.32em;
  border-radius: 3px;
}
.prose pre {
  overflow-x: auto;
  padding: 1rem 1.15rem;
  background: var(--tint);
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.55;
}
.prose pre code { background: none; padding: 0; font-size: inherit; border-radius: 0; }

.prose img { display: block; max-width: 100%; height: auto; margin-inline: auto; }

.prose hr {
  border: 0;
  height: auto;
  margin-block: 2.25em;
  text-align: center;
  color: var(--ink-soft);
}
.prose hr::before { content: "\25C7\2003\25C7\2003\25C7"; font-size: 0.8em; }

.table-wrap { overflow-x: auto; }
.prose table {
  border-collapse: collapse;
  font-size: 1.0625rem;
  font-variant-numeric: lining-nums tabular-nums;
}
.prose th, .prose td {
  padding: 0.45rem 1rem 0.45rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: baseline;
}
.prose th { font-weight: 600; border-bottom-color: var(--ink-soft); }

/* Math */
.katex { font-size: 1.07em; }
.katex-display {
  margin: 0;
  padding-block: 0.25em;
  overflow-x: auto;
  overflow-y: hidden;
}
.tex { font-family: var(--mono); font-size: 0.85em; color: var(--ink-soft); }

/* ---------- Medium screens ---------- */

@media (max-width: 70rem) {
  :root { --side-w: 16rem; --hang: 8.25rem; --hang-gap: 1.5rem; }
  .side-inner { padding-left: max(2.25rem, env(safe-area-inset-left, 0px)); padding-right: 1.5rem; }
  .main { padding-left: max(3rem, env(safe-area-inset-left, 0px)); }
}

/* ---------- Phones and narrow windows: the sidebar becomes a top band ---------- */

@media (max-width: 52rem) {
  :root { --step-0: 1.125rem; --step-1: 1.3125rem; --step-2: 1.5625rem; --step-3: 2rem; }

  .shell { display: block; }

  .side {
    position: static;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--side-edge);
  }
  .side-inner {
    gap: 1.1rem;
    padding-block: 1.4rem 1.2rem;
    padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
    padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
  }

  .brand-name { font-size: 1.375rem; }
  .brand-role { font-size: 1rem; }

  .side-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem 1.5rem;
  }
  .menu { display: flex; gap: 1.4rem; }
  .menu-link { font-size: 1.125rem; }
  .menu-link[aria-current="page"]::before { display: none; }
  .menu-link[aria-current="page"] {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
  }
  .recent { display: none; }
  .side-links { margin: 0; font-size: 0.9375rem; }

  .main {
    padding-block: 2.5rem 2rem;
    padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
    padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
  }

  .intro { margin-bottom: 3rem; }

  .entry, .year { grid-template-columns: minmax(0, 1fr); row-gap: 0.35rem; }
  .year { row-gap: 0.9rem; }
  .timeline { gap: 2rem; }

  .post-nav { grid-template-columns: minmax(0, 1fr); }
  .post-nav .later { grid-column: 1; text-align: left; }

  .foot { margin-top: 3.5rem; }
}

/* Desktop only: menu and links stack in the sidebar. */
@media (min-width: 52.0625rem) {
  .side-nav { display: contents; }
}

@media print {
  .side, .post-nav, .skip { display: none; }
  .shell { display: block; }
  .main { padding: 0; }
}
