/* ===== Tokens ===== */
:root {
  --paper: #F1F3F4;
  --surface: #FFFFFF;
  --ink: #14202B;
  --muted: #55646F;
  --line: #C8D0D5;
  --blue: #3A6A8C;
  --brick: #B04A33;
  --on-ink: #FFFFFF;

  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 6px;
  --gutter: clamp(1.1rem, 4vw, 2rem);
  --max: 68rem;
  --header-h: 3.5rem;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #0F171E;
  --surface: #16212A;
  --ink: #E8EDF0;
  --muted: #9AA8B2;
  --line: #2B3944;
  --blue: #7FB0D0;
  --brick: #E07B63;
  --on-ink: #0F171E;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

h1, h2, h3, strong { font-family: var(--font-head); }

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

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--on-ink);
  padding: .5rem .9rem;
  border-radius: var(--radius);
  z-index: 100;
}
.skip:focus { top: .75rem; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.bar {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: -.01em;
}

.nav {
  display: none;
  position: absolute;
  inset: var(--header-h) 0 auto 0;
  flex-direction: column;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: .5rem var(--gutter) 1rem;
}
.nav.open { display: flex; }

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}
.nav a:last-child { border-bottom: 0; }
.nav a:hover, .nav a.active { color: var(--ink); }
.nav a.active { box-shadow: inset 2px 0 0 var(--brick); padding-left: .75rem; }

.tools-row { display: flex; gap: .4rem; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s;
}
.icon-btn:hover { border-color: var(--blue); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: .6rem 1.3rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, color .2s;
}
.btn:hover { background: var(--ink); color: var(--on-ink); }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ===== Hero ===== */
.hero {
  display: grid;
  gap: 2rem;
  padding-block: clamp(2rem, 6vw, 4.5rem);
  align-items: center;
}

.plate {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  gap: .55rem;
  width: min(100%, 22rem);
  margin-inline: auto;
  animation: settle .7s ease-out both;
}

.plate img {
  grid-column: 1;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 18%;
  padding: .5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* dimension lines, like on a drawing sheet */
.dim {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
}
.dim::before, .dim::after {
  content: "";
  flex: 1;
  align-self: center;
}
.dim-h { grid-column: 1; }
.dim-h::before, .dim-h::after {
  height: .6rem;
  background: linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat;
}
.dim-h::before { border-left: 1px solid var(--line); }
.dim-h::after  { border-right: 1px solid var(--line); }

.dim-v {
  grid-column: 2;
  grid-row: 2;
  flex-direction: column;
  writing-mode: vertical-rl;
}
.dim-v::before, .dim-v::after {
  width: .6rem;
  background: linear-gradient(var(--line), var(--line)) center / 1px 100% no-repeat;
}
.dim-v::before { border-top: 1px solid var(--line); }
.dim-v::after  { border-bottom: 1px solid var(--line); }

.hero-copy h1 {
  font-size: clamp(2.5rem, 9vw, 4.75rem);
  line-height: 1;
  letter-spacing: -.035em;
  font-weight: 700;
}

.lead {
  margin-top: 1.1rem;
  max-width: 34rem;
  font-size: clamp(1.05rem, 2.6vw, 1.25rem);
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.6rem;
}

/* title block */
.titleblock {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 2rem;
  max-width: 34rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.titleblock > div {
  padding: .7rem .9rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.titleblock > div:nth-child(2n) { border-right: 0; }
.titleblock > div.wide { grid-column: 1 / -1; border-right: 0; }
.titleblock > div:last-child { border-bottom: 0; }
.titleblock > div:nth-last-child(2):not(.wide) { border-bottom: 0; }
.titleblock dt { font-size: .78rem; color: var(--muted); }
.titleblock dd { font-weight: 500; font-size: .95rem; line-height: 1.4; }

/* ===== Sections ===== */
.section {
  position: relative;
  display: grid;
  gap: 1.4rem;
  padding-block: clamp(2.75rem, 7vw, 5rem);
}
/* divider line stays inside the gutters; short brick mark on top */
.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  height: 1px;
  background: var(--line);
}
.section::after {
  content: "";
  position: absolute;
  top: -1px;
  left: var(--gutter);
  width: 2.5rem;
  height: 3px;
  background: var(--brick);
}

.section h2 {
  font-size: clamp(1.7rem, 4.5vw, 2.3rem);
  letter-spacing: -.025em;
  line-height: 1.1;
}

.section h3 {
  margin-top: 2.2rem;
  margin-bottom: .9rem;
  font-size: 1.05rem;
}

.content { min-width: 0; }

.prose { max-width: 40rem; }
.prose p + p { margin-top: 1rem; }
.prose .tagline {
  margin-top: 1.6rem;
  padding-left: 1rem;
  border-left: 3px solid var(--blue);
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 1.2rem;
  line-height: 1.4;
}

/* row lists */
.rows li {
  display: grid;
  gap: .25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.rows li:first-child { padding-top: 0; }
.rows strong { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.rows span { color: var(--muted); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li {
  padding: .35rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: .9rem;
}

/* project plots drawn to scale */
.projects li > div:first-child { display: grid; gap: .25rem; }
.plots {
  display: flex;
  align-items: flex-end;
  gap: 1.1rem;
  margin-top: .8rem;
}
.plots figure { display: grid; gap: .35rem; justify-items: start; }
.plots i {
  display: block;
  width: calc(var(--w) * 1.6px);
  height: calc(var(--h) * 1.6px);
  border: 2px solid var(--ink);
  border-radius: 2px;
  background:
    linear-gradient(var(--line), var(--line)) 50% 0 / 2px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) 0 55% / 100% 2px no-repeat;
}
.plots figcaption { font-size: .78rem; color: var(--muted); }

/* roadmap */
.stages { position: relative; padding-left: 1.6rem; }
.stages::before {
  content: "";
  position: absolute;
  left: .4rem;
  top: .55rem;
  bottom: .55rem;
  width: 1px;
  background: var(--line);
}
.stages li {
  position: relative;
  display: grid;
  gap: .15rem;
  padding-bottom: 1.5rem;
}
.stages li:last-child { padding-bottom: 0; }
.stages li::before {
  content: "";
  position: absolute;
  left: -1.6rem;
  top: .4rem;
  width: .8rem;
  height: .8rem;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--blue);
}
.stages li.current::before { background: var(--brick); border-color: var(--brick); }
.stages strong { font-size: 1.1rem; }
.stages span { color: var(--muted); max-width: 36rem; }

/* contact */
.lead-sm { max-width: 34rem; font-size: 1.1rem; color: var(--muted); }
.contact-links { display: grid; gap: .75rem; margin-top: 1.4rem; max-width: 26rem; }
.contact-links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  font-weight: 600;
  overflow-wrap: anywhere;
  transition: border-color .2s;
}
.contact-links a:hover { border-color: var(--blue); }
.contact-links small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.contact-empty { color: var(--muted); font-size: .95rem; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); padding-block: 1.5rem; color: var(--muted); font-size: .9rem; }
.foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ===== Motion ===== */
@keyframes settle {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .plate { animation: none; }
  * { transition: none !important; }
}

/* ===== Tablet and up ===== */
@media (min-width: 640px) {
  .titleblock { grid-template-columns: repeat(3, 1fr); }
  .titleblock > div { border-right: 1px solid var(--line) !important; border-bottom: 1px solid var(--line) !important; }
  .titleblock > div.wide { grid-column: span 3; border-right: 0 !important; }
  .titleblock > div:nth-child(5), .titleblock > div:nth-child(4) { border-bottom: 0 !important; }
  .titleblock > div:last-child { border-right: 0 !important; }
  .projects li { grid-template-columns: 1fr auto; align-items: end; column-gap: 2rem; }
  .plots { margin-top: 0; }
}

/* ===== Desktop ===== */
@media (min-width: 860px) {
  :root { --header-h: 4rem; }

  .menu-btn { display: none; }

  .nav {
    position: static;
    display: flex;
    flex-direction: row;
    gap: 1.6rem;
    padding: 0;
    background: none;
    border: 0;
    margin-left: auto;
  }
  .nav a { padding: .3rem 0; border: 0; font-size: .95rem; }
  .nav a.active, .nav a.active:last-child {
    box-shadow: inset 0 -2px 0 var(--brick);
    padding-left: 0;
  }

  .hero {
    grid-template-columns: 1.15fr .85fr;
    gap: clamp(2.5rem, 6vw, 5rem);
  }
  .plate { order: 2; width: 100%; max-width: 24rem; margin-inline: 0 auto; }
  .hero-copy { order: 1; }

  .section {
    grid-template-columns: 12rem 1fr;
    gap: 2rem;
  }
  .section h2 { position: sticky; top: calc(var(--header-h) + 1.5rem); align-self: start; }
}
