/* Demo: Mark Davis, backend engineer.

   Organised around systems and their numbers, because that is how backend work
   is judged: what happened to latency, to cost, to the on-call rotation. The
   page also does the one thing a resume cannot, which is show actual code with
   the reasoning attached.

   Visually it borrows from technical documentation rather than a CV: a
   monospace voice for labels and metrics, generous rules, one indigo accent,
   and a genuinely dark code block because that is where developers read code.
   Deliberately unlike the thermal engineer demo, which is warm-grey and
   chart-led. */

:root {
  --paper:   #FCFCFD;
  --raise:   #FFFFFF;
  --sunk:    #F2F3F6;
  --ink:     #14161C;
  --ink-2:   #4B5160;
  --ink-3:   #686E7C;
  --line:    #E3E5EB;
  --line-2:  #C9CDD7;
  --accent:  #3B4CCA;
  --accent-bright: #6B79FF;
  --accent-soft: #EDEEFB;
  --term:    #14161C;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

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

h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }

.shell { max-width: 1040px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ----------------------------------------------------------------- top --- */
.top {
  background: #171B2E;
  color: #EBEDF7;
  border-bottom: 5px solid var(--accent-bright);
  padding-block: 52px 46px;
  background-image:
    radial-gradient(56% 74% at 8% 6%, rgba(91, 107, 255, 0.34), transparent 62%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 64px);
}

.top__in {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.handle {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.top h1 {
  margin-top: 14px;
  font-size: clamp(1.9rem, 4.6vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
}

.top .sub { margin-top: 16px; color: rgba(235, 237, 247, 0.74); max-width: 46ch; }

.top__meta {
  border-left: 2px solid var(--accent);
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: 0.88rem;
}
.top__meta p { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: 10px; }
.top__meta span {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 3px;
}

.btn {
  display: inline-block;
  margin-top: 8px;
  padding: 9px 18px;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 4px;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--quiet:hover { background: var(--sunk); color: var(--ink); border-color: var(--ink); }

/* --------------------------------------------------------------- ships --- */
.ships { padding-block: 56px 0; }

.ship {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.ships .ship:first-of-type { border-top: 0; padding-top: 0; }

.ship__head { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; justify-content: space-between; }
.ship h3 { font-size: clamp(1.25rem, 2.8vw, 1.6rem); font-weight: 700; }
.ship__where { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-3); letter-spacing: 0.04em; }

.ship__body { margin-top: 16px; max-width: 72ch; }
.ship__body p { color: var(--ink-2); }
.ship__body p + p { margin-top: 12px; }

.metrics {
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.metrics > div { background: var(--raise); padding: 14px 16px; }
.metrics dt {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.metrics dd {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metrics dd i { color: var(--accent); font-style: normal; padding: 0 2px; }
.metrics dd span {
  display: block;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: 0;
  margin-top: 2px;
}

/* ---------------------------------------------------------------- code --- */
.code-block { padding-block: 56px 0; }
.code-intro { margin-top: 12px; color: var(--ink-2); max-width: 68ch; }

.code {
  margin-top: 22px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--term);
  box-shadow: 0 1px 2px rgba(20, 22, 28, 0.08), 0 16px 40px rgba(20, 22, 28, 0.16);
}

.code__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #1D202A;
  border-bottom: 1px solid #2A2E3A;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #9AA1B2;
}
.code__lang { color: #818999; }

.code pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.75;
  color: #E4E7EF;
  tab-size: 4;
}
.code .c { color: #7E869B; font-style: italic; }
.code .k { color: #9DA8FF; }
.code .f { color: #7FD6C0; }
.code .t { color: #E0B978; }
.code .s { color: #93D2A0; }
.code .n { color: #E58A82; }

/* --------------------------------------------------------------- stack --- */
.stack-section { padding-block: 56px 0; }

.stack-list { list-style: none; margin: 22px 0 0; padding: 0; border-top: 1px solid var(--line); }
.stack-list li {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.stack-list b { font-family: var(--mono); font-size: 0.9rem; font-weight: 700; }
.stack-list span { color: var(--ink-2); font-size: 0.92rem; }

/* ---------------------------------------------------------------- also --- */
.also {
  padding-block: 56px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 40px;
}
.also p { margin-top: 12px; color: var(--ink-2); font-size: 0.94rem; }
.also p + p { margin-top: 10px; }
.also b { font-family: var(--mono); font-weight: 700; color: var(--ink); }

.roles { list-style: none; margin: 16px 0 0; padding: 0; }
.roles li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.roles span { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); }

/* ------------------------------------------------------------- contact --- */
.contact {
  margin-top: 64px;
  padding: 36px 0 72px;
  border-top: 2px solid var(--ink);
}
.contact h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); font-weight: 700; }
.contact p { margin-top: 14px; color: var(--ink-2); max-width: 58ch; }
.contact__row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.updated { margin-top: 28px; font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); }

/* ------------------------------------------------------------ narrower --- */
@media (max-width: 860px) {
  .top__in { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .top__meta { border-left: 0; border-top: 2px solid var(--accent); padding-left: 0; padding-top: 16px; }
}

@media (max-width: 560px) {
  .shell { padding-left: 18px; padding-right: 18px; }
  .stack-list li, .roles li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .code pre { font-size: 0.72rem; padding: 14px; }
}


/* ------------------------------------------------------------ media slot ---
   Where the client's own headshot, work photograph or video goes. Marked
   rather than faked: a framed panel in the page palette with a glyph and a
   label, so the slot looks deliberate while it is empty and the layout does
   not move when the real image lands in it. */
.shot { margin: 0; }
.shot__fill {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 9px),
    linear-gradient(158deg, #262B3D 0%, #14161C 54%, #101E38 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.shot__fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 28% 16%, rgba(59, 76, 202, 0.48), transparent 62%);
}
.shot__glyph {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  color: rgba(255, 255, 255, 0.62);
}
.shot--wide .shot__fill,
.shot--video .shot__fill { aspect-ratio: 16 / 9; }
.shot--square .shot__fill { aspect-ratio: 1 / 1; }
.shot--tall .shot__fill { aspect-ratio: 3 / 4; }
.shot figcaption {
  margin-top: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.shot--on-dark figcaption { color: rgba(255, 255, 255, 0.55); }
.shot__play {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #3B4CCA;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
}
.shot__play svg { width: 25px; height: 25px; margin-left: 4px; color: #fff; }

/* A row of slots, for the pages where the work is the photographs. */
.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 22px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.top__in { grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.8fr) minmax(0, 0.75fr); }
@media (max-width: 980px) {
  .top__in { grid-template-columns: minmax(0, 1fr); }
}

.top .handle { color: var(--accent-bright); }
.top__meta { border-color: rgba(255, 255, 255, 0.2); }
.top__meta p { color: rgba(235, 237, 247, 0.82); }
.top__meta span { color: rgba(235, 237, 247, 0.5); }
.top .btn { background: var(--accent-bright); border-color: var(--accent-bright); color: #12152A; }
.top .btn:hover { background: #fff; border-color: #fff; color: #12152A; }
