/* yuanwang.ca — Swiss/neo-brutalist skin: concrete canvas, 2px ink rules,
   one hot-pink signal colour, Funnel Sans over Sometype Mono.
   Palette, type scale and layout metrics follow humansmd.dev. */

:root {
  --concrete: #c9cbcc;
  --paper: #eeefef;
  --white: #ffffff;
  --ink: #121314;
  --ink-soft: #2e3133;
  --muted: #45484b;
  --rule: #b4b7b9;
  --stone-1: #a9acae;
  --stone-2: #7f8386;
  --signal: #ff3d7f;
  --signal-ink: #c2185b; /* pink dark enough to set as text */
  --lit-tint: #fbe1ea;

  --font-display: "Funnel Sans Variable", system-ui, sans-serif;
  --font-body: "Funnel Sans Variable", system-ui, sans-serif;
  --font-mono: "Sometype Mono Variable", ui-monospace, monospace;

  --t-xl: clamp(38px, 6vw, 76px);
  --t-l: clamp(24px, 2.3vw, 34px);
  --t-m: clamp(18px, 1.4vw, 20px);

  --border: 2px solid var(--ink);
  --frame: 1080px;
  --measure: 760px;
  --margin: clamp(16px, 5vw, 48px);
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Verso's own stylesheet is inlined after this <link>, so its :root wins
   unless we out-specify it. */
:root:root {
  --verso-structure-font-family: var(--font-display);
  --verso-text-font-family: var(--font-body);
  --verso-code-font-family: var(--font-mono);

  --verso-text-color: var(--ink);
  --verso-structure-color: var(--ink);
  --verso-code-color: var(--ink-soft);
  --verso-code-const-color: var(--ink);
  --verso-code-keyword-color: var(--signal-ink);
  --verso-code-keyword-weight: 700;

  --verso-code-hover-bg-color: var(--lit-tint);
  --verso-selected-color: var(--lit-tint);

  --verso-tooltip-color: var(--ink);
  --verso-tooltip-bg-color: var(--paper);
  --verso-tooltip-border-color: var(--ink);
  --verso-tooltip-separator-color: var(--rule);

  /* Lean's #eval/#check feedback, in the signal colour instead of Verso's blue */
  --verso-info-indicator-color: var(--signal);
  --verso-output-info-color: var(--signal);
  --verso-code-info-hover-bg-color: var(--lit-tint);
  --verso-tooltip-info-border-color: var(--signal);

  --verso-tactic-state-color: var(--ink);
  --verso-tactic-state-bg-color: var(--paper);
  --verso-tactic-state-border-color: var(--ink);
  --verso-tactic-toggle-color: var(--stone-1);
  --verso-tactic-toggle-checked-color: var(--signal);
}

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

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

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

body {
  margin: 0;
  background: var(--concrete);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: clip;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: var(--t-xl);
  line-height: 1;
}

h2 {
  font-size: var(--t-l);
}

h3 {
  font-size: var(--t-m);
  letter-spacing: -0.01em;
}

p,
ul,
ol,
pre,
table,
blockquote {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.4rem;
}

li + li {
  margin-top: 0.3rem;
}

strong {
  font-weight: 700;
}

hr {
  border: 0;
  border-top: var(--border);
  margin: 2.5rem 0;
}

a {
  color: var(--ink);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

a:hover {
  text-decoration-color: var(--signal);
  text-decoration-thickness: 2px;
}

::selection {
  background: var(--signal);
  color: var(--ink);
}

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

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

abbr[title] {
  text-decoration: underline dotted;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
  font-size: 15.5px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--rule);
  background: var(--white);
  padding: 8px 12px;
}

thead th {
  background: var(--paper);
  font-weight: 700;
}

/* A small monospaced caption, used for metadata and breadcrumbs. */
.label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Layout ---- */

.wrap,
.inner-wrap {
  width: min(100% - 2 * var(--margin), var(--frame));
  margin-inline: auto;
}

header {
  border-bottom: var(--border);
}

header .inner-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding: 24px 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* The site mark: a pink chip in front of the wordmark. */
.logo h1 {
  font-size: 22px;
  letter-spacing: -0.015em;
}

.logo h1::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 10px;
  background: var(--signal);
  border: var(--border);
  vertical-align: baseline;
}

nav.top ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
}

nav.top li {
  margin: 0;
}

nav.top a {
  padding: 8px 0;
  text-decoration: none;
}

nav.top a:hover {
  box-shadow: inset 0 -3px var(--signal);
}

main {
  padding: clamp(28px, 5vh, 60px) 0 clamp(70px, 10vh, 130px);
}

/* The reading measure. Cards and code panels may run wider. */
main .wrap > :is(p, blockquote, h2, h3, h4, article, .metadata) {
  max-width: var(--measure);
}

main .wrap > ul:not(.post-list),
main .wrap > ol {
  max-width: var(--measure);
}

main h1 {
  max-width: 16ch;
  margin-bottom: 1rem;
}

main h2 {
  border-top: var(--border);
  margin: 3rem 0 1rem;
  padding-top: 0.7rem;
}

main h3 {
  margin: 2rem 0 0.6rem;
}

main h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 17.5px;
}

/* ---- Breadcrumbs ---- */

nav.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

nav.breadcrumbs li {
  display: block;
  margin: 0;
}

nav.breadcrumbs li:not(:last-child)::after {
  content: "»";
  margin-left: 10px;
  color: var(--stone-2);
}

nav.breadcrumbs a {
  text-decoration: none;
}

nav.breadcrumbs a:hover {
  text-decoration: underline;
  text-decoration-color: var(--signal);
  text-decoration-thickness: 2px;
}

/* ---- Post metadata ---- */

.metadata {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin: 0 0 2rem;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.authors {
  display: none;
}

.authors:not(:empty) {
  display: block;
}

.authors::before {
  content: "By ";
}

.authors .author:not(:last-child)::after {
  content: ", ";
}

.date {
  display: none;
}

.date:not(:empty) {
  display: block;
}

.date:not(:empty)::before {
  content: "·";
  margin-right: 0.7ch;
  color: var(--stone-2);
}

.categories {
  display: none;
  list-style: none;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.categories:not(:empty) {
  display: flex;
}

.categories::before {
  content: "Category:";
}

.categories:has(li:nth-child(2))::before {
  content: "Categories:";
}

.categories li {
  display: block;
  margin: 0;
}

.categories a {
  display: inline-block;
  padding: 4px 8px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}

.categories a:hover {
  background: var(--signal);
  color: var(--ink);
}

/* ---- Post list ---- */

.post-list {
  display: grid;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list > li {
  display: block;
  margin: 0;
  padding: 24px 26px;
  background: var(--white);
  border: var(--border);
  transition:
    transform 0.15s var(--ease-out),
    box-shadow 0.15s var(--ease-out);
}

.post-list > li:hover {
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 var(--ink);
}

.post-list .title {
  display: block;
  max-width: 46ch;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(21px, 2vw, 28px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.post-list .title:hover {
  text-decoration: underline;
  text-decoration-color: var(--signal);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.post-list .metadata {
  margin: 0.7rem 0 0.9rem;
}

.post-list > li p {
  max-width: 72ch;
  margin-bottom: 0.6rem;
  color: var(--ink-soft);
}

.read-more {
  display: none;
}

/* ---- Category directory ---- */

.category-directory {
  margin: 2.5rem 0;
}

.category-directory ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.category-directory li {
  margin: 0;
}

.category-directory a {
  display: inline-block;
  padding: 10px 14px;
  background: var(--white);
  border: var(--border);
  font-weight: 600;
  text-decoration: none;
}

.category-directory a:hover {
  background: var(--lit-tint);
}

/* ---- Code ---- */

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

/* Fences (python/bash/json/java) sit on an ink panel, terminal-style. */
pre {
  background: var(--ink);
  color: var(--paper);
  border: var(--border);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  overflow-x: auto;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

:not(pre) > code:not(.hl) {
  background: var(--white);
  border: 1px solid var(--rule);
  padding: 1px 5px;
}

/* Verso's Lean blocks are <code class="hl lean block"> — a light paper panel. */
.hl.lean.block {
  display: block;
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 14px 16px;
  margin: 1.4rem 0 2rem;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

blockquote {
  background: var(--lit-tint);
  box-shadow: inset 4px 0 var(--signal);
  margin: 1.4rem 0;
  padding: 10px 18px;
}

blockquote > :first-child {
  margin-top: 0;
}

blockquote > :last-child {
  margin-bottom: 0;
}

/* ---- Buttons (front page CTA) ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition:
    transform 0.12s var(--ease-out),
    background-color 0.16s ease;
}

.btn:hover {
  background: #000;
  color: var(--paper);
}

.btn:active {
  transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
