/* forester.dev: the Forester design language in its midnight variant */

/* Fonts are served from this site, so no third party sees visitors (Latin subset) */
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/figtree-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'League Spartan';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/league-spartan-700-latin.woff2') format('woff2');
}

:root {
  --bg: #0b0e14;
  --surface: #121722;
  --surface-raised: #192030;
  --line: #242c3c;
  --ink: #e8e7e4;
  --muted: #98a0ae;
  --accent: #2456d6;
  --accent-hover: #2d62ec;
  --accent-text: #7b9cf5;
  --accent-ink: #ffffff;

  --font-display: 'League Spartan', system-ui, -apple-system, sans-serif;
  --font-sans: 'Figtree', system-ui, -apple-system, sans-serif;

  --step-small: clamp(0.84rem, 0.81rem + 0.12vw, 0.9rem);
  --step-body: clamp(1.0625rem, 1rem + 0.2vw, 1.15rem);
  --step-lead: clamp(1.25rem, 1.12rem + 0.55vw, 1.55rem);
  --step-h2: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  --step-display: clamp(3.75rem, 1.2rem + 9vw, 9.5rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-hover: 180ms;
  --page-margin: 32px;
  --measure: 1180px;

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
a:focus-visible,
button:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 3px; }

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

p { margin: 0; }

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--page-margin));
  margin: 0 auto;
  padding: 0 var(--page-margin);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  z-index: 10;
}
.skip:focus { left: 8px; }

/* Header: the mark and the name, nothing else */
.site-head { padding: 28px 0; }

.brand {
  display: inline-flex;
  align-items: baseline;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: -0.04em;
}
.brand:hover { color: var(--ink); }
.brand .dot { color: var(--accent); }

main { flex: 1; }

/* Home */
.hero {
  padding-top: clamp(72px, 12vw, 168px);
  padding-bottom: clamp(64px, 9vw, 128px);
  display: grid;
  gap: 28px;
}

.hero h1 {
  font-size: var(--step-display);
  letter-spacing: -0.055em;
  line-height: 0.88;
}

.hero h1 .dot { color: var(--accent); }

.hero p {
  font-size: var(--step-lead);
  color: var(--muted);
  max-width: 34ch;
}

.section-label {
  font-size: var(--step-small);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.projects {
  list-style: none;
  margin: 0;
  padding: 0;
}

.projects li { border-bottom: 1px solid var(--line); }

.project {
  display: grid;
  grid-template-columns: 64px minmax(0, 5fr) minmax(0, 6fr) 32px;
  gap: 24px;
  align-items: start;
  padding: 36px 16px;
  margin: 0 -16px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--t-hover) var(--ease-out);
}

.project:hover { color: var(--ink); background: var(--surface); }
.project:hover .project-go { background: var(--accent); color: var(--accent-ink); }

.project-index {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 6px;
  padding-left: 4px;
}

.project h2 { font-size: var(--step-h2); }

.project-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: var(--step-small);
  color: var(--muted);
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 600;
}
.live::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #2fae6b;
}

.project-desc { color: var(--muted); max-width: 52ch; }
.project-desc strong { color: var(--ink); font-weight: 600; }

.project-go {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--surface-raised);
  color: var(--ink);
  transition: background-color var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out);
}

/* Footer */
.site-foot {
  margin-top: clamp(96px, 12vw, 160px);
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  font-size: var(--step-small);
  color: var(--muted);
}

.site-foot .wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px 32px;
  flex-wrap: wrap;
}

.site-foot nav {
  display: flex;
  gap: 8px 24px;
  flex-wrap: wrap;
}

.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover,
.site-foot a[aria-current='page'] { color: var(--ink); }

/* Legal documents */
.doc {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 64px;
  padding-top: clamp(48px, 7vw, 96px);
  align-items: start;
}

.doc-head {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.doc-head h1 { font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4.75rem); letter-spacing: -0.045em; }
.doc-head p { color: var(--muted); max-width: 62ch; }

.toc {
  position: sticky;
  top: 24px;
  font-size: var(--step-small);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  counter-reset: toc;
}

.toc li { counter-increment: toc; display: flex; gap: 10px; }
.toc li::before { content: counter(toc, decimal-leading-zero); color: var(--muted); font-variant-numeric: tabular-nums; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }

.doc-body {
  max-width: 70ch;
  counter-reset: section;
}

.doc-body section { padding-bottom: 40px; scroll-margin-top: 24px; }

.doc-body h2 {
  font-size: var(--step-lead);
  letter-spacing: -0.025em;
  margin-bottom: 14px;
  counter-increment: section;
}

.doc-body h2::before {
  content: counter(section, decimal-leading-zero) '  ';
  color: var(--accent-text);
  white-space: pre;
}

.doc-body h3 { font-size: 1.05rem; letter-spacing: -0.01em; margin: 20px 0 8px; }
.doc-body p,
.doc-body li { color: #c9cbd0; }
.doc-body p + p { margin-top: 12px; }
.doc-body ul { padding-left: 1.2em; margin: 12px 0; display: grid; gap: 6px; }
.doc-body strong { color: var(--ink); }

.callout {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 16px 18px;
  margin: 16px 0;
}

/* 404 */
.missing { padding-top: clamp(72px, 12vw, 168px); padding-bottom: clamp(72px, 12vw, 168px); display: grid; gap: 20px; }
.missing h1 { font-size: var(--step-display); letter-spacing: -0.055em; line-height: 0.9; }
.missing p { color: var(--muted); }

@media (max-width: 860px) {
  :root { --page-margin: 16px; }
  .project {
    grid-template-columns: 40px minmax(0, 1fr) 32px;
    gap: 14px 16px;
    padding: 28px 12px;
    margin: 0 -12px;
  }
  .project-desc { grid-column: 2 / 3; grid-row: 2; }
  .project-go { grid-column: 3; grid-row: 1; }
  .doc { grid-template-columns: 1fr; gap: 32px; }
  .toc { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
