/* ── Tokens ────────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg-alt: #fbfbfd;
  --rule: #d2d2d7;
  --rule-soft: #e8e8ed;
  --ink: #1d1d1f;
  --ink-soft: #424245;
  --ink-muted: #6e6e73;
  --ink-faint: #86868b;
  --accent: #0066cc;
  --accent-hover: #0040a0;

  --font-sans:
    -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;

  --measure: 44rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161617;
    --bg-alt: #1d1d1f;
    --rule: #38383a;
    --rule-soft: #2c2c2e;
    --ink: #f5f5f7;
    --ink-soft: #d2d2d7;
    --ink-muted: #a1a1a6;
    --accent: #2997ff;
    --accent-hover: #6cb6ff;
  }
}

/* ── Reset ─────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.52;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Layout ────────────────────────────────────────────── */
main {
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 6rem) var(--gutter) 4rem;
}

/* ── Masthead ──────────────────────────────────────────── */
.masthead {
  padding-bottom: clamp(2.5rem, 6vh, 4rem);
  border-bottom: 1px solid var(--rule);
  /* margin-bottom: clamp(2.5rem, 6vh, 4rem); */
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.masthead h1 {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 600;
  line-height: 1.07;
  margin-bottom: 1rem;
}

.lede {
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
  line-height: 1.4;
  color: var(--ink-soft);
}

/* ── Sections ──────────────────────────────────────────── */
section {
  padding: clamp(2.5rem, 6vh, 4rem) 0;
  border-bottom: 1px solid var(--rule-soft);
}

section:last-of-type {
  border-bottom: none;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}

section h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 1.5rem;
}

.section-summary {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 2rem;
  max-width: 38rem;
}

/* ── Links ─────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

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

/* ── Projects ──────────────────────────────────────────── */
.projects {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.75rem;
}

.project {
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-soft);
}

.project:first-child {
  padding-top: 0;
  border-top: none;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.project-meta .tag {
  color: var(--accent);
}
.project-meta .year {
  color: var(--ink-muted);
}

.project h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.project p {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 38rem;
}

/* ── Practice areas ────────────────────────────────────── */
.competencies {
  display: grid;
  gap: 2rem;
}

.competency {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-soft);
}

.competency:first-child {
  padding-top: 0;
  border-top: none;
}

.competency dt {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.15rem;
}

.competency dd {
  margin: 0;
}

.competency ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.competency li {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.5;
}

/* ── Contact ───────────────────────────────────────────── */
.contact-list {
  display: grid;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.contact-row {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule-soft);
}

.contact-row:last-child {
  border-bottom: none;
}

.contact-row dt {
  color: var(--ink-faint);
  text-transform: uppercase;
  font-size: 0.72rem;
  align-self: center;
}

.contact-row dd {
  margin: 0;
  color: var(--ink);
  word-break: break-word;
}

/* ── Email obfuscation ─────────────────────────────────── */
.email {
  font-family: var(--font-mono);
  user-select: all;
  -webkit-user-select: all;
  cursor: text;
}

.email::before {
  content: attr(data-user) "\0040" attr(data-host) "\002E" attr(data-tld);
}

/* ── Footer ────────────────────────────────────────────── */
footer {
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 2rem var(--gutter) 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}

/* ── Utilities ─────────────────────────────────────────── */
.nowrap {
  white-space: nowrap;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .competency {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .contact-row {
    grid-template-columns: 5rem 1fr;
    gap: 1rem;
  }
}

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ── Print ─────────────────────────────────────────────── */
@media print {
  body {
    background: white;
    color: black;
    font-size: 11pt;
  }
  main {
    max-width: 100%;
    padding: 0;
  }
  section {
    page-break-inside: avoid;
    border: none;
  }
  a {
    color: black;
    text-decoration: underline;
  }
  footer {
    border-top: 1px solid #ccc;
  }
}
