/* Personal site. One reading page: system type, two themes, no motion beyond a scroll-linked fade. */

:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-2: #57575d;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #1a7f37;
  --on-accent: #ffffff;
  --bar-bg: rgba(251, 251, 253, 0.72);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);

  --gutter: 1rem;
  --page: 68rem;
  --measure: 40rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d10;
    --surface: #14171c;
    --text: #f5f5f7;
    --text-2: #a1a1aa;
    --line: rgba(255, 255, 255, 0.09);
    --accent: #56d364;
    --on-accent: #0b0d10;
    --bar-bg: rgba(11, 13, 16, 0.7);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

@media (min-width: 48rem) {
  :root { --gutter: 2rem; }
}

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

html {
  font: 100%/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 4.5rem;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  transition: background-color 300ms ease, color 300ms ease; /* ease light/dark switches */
}

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 0.06em; }
a:hover { text-decoration-thickness: 0.12em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 0.25rem; }

.skip {
  position: absolute; left: var(--gutter); top: -3rem; z-index: 20;
  padding: 0.5rem 0.75rem; background: var(--surface); border-radius: 0.5rem;
}
.skip:focus { top: 0.75rem; }

/* Top bar: translucent material, content scrolls underneath, fade at the scroll edge instead of a border. */

.bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
}
.bar::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 100%;
  height: 1rem;
  background: linear-gradient(var(--bar-bg), transparent);
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .bar::after { opacity: 0; animation: edge linear both; animation-timeline: scroll(); animation-range: 0 4rem; }
  @keyframes edge { to { opacity: 1; } }
}

.bar-inner {
  max-width: var(--page); margin: 0 auto;
  padding: 0 var(--gutter);
  height: 3.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--text); text-decoration: none;
  font-weight: 600; letter-spacing: -0.01em; white-space: nowrap;
}
.bar nav { display: flex; gap: 1.25rem; }
.bar nav a {
  color: var(--text); text-decoration: none;
  font-size: 0.875rem; font-weight: 500; letter-spacing: 0.005em;
}
.bar nav a:hover { color: var(--accent); }

/* Layout */

main > section, .foot { max-width: var(--page); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* Hero */

.hero { padding-top: 4rem; padding-bottom: 2rem; }
.display {
  margin: 0;
  max-width: 22em;
  font-size: clamp(1.875rem, 1.2rem + 2.6vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}
.lede {
  margin: 1.25rem 0 0;
  max-width: 34em;
  color: var(--text-2);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.45;
  letter-spacing: -0.005em;
}

/* Sections */

.section-title {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.block { padding-top: 2rem; padding-bottom: 1.5rem; }
.block p, .block ul { max-width: var(--measure); margin: 0 0 1rem; }
.block ul { padding-left: 1.25rem; }
.card {
  max-width: var(--measure);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card p { margin: 0 0 0.75rem; }
.card .links { margin: 0; }
.hero-links { margin: 1rem 0 0; }
.block .facts { list-style: none; padding: 0; }
.block .facts li { margin: 0 0 0.5rem; }
.block .note { color: var(--text-2); font-size: 0.875rem; }

/* Footer */

.foot {
  padding-top: 2rem; padding-bottom: 3rem;
  background: linear-gradient(var(--line), var(--line)) var(--gutter) 0 / calc(100% - 2 * var(--gutter)) 1px no-repeat;
  color: var(--text-2); font-size: 0.875rem;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.foot .label { color: var(--text); font-weight: 600; }
.foot a { color: var(--text-2); }
.foot a:hover { color: var(--text); }
.foot p { margin: 1rem 0 0; }

/* Accessibility preferences */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar::after { animation: none; opacity: 1; }
}

@media (prefers-reduced-transparency: reduce) {
  .bar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .bar::after { background: linear-gradient(var(--bg), transparent); }
}

@media (prefers-contrast: more) {
  :root { --line: currentColor; --text-2: var(--text); --shadow: none; }
  .bar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 1px solid var(--text); }
  .bar::after { display: none; }
}

@media (forced-colors: active) {
  .bar::after { display: none; }
}

@media (max-width: 30rem) {
  .bar-inner { gap: 0.5rem; }
  .brand { font-size: 0.9375rem; }
  .bar nav { gap: 0.75rem; }
  .bar nav a { font-size: 0.8125rem; }
}
