/* juan504n.github.io: one stylesheet, no framework. */

:root {
  --bg: #f5f3ee;
  --surface: #fffefb;
  --surface-2: #efece5;
  --ink: #16181b;
  --ink-2: #3b3f45;
  --muted: #6b6f76;
  --line: #e2ded5;
  --accent: #0d7a4c;
  --accent-ink: #ffffff;
  --accent-soft: #0d7a4c1a;
  --code-bg: #1b1e22;
  --code-ink: #e8e6e1;
  --shadow: 0 1px 2px #16181b0d, 0 8px 24px -12px #16181b26;
  --heat-low: hsl(4 62% 44%);
  --heat-mid: hsl(48 66% 42%);
  --heat-high: hsl(140 52% 32%);
  --radius: 14px;
  --radius-sm: 8px;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1113;
    --surface: #16191c;
    --surface-2: #1c2024;
    --ink: #eceae5;
    --ink-2: #c9c7c1;
    --muted: #979ca3;
    --line: #2a2f34;
    --accent: #41c98b;
    --accent-ink: #0b1f15;
    --accent-soft: #41c98b1f;
    --code-bg: #0b0d0f;
    --shadow: 0 1px 2px #0006, 0 10px 30px -14px #000c;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1113;
  --surface: #16191c;
  --surface-2: #1c2024;
  --ink: #eceae5;
  --ink-2: #c9c7c1;
  --muted: #979ca3;
  --line: #2a2f34;
  --accent: #41c98b;
  --accent-ink: #0b1f15;
  --accent-soft: #41c98b1f;
  --code-bg: #0b0d0f;
  --shadow: 0 1px 2px #0006, 0 10px 30px -14px #000c;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(720px, 100% - 32px); margin-inline: auto; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 16px; }

/* ---------------------------------------------------------------- nav */

.nav {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.brand-mark {
  display: grid; grid-template-columns: repeat(3, 6px); gap: 2px;
}
.brand-mark i { width: 6px; height: 6px; border-radius: 1.5px; background: var(--heat-high); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { background: var(--heat-mid); }
.brand-mark i:nth-child(3), .brand-mark i:nth-child(8) { background: var(--heat-low); }
.brand-mark i:nth-child(6) { background: var(--accent); opacity: .5; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  font-size: 14px; color: var(--ink-2); text-decoration: none;
  padding: 6px 10px; border-radius: 999px;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
.theme-toggle {
  margin-left: 6px; width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}
@media (max-width: 560px) { .nav-links a.hide-sm { display: none; } }

/* ---------------------------------------------------------------- type */

.kicker {
  font: 500 12.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 10px;
}
.kicker .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
h1, h2, h3 { letter-spacing: -0.015em; line-height: 1.15; }
.display { font: 400 clamp(3.2rem, 9vw, 6.4rem)/0.95 var(--serif); letter-spacing: -0.02em; margin: 18px 0 22px; }
.hero .display { margin-bottom: 0; }
.section-title { font: 400 clamp(2rem, 4.5vw, 2.9rem)/1.05 var(--serif); margin: 0; }
.lede { font-size: clamp(1.06rem, 1.7vw, 1.22rem); color: var(--ink-2); max-width: 36em; margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---------------------------------------------------------------- buttons */

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 15px; font-weight: 500; text-decoration: none; color: var(--ink);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--accent)); }
.btn svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- hero */

.hero { padding: clamp(48px, 9vw, 104px) 0 clamp(40px, 7vw, 84px); }
.hero .wrap { display: grid; grid-template-columns: 1.08fr 0.92fr; gap: clamp(32px, 6vw, 72px); align-items: center; }
@media (max-width: 1080px) { .hero .wrap { grid-template-columns: 1fr; } .hero .board { max-width: 640px; } }

/* ---------------------------------------------------------------- heat board */

.board {
  container-type: inline-size;
  margin: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 18px 14px;
}
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.board-title { font: 600 13px/1.3 var(--mono); letter-spacing: .02em; }
.board-sub { font: 400 12px/1.3 var(--mono); color: var(--muted); }
.board-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px;
}
.cell {
  position: relative; aspect-ratio: 1 / 1.08; border-radius: 6px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; padding: 4px 4px 3px;
  font: 600 10px/1 var(--mono); overflow: hidden; cursor: default;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cell .pick { opacity: .78; font-weight: 500; font-size: 8.5px; }
.cell .pct { font-size: 11.5px; letter-spacing: -.02em; }
.cell:hover, .cell:focus-visible { transform: scale(1.12); z-index: 2; box-shadow: 0 6px 18px -6px #0008; outline: none; }
.board[data-animate] .cell { animation: cell-in .5s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 22ms); }
@keyframes cell-in { from { opacity: 0; transform: translateY(6px) scale(.9); } }
@media (prefers-reduced-motion: reduce) { .board[data-animate] .cell { animation: none; } }
/* Sized by the board, not the window: the same board sits in a hero column and in a post. */
@container (max-width: 470px) {
  .board-grid { gap: 3px; }
  .cell .pick { display: none; }
  .cell { justify-content: center; align-items: center; padding: 0; }
  .cell .pct { font-size: 10px; }
}
.board-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.legend { display: inline-flex; align-items: center; gap: 8px; font: 400 11.5px/1 var(--mono); color: var(--muted); }
.legend .ramp { width: 84px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--heat-low), var(--heat-mid), var(--heat-high)); }
.board-readout { font: 500 12px/1.4 var(--mono); color: var(--ink-2); min-height: 1.4em; }
.board-caption { font-size: 13.5px; color: var(--muted); margin: 12px 2px 0; line-height: 1.5; }

/* ---------------------------------------------------------------- sections */

.section { padding: clamp(56px, 8vw, 96px) 0; border-top: 1px solid var(--line); scroll-margin-top: 60px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 36px; flex-wrap: wrap; }
.section-head .kicker { margin-bottom: 12px; }

/* featured project */
.feature {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow); overflow: hidden;
}
@media (max-width: 860px) { .feature { grid-template-columns: 1fr; } }
.feature-main { padding: clamp(24px, 4vw, 44px); }
.feature-main h3 { font: 400 clamp(1.9rem, 3.6vw, 2.6rem)/1.05 var(--serif); margin: 10px 0 14px; }
.feature-main p { color: var(--ink-2); margin: 0 0 22px; }
.feature-list { list-style: none; padding: 0; margin: 0 0 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }
@media (max-width: 520px) { .feature-list { grid-template-columns: 1fr; } }
.feature-list li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; font-size: 15px; line-height: 1.45; }
.feature-list li::before { content: ""; width: 10px; height: 10px; margin-top: 6px; border-radius: 2.5px; background: var(--accent); opacity: .85; }
.feature-list b { font-weight: 600; }
.feature-side { background: var(--surface-2); border-left: 1px solid var(--line); padding: clamp(24px, 4vw, 40px); display: flex; flex-direction: column; gap: 22px; }
@media (max-width: 860px) { .feature-side { border-left: 0; border-top: 1px solid var(--line); } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 18px; margin: 0; }
.stats div { border-top: 1px solid var(--line); padding-top: 10px; }
.stats dt { font: 400 12px/1.3 var(--mono); color: var(--muted); letter-spacing: .02em; }
.stats dd { margin: 4px 0 0; font: 400 2rem/1 var(--serif); letter-spacing: -.01em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.chip { font: 500 12px/1 var(--mono); padding: 6px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }

/* writing list */
.posts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.post-row { border-bottom: 1px solid var(--line); }
.post-row a {
  display: grid; grid-template-columns: 110px 1fr auto; gap: 8px 28px; align-items: baseline;
  padding: 22px 4px; text-decoration: none;
}
.post-row a:hover .post-title { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.post-date { font: 400 13px/1.4 var(--mono); color: var(--muted); }
.post-title { font: 400 1.55rem/1.15 var(--serif); letter-spacing: -.01em; margin: 0 0 6px; }
.post-sum { color: var(--ink-2); font-size: 15.5px; margin: 0; line-height: 1.55; }
.post-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: end; max-width: 220px; }
.post-new { font: 600 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-left: 8px; vertical-align: 4px; }
@media (max-width: 760px) {
  .post-row a { grid-template-columns: 1fr; gap: 6px; padding: 20px 2px; }
  .post-tags { justify-content: start; max-width: none; }
}

/* about */
.about { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(28px, 6vw, 72px); align-items: start; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }
.about .toolbox { grid-template-columns: 1fr 1fr; gap: 28px 32px; }
@media (max-width: 560px) { .about .toolbox { grid-template-columns: 1fr; } }
.toolbox { display: grid; gap: 20px; }
.toolbox h3 { font: 500 12.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.edu { font-size: 15px; color: var(--ink-2); line-height: 1.5; margin: 0; }

/* ---------------------------------------------------------------- footer */

.footer { border-top: 1px solid var(--line); padding: 56px 0 40px; }
.footer .wrap { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.footer-cta { font: 400 clamp(1.8rem, 4vw, 2.6rem)/1.1 var(--serif); margin: 0 0 6px; }
.footer-cta a { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.socials { display: flex; gap: 8px; }
.socials a {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.socials a:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.socials svg { width: 18px; height: 18px; }
.fine { font: 400 12.5px/1.5 var(--mono); color: var(--muted); margin-top: 28px; }

/* ---------------------------------------------------------------- article */

.article-head { padding: clamp(40px, 7vw, 80px) 0 28px; }
.back { font: 500 13px/1 var(--mono); color: var(--muted); text-decoration: none; display: flex; width: fit-content; gap: 6px; margin-bottom: 28px; }
.back:hover { color: var(--ink); }
.article-title { font: 400 clamp(2.3rem, 6vw, 3.9rem)/1.02 var(--serif); letter-spacing: -.02em; margin: 14px 0 18px; }
.dek { font-size: 1.2rem; color: var(--ink-2); margin: 0 0 24px; line-height: 1.55; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font: 400 13px/1.4 var(--mono); color: var(--muted); padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.meta .chips { margin-left: auto; }

.prose { padding: 32px 0 24px; font-size: 18px; line-height: 1.75; }
.prose > * + * { margin-top: 1.1em; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose h2 { font: 400 2rem/1.15 var(--serif); margin: 2em 0 0; letter-spacing: -.01em; }
.prose h3 { font: 600 1.2rem/1.3 var(--sans); margin: 1.8em 0 0; }
.prose h4 { font: 600 1.02rem/1.35 var(--sans); margin: 1.6em 0 0; color: var(--ink-2); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose li::marker { color: var(--muted); }
.prose img {
  margin: 1.6em auto; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; box-shadow: var(--shadow);
}
.prose p > img { margin: 1.2em auto; }
.prose a { color: var(--accent); }
.prose strong, .prose b { font-weight: 600; color: var(--ink); }
.prose code { font: 500 .86em/1.5 var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: .1em .35em; }
.prose pre { background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius-sm); padding: 18px 20px; overflow-x: auto; font-size: 14px; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose blockquote { margin-left: 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); color: var(--ink-2); font-style: italic; }
.prose .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font: 600 12px/1.3 var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.prose tr:last-child td { border-bottom: 0; }
.prose td.num, .prose th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.prose .callout { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius-sm); padding: 16px 20px; font-size: 16.5px; }
.prose .board { margin: 1.8em 0; }
.prose .board-grid { padding-left: 0; }
.prose .board-grid li + li { margin-top: 0; }
.prose figure { margin: 1.8em 0; }
.prose figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.prose .archive-note { font: 400 13.5px/1.5 var(--mono); color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; margin-top: 2.4em; }

.more { padding: 24px 0 72px; }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .more-grid { grid-template-columns: 1fr; } }
.more-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; text-decoration: none; background: var(--surface); }
.more-card:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.more-card .post-title { font-size: 1.3rem; margin: 6px 0 0; }
.more-card.next { text-align: right; }
@media (max-width: 640px) { .more-card.next { text-align: left; } }
