:root {
  color-scheme: dark;
  --base: #1e1e2e;
  --crust: #11111b;
  --mantle: #181825;
  --surface-0: #313244;
  --surface-1: #45475a;
  --text: #cdd6f4;
  --subtext: #a6adc8;
  --accent: #cba6f7;
  --accent-strong: #b4befe;
  --accent-soft: rgb(203 166 247 / 12%);
  --border: #313244;
  --header-bg: rgb(30 30 46 / 88%);
  --shadow: 0 16px 34px rgb(17 17 27 / 28%);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --shell: 70rem;
  --reading: 44rem;
  --radius: 8px;
  --transition: 160ms ease;
}

html[data-theme="latte"] {
  color-scheme: light;
  --base: #eff1f5;
  --crust: #dce0e8;
  --surface-0: #ccd0da;
  --surface-1: #bcc0cc;
  --text: #4c4f69;
  --subtext: #5c5f77;
  --accent: #8839ef;
  --accent-strong: #7287fd;
  --accent-soft: rgb(136 57 239 / 10%);
  --border: #ccd0da;
  --header-bg: rgb(239 241 245 / 90%);
  --shadow: 0 16px 34px rgb(76 79 105 / 14%);
}

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

html {
  min-width: 20rem;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
  background: var(--base);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--base);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--transition), background-color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

a:hover {
  color: var(--accent-strong);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(calc(100% - 3rem), var(--shell));
  margin-inline: auto;
}

.reading-column {
  width: min(calc(100% - 3rem), var(--reading));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--crust);
  font-weight: 700;
  transform: translateY(-160%);
}

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

.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;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}

.site-header__inner {
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-name {
  color: var(--text);
  font-size: 1.04rem;
  font-weight: 750;
  text-decoration: none;
}

.site-name::before {
  content: "";
  display: inline-block;
  width: 0.48rem;
  height: 0.48rem;
  margin-right: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  vertical-align: 0.08rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.site-nav > a {
  color: var(--subtext);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.site-nav > a:hover {
  color: var(--text);
}

.external-link span {
  display: inline-block;
  font-size: 0.85em;
  transition: transform var(--transition);
}

.external-link:hover span {
  transform: translate(2px, -2px);
}

.icon-button {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--subtext);
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition), border-color var(--transition), transform var(--transition);
}

.icon-button:hover {
  border-color: var(--surface-1);
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

.intro {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 46rem);
  gap: 1.5rem;
  align-items: start;
  padding-block: 7rem 6.5rem;
}

.intro__mark {
  margin: 0.1rem 0 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
}

.intro h1 {
  margin: 0 0 1rem;
  color: var(--text);
  font-size: clamp(2.25rem, 6vw, 4.4rem);
  font-weight: 780;
  line-height: 1.04;
  letter-spacing: 0;
}

.intro div > p {
  max-width: 43rem;
  margin: 0;
  color: var(--subtext);
  font-size: 1.2rem;
  line-height: 1.75;
}

.project-band {
  padding-block: 4rem;
  border-block: 1px solid var(--border);
  background: var(--crust);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.section-heading h2 {
  margin: 0;
  color: var(--subtext);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-heading > a {
  font-size: 0.9rem;
  font-weight: 650;
}

.section-rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3rem;
  align-items: center;
  padding: 2.1rem 2.25rem;
  border: 1px solid var(--surface-0);
  border-radius: var(--radius);
  background: var(--base);
  box-shadow: 0 9px 0 -6px var(--surface-0);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.project-card:hover {
  border-color: var(--surface-1);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.project-card__content {
  display: flex;
  align-items: end;
  gap: 3rem;
}

.project-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1.65rem;
  line-height: 1.2;
}

.project-card p {
  max-width: 42rem;
  margin: 0;
  color: var(--subtext);
}

.tech-list,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.tech-list {
  flex: 0 0 auto;
}

.tech-list li,
.tag {
  display: inline-flex;
  min-height: 1.7rem;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.25;
  text-decoration: none;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.project-link {
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 700;
}

.article-feed,
.archive {
  padding-block: 5.5rem 7rem;
}

.post-list {
  border-top: 1px solid var(--border);
}

.post-item {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 2rem;
  padding-block: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-item__date {
  padding-top: 0.2rem;
  color: var(--subtext);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.post-item h3 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  line-height: 1.3;
}

.post-item h3 a {
  color: var(--text);
  text-decoration: none;
}

.post-item h3 a:hover {
  color: var(--accent);
}

.post-item__body > p {
  max-width: 46rem;
  margin: 0 0 1rem;
  color: var(--subtext);
}

.empty-state {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--subtext);
}

.page-heading {
  max-width: 47rem;
  margin-bottom: 3rem;
}

.page-heading__context {
  margin: 0 0 0.7rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0 0 1rem;
  font-size: 3rem;
  line-height: 1.08;
}

.page-heading > p:last-child {
  margin: 0;
  color: var(--subtext);
  font-size: 1.08rem;
}

.taxonomy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.taxonomy-grid li {
  border-bottom: 1px solid var(--border);
}

.taxonomy-grid li:nth-child(odd) {
  border-right: 1px solid var(--border);
}

.taxonomy-grid a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  color: var(--text);
  text-decoration: none;
}

.taxonomy-grid a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.taxonomy-grid a span:last-child {
  color: var(--subtext);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.article {
  padding-block: 5.5rem 7rem;
}

.article-header {
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.back-link {
  display: inline-block;
  color: var(--subtext);
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
}

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

.article-header h1 {
  margin: 1.35rem 0 1.1rem;
  font-size: clamp(2.3rem, 6vw, 4rem);
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: 0;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1rem;
  color: var(--subtext);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.prose {
  padding-block: 3.1rem;
  color: var(--text);
  font-size: 1.055rem;
  line-height: 1.82;
}

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

.prose > :last-child {
  margin-bottom: 0;
}

.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  line-height: 1.25;
  scroll-margin-top: 6rem;
}

.prose h2 {
  margin: 3.3rem 0 1rem;
  font-size: 1.7rem;
}

.prose h3 {
  margin: 2.5rem 0 0.8rem;
  font-size: 1.32rem;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose table,
.prose .code-block {
  margin-block: 1.35rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose strong {
  color: var(--text);
}

.prose blockquote {
  padding: 0.55rem 0 0.55rem 1.35rem;
  border-left: 3px solid var(--accent);
  color: var(--subtext);
  font-size: 1.08rem;
}

.prose blockquote p {
  margin: 0;
}

.prose code:not(pre code) {
  padding: 0.12em 0.34em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.87em;
}

.code-block {
  position: relative;
}

.prose pre {
  max-width: 100%;
  margin: 0;
  padding: 3.25rem 1.35rem 1.25rem;
  overflow: auto;
  border: 1px solid #313244;
  border-radius: 8px;
  background: #181825;
  color: #cdd6f4;
  scrollbar-color: #45475a #181825;
  tab-size: 2;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.7;
}

.copy-button {
  position: absolute;
  z-index: 2;
  top: 0.65rem;
  right: 0.65rem;
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  place-items: center;
  border: 1px solid #45475a;
  border-radius: 6px;
  background: #313244;
  color: #bac2de;
  cursor: pointer;
  opacity: 0.82;
  transition: opacity var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

.copy-button:hover,
.copy-button[data-copied="true"] {
  border-color: #cba6f7;
  color: #cba6f7;
  opacity: 1;
  transform: translateY(-1px);
}

.copy-button[data-copied="true"]::after {
  content: "Copied";
  position: absolute;
  right: calc(100% + 0.5rem);
  padding: 0.2rem 0.45rem;
  border: 1px solid #45475a;
  border-radius: 4px;
  background: #313244;
  color: #cdd6f4;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

/* Zola's class-based Syntect output uses scope-derived z-* classes. */
.prose pre .z-comment,
.prose pre .z-punctuation.z-definition.z-comment {
  color: #6c7086;
}

.prose pre .z-string,
.prose pre .z-string .z-punctuation {
  color: #a6e3a1;
}

.prose pre .z-keyword,
.prose pre .z-storage,
.prose pre .z-selector {
  color: #cba6f7;
}

.prose pre .z-constant,
.prose pre .z-number,
.prose pre .z-boolean {
  color: #fab387;
}

.prose pre .z-function,
.prose pre .z-entity.z-name.z-function {
  color: #89b4fa;
}

.prose pre .z-type,
.prose pre .z-support.z-type,
.prose pre .z-entity.z-name.z-class {
  color: #f9e2af;
}

.prose pre .z-variable,
.prose pre .z-parameter {
  color: #f5e0dc;
}

.prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-spacing: 0;
  border-collapse: separate;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.prose th,
.prose td {
  min-width: 9rem;
  padding: 0.72rem 0.9rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--crust);
  font-size: 0.82rem;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose th:last-child,
.prose td:last-child {
  border-right: 0;
}

.prose hr {
  margin-block: 3rem;
  border: 0;
  border-top: 1px solid var(--border);
}

.article-footer {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--crust);
}

.site-footer__inner {
  display: flex;
  min-height: 6rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--subtext);
  font-size: 0.82rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 48rem) {
  .shell,
  .reading-column {
    width: min(calc(100% - 2rem), var(--shell));
  }

  .site-header__inner {
    min-height: 4rem;
    gap: 1rem;
  }

  .site-nav {
    gap: 0.75rem;
  }

  .site-nav > a:nth-child(2) {
    display: none;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding-block: 4.5rem;
  }

  .intro__mark {
    font-size: 1rem;
  }

  .intro h1 {
    font-size: 2.75rem;
  }

  .intro div > p {
    font-size: 1.05rem;
  }

  .project-card,
  .project-card__content {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .project-card {
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .project-card__content {
    display: grid;
    gap: 1.2rem;
  }

  .project-link {
    justify-self: start;
  }

  .article-feed,
  .archive,
  .article {
    padding-block: 4rem;
  }

  .post-item {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

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

  .taxonomy-grid li:nth-child(odd) {
    border-right: 0;
  }

  .article-header h1 {
    font-size: 2.45rem;
  }
}

@media (max-width: 33rem) {
  .site-name {
    font-size: 0.95rem;
  }

  .site-nav > a:first-child {
    display: none;
  }

  .site-nav {
    margin-left: auto;
  }

  .project-band {
    padding-block: 3rem;
  }

  .section-heading {
    align-items: baseline;
  }

  .section-rule {
    display: none;
  }

  .page-heading h1 {
    font-size: 2.35rem;
  }

  .prose {
    font-size: 1rem;
  }

  .prose pre {
    padding: 3.25rem 1.1rem 1.1rem;
  }

  .site-footer__inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
