/* Richard Jamieson — portfolio.
   System fonts only: no third-party requests, nothing to break, instant first paint.
   Light and dark are both first-class; the palette is defined once as tokens. */

:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #5c6270;
  --faint: #8b909c;
  --rule: #e2e0dc;
  --accent: #1d4ed8;
  --accent-soft: #eef2ff;
  --shadow: 0 1px 2px rgba(16, 18, 22, .04), 0 6px 20px rgba(16, 18, 22, .05);
  --radius: 12px;
  --measure: 68ch;
  --serif: "Charter", "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --surface: #161920;
    --ink: #e8e9ec;
    --muted: #a2a8b6;
    --faint: #767d8c;
    --rule: #262a33;
    --accent: #8ab4ff;
    --accent-soft: #18203a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 6px;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---------- chrome ---------- */

header.site {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem 2rem; flex-wrap: wrap;
  max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.5rem 0;
}
.wordmark {
  font-family: var(--serif); font-size: 1.12rem; font-weight: 600;
  color: var(--ink); letter-spacing: -.2px;
}
header.site nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
header.site nav a { color: var(--muted); font-size: .93rem; }
header.site nav a:hover, header.site nav a.active { color: var(--ink); }

main { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem; }

footer.site {
  max-width: 1080px; margin: 5rem auto 0; padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--rule); font-size: .93rem;
}
footer.site p { margin: .2rem 0; }
.muted { color: var(--muted); }

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

.hero { padding: 4rem 0 3.5rem; max-width: var(--measure); }
.hero h1 {
  font-family: var(--serif); font-size: clamp(2.1rem, 5.5vw, 3.1rem);
  line-height: 1.1; letter-spacing: -.9px; margin: 0 0 1rem; font-weight: 600;
}
.hero p { font-size: 1.09rem; color: var(--muted); margin: 0 0 1rem; }
.hero p strong { color: var(--ink); font-weight: 600; }
.hero p:first-of-type { font-size: 1.2rem; color: var(--ink); }

/* ---------- sections ---------- */

section { padding: 3rem 0; border-top: 1px solid var(--rule); }
section.hero { border-top: 0; padding-top: 4rem; }
h2 {
  font-family: var(--serif); font-size: 1.6rem; font-weight: 600;
  letter-spacing: -.4px; margin: 0 0 1.6rem;
}
h3 { font-size: 1.12rem; margin: 2rem 0 .5rem; }
.subhead {
  font-size: .82rem; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--faint); margin: 3rem 0 1.2rem; font-weight: 600;
}

.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--ink); }
.prose p { margin: 0 0 1.1rem; }
.prose ul { padding-left: 1.15rem; margin: 0 0 1.2rem; }
.prose li { margin: 0 0 .5rem; }
.prose h2 { margin-top: 0; }

.portrait {
  float: right; width: 168px; height: 168px; object-fit: cover;
  border-radius: 14px; margin: .2rem 0 1rem 1.8rem;
  border: 1px solid var(--rule); box-shadow: var(--shadow);
}
@media (max-width: 560px) {
  .portrait { float: none; display: block; margin: 0 0 1.2rem; width: 140px; height: 140px; }
}

/* ---------- cards ---------- */

.cards {
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1.5rem 1.5rem 1.3rem;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.card h3 { margin: 0 0 .25rem; font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--accent); text-decoration: none; }
.card .role { margin: 0; font-size: .93rem; color: var(--ink); font-weight: 500; }
.card .period { margin: .1rem 0 .9rem; font-size: .86rem; color: var(--faint); }
.card > p { margin: 0 0 1rem; color: var(--muted); font-size: .97rem; }
.card .more { margin-top: auto; font-size: .93rem; }
.cards.secondary .card { padding: 1.2rem 1.3rem; }
.cards.secondary .card h3 { font-size: 1.12rem; }

.metrics { display: flex; flex-wrap: wrap; gap: 1.4rem; margin: 0 0 1.1rem; }
.metric { display: flex; flex-direction: column; }
.metric .figure {
  font-family: var(--serif); font-size: 1.35rem; font-weight: 600;
  line-height: 1.1; letter-spacing: -.4px;
}
.metric .label {
  font-size: .76rem; color: var(--faint); text-transform: uppercase;
  letter-spacing: .7px; margin-top: .15rem;
}

.tags { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.tags li {
  font-size: .78rem; color: var(--muted); background: var(--accent-soft);
  border-radius: 999px; padding: .18rem .6rem;
}

/* ---------- project pages ---------- */

.project-head { margin: 3rem 0 2.2rem; }
.eyebrow { font-size: .84rem; margin: 0 0 .6rem; }
.eyebrow a { color: var(--faint); }
.project h1 {
  font-family: var(--serif); font-size: clamp(1.9rem, 4.5vw, 2.5rem);
  letter-spacing: -.7px; margin: 0 0 .4rem; font-weight: 600;
}
.project .role { margin: 0; font-weight: 500; }
.project .period { margin: .15rem 0 1.4rem; color: var(--faint); font-size: .92rem; }
.project h2 { font-size: 1.3rem; margin: 2.4rem 0 .8rem; }
.back { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); font-size: .94rem; }
.links { list-style: none; padding: 0; }
.links li { margin: 0 0 .4rem; }

/* ---------- tables & code ---------- */

table { width: 100%; border-collapse: collapse; margin: 0 0 1.4rem; font-size: .95rem; }
td { padding: .55rem .8rem .55rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr td:first-child { font-weight: 600; width: 34%; }
code { font-family: var(--mono); font-size: .88em; background: var(--accent-soft); padding: .08em .35em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4rem 0; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 2.6rem 0 2.4rem; }
  section { padding: 2.4rem 0; }
  header.site { padding-top: 1.1rem; }
  header.site nav { gap: 1rem; }
}

@media print {
  header.site nav, .back, .more { display: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
}
