/* mindlathe: hand-written CSS. No frameworks, no web fonts. */

:root {
  color-scheme: light dark;
  --bg: #f6f4ef;
  --bg-2: #efece4;
  --surface: #ffffff;
  --fg: #1b1d21;
  --muted: #5d6169;
  --line: #e2ded3;
  --accent: #d9542b;
  --accent-2: #2b6cd9;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --shadow: 0 1px 2px rgb(20 20 30 / .05), 0 8px 24px -12px rgb(20 20 30 / .18);
  --shadow-hi: 0 2px 4px rgb(20 20 30 / .06), 0 18px 40px -16px rgb(20 20 30 / .28);
  --radius: 14px;
  --max: 72rem;
  --header-h: 4rem;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --step--1: clamp(.83rem, .8rem + .15vw, .92rem);
  --step-0: clamp(1rem, .96rem + .2vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.1rem + .45vw, 1.45rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3: clamp(2.1rem, 1.5rem + 3vw, 3.9rem);
  --space: clamp(1rem, .8rem + 1vw, 1.5rem);
  accent-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-2: #1a1d22;
    --surface: #1d2026;
    --fg: #e9e7e2;
    --muted: #a2a6ae;
    --line: #2c3038;
    --accent: #f07a50;
    --accent-2: #7aa8ff;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);
    --shadow-hi: 0 2px 4px rgb(0 0 0 / .45), 0 18px 40px -16px rgb(0 0 0 / .75);
  }
}

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

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

body {
  margin: 0;
  background:
    radial-gradient(60rem 30rem at 85% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
  color: var(--fg);
  font: var(--step-0)/1.65 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

.wrap { width: min(100% - 2 * var(--space), var(--max)); margin-inline: auto; }
.mono, .kicker, .eyebrow, .meta, .tag, .facts span, .nav a { font-family: var(--mono); }

/* skip link */
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: .6rem 1rem; border-radius: 8px;
  background: var(--fg); color: var(--bg); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 1rem; }

/* header + nav */
.site-header {
  position: sticky; top: 0; z-index: 50;
  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 var(--line);
}
.header-inner {
  min-height: var(--header-h);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1.5rem; padding-block: .5rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--fg); text-decoration: none; font-weight: 700; font-size: var(--step-1);
  letter-spacing: -.03em;
}
.brand-mark { width: 1.8rem; height: 1.8rem; }
.brand-mark rect { fill: var(--accent); }
.brand-mark circle { stroke: #fff; fill: #fff; }
.brand-mark circle[fill="none"] { fill: none; }

.nav {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .25rem;
}
.nav a {
  display: block; padding: .4rem .7rem; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: var(--step--1);
  transition: background-color .15s, color .15s;
}
.nav a:hover { color: var(--fg); background: var(--bg-2); }

/* sections */
main:focus { outline: none; }
section[id] { scroll-margin-top: calc(var(--header-h) + 1.5rem); }
.section { padding-block: clamp(3rem, 2rem + 4vw, 6rem) 0; }
.section-head { margin-bottom: 1.75rem; }
.kicker { color: var(--accent); font-size: var(--step--1); margin: 0 0 .4rem; letter-spacing: .04em; }
h2 { font-size: var(--step-2); }

.split { display: grid; gap: 1rem 3rem; }
@media (min-width: 52rem) {
  .split { grid-template-columns: minmax(12rem, 1fr) 2fr; }
  .split .section-head { position: sticky; top: calc(var(--header-h) + 2rem); align-self: start; }
}
.prose { max-width: 42rem; color: var(--fg); }
.prose p { color: color-mix(in srgb, var(--fg) 88%, var(--muted)); }

/* hero */
.hero { padding-block: clamp(3.5rem, 2rem + 7vw, 8rem) clamp(1rem, 2vw, 2rem); }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: var(--step--1); color: var(--muted);
  padding: .3rem .75rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
}
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: #3cb371;
  box-shadow: 0 0 0 3px color-mix(in srgb, #3cb371 25%, transparent); }
.hero h1 { font-size: var(--step-3); max-width: 18ch; margin: 1.25rem 0 1.25rem; }
.lede { font-size: var(--step-1); color: var(--muted); max-width: 46rem; line-height: 1.55; }
.chips { list-style: none; padding: 0; margin: 1.75rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li {
  font: var(--step--1)/1 var(--mono); padding: .45rem .7rem; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
}

/* project cards */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: var(--space);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16.5rem), 1fr));
}
.card {
  position: relative; display: flex; flex-direction: column;
  padding: 1.4rem 1.4rem 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0; transition: opacity .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.card:hover::before { opacity: 1; }
.card-icon {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; margin-bottom: 1rem;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 1.1rem;
}
.card h3 { font-size: var(--step-1); margin-bottom: .5rem; }
.card p { color: var(--muted); font-size: .97em; }
.card .meta { margin: auto 0 0; padding-top: .9rem; border-top: 1px dashed var(--line);
  font-size: var(--step--1); color: var(--muted); }

/* facts + now */
.facts { list-style: none; padding: 0; margin: 1.5rem 0 0; border-top: 1px solid var(--line); }
.facts li { display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.facts span { min-width: 9rem; color: var(--accent); font-size: var(--step--1); padding-top: .15em; }

.now { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; max-width: 46rem; }
.now li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem;
  padding: .9rem 1.1rem; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 10px;
}
.tag { font-size: var(--step--1); color: var(--accent-2); min-width: 6rem; }

/* footer */
.site-footer { margin-top: clamp(4rem, 3rem + 4vw, 7rem); border-top: 1px solid var(--line); background: var(--bg-2); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem;
  padding-block: 2rem; font-size: var(--step--1); color: var(--muted); }
.footer-inner p { margin: 0; }

@media (max-width: 40rem) {
  .header-inner { justify-content: center; }
  .nav { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .card:hover { transform: none; }
}

@media print {
  .site-header, .skip { position: static; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
}

/* links inside cards, buttons */
.card-link { margin-top: .9rem; font: 600 var(--step--1)/1.3 var(--mono); text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.card h3 a { color: inherit; text-decoration: none; }
.card .stretched::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card:has(.stretched:focus-visible) { outline: 3px solid var(--accent-2); outline-offset: 3px; }
.card .stretched:focus-visible { outline: none; }
.cta-row { margin-top: 1.5rem; }
.button {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.1rem; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow-hi); }
.nav .nav-ext { color: var(--accent); }

/* article pages (design notes) */
.article { padding-block: clamp(3rem, 2rem + 5vw, 6rem) 0; }
.article-head { max-width: 46rem; margin-bottom: 2.5rem; }
.article-head h1 { font-size: var(--step-3); margin: .75rem 0 1rem; max-width: 20ch; }
.breadcrumb { font: var(--step--1)/1.4 var(--mono); color: var(--muted); margin: 0; }
.breadcrumb a { color: var(--muted); }
.article-body { max-width: 46rem; }
.article-body h2 { margin: 3rem 0 1rem; scroll-margin-top: calc(var(--header-h) + 1.5rem); }
.article-body h3 { font-size: var(--step-1); margin: 1.75rem 0 .5rem; }
.article-body blockquote {
  margin: 1.5rem 0; padding: 1rem 1.25rem; border-left: 3px solid var(--accent);
  background: var(--surface); border-radius: 0 10px 10px 0; font-size: var(--step-1); line-height: 1.5;
}
.article-body blockquote p:last-child { margin: 0; }
.pages { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; counter-reset: page; }
.pages > li {
  counter-increment: page; position: relative;
  padding: 1.1rem 1.25rem 1.1rem 3.5rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.pages > li::before {
  content: counter(page, decimal-leading-zero); position: absolute; left: 1.1rem; top: 1.15rem;
  font: 600 var(--step--1)/1.6 var(--mono); color: var(--accent);
}
.pages h3 { margin: 0 0 .35rem; }
.pages p { margin: 0; color: var(--muted); }
.principles { padding-left: 1.2rem; }
.principles li { margin: .6rem 0; }
.principles li::marker { color: var(--accent); }
.takeaway { margin-top: 3rem; padding: 1.5rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.takeaway h2 { margin-top: 0; }
