/*
 * Alex McRitchie — Projects.
 *
 * One page: an intro, then the projects as a timeline, newest first.
 * Plain CSS, no build step. Colors are tokens on :root, redefined for dark
 * mode, so every rule below reads the same in both themes.
 */

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1a1c20;
  --muted: #5d626b;
  --faint: #8a8f98;
  --line: #e3e1da;
  --accent: #1f5fa8;
  --accent-soft: #e5eef8;
  --badge-text: #7a4b00;
  --badge-bg: #fbefd9;
  --shadow: 0 1px 2px rgb(20 20 30 / 0.04), 0 4px 16px rgb(20 20 30 / 0.05);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1a1c21;
    --text: #ecebe6;
    --muted: #a3a7af;
    --faint: #787d86;
    --line: #2b2e35;
    --accent: #7fb2f0;
    --accent-soft: #1d2a3b;
    --badge-text: #f3c77b;
    --badge-bg: #3a2e1a;
    --shadow: none;
  }
}

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

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

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) 1rem 3rem;
}

/* ---------- intro ---------- */

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--faint);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 1.25rem;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 1rem;
  max-width: 38rem;
  font-size: 1.1875rem;
}

.lede--quiet {
  color: var(--muted);
  font-size: 1.0625rem;
}

.lede strong {
  color: var(--text);
  font-weight: 600;
}

.summary {
  margin: 1.75rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

/* ---------- timeline ---------- */

.timeline {
  position: relative;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

/* The rail the year markers sit on. */
.timeline::before {
  content: "";
  position: absolute;
  top: 0.75rem;
  bottom: 0.75rem;
  left: 4.25rem;
  width: 1px;
  background: var(--line);
}

.timeline > li + li {
  margin-top: 1.25rem;
}

.project {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  column-gap: 1.5rem;
  scroll-margin-top: 1.5rem;
}

.project__years {
  position: relative;
  padding-top: 1.35rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* The dot on the rail. */
.project__years::after {
  content: "";
  position: absolute;
  top: 1.75rem;
  right: -1.15rem;
  width: 9px;
  height: 9px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--faint);
  box-sizing: content-box;
}

.project:target .project__years::after,
.project:has(.badge) .project__years::after {
  background: var(--accent);
}

.project__body {
  min-width: 0;
  padding: 1.1rem 1.25rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.project:target .project__body {
  border-color: var(--accent);
}

.project__name {
  display: inline;
  margin: 0;
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.project__name a {
  color: inherit;
  text-decoration: none;
}

.project__name a:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: 0.25em;
  white-space: nowrap;
}

.project__description {
  margin: 0.45rem 0 0;
}

.project__stack {
  margin: 0.5rem 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.project__links li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.4rem;
  min-width: 0;
}

.link {
  font-weight: 600;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.link--live {
  padding: 0.1rem 0.55rem;
  border-radius: 6px;
  background: var(--accent-soft);
}

.link__host {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.arrow {
  display: inline-block;
  font-size: 0.85em;
}

/* ---------- footer ---------- */

.footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.footer p {
  margin: 0;
}

/* ---------- phones ---------- */

@media (max-width: 34rem) {
  .timeline::before {
    display: none;
  }

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

  .project__years {
    padding: 0 0 0.35rem;
    text-align: left;
  }

  .project__years::after {
    display: none;
  }

  .project__body {
    padding: 1rem;
  }
}

@media print {
  .project__body {
    box-shadow: none;
  }
}
