/* Layout: the page is a hard court seen from above. Green apron outside,
   blue court inside, chalk lines as structure. Text stays short:
   the hero, the work "draw" (newest first), the net, an off-court reel of picture cards,
   then writing and find-me links. */
:root {
  --apron: #4f7d62;        /* green surround */
  --court: #2f5f93;        /* hard-court blue */
  --court-deep: #284f7c;   /* shaded court for panels */
  --chalk: #f6f7f1;        /* line paint + light cards */
  --ink: #142238;          /* text on chalk */
  --ball: #d8f03c;         /* optic yellow */
  --crayon: #e2683f;       /* kids' crayon, used sparingly */
  --muted-on-court: rgba(246, 247, 241, .74);
  --muted-on-chalk: #4a5a70;
  --shadow: rgba(10, 20, 35, .28);
  --line-w: 3px;

  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --hand: "Gochi Hand", "Comic Sans MS", cursive;

  --step--1: .82rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.3rem;
  --step-hero: clamp(3.6rem, 12vw, 9.5rem);
  color-scheme: light;
}

/* Night session: same court, floodlights on */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --apron: #0f1c17;
    --court: #1b3556;
    --court-deep: #152a45;
    --chalk: #e9ebe2;
    --ink: #0f1a2b;
    --ball: #e3fb4a;
    --crayon: #f0845f;
    --muted-on-court: rgba(233, 235, 226, .7);
    --muted-on-chalk: #44536a;
    --shadow: rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --apron: #0f1c17;
  --court: #1b3556;
  --court-deep: #152a45;
  --chalk: #e9ebe2;
  --ink: #0f1a2b;
  --ball: #e3fb4a;
  --crayon: #f0845f;
  --muted-on-court: rgba(233, 235, 226, .7);
  --muted-on-chalk: #44536a;
  --shadow: rgba(0, 0, 0, .5);
  color-scheme: dark;
}

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

body {
  margin: 0;
  background: var(--apron);
  color: var(--chalk);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.55;
  padding-inline: 16px;
  padding-block: 20px 40px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 3px solid var(--ball); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }

/* ---------- The court ---------- */
.court {
  max-width: 1120px;
  margin-inline: auto;
  background: var(--court);
  border: var(--line-w) solid var(--chalk);
  box-shadow: 0 18px 50px var(--shadow);
  position: relative;
}
/* centre service line, faint, running the full height */
.court::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: 2px;
  background: var(--chalk);
  opacity: .12;
  pointer-events: none;
}
.zone { position: relative; padding: clamp(20px, 4vw, 48px); }
.zone + .zone { border-top: 2px solid rgba(246, 247, 241, .35); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 14px clamp(20px, 4vw, 48px);
  border-bottom: var(--line-w) solid var(--chalk);
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: .04em;
}
.wordmark { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.wordmark .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ball); box-shadow: inset -3px -3px 0 rgba(0,0,0,.12); }
.nav { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0; padding: 0; }
.nav a { text-decoration: none; text-transform: uppercase; }
.nav a:hover { text-decoration: underline; text-decoration-color: var(--ball); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.lights {
  font: inherit;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--ball);
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  min-height: 380px;
  overflow: hidden;
  touch-action: manipulation;
  cursor: crosshair;
}
.hero:has(.portrait) { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero > *:not(canvas) { position: relative; z-index: 1; }
.eyebrow {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-on-court);
}
.hero h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: var(--step-hero);
  line-height: .84;
  letter-spacing: -.01em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero h1 .surname { color: var(--ball); display: block; }
.lede { font-size: var(--step-1); max-width: 34ch; }
.hero .lede { color: var(--muted-on-court); }
.score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 22px;
  margin-top: 22px;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-on-court);
}
.score b { color: var(--chalk); font-size: 1.1rem; font-variant-numeric: tabular-nums; margin-left: 4px; }
.score b.lit { color: var(--ball); }
.hint {
  font-family: var(--hand);
  font-size: var(--step-1);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ball);
  display: inline-block;
  transform: rotate(-3deg);
}
.portrait {
  margin: 0;
  justify-self: end;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 5;
  border: var(--line-w) solid var(--chalk);
  background: var(--court-deep);
  position: relative;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait::after {
  content: "";
  position: absolute;
  right: -16px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ball);
  box-shadow: inset -6px -6px 0 rgba(0,0,0,.14);
}

/* Scoreboard */
.scoreboard {
  background: #10261c;
  color: #f2f4ea;
  border: 4px solid #2a4434;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: var(--step--1);
  box-shadow: 0 10px 0 rgba(0,0,0,.18);
  cursor: default;
}
.scoreboard h2 {
  font-family: var(--mono);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 2px solid #2a4434;
  color: #a7b8a9;
}
.scoreboard dl { margin: 0; display: grid; grid-template-columns: auto 1fr; }
.scoreboard dt, .scoreboard dd {
  margin: 0;
  padding: 9px 14px;
  border-bottom: 1px solid #1f3a2b;
}
.scoreboard dt { color: #a7b8a9; text-transform: uppercase; letter-spacing: .06em; }
.scoreboard dd { text-align: right; color: #f2f4ea; font-variant-numeric: tabular-nums; }
.scoreboard dd.lit { color: #e3fb4a; font-weight: 600; font-size: 1.15rem; }
.scoreboard dl > :nth-last-child(-n+2) { border-bottom: 0; }

/* ---------- Section headings ---------- */
.side-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 28px;
}
.side-label h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-3);
  text-transform: uppercase;
  line-height: 1;
}
.side-label p { color: var(--muted-on-court); max-width: 46ch; }
.span-label { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-on-court); }

/* ---------- Work: the draw, newest stop first ---------- */
.draw {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  position: relative;
}
/* the line that joins the stops runs through the logos */
.draw::before {
  content: "";
  position: absolute;
  left: calc(100% / 12);
  right: calc(100% / 12);
  top: 58px;
  height: var(--line-w);
  background: var(--chalk);
  opacity: .5;
}
.stop { display: grid; justify-items: center; align-content: start; text-align: center; gap: 8px; padding-inline: 6px; position: relative; min-width: 0; }
.stop .when { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-on-court); font-variant-numeric: tabular-nums; }
.stop .logo {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: var(--line-w) solid var(--chalk);
  background: var(--chalk);
  overflow: hidden;
  transition: transform .2s;
}
.stop .logo::before { content: attr(data-initials); font-family: var(--mono); font-size: .7rem; font-weight: 600; color: var(--ink); }
.stop .logo img { position: absolute; inset: 9px; width: calc(100% - 18px); height: calc(100% - 18px); object-fit: contain; background: var(--chalk); }
.stop:hover .logo { transform: translateY(-4px) rotate(-4deg); }
.stop .co { font-weight: 600; font-size: var(--step-1); line-height: 1.15; }
.stop .role { font-size: var(--step--1); color: var(--muted-on-court); line-height: 1.3; }
.stop.now .when { color: var(--ball); font-weight: 600; }
.stop.now .logo { border-color: var(--ball); box-shadow: 0 0 0 6px rgba(216, 240, 60, .28); }

/* ---------- The net ---------- */
.net {
  position: relative;
  height: 54px;
  background:
    repeating-linear-gradient(45deg, transparent 0 7px, rgba(246,247,241,.38) 7px 8px),
    repeating-linear-gradient(-45deg, transparent 0 7px, rgba(246,247,241,.38) 7px 8px),
    #0e1b2c;
  border-block: 6px solid var(--chalk);
  display: grid;
  place-items: center;
}
.net span {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  background: var(--chalk);
  color: var(--ink);
  padding: 4px 12px;
  border-radius: 3px;
}

/* ---------- Off court: the reel ---------- */
#life { position: relative; }
@media (min-width: 1000px) { #life .span-label { display: none; } }
.reel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
}
.card {
  font: inherit;
  text-align: left;
  aspect-ratio: 3 / 4;
  max-width: 100%;
  background: var(--chalk);
  color: var(--ink);
  border: var(--line-w) solid var(--chalk);
  border-radius: 4px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  text-decoration: none;
  scroll-snap-align: start;
  position: relative;
  padding: 0;
  cursor: default;
  transition: transform .15s, box-shadow .15s;
}
a.card, button.card { cursor: pointer; }
.card:hover { transform: translateY(-4px) rotate(-.8deg); box-shadow: 0 8px 0 rgba(0,0,0,.18); }
.card .pic { display: grid; place-items: center; padding: 14px; min-height: 0; overflow: hidden; }
.card .pic > svg { width: 100%; height: auto; max-height: 100%; display: block; }
.card .cap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 2px solid var(--court);
  font-weight: 600;
}
.card .cap small {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-on-chalk);
}
.count { font-variant-numeric: tabular-nums; color: var(--crayon); }

/* Reading: a shelf of spines */
.shelf { display: flex; align-items: flex-end; gap: 3px; width: 100%; height: 100%; max-height: 150px; border-bottom: 8px solid #8a5a3b; padding-inline: 4px; }
.shelf i { flex: 1; height: var(--h); background: var(--c); border-radius: 2px 2px 0 0; transform-origin: bottom center; transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.shelf i:last-child { transform: rotate(10deg) translateX(4px); }
.card:hover .shelf i:nth-child(4) { transform: translateY(-10px) rotate(-3deg); }

/* Dogs: pet them */
.dog { cursor: pointer; }
.dog .tail { transform-box: fill-box; transform-origin: left bottom; animation: wag .5s ease-in-out infinite alternate; animation-play-state: paused; }
.card.dogs:hover .tail, .card.dogs:focus-within .tail { animation-play-state: running; }
@keyframes wag { from { transform: rotate(-14deg); } to { transform: rotate(18deg); } }
.woof {
  position: absolute;
  top: clamp(20px, 4vw, 48px);
  left: 50%;
  z-index: 2;
  font-family: var(--hand);
  font-size: var(--step-2);
  color: var(--ball);
  transform: rotate(8deg) scale(.6);
  opacity: 0;
  transition: opacity .2s, transform .25s cubic-bezier(.3,1.8,.5,1);
  pointer-events: none;
}
.woof.on { opacity: 1; transform: rotate(8deg) scale(1); }

/* Kids: fridge drawing */
.card.kids { background: #fffdf4; border-color: #fffdf4; }
.card.kids .magnet { position: absolute; top: -10px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--crayon); box-shadow: 0 3px 0 rgba(0,0,0,.2); }
.scribble path, .scribble circle { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }

/* Fitness: little lifter */
.lifter { max-width: 96px; }
.lifter .body { transition: transform .18s ease-out; transform-origin: 50px 100px; }
.lifter.down .body { transform: translateY(12px) scaleY(.88); }
button.card:active { transform: scale(.97); }

/* ---------- Writing ---------- */
.writing { display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px; }
.latest {
  flex: 1 1 320px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 16px 20px;
  background: var(--chalk);
  color: var(--ink);
  border-radius: 4px;
  text-decoration: none;
  min-width: 0;
}
.latest .k { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-on-chalk); }
.latest strong { font-size: var(--step-1); }
.latest .arrow { margin-left: auto; font-size: var(--step-1); color: var(--crayon); transition: transform .15s; }
.latest:hover .arrow { transform: translateX(4px); }
.door {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border: 2px dashed rgba(246, 247, 241, .6);
  border-radius: 4px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-2);
  text-transform: uppercase;
  line-height: 1;
  transition: background .2s, border-color .2s;
}
.door small { font-family: var(--mono); font-weight: 400; font-size: .66rem; letter-spacing: .1em; color: var(--ball); }
.door:hover { background: var(--court-deep); border-color: var(--ball); border-style: solid; }

/* ---------- Find me ---------- */
.find { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; background: var(--court-deep); }
.find .hand { font-family: var(--hand); font-size: var(--step-2); color: var(--ball); transform: rotate(-2deg); }
.badges { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.badges a {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tint);
  color: #fff;
  border: 2px solid var(--chalk);
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
  transition: transform .15s;
}
.badges a:hover { transform: translateY(-3px) rotate(-6deg); }

/* ---------- Footer ---------- */
.foot {
  max-width: 1120px;
  margin: 22px auto 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--chalk);
}
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* ---------- Inner pages (notes, lab) ---------- */
.page-head h1 { font-family: var(--display); font-weight: 900; font-size: clamp(3rem, 9vw, 6rem); text-transform: uppercase; line-height: .9; margin-block: 10px 16px; }
.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.entry { background: var(--chalk); color: var(--ink); border-radius: 4px; padding: 20px 22px; display: grid; gap: 6px; }
.entry .meta { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-on-chalk); }
.entry h2 { font-family: var(--body); font-size: var(--step-1); }
.prose { max-width: 65ch; }
.prose p + p { margin-top: 1em; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero, .hero:has(.portrait) { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .portrait { justify-self: start; max-width: 240px; }
}
/* On phones the draw turns vertical: the line runs down the left, newest at the top */
@media (max-width: 640px) {
  .draw { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .draw::before { left: 30px; right: auto; top: 8px; bottom: 8px; width: var(--line-w); height: auto; }
  .stop { grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "logo co" "logo role" "logo when"; justify-items: start; text-align: left; gap: 0 16px; padding: 0; align-items: center; }
  .stop .logo { grid-area: logo; }
  .stop .co { grid-area: co; align-self: end; }
  .stop .role { grid-area: role; }
  .stop .when { grid-area: when; align-self: start; }
  .reel { grid-auto-columns: 62%; }
  .court::before { display: none; }
}

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