/* Thomas Green - portfolio
   Graphite: a lab-register technical minimal. Light grey ground, white
   panels, near-black ink, IBM Plex Sans for text with Plex Mono carrying
   the furniture (nav, kickers, metadata, captions, stats, section
   dividers). One accent, safety orange, used in small doses. */

/* ------------------------------------------------------------------ fonts */

@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
}

/* ----------------------------------------------------------------- tokens */

:root {
  color-scheme: light;

  --bg:     #f1f1ee;      /* graphite paper */
  --panel:  #ffffff;      /* cards, spec tables, figure panels */
  --shot:   #fafaf8;      /* image wells */

  --ink:    #1b1b19;
  --ink-2:  #565651;
  --muted:  #7d7d76;

  --hair:   #dcdcd6;      /* light dividers */
  --rule:   #c8c8c1;      /* structural hairlines */

  --acc:    #e8590c;      /* safety orange, micro-doses */

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo,
          Consolas, monospace;

  --measure: 36rem;
  --wide: 62rem;
}

/* ------------------------------------------------------------------ reset */

*, *::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: 400 16px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; }
p { margin: 0 0 1rem; }
strong { font-weight: 600; }

/* ------------------------------------------------------------- typography */

h1, h3, h4 {
  margin: 0 0 0.5rem; line-height: 1.15; text-wrap: balance;
  letter-spacing: -0.018em; font-weight: 600;
}
h1 { font-size: clamp(2.1rem, 5vw, 3.1rem); }
h3 { font-size: 1.05rem; margin-top: 1.9rem; }

/* section headings run as mono-caps dividers, like file separators */
h2 {
  font: 600 0.8rem/1.5 var(--mono); letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink); text-align: center;
  border-top: 1px solid var(--ink); padding-top: 0.7rem;
  margin: 3rem 0 1rem;
}
article .prose h2:first-child { margin-top: 0; }

a {
  color: var(--ink); text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: var(--rule);
}
a:hover { color: var(--acc); text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }

.kicker, .eyebrow {
  font: 500 0.68rem/1.6 var(--mono); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-2); margin: 0 0 0.9rem;
}
.kicker::before, .eyebrow::before {
  content: ""; display: inline-block; width: 0.55em; height: 0.55em;
  background: var(--acc); margin-right: 0.65em;
}

.lede { font-size: 1.12rem; line-height: 1.58; color: var(--ink-2); }

/* ----------------------------------------------------------------- layout */

.wrap { width: min(100% - 2.5rem, var(--wide)); margin-inline: auto; }
section { scroll-margin-top: 4.5rem; }

.prose > * { max-width: var(--measure); }
article .prose > * { max-width: 42rem; margin-inline: auto; }
article .prose li { text-align: left; }
article figcaption { max-width: 42rem; margin-inline: auto; }
article figure.bleed { width: min(100%, 50rem); margin-inline: auto; }
article .media-row { max-width: 50rem; margin-inline: auto; }
article .stats { max-width: 50rem; margin-inline: auto; }
article .prose ul.tick { margin-inline: auto; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--panel); border: 1px solid var(--rule);
  padding: 0.6rem 1rem;
}
.skip:focus { left: 0; }

/* ----------------------------------------------------------------- header */

.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--ink);
}
.top .wrap {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: 0.8rem 0;
}
.brand {
  font-weight: 600; font-size: 0.95rem; color: var(--ink);
  text-decoration: none;
}
.nav {
  display: flex; gap: 1.4rem;
  font: 500 0.68rem/1.5 var(--mono); letter-spacing: 0.13em;
  text-transform: uppercase;
}
.nav a { color: var(--ink-2); text-decoration: none; }
.nav a:hover { color: var(--acc); }

@media (max-width: 34rem) { .nav { gap: 0.95rem; } }

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

.hero { padding: clamp(2.6rem, 6vw, 4.2rem) 0 2rem; }
.hero .lede { font-size: 1.16rem; max-width: 40rem; margin-top: 1.1rem; }

.facts {
  display: flex; flex-wrap: wrap; list-style: none;
  gap: 0.6rem 2.2rem; margin: 1.8rem 0 0; padding: 0.95rem 0 0;
  border-top: 1px solid var(--ink);
  font: 400 0.74rem/1.5 var(--mono);
}
.facts li b { font-weight: 600; color: var(--ink); }
.facts li span { display: block; color: var(--muted); margin-top: 0.22rem; }

.hero-links {
  display: flex; flex-wrap: wrap; gap: 1.3rem; margin-top: 1.5rem;
  font-size: 0.88rem;
}

/* The homepage hero runs centred; body columns, spec tables and section
   dividers stay left. */
.home .hero { text-align: center; }
.home #more .lede { text-align: center; }
.home .gh-link { text-align: center; }
.home #contact .prose > h2 { max-width: none; }
.home #contact .prose p { text-align: center; margin-inline: auto; }
.home .hero h1, .home .hero .lede { margin-inline: auto; }
.home .facts { justify-content: center; }
.home .facts li { text-align: center; }
.home .hero-links { justify-content: center; }

/* -------------------------------------------------- front page: project cards */

/* Flex rather than grid so a short final row centres its cards instead of
   leaving an orphan hanging on the left. */
.grid {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem;
  margin: 1.8rem 0 0; padding: 0; list-style: none;
}
.card { flex: 0 1 calc((100% - 3rem) / 3); }

@media (max-width: 62rem) { .card { flex-basis: calc((100% - 1.5rem) / 2); } }
@media (max-width: 40rem) { .card { flex-basis: 100%; } }

.card {
  display: flex; flex-direction: column; position: relative;
  background: var(--panel); border: 1px solid var(--rule);
  transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--ink); }
.card:hover h3 { color: var(--acc); }
.card a.card-hit {
  display: block; height: 100%; color: inherit; text-decoration: none;
}

.card-shot {
  aspect-ratio: 16 / 9; overflow: hidden; position: relative;
  display: grid; place-items: center;
  background: var(--shot); border-bottom: 1px solid var(--hair);
}
.card-shot img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  /* grid items get min-height:auto, which lets a tall image override the
     16/9 aspect-ratio on the parent and give the row uneven card shots */
  min-width: 0; min-height: 0;
}
.card-shot.contain img { object-fit: contain; padding: 0.5rem; }

.card-body { padding: 0.95rem 1.05rem 1.15rem; flex: 1; }
.card-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 0.6rem; margin: 0 0 0.45rem;
  font: 400 0.62rem/1.5 var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.card-meta .drg { color: var(--ink); white-space: nowrap; }
.card-body h3 { margin: 0 0 0.4rem; font-size: 1.04rem; line-height: 1.3; }
.card-body p {
  margin: 0; font-size: 0.83rem; color: var(--ink-2); line-height: 1.55;
}

/* ----------------------------------------------------------------- stamps */

.stamp {
  position: absolute; top: 0.6rem; right: 0.6rem;
  font: 600 0.58rem/1 var(--mono); letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink);
  background: var(--panel); border: 1px solid var(--ink);
  padding: 0.3rem 0.5rem;
}
.fig-stamp { position: absolute; top: 0.9rem; right: 0.9rem; }

.stamp-404 {
  position: static; display: inline-block;
  font-size: 1.3rem; letter-spacing: 0.1em; padding: 0.5rem 1rem;
  border-width: 2px; margin: 1.4rem 0 1rem;
}

/* ---------------------------------------------------------- project header */

.proj-head { padding: 2.6rem 0 0.4rem; text-align: center; }
.proj-head h1 { max-width: 24ch; margin-inline: auto; }
.proj-head .lede { max-width: 42rem; margin-inline: auto; }
.proj-head .meta { text-align: left; }

/* Title block: a spec table of white cells inside a single ink frame.
   Internal rules come from box-shadow so the container's overflow clips
   them at the outer edges - that avoids doubled borders wherever the grid
   wraps to a second row. */
.meta {
  display: grid; gap: 0; margin: 1.8rem 0 0; padding: 0; max-width: none;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  border: 1px solid var(--ink); overflow: hidden; background: var(--panel);
}
.meta > div {
  min-width: 0; padding: 0.55rem 0.85rem 0.65rem;
  box-shadow: -1px 0 0 var(--hair), 0 -1px 0 var(--hair);
}
.meta dt {
  font: 500 0.6rem/1.4 var(--mono); letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.28rem;
}
.meta dd { margin: 0; font: 400 0.76rem/1.5 var(--mono); color: var(--ink); }

/* ------------------------------------------------------------ figures / media */

article { counter-reset: figure; }

figure { margin: 2rem 0; }
figure img, figure video {
  display: block; width: 100%; height: auto;
  background: var(--panel); border: 1px solid var(--hair);
}

figcaption {
  counter-increment: figure; margin-top: 0.65rem;
  font: 400 0.74rem/1.6 var(--mono); color: var(--ink-2);
}
article figcaption::before {
  content: "FIG. " counter(figure) "  ";
  font-weight: 600; color: var(--ink);
}

.fig-svg {
  background: var(--panel); border: 1px solid var(--hair);
  padding: 0.6rem 0.7rem; position: relative;
}
.fig-svg img { border: 0; background: transparent; }

/* 15rem minimum lets a three-clip row sit three-across inside the 50rem
   media column instead of wrapping 2+1 and leaving a blank cell. */
.media-row {
  display: grid; gap: 1.2rem; margin: 2rem 0;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.media-row figure { margin: 0; }

/* ----------------------------------------------------------- photo callouts */

.callout-wrap { position: relative; }
.callout-wrap img { display: block; }
.callout {
  position: absolute; white-space: nowrap;
  font: 500 0.6rem/1.5 var(--mono); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink);
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--rule);
  padding: 0.1rem 0.38rem;
}
.callout::before {
  content: ""; position: absolute; top: 50%; height: 1.5px;
  width: 36px; background: var(--ink);
}
.callout::after {
  content: ""; position: absolute; top: calc(50% - 2.5px); width: 5px;
  height: 5px; border-radius: 50%; background: var(--ink);
}
.callout.l::before { left: -36px; }
.callout.l::after { left: -40px; }
.callout.r::before { right: -36px; }
.callout.r::after { right: -40px; }

@media (max-width: 40rem) {
  .callout { font-size: 0.5rem; padding: 0.05rem 0.22rem; }
  .callout::before { width: 18px; }
  .callout.l::before { left: -18px; } .callout.l::after { left: -22px; }
  .callout.r::before { right: -18px; } .callout.r::after { right: -22px; }
}

/* --------------------------------------------------------------- stat panel */

.stats {
  display: grid; margin: 2rem 0; padding: 0;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  background: var(--panel); border: 1px solid var(--rule); overflow: hidden;
}
.stats div { padding: 1rem 1.1rem; box-shadow: -1px 0 0 var(--hair); }
.stats .v {
  display: block; font: 500 1.45rem/1.1 var(--mono);
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.stats .k {
  display: block; margin-top: 0.45rem; font-size: 0.74rem;
  color: var(--ink-2); line-height: 1.45;
}

/* ------------------------------------------------------------------- lists */

ul.tick { max-width: var(--measure); padding-left: 1.15rem; margin: 0 0 1rem; }
ul.tick li { margin-bottom: 0.5rem; }
ul.tick li::marker { color: var(--muted); }

/* ---------------------------------------------------------- github pointer */

.gh-link a {
  display: inline-block; font: 500 0.84rem/1.5 var(--mono);
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--ink); padding: 0.62rem 1.25rem;
  text-decoration: none;
}
.gh-link a:hover { color: var(--acc); border-color: var(--acc); }
.gh-link { margin: 1.6rem 0 0; }

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

.site-foot {
  margin-top: 4rem; border-top: 1px solid var(--ink);
  padding: 1.4rem 0 3rem; font-size: 0.8rem; color: var(--ink-2);
}
.site-foot .wrap {
  display: flex; flex-wrap: wrap; gap: 0.8rem 1.6rem;
  justify-content: space-between; align-items: baseline;
}
.site-foot .set { display: flex; flex-wrap: wrap; gap: 1.2rem; }

.back {
  display: inline-block; margin: 2.4rem 0 0;
  font: 500 0.72rem/1.5 var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-2); text-decoration: none;
}
.back:hover { color: var(--acc); }

/* --------------------------------------------------------- mobile comfort */

@media (max-width: 40rem) {
  /* bigger touch targets without changing the visual layout */
  .nav a, .site-foot .set a, .hero-links a {
    padding: 0.55rem 0.35rem; margin: -0.55rem -0.35rem;
  }
  .prose p { overflow-wrap: break-word; }
}
