/*
 * kleininen.com
 *
 * One light theme, no JavaScript.
 */

:root {
  color-scheme: light;

  --bg: #f6f2e8;
  --surface: #ebe6d8;
  --fg: #0a0f24;
  --muted: #596181;
  --accent: #2340ff;
  --on-accent: #fff;
  --rule: var(--fg);
  --lime: #c6f432;
  --on-lime: #0a0f24;

  --hl-keyword: #a626a4;
  --hl-string: #50803c;
  --hl-comment: #8a8a8a;
  --hl-number: #b35c00;
  --hl-name: #2563c4;

  --font-body: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 38rem;
}

/* ---------- base ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
}

main, .site-header, .site-footer {
  width: 100%;
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 3rem);
}

main { flex: 1; padding-block: 0 5rem; counter-reset: sec; }

img, svg { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.15; }
ul { padding: 0; margin: 0; list-style: none; }

a { color: var(--fg); text-decoration-thickness: 2px; text-underline-offset: .2em; text-decoration-color: var(--accent); }
a:hover { background: var(--lime); color: var(--on-lime); }

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

.skip { position: absolute; left: -999px; top: 0; padding: .5rem 1rem; background: var(--fg); color: var(--bg); z-index: 20; }
.skip:focus { left: 0; }

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

.site-header {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap;
  gap: 1rem 2rem; padding-block: 1.25rem; border-bottom: 3px solid var(--rule);
}
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; text-decoration: none; text-transform: uppercase; }
.brand::after { content: "."; color: var(--accent); }

.site-header nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.5rem; font-weight: 600; }
.site-header nav a { text-decoration: none; }
.site-header nav a:hover { background: none; color: var(--accent); }
.site-header nav a[aria-current] { color: var(--accent); }


.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem;
  padding-block: 1.5rem; border-top: 3px solid var(--rule); font-size: .9rem;
}
.site-footer p { margin: 0; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }

/* ---------- shared bits ---------- */

.eyebrow, .meta { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; font-weight: 600; color: var(--muted); margin: 0; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; }
.tag { text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; font-weight: 700; border: 1.5px solid var(--fg); padding: .1rem .4rem; }

.button, .hero-links a { display: inline-block; text-decoration: none; background: var(--fg); color: var(--bg); padding: .6rem 1.1rem; font-weight: 700; }
.button:hover, .hero-links a:hover { background: var(--accent); color: var(--on-accent); }

.more { margin-top: 1.5rem; font-weight: 700; }

/* ---------- home ---------- */

.hero { padding-block: clamp(2.5rem, 9vw, 7rem) 3rem; display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 1.5rem; }
.hero > * { grid-column: 1 / -1; }
.hero h1 { font-size: clamp(3rem, 12vw, 9rem); font-weight: 800; letter-spacing: -.055em; line-height: .9; margin: 1rem 0 2rem; }
.hero .name { background: var(--lime); color: var(--on-lime); padding: 0 .08em; }
.lede { font-size: clamp(1.15rem, 2.2vw, 1.6rem); line-height: 1.3; font-weight: 500; max-width: 38ch; letter-spacing: -.01em; }
.hero .lede { grid-column: 1 / span 8; }
.hero-links { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 0; }

.section { border-top: 3px solid var(--rule); padding-block: 1rem 3rem; display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5rem; counter-increment: sec; }
.section > * { grid-column: 4 / -1; }
.section > .section-title { grid-column: 1 / 4; }
.section-title { font-size: 1rem; font-weight: 700; margin: 0; align-self: start; }
.section-title::before { content: "0" counter(sec); display: block; color: var(--accent); font-size: 2.5rem; letter-spacing: -.04em; line-height: 1; margin-bottom: .5rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1.5rem; margin: 0; }
.stats > div { display: flex; flex-direction: column; justify-content: space-between; gap: .35rem; }
.stats dt { text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; font-weight: 700; color: var(--muted); margin: 0; }
.stats dd { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -.05em; line-height: 1; margin: 0; }
.stats > div:first-child dd { color: var(--accent); }
/* Pinned to the bottom of the page, right-aligned, just above the footer rule. */
main:has(> .footnote) { display: flex; flex-direction: column; padding-bottom: 1.25rem; }
.footnote { margin: 2rem 0 0; font-size: .85rem; color: var(--muted); text-align: right; }
main > .footnote { margin-top: auto; padding-top: 2rem; }

@media (max-width: 48rem) {
  .hero .lede, .section > *, .section > .section-title { grid-column: 1 / -1; }
}

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

.post-list li { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding-block: 1rem; border-bottom: 1px solid var(--muted); }
.post-list li:first-child, .project-card:first-child { padding-top: 0; }
.post-list h3, .project-card h3 { font-size: clamp(1.4rem, 3vw, 2.1rem); font-weight: 700; letter-spacing: -.03em; margin: 0 0 .25rem; }
.post-list h3 a, .project-card h3 a { text-decoration: none; }
.post-list p, .project-card p { margin: 0; color: var(--muted); }

.project-card { padding-block: 1rem; border-bottom: 1px solid var(--muted); }

.archive { margin-top: 3rem; border-top: 3px solid var(--rule); padding-top: 1rem; }
.archive-title { font-size: 1rem; font-weight: 700; margin: 0; text-transform: uppercase; letter-spacing: .1em; }
.current-title { margin-bottom: 1.5rem; }
.archive-note { margin: .25rem 0 1.5rem; color: var(--muted); }
.archive .project-card h3 { font-size: 1.4rem; }
.project-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }

@media (max-width: 36rem) { .post-list li { grid-template-columns: 1fr; gap: .25rem; } }

/* ---------- pages and posts ---------- */

.page-head, .post-head { padding-block: clamp(2rem, 6vw, 4rem) 1.5rem; }
.page-head h1, .post-head h1 { font-size: clamp(2.5rem, 8vw, 6rem); font-weight: 800; letter-spacing: -.05em; line-height: .95; margin: .5rem 0 1rem; }

main > .prose, main > .post-list, main > .project-list { padding-top: 1.5rem; }
main > .prose { max-width: none; }
main > .prose > * { max-width: var(--measure); }

/* Projects with a screenshot or live demo: two clean columns. The title and text run down the left;
   the picture sits on the right, level with the title, and stays in view while the text scrolls. */
main > .prose.with-shot {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-areas: "head shot" "body shot";
  grid-template-rows: auto 1fr;
  column-gap: 3rem;
  align-items: start;
}
.with-shot > .post-head { grid-area: head; max-width: none; }
.with-shot > .shot { grid-area: shot; max-width: none; position: sticky; top: 1.5rem; margin: 0; padding-top: clamp(2rem, 6vw, 4rem); }
.with-shot > .project-body { grid-area: body; max-width: 34rem; }
.project-body > :first-child { margin-top: 0; }
.has-shot .post-head-text > * { max-width: 34rem; }
.has-shot h1 { font-size: clamp(2.5rem, 6vw, 5rem); }
.shot img { display: block; width: 100%; height: auto; border: 3px solid var(--rule); }
.shot a:hover { background: none; }
@media (max-width: 56rem) {
  main > .prose.with-shot { grid-template-columns: 1fr; grid-template-areas: "head" "shot" "body"; grid-template-rows: auto; }
  .with-shot > .shot { position: static; padding-top: 0; margin-bottom: 1.5rem; }
}

.prose { line-height: 1.6; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.6rem; letter-spacing: -.03em; margin-top: 2.5rem; }
.prose ul { margin: 1rem 0; }
.prose li + li { margin-top: .9rem; }
.prose img { border-radius: 0; }
.prose blockquote { margin: 1.5rem 0; padding: .25rem 1rem; border-left: 4px solid var(--accent); color: var(--muted); }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--surface); padding: .1em .35em; }
.prose pre { background: var(--surface); padding: 1rem; overflow-x: auto; font-size: .875rem; line-height: 1.5; tab-size: 2; }
.prose pre code { background: none; padding: 0; font-size: inherit; }

/* makeup token classes (<code class="makeup elixir">) */
.makeup .k, .makeup .kd, .makeup .kn, .makeup .kc, .makeup .kr, .makeup .kp, .makeup .kt, .makeup .ow { color: var(--hl-keyword); }
.makeup .s, .makeup .s1, .makeup .s2, .makeup .sa, .makeup .sc, .makeup .se, .makeup .si, .makeup .sr, .makeup .sd { color: var(--hl-string); }
.makeup .c, .makeup .c1, .makeup .cm, .makeup .cs { color: var(--hl-comment); font-style: italic; }
.makeup .ss, .makeup .m, .makeup .mi, .makeup .mf, .makeup .mh, .makeup .mb, .makeup .mo { color: var(--hl-number); }
.makeup .nf, .makeup .nc, .makeup .nn, .makeup .na, .makeup .nb, .makeup .no, .makeup .nd, .makeup .ne { color: var(--hl-name); }

/* the live demo on /projects/breve sits where a screenshot would */
.shot .demo { aspect-ratio: 1400 / 875; border: 3px solid var(--rule); background: #0b1226; overflow: hidden; }
