/* asazonov.dev: quiet, Scandinavian-style minimalism.
   One text column (wide blocks break out on notes), warm paper, near-black ink, one muted pine accent. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable-Italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f8f7f3;
  --ink: #1c1c1a;
  --muted: #6e6c66;
  --rule: #e4e1d9;
  --wash: #efede6;
  --accent: #2f5d4f;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 40rem;
  --wide: 72rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --space: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151514;
    --ink: #e9e7e2;
    --muted: #9b9891;
    --rule: #2b2a27;
    --wash: #1e1d1b;
    --accent: #93c2b0;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-feature-settings: "cv11", "ss01"; /* Inter: single-storey a, open digits */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.22em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

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

.site-header,
.site-main,
.site-footer {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.site-header,
.site-footer,
.site-main--note {
  max-width: calc(var(--wide) + 2 * var(--gutter));
}

/* Note pages: text stays in the content column, wide blocks span the frame.
   The side tracks shrink to 0 on narrow screens, so mobile is one column. */
.site-main--note {
  display: grid;
  grid-template-columns:
    [wide-start] minmax(0, 1fr)
    [content-start] minmax(0, var(--measure))
    [content-end] minmax(0, 1fr)
    [wide-end];
  align-content: start;
}
.site-main--note > *,
.site-main--note article > *,
.site-main--note .prose > * {
  grid-column: content;
}
.site-main--note > article,
.site-main--note article > .prose {
  grid-column: wide;
  display: grid;
  grid-template-columns: subgrid;
  align-content: start;
}
.site-main--note .prose > :is(figure.diagram, pre.mermaid, table, pre, p:has(> .excalidraw:only-child)) {
  grid-column: wide;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-block: 2.5rem 0;
}

.wordmark {
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.75rem;
  font-size: 0.9375rem;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover {
  color: var(--ink);
}

.site-main {
  flex: 1;
  padding-block: clamp(3.5rem, 10vw, 6rem) 4rem;
}

.site-footer {
  padding-block: 2rem 3rem;
  color: var(--muted);
  font-size: 0.8125rem;
}
.site-footer span {
  display: block;
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
}

.muted {
  color: var(--muted);
}

/* Small, quiet labels: "Writing", "Tags", "Backlinks" */
.section-label {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------- lists */

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.note-item {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.25rem 1.5rem;
  padding-block: 1.375rem;
  border-bottom: 1px solid var(--rule);
}

.note-date {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

.note-title {
  font-weight: 500;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.note-desc {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

@media (max-width: 34rem) {
  .note-item {
    grid-template-columns: 1fr;
  }
  .note-date {
    order: 2;
    padding-top: 0;
  }
}

.tag-cloud {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
}
.tag-cloud a {
  text-decoration: none;
}

/* ---------------------------------------------------------- note page */

.note-header {
  margin-bottom: 3rem;
}

.note-heading {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.tag {
  color: var(--muted);
  text-decoration: none;
}
.tag:hover {
  color: var(--accent);
}

.badge {
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.backlinks {
  margin-top: 4.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.backlinks ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.backlinks li + li {
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------- prose */

/* Direct children of .prose are grid items on note pages, where margins don't
   collapse: they are spaced by margin-top only, mirroring the collapsed rhythm. */
.prose > * {
  margin: 0;
}
.prose > * + * {
  margin-top: var(--space);
}
.prose > :where(h1, h2, h3, h4) + * {
  margin-top: 0.75rem;
}
.prose > :where(.diagram, pre.mermaid, p:has(> .excalidraw:only-child)) + *,
.prose > * + :where(.diagram, pre.mermaid, p:has(> .excalidraw:only-child)) {
  margin-top: 2rem;
}
.prose > * + :where(h1, h2, h3, h4) {
  margin-top: 2.75rem;
}
.prose > hr + *,
.prose > * + hr {
  margin-top: 3rem;
}
.prose > :first-child {
  margin-top: 0;
}
/* Notes often repeat their title as the first "# Heading"; the page shows it already. */
.prose > h1:first-child {
  display: none;
}
.prose > h1:first-child + * {
  margin-top: 0;
}

/* Nested blocks (inside lists and quotes) still collapse normally. */
.prose > * :where(p, ul, ol, blockquote, pre, table, figure) {
  margin: 0 0 var(--space);
}
.prose > blockquote > :last-child,
.prose > :where(ul, ol) > li:last-child > :last-child {
  margin-bottom: 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  scroll-margin-top: 2rem;
}
.prose h1 { font-size: 1.75rem; }
.prose h2 { font-size: 1.375rem; }
.prose h3 { font-size: 1.125rem; }
.prose h4 { font-size: 1rem; color: var(--muted); }

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}
.prose li + li {
  margin-top: 0.35rem;
}
.prose li::marker {
  color: var(--muted);
}

.prose strong {
  font-weight: 600;
}

.prose blockquote {
  margin-left: 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 0.12em 0.35em;
  background: var(--wash);
  border-radius: 4px;
}

.prose pre {
  overflow-x: auto;
  padding: 1.125rem 1.25rem;
  background: var(--wash);
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.6;
}
.prose pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.prose th,
.prose td {
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
.prose th {
  font-weight: 500;
  color: var(--muted);
}

.prose .hashtag a {
  color: var(--muted);
  text-decoration: none;
}
.prose .hashtag a:hover {
  color: var(--accent);
}

.prose .footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------------------------------------------------------- diagrams */

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

.prose pre.mermaid {
  display: flex;
  justify-content: center;
  padding: 0;
  background: none;
  color: transparent; /* hide the source while mermaid.js renders it */
}
.prose pre.mermaid svg {
  max-width: 100%;
  height: auto;
}

.prose img.excalidraw,
.prose picture.excalidraw img {
  margin-inline: auto;
  border-radius: 0;
}

/* ---------------------------------------------------------- errors */

.error {
  padding-block: 2rem 4rem;
}
.error-code {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}
.error .muted {
  margin: 0 0 2.5rem;
  font-size: 1.125rem;
}
.error-links {
  display: flex;
  gap: 1.75rem;
}
