/* ---------- Fonts (self-hosted, SIL OFL) ---------- */
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;
  --bg: #faf9f6;
  --surface: #ffffff;
  --ink: #15171c;
  --muted: #5a606c;
  --line: #e3e0d8;
  --accent: #2446c2;
  --accent-ink: #ffffff;
  --band-bg: #15171c;
  --band-ink: #f3f2ee;
  --band-muted: #a9aeb8;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;

  --wrap: 68rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section: clamp(4rem, 9vw, 7rem);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --surface: #16191d;
    --ink: #ecebe6;
    --muted: #9ba1ab;
    --line: #272b31;
    --accent: #94b0ff;
    --accent-ink: #0b1020;
    --band-bg: #16191d;
    --band-ink: #ecebe6;
    --band-muted: #9ba1ab;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: currentColor;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4rem;
}

.brand {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2rem);
  font-size: 0.925rem;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.15s ease;
}

.nav a:hover {
  color: var(--ink);
}

.nav .btn {
  color: var(--accent-ink);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.95rem;
  font-weight: 550;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn--small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  filter: none;
  border-color: var(--ink);
}

.btn svg {
  width: 1.05em;
  height: 1.05em;
  flex: none;
}

/* ---------- Shared type ---------- */
.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 7vw, 5rem);
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}

.hero h1 {
  margin-top: 1.25rem;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6.4vw, 4.5rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero .lead {
  margin-top: 1.5rem;
  max-width: 36rem;
  font-size: clamp(1.1rem, 1.6vw, 1.25rem);
  line-height: 1.6;
  color: var(--muted);
}

.hero .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

.portrait {
  position: relative;
}

.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

/* ---------- Stats ---------- */
.stats {
  border-block: 1px solid var(--line);
}

.stats ul {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stats li {
  padding: 2rem 1.25rem;
  border-left: 1px solid var(--line);
}

.stats li:first-child {
  padding-left: 0;
  border-left: 0;
}

.stats strong {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2rem, 3.6vw, 2.75rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.stats span {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- Sections ---------- */
.section {
  padding-block: var(--section);
  scroll-margin-top: 4rem;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section > .wrap {
  display: grid;
  grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
}

.section-head {
  align-self: start;
  position: sticky;
  top: 6rem;
}

.section-head h2 {
  margin-top: 0.9rem;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.section-head p:not(.eyebrow) {
  margin-top: 1rem;
  font-size: 0.975rem;
  color: var(--muted);
}

/* About */
.prose > p {
  max-width: 40rem;
  font-size: 1.125rem;
}

.prose > p + p {
  margin-top: 1.25rem;
}

.prose .big {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.4vw, 1.8rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.clients {
  margin-top: 2.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}

.clients ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2.25rem;
  margin-top: 0.9rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--muted);
}

/* Item grids (services, activities) */
.items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(1.5rem, 4vw, 3rem);
}

.items li {
  padding-block: 1.6rem;
  border-top: 1px solid var(--line);
}

.items .num {
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.items h3 {
  margin-top: 0.5rem;
  font-size: 1.075rem;
  font-weight: 620;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.items p {
  margin-top: 0.5rem;
  font-size: 0.975rem;
  color: var(--muted);
}

/* Experience */
.timeline li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1.5rem;
  padding-block: 1.6rem;
  border-top: 1px solid var(--line);
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline .when {
  padding-top: 0.15rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.timeline h3 {
  font-size: 1.075rem;
  font-weight: 620;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.timeline .org {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--accent);
}

.timeline p {
  margin-top: 0.4rem;
  font-size: 0.975rem;
  color: var(--muted);
}

/* Pricing */
.plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.plan {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.plan .figure {
  margin-top: 1.1rem;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4vw, 3.1rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}

.plan .unit {
  margin-top: 0.4rem;
  font-size: 0.925rem;
  color: var(--muted);
}

.plan ul {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.6rem;
  font-size: 0.975rem;
}

.plan ul li {
  display: flex;
  gap: 0.65rem;
  align-items: baseline;
}

.plan ul li::before {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-0.1em);
}

.plan > p:last-child {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.975rem;
  color: var(--muted);
}

/* ---------- Contact band ---------- */
.contact {
  background: var(--band-bg);
  color: var(--band-ink);
  padding-block: clamp(4.5rem, 10vw, 7.5rem);
  scroll-margin-top: 4rem;
}

.contact .eyebrow {
  color: var(--band-muted);
}

.contact h2 {
  margin-top: 1rem;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5.5vw, 3.75rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.contact p {
  margin-top: 1.25rem;
  max-width: 34rem;
  font-size: 1.125rem;
  color: var(--band-muted);
}

.contact .btn {
  margin-top: 2.25rem;
  background: var(--band-ink);
  border-color: var(--band-ink);
  color: var(--band-bg);
}

@media (prefers-color-scheme: dark) {
  .contact {
    border-top: 1px solid var(--line);
  }
  .contact .btn {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--band-bg);
  color: var(--band-muted);
  font-size: 0.875rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.75rem;
  border-top: 1px solid color-mix(in srgb, var(--band-muted) 25%, transparent);
}

/* ---------- 404 ---------- */
.notfound {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: 4rem;
}

.notfound h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.notfound p {
  margin-top: 1rem;
  color: var(--muted);
}

.notfound .btn {
  margin-top: 2rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 60rem) {
  .nav a:not(.btn) {
    display: none;
  }

  .section > .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.25rem;
  }

  .section-head {
    position: static;
  }

  .stats ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats li:nth-child(4) {
    padding-left: 0;
    border-left: 0;
  }

  .stats li:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 42rem) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .portrait {
    order: -1;
    max-width: 11rem;
  }

  .stats ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats li {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--line);
  }

  .stats li:nth-child(-n + 2) {
    border-top: 0;
  }

  .stats li:nth-child(4) {
    padding-left: 1rem;
    border-left: 1px solid var(--line);
  }

  .stats li:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .stats li:last-child {
    grid-column: 1 / -1;
  }

  .items,
  .plans {
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .btn {
    transition: none;
  }
}

/* ---------- Print (doubles as a paper CV) ---------- */
@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --ink: #000;
    --muted: #333;
    --line: #ccc;
    --accent: #000;
    --band-bg: #fff;
    --band-ink: #000;
    --band-muted: #333;
    --section: 1.5rem;
  }

  body {
    font-size: 10.5pt;
  }

  .site-header,
  .hero .actions,
  .skip {
    display: none;
  }

  .hero {
    padding-block: 0 1.5rem;
  }

  .portrait {
    max-width: 8rem;
  }

  .section > .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .section-head {
    position: static;
  }

  .items li,
  .timeline li,
  .plan {
    break-inside: avoid;
  }

  .contact {
    padding-block: 1.5rem;
    border-top: 1px solid var(--line);
  }

  .contact .btn {
    padding: 0;
    border: 0;
    margin-top: 0.5rem;
  }

  .contact .btn::after {
    content: " — linkedin.com/in/jonathanyapp";
  }
}
