:root {
  --bg: #0b0b0c;
  --ink: #efebe2;
  --muted: #8d8a83;
  --rule: #efebe2;
  --hair: #3a3936;
  --gap: 20px;
  --pad: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); overflow-x: clip; } /* the column grain reaches the edge on phones; no sideways scroll */

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: var(--pad);
  /* on a big monitor the page stops growing at 1600px and sits in the middle, so the work stays sharp */
  max-width: 1600px;
  margin-inline: auto;
  /* three columns: the left one holds still (ball, name, timeline), the work fills the right two */
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: start;
}

/* ---- the fixed left column: one block as wide as the name ---- */
.side {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: sticky;
  top: var(--pad);
  height: calc(100vh - 2 * var(--pad));
  container-type: inline-size;
}
/* grain behind the column, under the words; fades out down the column and before the gap to the work */
.side::before {
  content: "";
  position: absolute;
  /* reaches past the page's left edge and fades in, so on a wide screen the grain has no hard edge */
  left: calc(-1 * var(--pad) - 240px); top: calc(-1 * var(--pad)); right: -12px; bottom: calc(-1 * var(--pad));
  pointer-events: none;
  background: url(/noise.png) 0 0 / 160px;
  opacity: 0.085;
  animation: drift 0.6s steps(4) infinite;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%), linear-gradient(to right, transparent 0, #000 240px, #000 calc(100% - (100% - 240px) * 0.38), transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, #000 70%, transparent 100%), linear-gradient(to right, transparent 0, #000 240px, #000 calc(100% - (100% - 240px) * 0.38), transparent 100%);
  mask-composite: intersect;
}
@keyframes drift { 0% { background-position: 0 0; } 25% { background-position: -60px 40px; } 50% { background-position: 50px -70px; } 75% { background-position: -30px -20px; } }
.stack {
  position: relative;
  width: fit-content;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
/* everything but the name takes the name's width */
.stack > :not(.lk), .lk > :not(.name) { contain: inline-size; }
.court {
  position: relative;
  /* three quarters of the name, smaller on short screens so the column still fits */
  width: min(74%, max(110px, calc(100vh - 2 * var(--pad) - 470px)));
  aspect-ratio: 1;
  align-self: center;
  margin: 0 0 16px;
}
.ball {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  /* the ball's grain fades out round it, so there is no square */
  -webkit-mask-image: radial-gradient(closest-side, #000 82%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 82%, transparent 100%);
}
.ball.is-out { visibility: hidden; }
html.is-grabbing, html.is-grabbing * { cursor: grabbing !important; }
/* where the ball goes back: its outline, dashed, and a quiet button */
.putback {
  all: unset;
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 1.5px dashed var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  transition: color .15s, border-color .15s;
}
.putback:hover, .putback.is-near { color: var(--ink); border-color: var(--ink); }
.putback:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
/* first visit: a dark page, five balls in a row, then the site */
.intro { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; }
.intro::before { content: ""; position: absolute; inset: 0; background: url(/noise.png) 0 0 / 160px; opacity: .09; pointer-events: none; }
.no-intro .intro { display: none; }
.intro__row { display: flex; gap: 0; }
.intro__row canvas { width: min(19vw, 168px); aspect-ratio: 1; display: block; opacity: 0; transform-origin: 50% 86%; }
.ball-free { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; will-change: transform; }
.lk p, .lk h1 { margin: 0; }
.name {
  font-weight: 700;
  font-size: clamp(40px, 14cqi, 58px);
  line-height: 1;
  letter-spacing: -0.065em;
  padding-right: 0.04em;
  white-space: nowrap;
  text-shadow: 0 0 1px rgba(239,235,226,.6), 0 0 14px rgba(239,235,226,.28), 0 0 42px rgba(233,180,55,.16);
}
.what { margin-top: 10px !important; font-size: 13px; }
.sub { margin-top: 2px !important; font-size: 13px; color: var(--muted); }

.timeline { list-style: none; margin: 26px 0 0; padding: 0; font-size: 12px; }
.timeline li { display: grid; grid-template-columns: 58px 1fr; gap: 8px; padding: 3px 0; }
.timeline b { font-weight: 700; }
.timeline span { color: var(--muted); }
.timeline li:first-child span { color: var(--ink); }

.icons { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.icons a { display: grid; place-items: center; color: #cfcbc2; text-decoration: none; transition: color .15s, transform .15s; }
.icons a:hover { color: var(--ink); transform: translateY(-1px); }
.icons a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.icons svg { width: 20px; height: 20px; display: block; fill: currentColor; }
.icons .uxe svg { width: 34px; }

/* the IM: a few lines of text under a hairline, at the bottom of the column */
.im { margin-top: auto; padding-top: 20px; font-size: 12px; }
.im__bar { display: flex; align-items: center; gap: 7px; padding: 8px 0; border-top: 1px solid var(--hair); font-weight: 700; }
.im__bar svg { width: 16px; height: 16px; flex: none; }
.im__bar span { color: var(--muted); font-weight: 400; margin-left: auto; }
/* minimize, like the window button: a bar when open, a little window when minimized */
.im__min { all: unset; cursor: pointer; display: grid; place-items: center; width: 20px; height: 20px; margin: -4px -4px -4px 2px; color: var(--muted); }
.im__min:hover { color: var(--ink); }
.im__min:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-radius: 2px; }
.im__min i { display: block; width: 9px; height: 0; border-bottom: 1.5px solid currentColor; transform: translateY(3px); }
.im.is-min .im__min i { height: 7px; border: 1.5px solid currentColor; border-top-width: 2.5px; transform: none; }
.im.is-min .im__body { display: none; }
.im__log { height: clamp(64px, calc(100vh - 2 * var(--pad) - 600px), 128px); overflow-y: auto; padding: 2px 0 8px; line-height: 1.5; scrollbar-width: thin; }
.im__log p { margin: 0 0 3px; overflow-wrap: anywhere; }
.im__log .her { color: #E0503F; font-weight: 700; }
.im__log .you { color: #3FA7D6; font-weight: 700; }
.im__log .auto, .im__log .typing { color: var(--muted); }
.im__log a { color: var(--ink); font-weight: 700; text-decoration: none; border-bottom: 1px solid var(--muted); }
.im__send { display: flex; border-top: 1px solid var(--hair); }
.im__send input { flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--ink); background: transparent; border: 0; padding: 8px 0; outline: none; }
.im__send input::placeholder { color: var(--muted); }
.im__send button { all: unset; cursor: pointer; font-weight: 700; padding: 0 0 0 12px; }
.im__send input:focus-visible, .im__send button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (min-width: 761px) { .im__send input { font-size: 12px; } }

/* ---- pinterest grid, 3 columns ---- */
.grid {
  grid-column: 2 / span 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: calc(var(--gap) * 2); }
.col:nth-child(2) { padding-top: 48px; }

.tile {
  all: unset;
  display: block;
  cursor: zoom-in;
}
.tile img, .tile video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: #18181a;
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), filter 0.35s;
}
.tile:hover img, .tile:hover video { transform: translateY(-3px); filter: brightness(1.06); }
.tile:focus-visible img, .tile:focus-visible video { outline: 2px solid var(--ink); outline-offset: 4px; }

.tile__cap, .modal__cap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  line-height: 1.35;
}
.tile__cap { padding-top: 10px; }
.tile__cap b, .modal__cap b { font-weight: 600; }
.tile__cap span, .modal__cap span { color: var(--muted); }

.foot {
  grid-column: 2 / span 2;
  display: flex;
  gap: 24px;
  margin-top: clamp(56px, 8vw, 96px);
  padding-top: 8px;
  border-top: 1px solid var(--hair);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.foot span:last-child { margin-left: auto; }

/* ---- modal ---- */
.modal {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
.modal::backdrop { background: rgba(6, 6, 7, 0.92); backdrop-filter: blur(6px); }
.modal[open] { display: grid; place-items: center; animation: fade 0.25s ease-out; }
.modal__fig {
  margin: 0;
  padding: 56px var(--pad) 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-height: 100vh;
}
.modal__img {
  display: block;
  max-width: min(92vw, 1400px);
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  border-radius: 16px;
  cursor: zoom-out;
}
.modal__cap { align-self: stretch; align-items: center; text-align: center; }
.modal__close-form { position: fixed; top: 16px; right: var(--pad); margin: 0; z-index: 1; }
.modal__close {
  all: unset;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 0;
  border-bottom: 1px solid var(--ink);
}
.modal__close:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 760px) {
  body { display: block; }
  .side { position: static; height: auto; margin-bottom: 56px; }
  .stack { margin-inline: auto; } /* the block sits in the middle; its words stay left aligned */
  .side::before { -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%); mask-image: linear-gradient(to bottom, #000 60%, transparent 100%); right: calc(-1 * var(--pad)); }
  .name { font-size: min(18.5cqi, 72px); }
  .court { width: 74%; }
  .im { margin-top: 28px; }
  .im__log { height: 128px; }
  .grid { grid-template-columns: 1fr; gap: calc(var(--gap) * 2); }
  .col, .col:nth-child(n) { padding-top: 0; }
  .col { display: contents; } /* one column: every Informed K12 piece first, then the rest */
  .tile--more { order: 1; }
}

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