/*
 * jacob.knapp.pro
 *
 * Two faces, eight colors, one column. Boska carries the name and the
 * monogram; Switzer carries everything else. Chrome (top bar, footer)
 * rides the page gutter, content rides the 42rem column.
 */

@font-face {
  font-family: "Boska";
  src: url("../fonts/Boska-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Switzer";
  src: url("../fonts/Switzer-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* color */
  --bg: #0e0f11;
  --bg-raised: #141518;
  --text: #e8e9eb;
  --text-dim: #9a9ea6;
  --text-faint: #818793;
  --line: #24262b;
  --accent: #8ab4ff;
  --accent-strong: #b3ceff;

  /* type */
  --display: "Boska", Georgia, serif;
  --body: "Switzer", "Helvetica Neue", Arial, sans-serif;

  /* layout */
  --col: 42rem;
  --gutter: 1.5rem;
  --section: 4.5rem;
  --rule: 1px solid var(--line);
  --r-pill: 999px;

  /* motion: color-only changes run fast, moving surfaces slightly slower */
  --t-text: 140ms;
  --t-surface: 160ms;
  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);

  color-scheme: dark;
}

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

* { box-sizing: border-box; }

html {
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--bg);
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  padding: 0 var(--gutter);
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.0625rem;
  font-weight: 430;
  line-height: 1.65;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }

::selection { background: var(--accent); color: var(--bg); }

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

/* standard properties cover Firefox and new Chromium; the rest get this */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--r-pill);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
::-webkit-scrollbar-corner { background: var(--bg); }

/* ---------------------------------------------------------- skip link */

.skip {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  transform: translate(-50%, -250%);
  z-index: 2;
  padding: 0.6rem 1.1rem;
  border: var(--rule);
  border-radius: var(--r-pill);
  background: var(--bg-raised);
  font-size: 0.95rem;
  font-weight: 480;
  white-space: nowrap;
}
.skip:focus-visible { transform: translate(-50%, 0); }

/* skip target */
#intro:focus-visible { outline-offset: 8px; }

/* ------------------------------------------------------------ top bar */

.top {
  padding: var(--gutter) 0 0;
  display: flex;
  flex-wrap: wrap;
  row-gap: 0.5rem;
  align-items: baseline;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 660;
  letter-spacing: 0.1em;
  line-height: 1.6; /* pins .top at exactly 3.5rem; the hero subtracts it */
  color: var(--text-dim);
}

.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem var(--gutter);
}
.top nav a {
  padding: 0.55rem 0;
  margin: -0.55rem 0; /* tap target without moving a pixel */
  font-size: 0.9rem;
  font-weight: 470;
  color: var(--text-dim);
  transition: color var(--t-text) ease-out;
}
.top nav a:hover { color: var(--text); }

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

.hero {
  position: relative;
  min-height: calc(100vh - 3.5rem); /* for engines that predate lvh */
  min-height: calc(100lvh - 3.5rem); /* Safari's collapsed-chrome viewport */
  display: flex;
  align-items: center;
}

.hero-copy {
  max-width: var(--col);
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  padding-bottom: 9rem;
  text-align: center;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 1.6rem + 7vw, 6rem);
  font-weight: 340;
  letter-spacing: 0;
  line-height: 1.04;
}

.role {
  margin: 1.1rem 0 0;
  font-size: 1.1rem;
  font-weight: 460;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}
.role .seg { white-space: nowrap; }
.role-text { min-width: 0; text-wrap: balance; }
.role::before,
.role::after {
  content: "";
  flex: 0 1 2rem;
  height: 1px;
  background: var(--accent);
}

@media (max-width: 40rem) {
  .role .seg { display: block; white-space: normal; }
  .role .sep { display: none; }
}
@media (max-width: 24rem) {
  .role { gap: 0.5rem; }
  .role::before, .role::after { flex: 0 1 1rem; }
}

/* the horizon: a canvas of drifting lines, drawn by js/site.js */
.field {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: calc(100% + 2 * var(--gutter));
  height: 42svh;
  pointer-events: none;
}

/* ------------------------------------------------------------- panels */

.panel {
  max-width: var(--col);
  margin: 0 auto;
  padding: var(--section) 0 0;
}

.panel h2 {
  margin: 0 0 var(--gutter);
  font-size: 0.85rem;
  font-weight: 550;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: color var(--t-text) ease-out;
}
.panel h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.panel:target h2 { color: var(--text-dim); }

/* a label's rule and a table's first rule shouldn't read as one header */
.panel h2:has(+ .stack) { margin-bottom: 2.5rem; }
.panel:has(.stack) { padding-bottom: 1rem; }

.panel p {
  margin: 0 0 1rem;
  max-width: 35rem;
  color: var(--text-dim);
  text-wrap: pretty;
}
.panel p:last-child { margin-bottom: 0; }

.panel .intro {
  margin: 0;
  max-width: 36rem;
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text);
  text-wrap: pretty;
}

/* ledger: term / definition rows between hairlines */
.stack { margin: 0; }
.stack-row {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: var(--gutter);
  padding: 0.85rem 0;
  border-top: var(--rule);
}
.stack-row:last-child { border-bottom: var(--rule); }
.stack dt { font-size: 0.95rem; font-weight: 520; color: var(--text); }
.stack dd { margin: 0; font-size: 0.95rem; color: var(--text-dim); text-wrap: pretty; }

@media (max-width: 34rem) {
  .stack-row { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* ------------------------------------------------------------ contact */

.reach { margin-bottom: var(--gutter); }

.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.links li { display: flex; align-items: center; }

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.6rem 1.1rem;
  border: var(--rule);
  border-radius: var(--r-pill);
  background: var(--bg-raised);
  font-size: 0.95rem;
  font-weight: 480;
  color: var(--text);
  transition: border-color var(--t-surface) ease-out, background var(--t-surface) ease-out;
}
.links a:hover {
  border-color: var(--accent);
  background: var(--bg);
}

/* one direction for every pill: they all mean "go", wherever they go */
.arrow {
  color: var(--text-faint);
  transition: transform var(--t-surface) ease-out, color var(--t-surface) ease-out;
}
.links a:hover .arrow,
.links a:focus-visible .arrow { transform: translateX(2px); color: var(--accent); }

.email-link { cursor: pointer; }
/* keep the arrow lit once revealed */
.email-link.is-armed .arrow { transform: translateX(2px); color: var(--accent); }

/* removed by site.js; still here means the reveal isn't wired */
.noscript-mail { color: var(--text-dim); font-size: 0.95rem; padding-inline-start: 0.5rem; }
.links li:has(.noscript-mail) .email-link { display: none; }

/* for crawlers that ignore robots.txt; real browsers delete it on load */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

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

.foot {
  max-width: var(--col);
  margin: var(--section) auto 0;
  border-top: var(--rule);
  padding: 2rem 0 2.5rem;
}
.foot p {
  margin: 0 0 0.35rem;
  max-width: 27rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  text-wrap: pretty;
}

/* ---------------------------------------------------------- not found */

/* 404.html borrows the hero grammar; no field down there, so no 9rem gap */
.hero--lost .hero-copy { padding-bottom: 0; }
.hero--lost .lost {
  margin: 1.5rem auto 0;
  max-width: 30rem;
  color: var(--text-dim);
  text-wrap: pretty;
}
.hero--lost .links { margin-top: 1.75rem; justify-content: center; }

/* ------------------------------------------------------------- motion */

/* one entrance; after it the page holds still except the horizon */
@media (prefers-reduced-motion: no-preference) {
  .top, .hero h1, .role {
    animation: rise 550ms var(--ease-out) backwards;
  }
  .hero h1 { animation-delay: 60ms; }
  .role { animation-delay: 120ms; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .arrow { transition: none; }
  .links a:hover .arrow,
  .links a:focus-visible .arrow,
  .email-link.is-armed .arrow { transform: none; }
}

/* --------------------------------------------------------------- a11y */

@media (prefers-contrast: more) {
  :root { --text-dim: #e8e9eb; --text-faint: #9a9ea6; --line: #818793; }
}

/* forced colors paints over backgrounds; hairlines drawn with background
   (rather than border) need redeclaring in system colors */
@media (forced-colors: active) {
  .role::before, .role::after, .panel h2::after { background: CanvasText; }
  .field { display: none; }
}

/* -------------------------------------------------------------- print */

@media print {
  :root {
    --bg: #fff; --bg-raised: #fff; --text: #000;
    --text-dim: #222; --text-faint: #555; --line: #bbb;
    --accent: #000; --accent-strong: #000;
  }
  .top, .hero h1, .role { animation: none; }
  .top nav, .skip, .field, .trap { display: none; }
  .hero { padding-top: var(--gutter); min-height: 0; }
  .hero-copy { padding-bottom: 0; }
  .panel { padding-top: 1.75rem; }
  .panel h2 { break-after: avoid; }
  .panel p { orphans: 3; widows: 3; }
  .stack-row { break-inside: avoid; }
  .links a { border: none; padding: 0; background: none; min-height: 0; }
  .links a[href^="https://"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: var(--text-faint); }
  .email-link::after { content: " jacoknapp at gmail dot com"; }
  .email-link .email-text, .arrow { display: none; }
}
