/* =========================================================
   Tokens
   ========================================================= */
:root {
  --bg: #fcfcfb;
  --text: #111111;
  --text-2: #4a4a4a;
  --text-3: #8a8a8a;
  --field: #f3f3f1;
  --field-focus: #ebebe8;
  --accent: #1d4ed8;
  --accent-hover: #1e3a8a;
  --accent-soft: rgba(29, 78, 216, 0.08);
  --btn: #111111;
  --on-btn: #ffffff;
  --outline: #d4d4d0;
  --success: #1a7f4b;
  --error: #c2261b;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --container: 1520px;
  --gutter: clamp(20px, 5vw, 96px);
  --label-col: clamp(160px, 16vw, 260px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --text: #f2f2f2;
    --text-2: #b4b4b4;
    --text-3: #777777;
    --field: #181818;
    --field-focus: #202020;
    --accent: #7ea6ff;
    --accent-hover: #a9c4ff;
    --accent-soft: rgba(126, 166, 255, 0.12);
    --btn: #f2f2f2;
    --on-btn: #0d0d0d;
    --outline: #3a3a3a;
    --success: #4cc38a;
    --error: #ff8a80;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

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

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { list-style: none; padding: 0; }
img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: text-decoration-color .15s, color .15s, background-color .15s, border-color .15s;
}
a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

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

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--text);
  color: var(--bg);
}
.skip:focus { left: 8px; }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  height: 72px;
}
.nav { display: flex; gap: 6px; }
.nav a {
  display: block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
}
.nav a:hover {
  color: var(--text);
  background: var(--field);
}
.nav a[aria-current="true"] {
  color: var(--text);
  background: var(--field);
}

/* =========================================================
   Hero
   ========================================================= */
.hero { padding: 104px 0 136px; }

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 20%;
  margin-bottom: 40px;
  background: var(--field);
}

.hero h1 {
  font-size: clamp(40px, 6.6vw, 76px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.045em;
  max-width: 13ch;
}

.hero-lede {
  margin-top: 32px;
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.6;
  color: var(--text-2);
  max-width: 40em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}


/* =========================================================
   Blocks (label column + content column, no dividers)
   ========================================================= */
.block { padding: 0 0 128px; }

.block-grid {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: 40px;
}

.label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-3);
  line-height: 1.9;
}

/* ---------- Work ---------- */
.work { display: grid; gap: 64px; }

.work-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.work-item h3 {
  font-size: 26px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.work-item h3 a {
  color: var(--text);
  text-decoration: none;
}
.work-item h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 8px 14px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.source svg { width: 16px; height: 16px; }
.source:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.year {
  font-size: 15px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.work-item > p:not(.stack) {
  color: var(--text-2);
  max-width: 38em;
}
.stack {
  margin-top: 14px;
  font-size: 14px;
  color: var(--text-3);
}

.endpoints {
  display: inline-grid;
  gap: 4px;
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 8px;
  background: var(--field);
  font-family: var(--mono);
  font-size: 13px;
}
.endpoints > div { display: flex; gap: 14px; }
.method { min-width: 36px; color: var(--text-3); }

/* ---------- Background ---------- */
.history { display: grid; gap: 20px; }
.history li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  column-gap: 24px;
}
.when {
  grid-row: span 2;
  font-size: 15px;
  color: var(--text-3);
  line-height: 1.75;
  font-variant-numeric: tabular-nums;
}
.what strong { font-weight: 600; }
.note { font-size: 15px; color: var(--text-3); }

.writing {
  margin-top: 48px;
  color: var(--text-2);
  max-width: 36em;
}

/* ---------- Contact ---------- */
.contact-title {
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.035em;
  max-width: 18ch;
}
.contact-lede {
  margin-top: 20px;
  color: var(--text-2);
  max-width: 36em;
}

.form {
  margin-top: 48px;
  max-width: 600px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field-row + .field { margin-top: 16px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 8px;
}
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;
  transition: background-color .15s, border-color .15s;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus,
.field textarea:focus {
  outline: none;
  background: var(--field-focus);
  border-color: var(--text-3);
}
.field [aria-invalid="true"] { border-color: var(--error); }

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 24px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--on-btn);
  background: var(--btn);
  border: 1px solid var(--btn);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity .15s, background-color .15s, border-color .15s, color .15s;
}
.btn:hover { color: var(--on-btn); opacity: .85; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { height: 38px; padding: 0 18px; font-size: 14px; }
.btn-outline {
  color: var(--text);
  background: transparent;
  border-color: var(--outline);
}
.btn-outline:hover {
  color: var(--text);
  opacity: 1;
  border-color: var(--text);
}

.form-status { font-size: 15px; color: var(--text-2); }
.form-status.is-success { color: var(--success); }
.form-status.is-error { color: var(--error); }

/* =========================================================
   Footer
   ========================================================= */
.footer-social { display: flex; gap: 4px; margin-right: -9px; }
.footer-social a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-3);
}
.footer-social a:hover { color: var(--text); background: var(--field); }
.footer-social svg { width: 18px; height: 18px; }

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 32px;
  padding-bottom: 48px;
  font-size: 14px;
  color: var(--text-3);
}

/* =========================================================
   Responsive
   ========================================================= */
/* ---------- Wide screens: use the horizontal space ---------- */
@media (min-width: 1100px) {
  .hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: clamp(48px, 6vw, 120px);
    align-items: end;
  }
  .hero h1 {
    font-size: clamp(56px, 5vw, 92px);
    max-width: 14ch;
  }
  .hero-lede { margin-top: 0; }

  .work {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 56px;
  }
  .work-item { display: flex; flex-direction: column; align-items: flex-start; }
  .work-head { flex-direction: column-reverse; gap: 6px; }
  .work-item .source { margin-top: auto; }
  .work-item .stack { margin-bottom: 18px; }

  .history {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 48px;
  }
  .history li { grid-template-columns: 1fr; row-gap: 2px; }
  .when { grid-row: auto; }

  .contact-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: clamp(48px, 6vw, 112px);
    align-items: start;
  }
  .contact-body .form { margin-top: 0; max-width: none; }
}

@media (max-width: 820px) {
  .hero { padding: 64px 0 96px; }
  .block { padding-bottom: 96px; }
  .block-grid { grid-template-columns: 1fr; gap: 20px; }
  .nav { gap: 22px; }
}

@media (max-width: 560px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .header-inner { height: 60px; }
  .nav { display: none; }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero { padding: 40px 0 80px; }
  .avatar { width: 60px; height: 60px; margin-bottom: 28px; }
  .block { padding-bottom: 80px; }
  .work { gap: 48px; }
  .work-item h3 { font-size: 22px; }
  .history li { grid-template-columns: 1fr; }
  .when { grid-row: auto; }
  .field-row { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column-reverse; align-items: flex-start; gap: 12px; }
  .footer-social { margin: 0 0 0 -9px; }
}
