/* Tokens — see DESIGN.md */
:root {
  --bg: #fcfcfa;
  --fg: #1a1a19;
  --muted: #6f6e69;
  --line: #e6e5e0;
  --hover: #f2f1ec;
  --focus: #2f6fdf;

  --sans: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --width: 1040px;
  --gutter: clamp(20px, 5vw, 40px);
  --label: 200px;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --fg: #ededec;
    --muted: #a09f9a;
    --line: #2a2a28;
    --hover: #1b1b1a;
    --focus: #7aa7ff;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

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

img { display: block; max-width: 100%; height: auto; }
ul, ol { list-style: none; }
h1, h2, h3 { font-weight: 500; }
button, input, textarea { font: inherit; color: inherit; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--fg) 30%, transparent);
  transition: text-decoration-color .15s;
}
a:hover { text-decoration-color: var(--fg); }

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

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 10;
  padding: 8px 12px; background: var(--fg); color: var(--bg); border-radius: var(--radius); text-decoration: none;
}
.skip-link:focus { top: 12px; }

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

/* Header */
.header { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding: 32px 0; }
.name { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; text-decoration: none; }
.header ul { display: flex; gap: 24px; }
.header nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; font-size: 15px; }
.header nav a:hover { color: var(--fg); }

/* Intro */
.intro { padding: clamp(48px, 10vw, 120px) 0 0; }
.intro h1 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.25; letter-spacing: -0.02em; max-width: 26ch; margin-bottom: 32px; }
.intro-text { max-width: 60ch; color: var(--muted); }
.intro-text p + p { margin-top: 16px; }
.intro-text a { color: var(--fg); }
.intro-links { display: flex; flex-wrap: wrap; gap: 0 24px; margin-top: 24px; font-size: 15px; }
.intro-links a { display: inline-flex; align-items: center; min-height: 44px; }

/* Sections */
.section {
  display: grid; grid-template-columns: var(--label) 1fr; gap: 24px;
  margin-top: clamp(80px, 12vw, 136px); padding-top: 20px; border-top: 1px solid var(--line);
}
.section-title { font-size: 15px; color: var(--muted); line-height: 1.6; }
.section-body { min-width: 0; }

/* Featured projects */
.project + .project { margin-top: 72px; }
.project-shot { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--hover); }
.project-shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.project-info { display: grid; grid-template-columns: 1fr 2fr; grid-template-rows: min-content 1fr; column-gap: 24px; margin-top: 20px; align-items: start; }
.project-info h3 { font-size: 20px; line-height: 1.3; grid-column: 1; }
.project-meta { grid-column: 1; font-size: 15px; color: var(--muted); }
.project-info > p:not(.project-meta), .project-link { grid-column: 2; }
.project-info > p:nth-of-type(2) { grid-row: 1 / span 2; }
.project-info > p:not(.project-meta) { max-width: 60ch; }
.project-stack { margin-top: 12px; font-size: 15px; color: var(--muted); }
.project-link { justify-self: start; display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; font-size: 15px; }

/* Other projects table */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table thead th { text-align: left; font-weight: 400; color: var(--muted); padding: 0 16px 12px 0; border-bottom: 1px solid var(--line); }
.table tbody th, .table td { text-align: left; vertical-align: top; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); }
.table tbody th { font-weight: 500; white-space: nowrap; }
.table td { color: var(--muted); }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover { background: var(--hover); }
.col-link { white-space: nowrap; padding-right: 0 !important; }
.col-link a { font-family: var(--mono); font-size: 13px; color: var(--fg); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Experience */
.rows li { display: grid; grid-template-columns: 120px 1fr; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.rows li:first-child { padding-top: 0; }
.row-date { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rows h3 { font-size: 17px; }
.rows p { color: var(--muted); font-size: 15px; max-width: 60ch; margin-top: 2px; }
.tools { margin-top: 32px; font-size: 15px; color: var(--muted); max-width: 64ch; }
.tools-label { color: var(--fg); }

/* Quotes */
.quotes { display: grid; gap: 40px; }
.quotes blockquote p { max-width: 58ch; }
.quotes figcaption { margin-top: 8px; font-size: 15px; color: var(--muted); }

/* Contact */
.contact-lead { max-width: 60ch; margin-bottom: 32px; }
.copy {
  margin-left: 6px; min-height: 32px; min-width: 44px; padding: 4px 10px; font-size: 13px; color: var(--muted); background: none;
  border: 1px solid var(--line); border-radius: 4px; cursor: pointer; vertical-align: 1px;
}
.copy:hover { color: var(--fg); border-color: var(--muted); }

.form { display: grid; gap: 16px; max-width: 640px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 15px; color: var(--muted); }
.field input, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font-size: 16px;
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--fg); }
.field [aria-invalid="true"] { border-color: #c4352b; }
.form-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.submit {
  min-height: 44px; padding: 0 20px; border: 0; border-radius: var(--radius);
  background: var(--fg); color: var(--bg); font-weight: 500; cursor: pointer;
}
.submit:hover { opacity: .88; }
.submit:disabled { opacity: .5; cursor: progress; }
.form-status { font-size: 15px; color: var(--muted); }

/* Footer */
.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px;
  margin-top: clamp(80px, 12vw, 136px); padding: 20px 0 40px; border-top: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}

/* Tablet */
@media (max-width: 860px) {
  :root { --label: 1fr; }
  .section { grid-template-columns: 1fr; gap: 20px; }
}

/* Phone */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .header { flex-direction: column; gap: 0; padding: 16px 0; }
  .header ul { gap: 20px; }

  .project-info { grid-template-columns: 1fr; }
  .project-info > * { grid-column: 1 !important; grid-row: auto !important; }
  .project-info > p:nth-of-type(2) { margin-top: 12px; }

  .table thead { display: none; }
  .table, .table tbody, .table tr, .table th, .table td { display: block; }
  .table tbody tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .table tbody th, .table td { padding: 0; border: 0; white-space: normal; }
  .table td { margin-top: 4px; }
  .table .col-link a { display: inline-flex; align-items: center; min-height: 44px; }

  .rows li { grid-template-columns: 1fr; gap: 2px; }
  .form-row { grid-template-columns: 1fr; }
}
