  :root {
    --paper:    #f2f1ee;
    --ink:      #1c2024;
    --ink-soft: #545c64;
    --rule:     #d8d5d0;
    --accent:   #2b4a6f;
    --accent-2: #1e3653;
    --deep:     #14181c;
    --on-deep:  #e7e5e1;
    --on-deep-soft: #a8adb3;

    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --gutter: clamp(1.25rem, 3.5vw, 3rem);
  }

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

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

  body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
  }

  .wrap {
    width: 100%;
    max-width: 76rem;
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  img { max-width: 100%; height: auto; display: block; }

  a { color: var(--accent); }

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

  .on-deep :focus-visible { outline-color: #9fc2e8; }

  .tricolour {
    height: 4px;
    border: 0;
    margin: 4px 0 0;
    background: linear-gradient(90deg,
      #17171a 0 33.333%,
      #f2c300 0 66.666%,
      #c8102e 0);
  }

  /* ─────────────────────────── Hero ─────────────────────────── */

  .hero {
    position: relative;
    isolation: isolate;
    padding-block: clamp(1rem, 2.9vh, 1.875rem);
    background: var(--deep);
    color: var(--on-deep);
    overflow: hidden;
  }

  .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: url("../assets/hero-arch-tall.jpg") right center / auto 108% no-repeat;
    filter: saturate(1.15) contrast(1.05);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%);
    mask-image: linear-gradient(90deg, transparent 0, #000 22%);
  }

  .hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
      linear-gradient(90deg, rgba(20,24,28,.97) 0%, rgba(20,24,28,.95) 60%, rgba(20,24,28,.58) 79%, rgba(20,24,28,.12) 95%, rgba(20,24,28,.06) 100%),
      linear-gradient(to bottom, rgba(20,24,28,.25) 0%, rgba(20,24,28,0) 42% 72%, rgba(20,24,28,.45) 100%);
  }

  .hero-grid {
    display: grid;
    gap: clamp(.75rem, 1.8vh, 1.375rem) 3rem;
    align-items: start;
  }

  .hero h1 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(1.75rem, 1.05rem + 1.8vw, 2.5rem);
    line-height: 1.08;
    letter-spacing: -0.015em;
    margin: 0;
    text-wrap: balance;
    text-shadow: 0 1px 24px rgba(0,0,0,.45);
  }

  .title-foot {
    display: flex;
    align-items: center;
    gap: 1.125rem;
    margin-top: clamp(.625rem, 1.5vh, 1rem);
  }

  .keyline {
    flex: none;
    width: 3.5rem;
    height: 2px;
    background: currentColor;
    opacity: .45;
  }

  .lede {
    margin: 0 0 .5rem;
    font-family: var(--serif);
    font-size: clamp(.9375rem, .70rem + .40vh, 1.0625rem);
    line-height: 1.48;
    color: #dfddd8;
    text-shadow: 0 1px 18px rgba(0,0,0,.5);
  }

  .lede:last-child { margin-bottom: 0; }

  .langs { display: flex; }

  .langs[hidden] { display: none; }

  .langs button {
    font-family: var(--sans);
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1;
    color: var(--on-deep-soft);
    background: transparent;
    border: 1px solid rgba(231,229,225,.22);
    padding: .3125rem .5625rem;
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, background .2s ease;
  }

  .langs button + button { margin-left: -1px; }

  .langs button:hover { color: var(--on-deep); border-color: rgba(231,229,225,.45); }

  .langs button[aria-pressed="true"] {
    color: #fff;
    background: rgba(231,229,225,.14);
    border-color: rgba(231,229,225,.5);
  }

  /* ────────────────────────── Projects ────────────────────────── */

  main {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    padding-block: clamp(.75rem, 2.2vh, 1.5rem);
  }

  .projects {
    display: grid;
    gap: clamp(1.25rem, 3vw, 2.5rem);
  }

  .project {
    display: flex;
    flex-direction: column;
    border-top: 2px solid var(--accent);
    padding-top: clamp(.625rem, 1.5vh, 1rem);
  }

  .project h2 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(1.0625rem, .9rem + .38vh, 1.3125rem);
    line-height: 1.18;
    letter-spacing: -0.01em;
    margin: 0 0 .5rem;
    text-wrap: balance;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
  }

  .project-icon {
    flex: none;
    width: 1.25em;
    height: 1.25em;
    margin-top: .02em;
    color: var(--accent);
  }

  .project p {
    margin: 0 0 .5rem;
    font-size: clamp(.8125rem, .52rem + .62vh, .9375rem);
    line-height: 1.5;
    color: #3c434a;
  }

  .project p:last-of-type { margin-bottom: clamp(.625rem, 1.5vh, 1rem); }

  .project .button { margin-top: auto; }

  .button {
    display: block;
    text-align: center;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.35;
    padding: clamp(.5625rem, 1.3vh, .75rem) 1rem;
    border: 1px solid var(--accent);
    box-shadow: 0 1px 2px rgba(28,32,36,.14);
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
  }

  .button span::after {
    content: "\00a0\2197";
    font-size: .9em;
    opacity: .8;
  }

  .button:hover,
  .button:focus-visible {
    background: var(--accent-2);
    border-color: var(--accent-2);
  }

  .button:active { transform: translateY(1px); }

  /* ─────────────────────────── Footer ─────────────────────────── */

  footer {
    position: relative;
    isolation: isolate;
    flex: none;
    background: var(--deep);
    color: var(--on-deep);
    text-align: center;
    padding-block: clamp(.625rem, 1.7vh, 1.125rem);
    overflow: hidden;
  }

  footer::before {
    content: "";
    position: absolute;
    inset: -20% 0;
    z-index: -2;
    background: url("../assets/wood.jpg") center / cover no-repeat;
    opacity: .7;
  }

  footer::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to bottom, rgba(20,24,28,.78), rgba(20,24,28,.90));
  }

  .wordmark {
    width: clamp(9.5rem, 18vw, 13rem);
    margin: 0 auto .625rem;
    opacity: .8;
  }

  .byline {
    margin: 0 0 .25rem;
    font-size: .9375rem;
    line-height: 1.5;
  }

  .byline a {
    color: var(--on-deep);
    text-decoration-color: rgba(231,229,225,.4);
    text-underline-offset: 3px;
    transition: text-decoration-color .2s ease;
  }

  .byline a:hover { text-decoration-color: var(--on-deep); }

  .byline .sep { color: var(--on-deep-soft); padding-inline: .4em; }
  .byline .place { color: var(--on-deep-soft); }

  .note {
    margin: 0;
    font-size: .8125rem;
    line-height: 1.5;
    color: var(--on-deep-soft);
  }

  /* ─────────────────────────── Motion ─────────────────────────── */

  @media (prefers-reduced-motion: no-preference) {
    .hero h1, .lede, .project {
      animation: settle .8s cubic-bezier(.16,.8,.3,1) backwards;
    }
    .hero h1  { animation-delay: .05s; }
    .lede     { animation-delay: .16s; }
    .project:nth-of-type(1) { animation-delay: .30s; }
    .project:nth-of-type(2) { animation-delay: .38s; }
    .project:nth-of-type(3) { animation-delay: .46s; }
  }

  @keyframes settle {
    from { opacity: 0; transform: translateY(.875rem); }
    to   { opacity: 1; transform: none; }
  }

  /* ───────────────────── Wide: one screen, three columns ───────────────────── */

  @media (min-width: 60rem) {
    .hero-grid { grid-template-columns: minmax(0, 23rem) minmax(0, 1fr) clamp(4.5rem, 8vw, 8.5rem); }
    .projects  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    /* keep the three columns' body copy on a common baseline */
    .project h2 { min-height: 2.36em; }
  }

  @media (max-width: 59.999rem) {
    .hero::before { background-size: auto 135%; opacity: .55; }
    .hero::after {
      background:
        linear-gradient(90deg, rgba(20,24,28,.96) 0%, rgba(20,24,28,.90) 55%, rgba(20,24,28,.72) 100%),
        linear-gradient(to bottom, rgba(20,24,28,.30), rgba(20,24,28,0) 45% 75%, rgba(20,24,28,.50));
    }
    .lede { max-width: 60ch; }
    .project p { max-width: 68ch; }
  }

  /* ───────────────────────── About page ───────────────────────── */

  .page-link {
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--on-deep-soft);
    text-decoration: none;
    transition: color .2s ease;
  }

  .page-link:hover { color: var(--on-deep); }

  .about-page main { align-items: flex-start; padding-block: clamp(1.5rem, 4vh, 3rem); }

  .about { max-width: 60rem; }

  .about-section {
    border-top: 2px solid var(--accent);
    padding-top: clamp(.625rem, 1.5vh, 1rem);
    margin-bottom: clamp(2rem, 5vh, 3rem);
  }

  .about-section:last-child { margin-bottom: 0; }

  .about-section h2 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(1.25rem, 1rem + .6vw, 1.5rem);
    line-height: 1.18;
    letter-spacing: -0.01em;
    margin: 0 0 1rem;
  }

  .about-body p {
    margin: 0 0 .875rem;
    max-width: 68ch;
    color: #3c434a;
  }

  .skills {
    display: grid;
    gap: 1rem 2.5rem;
    margin: 0;
  }

  .skills dt {
    font-family: var(--serif);
    font-weight: 600;
    color: var(--ink);
  }

  .skills dd {
    margin: .125rem 0 0;
    font-size: .9375rem;
    line-height: 1.5;
    color: #3c434a;
  }

  .timeline {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .timeline > li {
    display: grid;
    grid-template-columns: 3.75rem minmax(0, 1fr);
    gap: 1rem;
    padding-block: 1rem;
    border-bottom: 1px solid var(--rule);
  }

  .timeline > li:first-child { padding-top: 0; }
  .timeline > li:last-child  { border-bottom: 0; }

  .timeline .year {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 1.0625rem;
    line-height: 1.4;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
  }

  .timeline h3 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 1.0625rem;
    line-height: 1.3;
    margin: 0 0 .375rem;
  }

  .timeline h3 a {
    color: var(--ink);
    text-decoration-color: rgba(43,74,111,.35);
    text-underline-offset: 3px;
    transition: color .2s ease, text-decoration-color .2s ease;
  }

  .timeline h3 a:hover { color: var(--accent); text-decoration-color: var(--accent); }

  .timeline h3 a[target="_blank"]::after {
    content: "\00a0\2197";
    font-size: .8em;
    color: var(--accent);
  }

  .timeline p {
    margin: 0 0 .5rem;
    max-width: 68ch;
    font-size: .9375rem;
    line-height: 1.55;
    color: #3c434a;
  }

  .sublinks {
    margin: 0;
    padding-left: 1.125rem;
    font-size: .9375rem;
    line-height: 1.55;
    color: #3c434a;
  }

  .sublinks li { margin-bottom: .25rem; }

  .elsewhere {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .5rem;
  }

  .elsewhere a { font-weight: 600; }

  .elsewhere span { color: var(--ink-soft); font-size: .9375rem; }

  .elsewhere span::before { content: "— "; }

  @media (min-width: 45rem) {
    .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  .about-section h2 { display: flex; align-items: center; gap: .5rem; }

  .skills dt { display: flex; align-items: center; gap: .4rem; }

  .timeline .year { display: flex; flex-direction: column; gap: .375rem; }

  .timeline .year .project-icon { width: 1.5em; height: 1.5em; }
