:root {
  --paper: #f4f0e8;
  --paper-deep: #e7e0d4;
  --surface: #fbf9f4;
  --surface-soft: #ece5da;
  --ink: #201f1b;
  --muted: #6d685f;
  --brick: #a64330;
  --hairline: #918b80;
  --line: #918b80;
  --blue: #a64330;
  --blue-dark: #7e3023;
  --green: #2f855a;
  --coral: #a64330;
  --amber: #b7791f;
  --on-accent: #ffffff;
  --success-foreground: #235f3e;
  --visibility-public-foreground: #235f3e;
  --visibility-private-foreground: #744b12;
  --notice-foreground: #5f5a52;
  --shadow: 0 16px 40px rgba(31, 41, 55, 0.08);
  --header-background: rgba(244, 240, 232, 0.94);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --control-height: 48px;
  --compact-control-height: 44px;
  --prominent-control-height: 52px;
  --content-width: 1180px;
  --reading-width: 72ch;
  --focus-ring: 0 0 0 2px var(--paper), 0 0 0 4px var(--blue);
  --display-font: Georgia, "Noto Serif KR", "Times New Roman", serif;
  --control-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
  max-width: 100%;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--control-font);
}

@supports not (overflow: clip) {
  html,
  body {
    overflow-x: hidden;
  }
}

body.dark-mode {
  --paper: #171714;
  --paper-deep: #22211d;
  --surface: #1d1c19;
  --surface-soft: #2a2823;
  --ink: #f2ede3;
  --muted: #b9b0a3;
  --brick: #df8069;
  --hairline: #716a60;
  --line: #716a60;
  --blue: #df8069;
  --blue-dark: #f0a08d;
  --on-accent: #201f1b;
  --success-foreground: #91d1ad;
  --visibility-public-foreground: #91d1ad;
  --visibility-private-foreground: #e6bd78;
  --notice-foreground: #b9b0a3;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.26);
  --header-background: rgba(23, 23, 20, 0.94);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.skip-link {
  position: fixed;
  min-height: var(--control-height);
  top: var(--space-2);
  left: var(--space-2);
  z-index: 30;
  padding: var(--space-2) var(--space-3);
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  transform: translateY(-160%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
}

.app-shell,
.site-header,
.main-wrap,
.panel,
.write-controls,
.cornell-note,
.markdown-body {
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--header-background);
  backdrop-filter: blur(14px);
  transition: transform 180ms ease;
  will-change: transform;
}

.site-header.site-header-hidden {
  transform: translateY(calc(-100% - 2px));
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: min(var(--content-width), calc(100% - var(--space-8)));
  margin: 0 auto;
  padding: 14px 0;
}

.archive-utility {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 32px;
  padding: 4px max(var(--space-4), calc((100% - var(--content-width)) / 2));
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-family: var(--control-font);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 3px double var(--ink);
}

.archive-wordmark {
  justify-self: start;
  font-family: var(--display-font);
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  letter-spacing: -0.055em;
}

.archive-wordmark-accent {
  color: var(--brick);
  font-style: italic;
}

.archive-masthead .nav-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-self: end;
}

.archive-masthead-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-self: end;
  gap: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-height);
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--coral);
  font-weight: 900;
}

.nav-actions,
.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 16px;
  font-weight: 700;
  line-height: 1.25;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 8px 0 10px;
  font-size: 0.86rem;
  font-weight: 800;
}

.language-control select {
  min-width: 88px;
  height: calc(var(--control-height) - 2px);
  min-height: calc(var(--control-height) - 2px);
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.sort-control select {
  min-width: var(--control-height);
  min-height: var(--control-height);
}

.button.primary,
.nav-link.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--on-accent);
}

.button.primary:hover,
.nav-link.primary:hover {
  background: var(--blue-dark);
}

.button.ghost,
.nav-link.ghost {
  background: transparent;
}

.button.danger {
  border-color: color-mix(in srgb, var(--brick) 35%, transparent);
  color: var(--brick);
}

.button.danger.reset-note-button {
  margin-left: auto;
  border-color: #dc2626;
  background: #dc2626;
  color: white;
}

.button.danger.reset-note-button:hover {
  background: #b91c1c;
}

.button.small {
  min-width: var(--compact-control-height);
  min-height: var(--compact-control-height);
  padding: 6px 10px;
  font-size: 0.86rem;
}

.menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--compact-control-height);
  height: var(--compact-control-height);
  min-width: var(--compact-control-height);
  min-height: var(--compact-control-height);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.25rem;
}

.nav-link.is-current {
  border-color: var(--blue);
  box-shadow: inset 0 -2px 0 var(--blue);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.user-box {
  position: relative;
}

.avatar-button {
  display: grid;
  width: var(--compact-control-height);
  height: var(--compact-control-height);
  min-width: var(--compact-control-height);
  min-height: var(--compact-control-height);
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  padding: 0;
}

.avatar-button img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  min-width: 190px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
  box-shadow: var(--shadow);
}

.main-wrap {
  width: min(var(--content-width), calc(100% - var(--space-8)));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.worktop {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 24px;
  align-items: start;
}

.write-wrap,
.write-form {
  display: grid;
  gap: 20px;
}

.write-heading {
  display: grid;
  gap: 4px;
}

.write-controls {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 10px 28px rgba(31, 41, 55, 0.05);
}

.page-band {
  display: grid;
  gap: 20px;
}

.page-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-actions-primary,
.view-actions-secondary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-quick-nav {
  display: flex;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.section-quick-nav a {
  display: inline-flex;
  min-height: var(--control-height);
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--blue-dark);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.profile-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: end;
}

.profile-panel h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.profile-panel-copy p:last-child {
  margin-bottom: 0;
}

.profile-form {
  display: grid;
  gap: 10px;
}

.profile-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.compact-status {
  min-height: 18px;
  margin-bottom: 0;
  font-size: 0.86rem;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--coral);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: var(--space-2);
  font-size: 3rem;
  line-height: 1.02;
  letter-spacing: 0;
}

.page-band h1,
.page-band h2,
.archive-heading,
.markdown-body,
.cornell-note-preview {
  font-family: var(--display-font);
}

:lang(en) :where(.archive-lead h1, .archive-writing-head h1, .archive-article-head h1, .cornell-title h2) {
  letter-spacing: -0.045em;
}

:lang(ko) :where(.archive-lead h1, .archive-writing-head h1, .archive-article-head h1, .cornell-title h2) {
  letter-spacing: 0;
  line-height: 1.12;
  word-break: keep-all;
}

html:lang(ko) body[data-page] :where(
  .archive-utility > [data-i18n],
  .archive-utility .language-control > [data-i18n],
  .eyebrow,
  .archive-catalog-head,
  .archive-reading-index h2,
  .field label,
  .write-section-toggle > [data-i18n],
  .write-section-toggle [data-write-section-status],
  .editor-section-heading > [data-i18n],
  .archive-reading-edition .cornell-section h3
) {
  letter-spacing: 0;
  line-height: 1.5;
  word-break: keep-all;
}

.lead {
  max-width: var(--reading-width);
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.45fr);
  gap: 12px;
}

.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  align-self: start;
  min-width: 0;
  padding: 8px 8px 6px;
}

.markdown-toolbar-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.markdown-toolbar-more {
  position: relative;
}

.markdown-toolbar-more > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  cursor: pointer;
}

.markdown-toolbar-more > summary::-webkit-details-marker {
  display: none;
}

.markdown-toolbar-more-panel {
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding-top: 7px;
}

.markdown-toolbar-more[open] > .markdown-toolbar-more-panel {
  display: flex;
}

.markdown-toolbar-more:not([open]) > .markdown-toolbar-more-panel {
  display: none;
}

.markdown-toolbar .button.small {
  min-width: var(--compact-control-height);
  min-height: var(--compact-control-height);
  border-color: var(--line);
  background: var(--surface);
  padding: 7px 11px;
  line-height: 1;
  white-space: nowrap;
}

.field {
  display: grid;
  gap: 7px;
}

.field-label-row {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--compact-control-height);
  gap: var(--space-2);
  min-width: 0;
}

.editor-section-title {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.field label,
.section-label {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.field input,
.field textarea,
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
  line-height: 1.5;
  outline: none;
}

.field input {
  min-height: var(--control-height);
}

.search-input {
  min-height: var(--prominent-control-height);
}

fieldset.field {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.field textarea {
  min-height: 118px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}

.field-hint {
  color: var(--muted);
  font-size: 0.84rem;
}

.visibility-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 10px;
  min-height: var(--control-height);
  cursor: pointer;
}

.visibility-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.visibility-switch-track {
  display: inline-flex;
  width: 52px;
  height: 28px;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 2px;
  transition: background 160ms ease, border-color 160ms ease;
}

.visibility-switch-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(31, 41, 55, 0.28);
  transition: transform 160ms ease;
}

.visibility-switch input:checked + .visibility-switch-track {
  border-color: var(--blue);
  background: var(--blue);
}

.visibility-switch input:checked + .visibility-switch-track .visibility-switch-thumb {
  transform: translateX(24px);
}

.visibility-switch input:focus-visible + .visibility-switch-track {
  outline: 3px solid color-mix(in srgb, var(--blue) 24%, transparent);
  outline-offset: 2px;
}

.visibility-switch:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.72;
}

.visibility-switch-state {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.form-actions,
.search-form {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}

.search-form > .button {
  min-height: var(--prominent-control-height);
}

.archive-lead .form-actions,
.archive-lead .search-form {
  margin-top: var(--space-2);
}

.write-submit-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.write-submit-bar .status {
  grid-column: 1;
  margin: 0;
}

.write-submit-bar .button {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: var(--control-height);
}

.save-status:not(:empty) {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-soft);
}

.save-status[data-tone="success"] {
  border-color: rgba(22, 163, 74, 0.28);
  background: rgba(22, 163, 74, 0.08);
  font-weight: 800;
}

.save-status[data-tone="error"] {
  border-color: rgba(184, 50, 36, 0.28);
  background: rgba(184, 50, 36, 0.08);
}

.write-secondary-actions > summary {
  display: flex;
  min-height: var(--control-height);
  align-items: center;
  color: var(--blue-dark);
  cursor: pointer;
  font-weight: 800;
}

.write-secondary-actions > .form-actions {
  margin-top: 10px;
}

@media screen and (min-width: 861px) {
  .write-secondary-actions > summary {
    display: none;
  }

  .write-secondary-actions > .form-actions {
    display: flex;
  }
}

.anonymous-password-fields {
  display: grid;
  gap: 8px;
}

.site-footer {
  width: min(var(--content-width), calc(100% - var(--space-8)));
  margin: 0 auto;
  padding: 22px 0 34px;
  color: var(--muted);
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: center;
}

.privacy-link {
  color: var(--blue-dark);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.note-meta a,
.privacy-link {
  display: inline-flex;
  min-width: var(--control-height);
  min-height: var(--control-height);
  align-items: center;
}

.privacy-link:hover {
  color: var(--blue);
}

.modal-dialog {
  width: min(420px, calc(100% - 32px));
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
}

.modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.44);
}

.modal-dialog:not([open]):not(.is-open) {
  display: none;
}

.modal-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin-bottom: 6px;
  font-size: 1.2rem;
}

.modal-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.privacy-policy-dialog {
  width: min(760px, calc(100% - 32px));
  max-height: min(84vh, 780px);
}

.privacy-policy-card {
  max-height: inherit;
  overflow: hidden;
}

.privacy-policy-card header {
  display: grid;
  gap: 6px;
}

.privacy-policy-content {
  display: grid;
  gap: 16px;
  max-height: min(58vh, 520px);
  overflow: auto;
  padding-right: 4px;
}

.privacy-policy-section {
  display: grid;
  gap: 6px;
}

.privacy-policy-section h3 {
  margin-bottom: 0;
  color: var(--blue-dark);
  font-size: 0.98rem;
}

.privacy-policy-section p {
  color: var(--ink);
}

.privacy-policy-actions {
  display: flex;
  justify-content: flex-end;
}

.password-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search-form {
  width: min(560px, 100%);
}

.list-toolbar {
  display: flex;
  gap: var(--space-3);
  align-items: stretch;
  justify-content: flex-end;
  width: min(760px, 100%);
  flex-wrap: wrap;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--prominent-control-height);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding-block: 0;
  padding-inline: var(--space-4);
  font-size: 0.9rem;
  font-weight: 800;
}

.sort-control select {
  min-width: 148px;
  min-height: var(--control-height);
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.list-toolbar .search-form {
  flex: 1 1 420px;
}

.search-input {
  flex: 1 1 260px;
}

.status {
  min-height: var(--control-height);
  padding: var(--space-4) 0;
  border-block: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.status:empty {
  display: none;
}

.status.error {
  color: var(--brick);
  border-color: var(--brick);
}

.status[data-tone="error"] {
  color: var(--brick);
  border-color: var(--brick);
}

.status[data-tone="success"] {
  color: var(--success-foreground);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 16px;
}

.note-card {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 12px;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 10px 28px rgba(31, 41, 55, 0.06);
}

.note-card-primary {
  display: grid;
  grid-template-rows: auto auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.note-card h3 {
  min-width: 0;
  margin-bottom: 0;
  font-size: 1.12rem;
  line-height: 1.3;
}

.note-card-title-link {
  display: -webkit-box;
  min-width: var(--control-height);
  min-height: var(--control-height);
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.note-card-fields {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.note-card p {
  margin-bottom: 0;
}

.note-card-field {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.note-card-field-label {
  display: block;
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.note-card-field-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.public {
  border-color: rgba(47, 133, 90, 0.25);
  color: var(--visibility-public-foreground);
}

.pill.private {
  border-color: rgba(183, 121, 31, 0.28);
  color: var(--visibility-private-foreground);
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
}

.archive-catalog {
  display: block;
  counter-reset: archive-entry;
  border-top: 1px solid var(--ink);
}

.archive-catalog-head,
.archive-entry {
  display: grid;
  grid-template-columns: 3rem minmax(14rem, 1.4fr) minmax(10rem, 0.8fr) minmax(7rem, 0.5fr) auto;
  grid-template-areas: "number primary cues meta actions";
  gap: var(--space-4);
  align-items: center;
}

.archive-catalog-head {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-entry {
  min-height: 112px;
  grid-template-rows: none;
  padding: var(--space-4) 0;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  counter-increment: archive-entry;
}

.archive-entry::before {
  grid-area: number;
  content: counter(archive-entry, decimal-leading-zero);
  color: var(--brick);
  font-weight: 900;
}

.archive-entry-primary {
  grid-area: primary;
  min-width: 0;
}

.archive-entry-kicker {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
}

.archive-entry-kicker > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.archive-entry-primary h3 {
  margin: var(--space-2) 0;
  font-family: var(--display-font);
}

.archive-entry-author {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.archive-entry-cues {
  grid-area: cues;
  min-width: 0;
}

.archive-entry-meta {
  grid-area: meta;
  min-width: 0;
  display: grid;
  gap: var(--space-1);
}

.archive-entry-actions {
  grid-area: actions;
  margin-top: 0;
  justify-content: flex-end;
}

.home-layout .archive-entry {
  grid-template-columns: 2.5rem minmax(0, 1fr);
  grid-template-areas:
    "number primary"
    ". cues"
    ". meta"
    ". actions";
}

.home-layout .archive-entry-actions {
  justify-content: flex-start;
}

.cornell-note {
  display: grid;
  grid-template-columns: minmax(170px, 0.38fr) minmax(0, 1fr);
  overflow: hidden;
  border: 2px solid #253245;
  border-radius: 8px;
  background:
    linear-gradient(#ffffff 31px, rgba(37, 50, 69, 0.05) 32px),
    #ffffff;
  background-size: 100% 32px;
  box-shadow: var(--shadow);
}

.cornell-note,
.cornell-title,
.cornell-section,
.cornell-side,
.cornell-main,
.cornell-bottom,
.markdown-field-shell,
.markdown-field-preview {
  min-width: 0;
}

.cornell-editor {
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  min-height: 760px;
  overflow: visible;
}

.cornell-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid #253245;
  background: #f7fbff;
  padding: 14px 16px;
}

.cornell-editor-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 27.5rem);
  align-items: end;
  gap: var(--space-6);
  padding: var(--space-6);
}

.cornell-title-field input {
  height: var(--prominent-control-height);
  min-height: var(--prominent-control-height);
  padding: 0 16px;
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.25;
}

.cornell-editor-meta {
  align-items: end;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.55fr);
}

.note-info-disclosure {
  min-width: 0;
}

.note-info-disclosure > summary {
  display: none;
}

.cornell-title h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.cornell-metadata {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.cornell-side {
  display: grid;
  grid-column: 1;
  grid-row: 2;
  align-content: start;
  border-right: 2px solid #253245;
}

.cornell-main {
  grid-column: 2;
  grid-row: 2;
  min-height: 390px;
}

.cornell-editor .cornell-main {
  min-height: 520px;
}

.cornell-bottom {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 2px solid #253245;
}

.cornell-section {
  min-height: 150px;
  padding: 16px;
}

.cornell-editor .cornell-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.editor-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.editor-section-heading label,
.editor-section-title label {
  color: var(--blue-dark);
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-section-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.write-section-toggle {
  display: flex;
  min-width: 0;
  min-height: var(--control-height);
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  padding: 0;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.write-section-toggle [data-write-section-status] {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.field label,
.write-section-toggle strong,
.write-section-toggle [data-write-section-status] {
  overflow-wrap: normal;
  word-break: keep-all;
}

.write-section-navigation {
  display: none;
}

.editor-section-heading span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}

.field-help {
  position: static;
  display: inline-grid;
  flex: 0 0 var(--compact-control-height);
  line-height: 1;
}

.field-help summary {
  display: grid;
  width: var(--compact-control-height);
  height: var(--compact-control-height);
  min-width: var(--compact-control-height);
  min-height: var(--compact-control-height);
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  padding: 0;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.field-help-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--blue) 8%, transparent);
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.field-help summary::-webkit-details-marker {
  display: none;
}

.field-help summary::marker {
  font-size: 0;
}

.field-help[open] .field-help-icon,
.field-help summary:hover .field-help-icon {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 14%, transparent);
}

.field-help-panel {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  z-index: 16;
  width: min(320px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-align: left;
  text-transform: none;
}

.cornell-editor-meta > .field:last-child .field-help-panel {
  inset-inline-start: auto;
  inset-inline-end: 0;
}

.field-help-panel p {
  margin-bottom: 8px;
}

.field-help-panel p:last-child {
  margin-bottom: 0;
}

.field-help-example {
  color: var(--muted);
}

.field-help-example span:last-child {
  color: var(--ink);
  font-weight: 800;
}

.cornell-editor textarea {
  min-height: 160px;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: var(--space-4);
  resize: vertical;
  line-height: 1.6;
  outline: none;
}

.markdown-field-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 160px;
  height: 100%;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
}

.markdown-field-shell:focus-within {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 5%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 24%, transparent);
}

.markdown-field-shell > textarea,
.markdown-field-shell > .markdown-field-preview {
  grid-area: 2 / 1;
}

.markdown-field-preview {
  min-height: 160px;
  overflow: auto;
  border-radius: 0;
  padding: var(--space-4);
  background: transparent;
  cursor: text;
  line-height: 1.6;
}

.markdown-field-preview.hidden {
  display: none;
}

.markdown-field-preview.empty::before {
  content: attr(data-empty-label);
  color: var(--muted);
}

.keyword-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-content: flex-start;
}

.keyword-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--blue) 20%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 8%, transparent);
  color: var(--blue-dark);
  padding: 4px 9px;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cornell-editor textarea.hidden {
  display: none;
}

.cornell-editor .markdown-body {
  font-size: 0.98rem;
}

.cornell-editor .cornell-main textarea {
  min-height: 456px;
}

.cornell-editor .cornell-main .markdown-field-shell,
.cornell-editor .cornell-main .markdown-field-preview {
  min-height: 456px;
}

.cornell-editor .cornell-side textarea {
  min-height: 210px;
}

.cornell-editor .cornell-side .markdown-field-shell,
.cornell-editor .cornell-side .markdown-field-preview {
  min-height: 210px;
}

.cornell-editor .cornell-bottom textarea {
  min-height: 178px;
}

.cornell-editor .cornell-bottom .markdown-field-shell,
.cornell-editor .cornell-bottom .markdown-field-preview {
  min-height: 178px;
}

.cornell-editor textarea:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.cornell-section + .cornell-section {
  border-top: 1px solid var(--line);
}

.cornell-bottom .cornell-section + .cornell-section {
  border-top: 0;
  border-left: 2px solid #253245;
}

.cornell-section h3 {
  margin-bottom: 10px;
  color: var(--blue-dark);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cornell-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.cornell-section-header h3 {
  margin-bottom: 0;
}

.markdown-body.section-collapsed {
  display: none;
}

.markdown-body.section-collapsed {
  min-height: auto;
}

.cornell-section {
  scroll-margin-top: 76px;
}

.markdown-body {
  color: var(--ink);
  line-height: 1.6;
  overflow-wrap: break-word;
}

.markdown-body a {
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.markdown-body a:hover,
.markdown-body a:focus-visible {
  color: var(--blue);
}

.markdown-body :where(p, ul, ol, pre, blockquote, table) {
  margin-block: 0 var(--space-4);
}

.markdown-body > p,
.markdown-body > ul,
.markdown-body > ol,
.markdown-body > blockquote {
  max-width: var(--reading-width);
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.35rem;
}

.markdown-body li + li {
  margin-top: 4px;
}

.markdown-body blockquote {
  margin-left: 0;
  border-left: 4px solid var(--coral);
  border-radius: 0 8px 8px 0;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 10px 12px;
}

.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.markdown-body code {
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 2px 5px;
}

.markdown-body pre {
  position: relative;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: #101827;
  color: #e5edf7;
  padding: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 24px rgba(15, 23, 42, 0.12);
  line-height: 1.7;
}

.markdown-code-block {
  scrollbar-color: rgba(148, 163, 184, 0.7) rgba(15, 23, 42, 0.32);
}

.markdown-code-copy {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 1;
  display: inline-flex;
  min-width: var(--compact-control-height);
  min-height: var(--compact-control-height);
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(203, 213, 225, 0.45);
  border-radius: 6px;
  background: #1e293b;
  color: #f8fafc;
  padding: 0 var(--space-3);
  font: 700 0.78rem/1 var(--control-font);
  cursor: pointer;
}

.markdown-code-copy:hover,
.markdown-code-copy:focus-visible {
  border-color: #f8fafc;
  background: #334155;
}

.markdown-code-copy[data-copy-state="success"] {
  border-color: #86efac;
  color: #dcfce7;
}

.markdown-code-copy[data-copy-state="error"] {
  border-color: #fca5a5;
  color: #fee2e2;
}

.markdown-body pre[data-language] {
  padding-top: 38px;
}

.markdown-body pre[data-language]::before {
  content: attr(data-language);
  position: absolute;
  top: 9px;
  right: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.84);
  color: #cbd5e1;
  padding: 2px 8px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.4;
  pointer-events: none;
  text-transform: lowercase;
}

.markdown-body pre code {
  display: block;
  width: max-content;
  min-width: 100%;
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92rem;
  line-height: inherit;
  white-space: pre;
  tab-size: 2;
}

.status a {
  display: inline-flex;
  min-width: var(--control-height);
  min-height: var(--control-height);
  align-items: center;
}

.mermaid-diagram,
.math-block {
  width: 100%;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.mermaid-diagram {
  overflow: clip;
}

.mermaid-diagram svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

.mermaid-diagram pre {
  margin-bottom: 0;
}

.math-block,
.math-inline {
  overflow: clip;
}

.math-inline {
  display: inline-block;
  max-width: 100%;
  vertical-align: -0.08em;
}

.math-inline[data-fit="true"] {
  width: var(--fit-width);
  height: var(--fit-height);
}

.math-inline[data-fit="true"] > .katex {
  display: block;
  transform: scale(var(--fit-scale));
  transform-origin: left top;
}

.math-block {
  display: block;
  text-align: center;
}

.math-block .katex-display {
  margin: 0;
}

.math-block[data-fit="true"] .katex-display {
  height: var(--fit-height);
}

.math-block[data-fit="true"] .katex-display > .katex {
  transform: scale(var(--fit-scale));
  transform-origin: center top;
}

.youtube-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101827;
  margin-bottom: 12px;
}

.youtube-embed iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.pdf-youtube-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  background: #ffffff;
  color: #111827;
  text-decoration: none;
}

.pdf-youtube-card::before {
  content: "YouTube";
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  background: #d22f27;
  color: #ffffff;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.pdf-youtube-url {
  overflow-wrap: anywhere;
  color: #1f5fbf;
  font-size: 0.86rem;
}

.pdf-mermaid-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.markdown-render-error {
  border-color: rgba(223, 107, 87, 0.4);
  background: rgba(223, 107, 87, 0.08);
  color: #b83224;
  font-weight: 800;
}

.markdown-body img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(70vh, 720px);
  object-fit: contain;
  border-radius: 6px;
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--surface-soft);
  font-weight: 800;
}

.empty-state {
  padding: var(--space-8);
  border: 3px double var(--ink);
  color: var(--notice-foreground);
  background: var(--paper-deep);
  font-family: var(--display-font);
  text-align: center;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  gap: 24px;
  align-items: start;
}

.archive-writing-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding-bottom: var(--space-4);
  border-bottom: 3px double var(--ink);
}

.archive-writing-head h1 {
  font-family: var(--display-font);
}

.archive-folio {
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.archive-folio .cornell-title {
  border-bottom: 3px double var(--ink);
  background: var(--paper);
}

.archive-folio .cornell-side {
  border-right-color: var(--ink);
  background: var(--paper-deep);
}

.archive-folio .cornell-bottom {
  border-top-color: var(--ink);
  background: var(--paper-deep);
}

.archive-folio .cornell-side .write-section-toggle,
.archive-folio .cornell-bottom .write-section-toggle,
.archive-folio .cornell-side .write-section-toggle [data-write-section-status],
.archive-folio .cornell-bottom .write-section-toggle [data-write-section-status],
.archive-folio .cornell-side .editor-section-heading > span,
.archive-folio .cornell-bottom .editor-section-heading > span {
  color: var(--ink);
}

.archive-folio .editor-section-title > button {
  font-family: var(--display-font);
}

.archive-folio [data-write-section="recordMarkdown"] .write-section-toggle::before {
  content: "I. ";
  color: var(--brick);
}

.archive-folio [data-write-section="reduceMarkdown"] .write-section-toggle::before {
  content: "II. ";
  color: var(--brick);
}

.archive-folio [data-write-section="reciteMarkdown"] .write-section-toggle::before {
  content: "III. ";
  color: var(--brick);
}

.archive-folio [data-write-section="reflectMarkdown"] .write-section-toggle::before {
  content: "IV. ";
  color: var(--brick);
}

.archive-folio [data-write-section="reviewMarkdown"] .write-section-toggle::before {
  content: "V. ";
  color: var(--brick);
}

.archive-folio textarea {
  background-image: linear-gradient(transparent calc(1.6em - 1px), color-mix(in srgb, var(--hairline) 28%, transparent) 1.6em);
  background-size: 100% 1.6em;
  line-height: 1.6;
}

@media screen {
  .archive-article-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 3px double var(--ink);
  }

  .archive-article-head h1 {
    font-family: var(--display-font);
    font-size: clamp(2rem, 5vw, 4.5rem);
  }

  .archive-article-actions {
    align-self: end;
    gap: var(--space-3);
  }

  .archive-reading-edition {
    --reading-sticky-offset: 152px;
  }

  .archive-reading-layout {
    display: grid;
    grid-template-columns: minmax(9rem, 0.28fr) minmax(0, 1fr);
    align-items: start;
    gap: clamp(var(--space-6), 5vw, var(--space-12));
    padding-top: var(--space-6);
  }

  .archive-reading-index-nav {
    position: sticky;
    top: var(--reading-sticky-offset);
    max-height: calc(100dvh - var(--reading-sticky-offset) - var(--space-4));
    align-self: start;
    display: grid;
    gap: 0;
    counter-reset: reading-section;
    border-block: 0;
    background: transparent;
    margin-block: 0;
    padding-block: 0;
    overflow: visible;
    overflow-y: auto;
  }

  .archive-reading-index-label {
    margin: 0 0 var(--space-2);
    color: var(--brick);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .archive-reading-index-nav > a {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    min-height: var(--compact-control-height);
    flex: none;
    gap: var(--space-2);
    border: 0;
    border-left: 2px solid var(--hairline);
    border-radius: 0;
    background: transparent;
    padding: var(--space-2);
    text-align: left;
  }

  .archive-reading-index-nav > a::before {
    counter-increment: reading-section;
    content: "0" counter(reading-section);
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }

  .archive-reading-index-nav > a[aria-current="location"] {
    border-left-color: var(--brick);
    background: var(--paper-deep);
    color: var(--brick);
  }

  .archive-reading-edition #noteMount {
    width: 100%;
    min-width: 0;
    max-width: 68ch;
  }

  .archive-reading-edition .cornell-note {
    display: flex;
    flex-direction: column;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    margin-top: 0;
  }

  .archive-reading-edition .cornell-title {
    display: none;
  }

  .archive-reading-edition .cornell-side,
  .archive-reading-edition .cornell-bottom {
    display: contents;
  }

  .archive-reading-edition .cornell-section {
    scroll-margin-top: var(--reading-sticky-offset);
    min-height: 0;
    border: 0;
    border-bottom: 1px solid var(--hairline);
    padding: var(--space-6) 0 var(--space-8);
  }

  .archive-reading-edition .cornell-main {
    min-height: 0;
  }

  .archive-reading-edition .cornell-record { order: 1; }
  .archive-reading-edition .cornell-reduce { order: 2; }
  .archive-reading-edition .cornell-recite { order: 3; }
  .archive-reading-edition .cornell-reflect { order: 4; }
  .archive-reading-edition .cornell-review {
    order: 5;
    border-bottom: 0;
  }

  .archive-reading-edition .cornell-bottom .cornell-section + .cornell-section {
    border-left: 0;
  }

  .archive-reading-edition .cornell-section-header button {
    display: none;
  }

  .archive-reading-edition .markdown-body.section-collapsed {
    display: block;
  }

  .archive-reading-edition .cornell-section h3 {
    color: var(--brick);
    font-family: var(--control-font);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .archive-reading-edition .markdown-body {
    font-family: var(--display-font);
    font-size: 1.05rem;
    line-height: 1.6;
  }

  .archive-reading-edition .markdown-code-block {
    padding-top: calc(var(--compact-control-height) + var(--space-4));
  }

  .archive-reading-edition .markdown-body pre[data-language]::before {
    right: auto;
    left: 12px;
  }
}

.archive-front-page {
  display: block;
  padding-block: var(--space-12);
}

.archive-lead {
  display: grid;
  gap: var(--space-4);
  padding-bottom: var(--space-8);
  border-bottom: 3px double var(--ink);
}

.archive-lead h1 {
  max-width: 18ch;
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(2.7rem, 7vw, 6.6rem);
}

.archive-lead .lead {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.6;
}

.archive-home-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.28fr);
}

.archive-selection {
  min-width: 0;
  padding: var(--space-8) var(--space-8) 0 0;
  border-right: 1px solid var(--hairline);
}

.archive-section-rule {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--ink);
}

.archive-reading-index {
  padding: var(--space-8) 0 0 var(--space-6);
  background: var(--paper-deep);
}

.archive-reading-index h2 {
  margin-top: 0;
  font-family: var(--display-font);
}

.archive-reading-index ol {
  margin: 0;
  padding-left: var(--space-6);
}

.archive-reading-index li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--hairline);
}

.archive-reading-index .subject-ranking {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-reading-index .subject-ranking li {
  padding: 0;
  border-bottom: 0;
}

.subject-ranking-link {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  min-height: var(--control-height);
  align-items: center;
  gap: var(--space-2);
  border-bottom: 1px solid var(--hairline);
  color: inherit;
  text-decoration: none;
}

.subject-ranking-link:hover {
  color: var(--accent);
}

.subject-ranking-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.subject-ranking-rank,
.subject-ranking-count,
.subject-ranking-status {
  color: var(--muted);
}

.subject-ranking-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-filter {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.archive-reading-index blockquote {
  margin: var(--space-8) 0;
  padding: var(--space-6) 0;
  border-block: 3px double var(--ink);
  font-family: var(--display-font);
  font-style: italic;
}

body[data-page="home"] .archive-entry:first-child .archive-entry-primary h3 {
  font-size: clamp(1.6rem, 3vw, 2.5rem);
}

.compact-preview {
  transform-origin: top center;
}

.full-screen-mode .site-header,
.full-screen-mode .write-heading,
.full-screen-mode .preview-band {
  display: none;
}

.full-screen-mode .worktop {
  grid-template-columns: 1fr;
}

.full-screen-mode .main-wrap {
  width: min(1380px, calc(100% - 24px));
  padding-top: 12px;
}

.full-screen-mode .write-controls {
  position: sticky;
  bottom: 12px;
  z-index: 12;
}

body.dark-mode .cornell-note {
  border-color: var(--line);
  background:
    linear-gradient(var(--surface) 31px, color-mix(in srgb, var(--line) 22%, transparent) 32px),
    var(--surface);
  background-size: 100% 32px;
}

body.dark-mode .cornell-title {
  border-bottom-color: var(--line);
  background: var(--surface-soft);
}

body.dark-mode .cornell-side {
  border-right-color: var(--line);
}

body.dark-mode .cornell-bottom {
  border-top-color: var(--line);
}

body.dark-mode .cornell-bottom .cornell-section + .cornell-section {
  border-left-color: var(--line);
}

@media screen and (max-width: 860px) {
  .archive-reading-edition {
    --reading-sticky-offset: 76px;
  }

  .archive-reading-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
    padding-top: var(--space-4);
  }

  .archive-reading-edition .archive-reading-index-nav {
    position: static;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    max-height: none;
    overflow: visible;
  }

  .archive-reading-edition .archive-reading-index-label {
    display: none;
  }

  .archive-reading-edition .archive-reading-index-nav > a {
    display: flex;
    min-width: 0;
    min-height: var(--compact-control-height);
    justify-content: center;
    border-left: 0;
    border-bottom: 2px solid var(--hairline);
    padding-inline: 2px;
    overflow: hidden;
    font-size: 0.75rem;
    letter-spacing: 0;
    text-align: center;
  }

  .archive-reading-edition .archive-reading-index-nav > a::before {
    display: none;
  }

  .archive-reading-edition .archive-reading-index-nav > a[aria-current="location"] {
    border-bottom-color: var(--brick);
  }

  .site-header {
    min-height: 64px;
  }

  .nav-shell,
  .page-title-row,
  .profile-panel,
  .home-layout,
  .worktop {
    grid-template-columns: 1fr;
  }

  .nav-shell {
    position: relative;
    flex-direction: row;
    align-items: center;
    width: min(var(--content-width), calc(100% - var(--space-8)));
    min-height: 63px;
    padding: 0;
  }

  .menu-button {
    display: inline-flex;
    flex: 0 0 var(--compact-control-height);
  }

  #siteMenu[hidden] {
    display: none;
  }

  #siteMenu:not([hidden]) {
    position: absolute;
    top: 100%;
    left: calc(var(--space-4) * -1);
    z-index: 1;
    display: grid;
    width: 100vw;
    gap: var(--space-2);
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    padding: var(--space-3) var(--space-4) var(--space-4);
    box-shadow: var(--shadow);
  }

  #siteMenu .nav-link,
  #siteMenu .language-control,
  #siteMenu .auth-area {
    width: 100%;
  }

  #siteMenu .auth-area {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
  }

  #siteMenu .language-control {
    display: inline-flex;
  }

  .nav-actions,
  .auth-area {
    justify-content: flex-start;
  }

  .list-toolbar {
    justify-content: flex-start;
    width: 100%;
  }

  .list-toolbar .search-form {
    flex-basis: 100%;
    width: 100%;
  }

  h1 {
    font-size: 2.2rem;
  }

  .cornell-note {
    grid-template-columns: 1fr;
  }

  .cornell-note .cornell-record {
    grid-column: 1 / -1;
    grid-row: auto;
    order: 1;
    border-bottom: 2px solid #253245;
  }

  .cornell-note .cornell-side {
    grid-column: 1 / -1;
    grid-row: auto;
    order: 2;
  }

  .cornell-note .cornell-bottom {
    grid-column: 1 / -1;
    grid-row: auto;
    order: 3;
    border-top: 0;
  }

  body.dark-mode .cornell-note .cornell-record {
    border-bottom-color: var(--line);
  }

  .cornell-editor {
    min-height: auto;
    display: flex;
    flex-direction: column;
  }

  .cornell-editor-title {
    order: 1;
  }

  .cornell-editor .cornell-editor-record {
    order: 2;
  }

  .cornell-editor .cornell-editor-side,
  .cornell-editor .cornell-editor-bottom {
    display: contents;
  }

  .cornell-editor .cornell-editor-reduce {
    order: 3;
  }

  .cornell-editor .cornell-editor-recite {
    order: 4;
  }

  .cornell-editor .cornell-editor-reflect {
    order: 5;
  }

  .cornell-editor .cornell-editor-review {
    order: 6;
  }

  .cornell-editor-title {
    display: block;
  }

  .note-info-disclosure {
    margin-top: 12px;
  }

  .note-info-disclosure > summary {
    display: flex;
    min-height: 44px;
    align-items: center;
    color: var(--blue-dark);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 800;
  }

  .note-info-disclosure[open] > summary {
    margin-bottom: 10px;
  }

  .cornell-editor-meta {
    grid-template-columns: 1fr;
  }

  .cornell-side {
    border-right: 0;
    border-bottom: 0;
  }

  body.dark-mode .cornell-side {
    border-bottom-color: var(--line);
  }

  .cornell-editor .cornell-main {
    border-bottom: 0;
  }

  body.dark-mode .cornell-editor .cornell-main {
    border-bottom-color: var(--line);
  }

  .cornell-bottom {
    grid-template-columns: 1fr;
  }

  .cornell-editor .cornell-bottom {
    border-top: 0;
  }

  .cornell-bottom .cornell-section + .cornell-section {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  body.dark-mode .cornell-bottom .cornell-section + .cornell-section {
    border-top-color: var(--line);
  }

  .metadata-grid {
    grid-template-columns: 1fr;
  }

  .cornell-editor [data-write-section] {
    width: 100%;
    min-height: 0;
    border-bottom: 1px solid var(--line);
  }

  body.responsive-ui-ready .cornell-editor [data-write-section].is-write-section-active {
    display: block;
  }

  .field-label-row,
  .editor-section-title {
    width: 100%;
  }

  .write-section-toggle {
    width: auto;
    min-height: 44px;
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  .write-section-toggle [data-write-section-status] {
    min-width: 0;
    margin-inline-start: auto;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .editor-section-title > .field-help {
    flex: 0 0 var(--compact-control-height);
  }

  .field-help-panel {
    width: min(320px, 100%);
    max-width: 100%;
  }

  .editor-section-heading > [data-i18n^="write."][data-i18n$="Hint"] {
    display: none;
  }

  body.responsive-ui-ready .write-section-navigation {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
  }

  .write-section-navigation .button {
    min-height: 44px;
  }

  body.responsive-ui-ready .cornell-editor [data-write-section] > .write-section-body {
    display: none;
  }

  body.responsive-ui-ready .cornell-editor [data-write-section].is-write-section-active > .write-section-body {
    display: block;
  }

  body.responsive-ui-ready .cornell-editor [data-write-section] .write-section-body,
  body.responsive-ui-ready .cornell-editor [data-write-section][data-write-section] textarea,
  body.responsive-ui-ready .cornell-editor [data-write-section][data-write-section] .markdown-field-shell,
  body.responsive-ui-ready .cornell-editor [data-write-section][data-write-section] .markdown-field-preview {
    min-height: 0;
  }

  body.responsive-ui-ready .cornell-editor [data-write-section].is-write-section-active .write-section-body textarea,
  body.responsive-ui-ready .cornell-editor [data-write-section].is-write-section-active .write-section-body .markdown-field-shell,
  body.responsive-ui-ready .cornell-editor [data-write-section].is-write-section-active .write-section-body .markdown-field-preview {
    min-height: min(42vh, 360px);
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .form-actions {
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  }

  .write-submit-bar {
    position: sticky;
    bottom: 0;
    z-index: 14;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .write-submit-bar .button {
    min-width: var(--control-height);
  }

  .write-secondary-actions {
    margin-top: 12px;
  }

  .write-secondary-actions > summary {
    justify-content: space-between;
  }

  .write-secondary-actions:not([open]) > .form-actions {
    display: none;
  }

  .write-secondary-actions[open] > .form-actions {
    display: grid;
  }

  .button,
  .nav-link {
    min-width: 0;
    white-space: normal;
  }


  .archive-utility {
    display: none;
  }

  .archive-masthead {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 63px;
  }

  .archive-wordmark {
    justify-self: start;
    font-size: 1.25rem;
  }

  .archive-masthead-actions {
    display: flex;
    gap: 6px;
  }

  .archive-masthead-action {
    min-height: var(--control-height);
    padding-inline: 10px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .archive-home-columns {
    grid-template-columns: 1fr;
  }

  .archive-selection {
    padding-right: 0;
    border-right: 0;
  }

  .archive-reading-index {
    padding-left: 0;
  }

  .subject-filter {
    flex-wrap: wrap;
  }

  .archive-catalog-head {
    display: none;
  }

  .archive-entry,
  .home-layout .archive-entry {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    grid-template-areas:
      "number primary"
      ". cues"
      ". meta"
      ". actions";
    align-items: start;
  }

  .archive-entry-actions {
    justify-content: flex-start;
  }

  .archive-article-head {
    grid-template-columns: 1fr;
  }

  .archive-article-actions {
    justify-self: stretch;
  }
}

@media screen and (max-width: 520px) {
  .nav-shell {
    position: relative;
    width: min(100% - 26px, 100%);
    gap: 12px;
    padding: 0;
  }

  .nav-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .nav-actions > .nav-link,
  .nav-actions > .language-control,
  .nav-actions > .auth-area {
    width: 100%;
    min-width: 0;
  }

  body.is-authenticated .nav-shell {
    padding-right: 50px;
  }

  body.is-authenticated .nav-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.is-authenticated .nav-actions > .user-box,
  body.is-authenticated .nav-actions > .auth-area {
    position: absolute;
    top: 12px;
    right: 0;
    width: 38px;
  }

  body.is-authenticated .nav-actions > .language-control {
    display: none;
  }

  body.is-authenticated .auth-area {
    display: block;
  }

  body.is-authenticated .auth-area .user-box {
    display: block;
  }

  .nav-actions > .nav-link,
  .form-actions .button,
  .search-form .button {
    white-space: nowrap;
  }

  .language-control {
    justify-content: space-between;
    gap: 6px;
    padding-inline: 8px;
    font-size: 0.78rem;
  }

  .language-control select {
    min-width: 70px;
    width: min(76px, 50%);
  }

  .auth-area {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .auth-area .button {
    width: 100%;
    min-width: 0;
  }

  .user-menu {
    right: 0;
    min-width: min(230px, calc(100vw - 26px));
  }

  .user-menu .language-control {
    display: flex;
    width: 100%;
    margin-bottom: 2px;
    justify-content: space-between;
  }

  .cornell-title {
    flex-direction: column;
    gap: 10px;
  }

  .cornell-title .pill {
    align-self: flex-start;
  }

  .form-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .form-actions .button {
    width: 100%;
  }

  .search-form {
    flex-wrap: wrap;
  }

  .list-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .sort-control {
    width: 100%;
    justify-content: space-between;
  }

  .sort-control select {
    min-width: 0;
    width: min(170px, 58%);
  }

  .note-card {
    height: auto;
    min-height: 188px;
    grid-template-rows: auto auto auto auto;
    overflow: visible;
  }

  .note-card-primary,
  .note-card-fields,
  .note-card-field,
  .note-card-field-value {
    overflow: visible;
  }

  .note-card-field-value {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .note-card-cue .note-card-field-value {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .card-actions .button {
    min-height: var(--control-height);
  }


  .markdown-body pre code {
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
  }

  .search-input {
    min-width: 0;
    flex-basis: auto;
  }

  .archive-front-page {
    padding-block: var(--space-6) var(--space-8);
  }

  .archive-masthead {
    width: min(100% - var(--space-4), var(--content-width));
  }

  .archive-masthead-action {
    min-height: 44px;
  }

  .menu-button {
    width: var(--compact-control-height);
    height: var(--compact-control-height);
  }

  .archive-lead h1 {
    font-size: clamp(2.35rem, 15vw, 4rem);
  }

  .archive-entry,
  .home-layout .archive-entry {
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: var(--space-2);
  }

  .archive-entry-actions .button {
    min-height: var(--control-height);
  }

  .archive-writing-room,
  .archive-reading-edition {
    padding-inline: var(--space-3);
  }
}

@media screen and (min-width: 861px) {
  .note-info-disclosure > .cornell-editor-meta {
    display: grid;
  }

  #siteMenu {
    display: flex !important;
  }
}

@media print {
  .markdown-code-copy {
    display: none !important;
  }

  .site-header,
  .panel,
  .write-heading,
  .write-controls,
  .markdown-toolbar,
  .preview-band,
  .page-band > div:first-child {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .main-wrap {
    width: 100%;
    padding: 0;
  }

  .cornell-note {
    box-shadow: none;
    break-inside: avoid;
  }

  body.dark-mode {
    --paper: #ffffff;
    --paper-deep: #f8fafc;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #000000;
    --muted: #333333;
    --brick: #000000;
    --hairline: #000000;
    --line: #000000;
    --blue: #000000;
    --blue-dark: #000000;
    --green: #235f3e;
    --on-accent: #ffffff;
    --success-foreground: #235f3e;
    --visibility-public-foreground: #235f3e;
    --visibility-private-foreground: #744b12;
    --notice-foreground: #333333;
    --header-background: #ffffff;
  }

  .archive-utility,
  .archive-masthead,
  .archive-article-head,
  .archive-reading-index-nav,
  .archive-reading-index {
    display: none !important;
  }

  .archive-writing-room,
  .archive-reading-edition {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .cornell-note,
  .cornell-editor {
    display: grid;
    grid-template-columns: minmax(210px, 0.34fr) minmax(0, 1fr);
  }

  .cornell-title {
    grid-column: 1 / -1;
  }

  .cornell-side {
    display: grid;
    border-right: 2px solid #000000;
  }

  .cornell-main {
    display: block;
  }

  .cornell-bottom {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 2px solid #000000;
  }

  .markdown-body.section-collapsed {
    display: block !important;
  }

  .cornell-section-header button,
  [data-section-toggle] {
    display: none !important;
  }

  body.dark-mode .cornell-note {
    border-color: #000000;
    background: #ffffff;
    color: #000000;
  }

  body.dark-mode .cornell-title,
  body.dark-mode .cornell-side,
  body.dark-mode .cornell-bottom {
    border-color: #000000;
    background: #f8fafc;
    color: #000000;
  }

  body.dark-mode .cornell-main,
  body.dark-mode .cornell-section,
  body.dark-mode .markdown-body {
    background: #ffffff;
    color: #000000;
  }

  body.responsive-ui-ready .cornell-editor [data-write-section],
  body.responsive-ui-ready .cornell-editor [data-write-section].is-write-section-active {
    display: block !important;
  }

  body.responsive-ui-ready .cornell-editor [data-write-section] > .write-section-body {
    display: block !important;
  }

  .note-info-disclosure > .cornell-editor-meta {
    display: grid !important;
  }

  .mermaid-diagram svg {
    width: 100% !important;
    height: auto !important;
  }

  .math-block,
  .math-inline {
    overflow: visible;
  }

  .math-inline[data-fit="true"] {
    width: auto;
    height: auto;
  }

  .math-block[data-fit="true"] .katex-display {
    height: auto;
  }

  .math-inline[data-fit="true"] > .katex,
  .math-block[data-fit="true"] .katex-display > .katex {
    transform: none !important;
  }
}

.pdf-export-root {
  --fit-width: auto;
  --fit-height: auto;
  width: 794px;
  max-width: 794px;
  min-height: auto;
  padding: 0;
  background: #ffffff;
  color: #111827;
}

.pdf-export-root .cornell-note {
  display: grid;
  grid-template-columns: minmax(210px, 0.34fr) minmax(0, 1fr);
  width: 100%;
  min-height: 0;
  overflow: visible;
  border: 2px solid #253245;
  border-radius: 4px;
  box-shadow: none;
  background: #ffffff;
  color: #111827;
}

.pdf-export-root .cornell-title {
  grid-column: 1 / -1;
  display: flex;
  margin-bottom: 0;
  border: 0;
  border-bottom: 2px solid #253245;
  border-radius: 0;
  background: #f8fafc;
  padding: 14px;
}

.pdf-export-root .cornell-title .pill {
  margin-top: 8px;
}

.pdf-export-root .cornell-side {
  display: grid;
  align-content: start;
  border-right: 2px solid #253245;
}

.pdf-export-root .cornell-main {
  min-height: 360px;
}

.pdf-export-root .cornell-bottom {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 2px solid #253245;
}

.pdf-export-root .cornell-section {
  width: 100%;
  min-height: 0;
  margin-bottom: 0;
  overflow: visible;
  break-inside: auto;
  page-break-inside: auto;
  border: 0;
  border-radius: 0;
  padding: 14px;
}

.pdf-export-root .cornell-section + .cornell-section,
.pdf-export-root .cornell-bottom .cornell-section + .cornell-section {
  border-top: 1px solid #d7dee8;
  border-left: 0;
}

.pdf-export-root .cornell-bottom .cornell-section + .cornell-section {
  border-top: 0;
  border-left: 2px solid #253245;
}

.pdf-export-root .cornell-section-header button {
  display: none !important;
}

.pdf-export-root .markdown-body {
  color: #111827;
  overflow: visible;
}

.pdf-export-root .youtube-embed {
  aspect-ratio: auto;
  min-height: auto;
  overflow: visible;
  background: #ffffff;
}

.pdf-export-root .pdf-youtube-card {
  position: static;
  min-height: 104px;
}

.pdf-export-root .mermaid-diagram,
.pdf-export-root .math-block,
.pdf-export-root .math-inline {
  overflow: visible;
}

.pdf-export-root .math-block .katex-display {
  overflow: visible;
}

.pdf-export-root .math-inline[data-fit="true"] {
  width: auto;
  height: auto;
}

.pdf-export-root .math-block[data-fit="true"] .katex-display {
  height: auto;
}

.pdf-export-root .math-inline[data-fit="true"] > .katex,
.pdf-export-root .math-block[data-fit="true"] .katex-display > .katex {
  transform: none !important;
}
