/* ------------------------------------------------------------------
   kevinrocci.com — shared stylesheet

   Palette      Yellow-billed magpie (Pica nuttalli), a Central Valley
                endemic. Two large neutral fields interrupted by two
                saturated marks — the iridescent wing and the bill.
                See the :root block for the six values and the reasoning.

   Layout       Fixed 260px iridescent rail, chalk content column.
                Collapses to a top bar under 880px.
   Type         Fraunces (display, WONK axis on — the wobble is the
                point), Source Serif 4 (body), IBM Plex Mono (labels).
   Cards        Field-guide entries, not data tables. Employer reads as
                a common name, role as its binomial in italic. Each card
                carries a span bar on a shared 2013–now axis, so reading
                down the stack shows the arc.
   Theme        Deliberately single-theme. Every color painted
                explicitly, so the page holds on any ground.
   Swatches     Real PNG washes, generated by tools/make-swatches.py
                into img/magpie/. Re-run to reroll, or change SEED for a
                different set of accidents. To use hand-painted scans
                instead, drop them in under the same six filenames.

   Page classes body.home and body.case carry the few divergences.
   ------------------------------------------------------------------ */

:root {
  /* ------------------------------------------------------------------
     Yellow-billed magpie (Pica nuttalli) — a Central Valley endemic,
     which is to say it lives here and almost nowhere else.

     The bird is built from two enormous neutral fields interrupted by
     exactly two saturated marks: the iridescent wing and the bill. The
     page is built the same way. Nothing sits in the middle.

     The black is never #000 — a magpie's black is structural colour,
     shifting blue, green and violet with the angle of the light. The
     rail carries that shift. The white is warm, not paper-white.
     ------------------------------------------------------------------ */
  --ground:    #F5F3EE;  /* belly and scapulars */
  --surface:   #FCFBF8;  /* the same, one step up */
  --text:      #161C24;  /* head and breast */
  --text-soft: #566270;
  --rail-bg:   #17202B;  /* base of the iridescent black */
  --rail-deep: #0E141B;
  --rail-fg-rgb: 245, 243, 238;
  --accent:    #1A5F92;  /* the blue that catches the light */
  --fill-edge: #CFDEE8;
  --fill:      #E9F1F6;
  --spark:     #F0AD1B;  /* bill and eye ring */
  --line:      #E3DFD6;

  /* Iridescence, sampled across the wing and tail. Violet at the head
     end, teal at the tail end — the direction the bird actually runs. */
  --irid-violet: #1E1D30;
  --irid-blue:   #17202B;
  --irid-teal:   #102A31;

  --rail-w: 260px;
  --display: "Fraunces", "Source Serif 4", Charter, Georgia, serif;
  --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); text-decoration-color: var(--spark); }
:focus-visible { outline: 2px solid var(--spark); outline-offset: 3px; border-radius: 4px; }

.label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-soft);
}

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; align-items: stretch; }

/* ---------- rail ---------- */

.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  /* Structural colour, not pigment. A magpie's black is an
     interference effect, so it shifts violet at the head and teal down
     the tail. Two stacked gradients: the body shift, and a soft sheen
     raking across it the way light catches the barbs. */
  background:
    linear-gradient(112deg,
      transparent 26%,
      rgba(64, 148, 168, 0.13) 45%,
      rgba(96, 122, 190, 0.07) 56%,
      transparent 72%),
    linear-gradient(176deg,
      var(--irid-violet) 0%,
      var(--irid-blue) 42%,
      var(--irid-blue) 58%,
      var(--irid-teal) 100%);
  background-color: var(--rail-bg);
  color: var(--ground);
  padding: 44px 30px 34px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  position: sticky;
  top: 0;
  height: 100vh;
}
body.case .rail { padding: 40px 30px 34px; gap: 26px; }

.back {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(var(--rail-fg-rgb), 0.88);
  text-decoration: none;
}
.back:hover { color: var(--spark); }

/* The white block on the dark rail is the magpie's scapular patch —
   the one hard-edged white shape on an otherwise black bird. It is why
   the mark sits in a filled box rather than floating free. */
.monogram {
  width: 86px; height: 86px;
  background: var(--ground);
  color: var(--rail-deep);
  display: grid; place-items: center;
  border-radius: 18px;
  text-decoration: none;
}
.monogram svg { width: 46px; height: 46px; display: block; }
body.case .monogram { width: 74px; height: 74px; border-radius: 16px; }
body.case .monogram svg { width: 40px; height: 40px; }
a.monogram:hover { color: var(--accent); }

.rail-name { font-size: 21px; font-weight: 600; line-height: 1.2; margin: 0; }
body.case .rail-name { font-size: 19px; line-height: 1.25; }

.rail-role {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.13em;
  text-transform: uppercase; color: rgba(var(--rail-fg-rgb), 0.80); margin: 6px 0 0;
}

.nav { display: flex; flex-direction: column; gap: 1px; margin-top: -6px; }
body.case .nav { margin-top: 0; }

.nav a {
  position: relative; display: block;
  padding: 6px 0 6px 18px;
  font-size: 16px;
  color: rgba(var(--rail-fg-rgb), 0.94);
  text-decoration: none;
  transition: color 140ms ease;
}
body.case .nav a { padding: 5px 0 5px 18px; font-size: 15.5px; }

.nav a::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--spark);
  transform: translateY(-50%) scale(0);
  transition: transform 160ms ease;
}
.nav a:hover, .nav a.is-active { color: var(--ground); }
.nav a.is-active::before { transform: translateY(-50%) scale(1); }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.rail-foot a {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.03em;
  color: rgba(var(--rail-fg-rgb), 0.92); text-decoration: none;
  border-bottom: 1px solid rgba(var(--rail-fg-rgb), 0.28);
  align-self: flex-start; padding-bottom: 1px;
}
.rail-foot a:hover { color: var(--ground); border-bottom-color: var(--spark); }

/* ---------- content ---------- */

main { flex: 1 1 auto; min-width: 0; padding: 76px 56px 100px; }
body.case main { padding: 72px 56px 110px; }

.col { max-width: 660px; }
body.case .col { max-width: 680px; }

h1 {
  font-size: clamp(2.4rem, 4.6vw, 3.15rem);
  font-weight: 600; line-height: 1.08; letter-spacing: -0.015em;
  margin: 0; text-wrap: balance;
}
body.case h1 { font-size: clamp(2.2rem, 4.2vw, 2.95rem); line-height: 1.1; }

/* The rule reads left to right the way the bird does: bill, head,
   wing, then that ridiculous tail running out to nothing. A
   yellow-billed magpie's tail is longer than its body, so the rule is
   long and thin rather than short and thick. */
.rule {
  width: 100%;
  max-width: 430px;
  height: 3px;
  border-radius: 2px;
  margin: 26px 0 24px;
  background: linear-gradient(90deg,
    var(--spark) 0, var(--spark) 22px,
    var(--text) 22px, var(--text) 42px,
    var(--accent) 56px,
    #1C5E77 46%,
    #23324F 74%,
    rgba(35, 50, 79, 0) 100%);
}
body.case .rule { margin: 24px 0 26px; }

.intro { margin: 0; font-size: 18px; line-height: 1.66; }
.lede { font-size: 18.5px; line-height: 1.6; margin: 0; }

section { margin-top: 68px; scroll-margin-top: 28px; }
body.case section { margin-top: 60px; scroll-margin-top: 26px; }

h2 { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.008em; margin: 0; }
body.case h2 { font-size: 1.45rem; letter-spacing: -0.01em; margin: 0 0 18px; text-wrap: balance; }
h2 .n {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.1em; color: var(--accent);
  display: block; margin-bottom: 7px;
}

body.case p { margin: 0 0 17px; }
body.case section p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }

.sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
  padding-bottom: 12px; margin-bottom: 26px;
  /* A hairline that starts as bill yellow and hands off to the rule
     colour, so every section carries a trace of the same bird. */
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg,
    var(--spark) 0, var(--spark) 34px,
    var(--line) 34px, var(--line) 100%) 1;
}
.sec-head .label { text-align: right; }

/* ---------- what I do ---------- */

.skills { margin: 0; }
.skill {
  display: grid; grid-template-columns: 172px 1fr; gap: 20px;
  padding: 15px 0; border-top: 1px dotted var(--line);
}
.skill:first-child { border-top: none; padding-top: 0; }
.skill dd { margin: 0; }

/* ---------- field-guide cards ---------- */

.cards { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 26px 24px;
}

.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 1.24rem; font-weight: 600; letter-spacing: -0.008em; }
.card-head .when {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--text-soft); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.binomial { font-style: italic; font-size: 1.02rem; color: var(--text-soft); margin: 2px 0 0; }

/* span bar on a shared 2013–now axis */
.span {
  height: 4px; background: var(--fill-edge); border-radius: 3px;
  margin: 16px 0 18px; position: relative; overflow: hidden;
}
.span i {
  position: absolute; top: 0; bottom: 0;
  left: var(--a); width: var(--w); min-width: 9px;
  background: var(--accent); border-radius: 3px;
}

.card p.did { margin: 0; }

.note {
  background: var(--fill);
  border: 1px solid var(--fill-edge);
  border-radius: 10px;
  padding: 15px 18px;
  margin-top: 18px;
}
.note .label { display: block; margin-bottom: 6px; color: var(--accent); }
.note p { margin: 0; }
body.case .note { border-radius: 12px; padding: 18px 22px; margin: 22px 0; }
body.case .note p:last-child { margin-bottom: 0; }

/* ---------- projects ---------- */

.proj .card { padding: 20px 26px 22px; }
.proj .card-head { align-items: center; }
.proj p.did { margin-top: 8px; color: var(--text-soft); }
.proj .go { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.03em; }
.proj .go-row { margin: 14px 0 0; }

.tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--text-soft);
  background: var(--fill); border: 1px solid var(--fill-edge);
  padding: 3px 8px; border-radius: 6px; white-space: nowrap;
}

/* ---------- watercolor swatches ---------- */

.swatches { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 30px; }
.chip-wrap { width: 84px; text-align: center; }
.chip {
  width: 76px; height: 68px; margin: 0 auto 9px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.chip-name {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.07em;
  text-transform: uppercase; display: block; color: var(--text);
}
.chip-src {
  font-size: 12.5px; font-style: italic; color: var(--text-soft);
  display: block; line-height: 1.3; margin-top: 2px;
}

.c1 { background-image: url("img/magpie/swatch-wing.png");   transform: rotate(-4deg); }
.c2 { background-image: url("img/magpie/swatch-azure.png");  transform: rotate(3deg); }
.c3 { background-image: url("img/magpie/swatch-chalk.png");  transform: rotate(-2deg); }
.c4 { background-image: url("img/magpie/swatch-pewter.png"); transform: rotate(5deg); }
.c5 { background-image: url("img/magpie/swatch-ink.png");    transform: rotate(-3deg); }
.c6 { background-image: url("img/magpie/swatch-bill.png");   transform: rotate(2deg); }

/* ---------- link list ---------- */

.links { display: flex; flex-direction: column; }
.links a {
  display: grid; grid-template-columns: 124px 1fr; gap: 20px;
  padding: 13px 0; border-top: 1px dotted var(--line);
  text-decoration: none; color: var(--text);
}
.links a:first-child { border-top: none; }
.links a:hover .dest { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.dest { font-family: var(--mono); font-size: 14px; letter-spacing: 0.02em; }


/* ---------- case study only ---------- */

.meta {
  margin: 30px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}
.meta div { display: grid; grid-template-columns: 92px 1fr; gap: 20px; padding: 9px 0; }
.meta div + div { border-top: 1px dotted var(--line); }
.meta p { margin: 0; font-size: 16px; }

/* the four stages are a real sequence, so they are numbered */
.stages { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.stages li {
  counter-increment: s;
  display: grid; grid-template-columns: 46px 1fr; gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.stages li:first-child { border-top: none; padding-top: 4px; }
.stages li::before {
  content: counter(s, decimal-leading-zero);
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  padding-top: 4px;
}
.stages h3 { margin: 0 0 3px; font-size: 1.06rem; font-weight: 600; }
.stages p { margin: 0; color: var(--text-soft); }

.find { margin: 26px 0; }
.find h3 { font-size: 1.06rem; font-weight: 600; margin: 0 0 6px; text-wrap: balance; }
.find + .find { border-top: 1px solid var(--line); padding-top: 22px; }

ul.plain { margin: 0 0 17px; padding-left: 20px; }
ul.plain li { margin-bottom: 8px; }

.scroller { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 15.5px; }
th, td { text-align: left; padding: 12px 18px; vertical-align: top; }
thead th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-soft); font-weight: 500;
  border-bottom: 1px solid var(--line);
}
tbody tr + tr td { border-top: 1px dotted var(--line); }
tbody td:first-child { padding-right: 26px; }

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

footer { margin-top: 76px; padding-top: 20px; border-top: 1px solid var(--line); }
body.case footer {
  margin-top: 66px;
  display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: baseline;
}

/* ---------- motion ---------- */

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

/* ---------- narrow ---------- */

@media (max-width: 880px) {
  .shell { flex-direction: column; }
  .rail, body.case .rail {
    width: 100%; flex: none; height: auto; position: static;
    padding: 26px 24px 22px; gap: 18px;
  }
  .monogram, body.case .monogram { width: 58px; height: 58px; font-size: 24px; border-radius: 11px; }
  .nav, body.case .nav { flex-direction: row; flex-wrap: wrap; gap: 4px 20px; margin-top: 0; }
  .nav a, body.case .nav a { padding: 2px 0 2px 15px; font-size: 15px; }
  .rail-foot { margin-top: 4px; flex-direction: row; flex-wrap: wrap; gap: 16px; }
  main, body.case main { padding: 40px 24px 64px; }
  .skill { grid-template-columns: 1fr; gap: 4px; }
  .card { padding: 19px 20px 21px; }
  .links a { grid-template-columns: 1fr; gap: 3px; }
  .meta div { grid-template-columns: 1fr; gap: 2px; }
  .stages li { grid-template-columns: 1fr; gap: 4px; }
  .stages li::before { padding-top: 0; }
}

/* ------------------------------------------------------------------
   Display face — Fraunces with the WONK axis on.

   Fraunces is a variable "old-style" face with two joy axes: SOFT
   rounds the terminals, WONK swaps in the wobbly single-storey
   alternates. Both are turned up here on purpose. The body face stays
   Source Serif 4, which is quiet enough to read a long case study in.
   Set opsz per size so the large type keeps its contrast.
   ------------------------------------------------------------------ */

h1, h2, h3, .rail-name, .monogram {
  font-family: var(--display);
  font-variation-settings: "SOFT" 60, "WONK" 1;
  font-optical-sizing: auto;
}

h1 {
  font-weight: 700;
  letter-spacing: -0.022em;
  font-variation-settings: "opsz" 120, "SOFT" 70, "WONK" 1;
}
body.case h1 { font-variation-settings: "opsz" 96, "SOFT" 70, "WONK" 1; }

h2 { font-weight: 650; font-variation-settings: "opsz" 40, "SOFT" 60, "WONK" 1; }
h3, .card-head h3 { font-weight: 650; font-variation-settings: "opsz" 24, "SOFT" 60, "WONK" 1; }

.rail-name { font-weight: 650; font-variation-settings: "opsz" 24, "SOFT" 60, "WONK" 1; }
.monogram { font-weight: 700; font-variation-settings: "opsz" 72, "SOFT" 80, "WONK" 1; }

/* The binomial reads as a field-guide sub-name, so it takes the
   display face in italic rather than the body italic. */
.binomial {
  font-family: var(--display);
  font-variation-settings: "opsz" 20, "SOFT" 70, "WONK" 1;
  font-weight: 400;
}

/* ------------------------------------------------------------------
   Small moments — the difference between a resume and a person.
   ------------------------------------------------------------------ */

/* Cards lift a hair on hover. Enough to feel alive, not enough to
   distract while reading. */
.card { transition: transform 200ms ease, border-color 200ms ease; }
.cards a:focus-visible ~ .card { border-color: var(--spark); }
.proj .card:hover, .cards .card:hover {
  transform: translateY(-2px);
  border-color: var(--fill-edge);
}

/* The swatches tilt when you point at them, the way a paint chip does
   when you pick it up. Each already sits at its own angle. */
.chip { transition: transform 260ms cubic-bezier(.34,1.4,.64,1); }
.chip-wrap:hover .chip { transform: rotate(0deg) scale(1.14); }

/* The monogram is the only mark on the page, so let it react. */
.monogram { transition: transform 240ms cubic-bezier(.34,1.4,.64,1); }
.rail:hover .monogram { transform: rotate(-3deg); }

@media (prefers-reduced-motion: reduce) {
  .card:hover, .chip-wrap:hover .chip, .rail:hover .monogram { transform: none; }
}
