@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  color-scheme: light;
  --bg: #f4f2ec;
  --bg-2: #efede6;
  --bg-3: #ece8df;
  --ink: #20211f;
  --muted: #555951;
  --line: #d7d4cc;
  --line-2: #c9c6bd;
  --accent: #ef5e42;
  --card: #f8f7f3;
  --sage: #dce2d5;
  --band-ink: #20211f;
  --band-ink-text: #f5f2eb;
  --md-bg: #f7f5ef;
  --md-code: #f0eee6;
  --md-meta: #8a8c84;
  --orb: #f2c14e;
  --orb-2: #1b2430;
  --good: #1d604c;
  --good-muted: #2b6b55;
  --good-bg: #d6e3d8;
  --good-ink: #225b49;
  --warn: #aa6e5d;
  --mark: #657767;
  --strike: #8d8b84;
  --skill-line: #aeb4a9;
  --skill-label: #526057;
  --placeholder: #eceae3;
  --nav-btn: #ffffff;
  --reveal-x: 50%;
  --reveal-y: 12%;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111210;
    --bg-2: #181916;
    --bg-3: #1c1d19;
    --ink: #f0eee6;
    --muted: #b0b2aa;
    --line: #3c3d37;
    --line-2: #4a4b44;
    --accent: #f07858;
    --card: #1a1b17;
    --sage: #232820;
    --band-ink: #0c0d0b;
    --band-ink-text: #eceae3;
    --md-bg: #161714;
    --md-code: #10110f;
    --md-meta: #8d8f86;
    --orb: #f4d27a;
    --orb-2: #d7dde8;
    --good: #8ed9b4;
    --good-muted: #8ecfb0;
    --good-bg: #1d2a22;
    --good-ink: #b5e4c9;
    --warn: #d4a090;
    --mark: #9bb59e;
    --strike: #8a8c84;
    --skill-line: #3a4036;
    --skill-label: #9aa894;
    --placeholder: #1c1d19;
    --nav-btn: #f0eee6;
  }
}

html[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f2ec;
  --bg-2: #efede6;
  --bg-3: #ece8df;
  --ink: #20211f;
  --muted: #555951;
  --line: #d7d4cc;
  --line-2: #c9c6bd;
  --accent: #ef5e42;
  --card: #f8f7f3;
  --sage: #dce2d5;
  --band-ink: #20211f;
  --band-ink-text: #f5f2eb;
  --md-bg: #f7f5ef;
  --md-code: #f0eee6;
  --md-meta: #8a8c84;
  --orb: #f2c14e;
  --orb-2: #1b2430;
  --good: #1d604c;
  --good-muted: #2b6b55;
  --good-bg: #d6e3d8;
  --good-ink: #225b49;
  --warn: #aa6e5d;
  --mark: #657767;
  --strike: #8d8b84;
  --skill-line: #aeb4a9;
  --skill-label: #526057;
  --placeholder: #eceae3;
  --nav-btn: #ffffff;
}

html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111210;
  --bg-2: #181916;
  --bg-3: #1c1d19;
  --ink: #f0eee6;
  --muted: #b0b2aa;
  --line: #3c3d37;
  --line-2: #4a4b44;
  --accent: #f07858;
  --card: #1a1b17;
  --sage: #232820;
  --band-ink: #0c0d0b;
  --band-ink-text: #eceae3;
  --md-bg: #161714;
  --md-code: #10110f;
  --md-meta: #8d8f86;
  --orb: #f4d27a;
  --orb-2: #d7dde8;
  --good: #8ed9b4;
  --good-muted: #8ecfb0;
  --good-bg: #1d2a22;
  --good-ink: #b5e4c9;
  --warn: #d4a090;
  --mark: #9bb59e;
  --strike: #8a8c84;
  --skill-line: #3a4036;
  --skill-label: #9aa894;
  --placeholder: #1c1d19;
  --nav-btn: #f0eee6;
}

html { view-transition-name: root; }

::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--ink);
}

html.theme-fade,
html.theme-fade body,
html.theme-fade .section,
html.theme-fade .sidebar,
html.theme-fade .md {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) { z-index: 1; }

::view-transition-new(root) {
  z-index: 2;
  animation: theme-wipe .72s cubic-bezier(.22, 1, .36, 1);
}

@keyframes theme-wipe {
  from { clip-path: circle(0 at var(--reveal-x) var(--reveal-y)); }
  to { clip-path: circle(150vmax at var(--reveal-x) var(--reveal-y)); }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
  .theme-switch-label em::after { animation: none; }
}

.theme-switch {
  appearance: none;
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 132px;
  padding: 10px 12px 9px;
  border: 1px dashed var(--md-meta);
  border-radius: 4px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  color: var(--ink);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 8%, transparent);
}

.theme-switch:hover { border-color: var(--accent); }

.theme-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.theme-switch-front {
  color: var(--md-meta);
  font-size: 10px;
  letter-spacing: .18em;
}

.theme-switch-orb {
  position: relative;
  display: block;
  width: 42px;
  height: 22px;
  margin: 2px 0 3px;
  border-radius: 99px;
  background:
    radial-gradient(1px 1px at 72% 28%, var(--nav-btn) 70%, transparent 80%),
    radial-gradient(1px 1px at 86% 64%, var(--nav-btn) 70%, transparent 80%),
    color-mix(in srgb, var(--ink) 12%, var(--bg));
  overflow: hidden;
}

.theme-switch-orb i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--orb);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--orb) 35%, transparent);
  transition: transform .55s cubic-bezier(.22, 1, .36, 1), background .45s ease, box-shadow .45s ease;
}

html[data-theme='dark'] .theme-switch-orb i,
.theme-switch[data-mode='dark'] i {
  transform: translateX(20px);
  background: var(--orb-2);
  box-shadow:
    inset -4px -2px 0 0 var(--bg-2),
    0 0 0 2px color-mix(in srgb, var(--orb-2) 25%, transparent);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']) .theme-switch-orb i {
    transform: translateX(20px);
    background: var(--orb-2);
    box-shadow: inset -4px -2px 0 0 var(--bg-2);
  }
}

.theme-switch-label {
  font-size: 11px;
  line-height: 1.3;
  text-align: left;
}

.theme-switch-label em {
  font-style: normal;
  color: var(--accent);
}

.theme-switch-label em::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: .85em;
  margin-left: 5px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: theme-caret 1s steps(1) infinite;
}

@keyframes theme-caret {
  50% { opacity: 0; }
}

.theme-switch.floating {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 12;
}

.theme-switch.compact {
  min-width: 118px;
  padding: 6px 8px 5px;
  box-shadow: none;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.md-page {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

.md-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 22px 80px;
}

.md-window {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--md-bg);
  box-shadow: 0 28px 70px color-mix(in srgb, var(--ink) 10%, transparent);
}

.md-titlebar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.md-dots {
  display: flex;
  gap: 6px;
}

.md-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5f57;
}

.md-dots i:nth-child(2) { background: #febc2e; }
.md-dots i:nth-child(3) { background: #28c840; }

.md-filename {
  color: var(--md-meta);
  font: 12px/1 "IBM Plex Mono", ui-monospace, monospace;
}

.md-file {
  display: inline-block;
  margin: 0 0 14px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--card);
  color: var(--md-meta);
  font: 12px/1 "IBM Plex Mono", ui-monospace, monospace;
}

.md {
  padding: 28px 30px 36px;
  background: var(--md-bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 16.5px;
  line-height: 1.7;
}

.md > p:first-child { margin-top: 0; }

.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.md h1, .md h2, .md h3 {
  letter-spacing: -0.03em;
  line-height: 1.25;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.md h1 {
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 1.85rem;
  font-weight: 600;
}

.md h1::before { content: "# "; color: var(--md-meta); font-weight: 500; }
.md h2::before { content: "## "; color: var(--md-meta); font-weight: 500; }
.md h3::before { content: "### "; color: var(--md-meta); font-weight: 500; }

.md h2 {
  margin: 2em 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 1.2rem;
  font-weight: 600;
}

.md h3 { margin: 1.6em 0 8px; font-size: 1.02rem; }

.md p, .md li, .md dd { color: var(--ink); }

.md p { margin: 0 0 1em; }

.md ul { margin: 0 0 1.1em; padding-left: 0; list-style: none; }

.md li {
  margin: 0 0 .35em;
  padding-left: 1.15em;
  text-indent: -1.15em;
}

.md li::before {
  content: "- ";
  color: var(--md-meta);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.md dl {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 1fr;
  gap: 6px 16px;
  margin: 0 0 1.4em;
}

.md dt {
  margin: 0;
  color: var(--md-meta);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 500;
}

.md dt::before { content: "- "; }

.md dd { margin: 0; }

.md hr {
  margin: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.md pre {
  overflow: auto;
  max-height: 420px;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--md-code);
  color: var(--ink);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.md-code {
  position: relative;
  margin: 0 0 8px;
}

.md-code::before {
  content: "```json";
  display: block;
  margin-bottom: 8px;
  color: var(--md-meta);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
}

.md-code::after {
  content: "```";
  display: block;
  margin-top: 8px;
  color: var(--md-meta);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
}

.md-human {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.2rem;
  margin: 0 0 8px;
  padding: 1.3rem 1.5rem;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -.03em;
  text-align: center;
}

.md-human:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.md-note {
  margin: 0 0 18px;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.md-note a { color: var(--accent); }

@media (max-width: 700px) {
  .theme-switch.floating { top: 12px; right: 12px; min-width: 112px; padding: 8px 10px; }
  .md { padding: 20px 16px 28px; font-size: 15.5px; }
  .md dl { grid-template-columns: 1fr; gap: 2px 0; }
  .md-human { font-size: 1.2rem; min-height: 4.4rem; }
  .md-titlebar { grid-template-columns: auto 1fr; }
  .md-titlebar .theme-switch { grid-column: 1 / -1; }
}
