/* Case pages: a sidebar with every project on the left, the case itself on the right.
   Tokens, type and the card hairline are the home page's own, so both read as one site. */
@property --hair { syntax: "<percentage>"; inherits: true; initial-value: 55%; }

:root {
  --bg: #ffffff;
  --fg: #0f1115;
  --muted: #6a6f7c;
  --tint: rgb(15 17 21 / 0.05);
  --tint-hover: rgb(15 17 21 / 0.09);
  --tint-active: rgb(15 17 21 / 0.04);
  --line: rgb(15 17 21 / 0.08);
  --accent: oklch(0.52 0.2 262);

  --blue: oklch(0.74 0.15 262);
  --violet: oklch(0.74 0.15 300);
  --pink: oklch(0.78 0.14 350);
  --peach: oklch(0.85 0.1 55);
  --mint: oklch(0.85 0.1 170);

  --font: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --side: 17.5rem;
  --text: 44rem;
  --wide: 72rem;
  --accent-soft: oklch(0.96 0.025 262);
  --line-strong: #e2e5eb;
  /* the home page's radius scale: cards 24, boxes and frames 20, rows 12, pills round */
  --r-card: 24px;
  --r-box: 20px;
  --r-row: 12px;
  --r-pill: 999px;
  /* screenshots take the small radius: a bigger one eats the corners of the interface in them */
  --r-shot: var(--r-row);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
}
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }

.label {
  font-family: var(--font-data);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Layout */
.page { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }

/* Sidebar: the whole catalogue, grouped like the home page */
.side {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 1.75rem 1.25rem 2rem 1.5rem;
  display: flex; flex-direction: column; gap: 2rem;
  border-right: 1px solid var(--line);
  /* the home page's soft grey, the one under the MySky chip and the active work row */
  background: var(--tint-active);
  scrollbar-width: thin;
}
/* Back home sits with the identity at the top of the sidebar: navigation stays where it doesn't change */
.side-top { display: flex; flex-direction: column; align-items: flex-start; gap: 1.1rem; }
.back {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  height: 2.25rem; padding: 0 0.95rem;
  border-radius: var(--r-pill); background: var(--tint);
  font-size: 0.9375rem; font-weight: 500; line-height: 1; text-decoration: none;
  transition: background-color 0.25s;
}
.back:hover { background: var(--tint-hover); }
.me { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; line-height: 1.3; }
.me img { width: 36px; height: 36px; border-radius: 50%; }
.me b { display: block; font-weight: 600; font-size: 0.9375rem; }
.me span span { display: block; color: var(--muted); font-size: 0.8125rem; }
.side-toggle { display: none; }
.side nav { display: flex; flex-direction: column; gap: 1.6rem; }
.side ul { margin: 0.5rem -0.6rem 0; display: flex; flex-direction: column; gap: 1px; }
.side li a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  padding: 0.45rem 0.6rem; border-radius: var(--r-row);
  color: var(--muted); font-size: 0.9375rem; line-height: 1.35; text-decoration: none;
  transition: background-color 0.2s, color 0.2s, opacity 0.2s;
}
.side li a:hover { background: var(--tint-active); color: var(--fg); }
.side li a[aria-current="page"] { background: var(--tint-hover); color: var(--fg); font-weight: 500; }
/* One line per title: a long one ends in an ellipsis and, on hover, scrolls to its end
   (catalog.js measures how far); it eases back when the pointer leaves. */
.side .t {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  transition: text-indent 0.35s var(--ease);
}
.side li a:is(:hover, :focus-visible) .t.is-long {
  text-overflow: clip; text-indent: var(--shift);
  transition: text-indent var(--dur) linear 0.3s;
}
/* More: the rest of a long group, behind a row of the same size */
.side ul.rest { margin-top: 1px; }
.side ul.rest[hidden] { display: none; }
.more-items {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  width: calc(100% + 1.2rem); margin: 1px -0.6rem 0; padding: 0.45rem 0.6rem;
  border: 0; border-radius: var(--r-row); background: none;
  color: var(--muted); font: inherit; font-size: 0.9375rem; font-weight: 500; line-height: 1.35; text-align: left;
  cursor: pointer; transition: background-color 0.2s, color 0.2s;
}
.more-items:hover { background: var(--tint-active); color: var(--fg); }
/* A project with its own cases: the cases sit indented under it, on a hairline */
.side .project {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.45rem 0.6rem; font-size: 0.9375rem; font-weight: 500; line-height: 1.35;
}
.side ul.sub { margin: 0 0 0.25rem 0.6rem; padding-left: 0.4rem; border-left: 1px solid var(--line); }
.side .note { flex: none; font-family: var(--font-data); font-size: 0.6875rem; letter-spacing: 0.06em; color: var(--muted); opacity: 0.75; }
/* A project still being put together: a Soon tag, its cases quieter until you point at one */
.tag {
  flex: none; display: inline-block; padding: 0.2em 0.6em; border-radius: 999px;
  background: var(--tint); color: var(--muted);
  font-family: var(--font-data); font-size: 0.6875rem; font-weight: 400; line-height: 1.3;
  letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 0.1em;
}
.side .soon .sub a:not(.ready) { opacity: 0.55; }
.side .soon .sub a:is(:hover, :focus-visible, [aria-current="page"]) { opacity: 1; }
.side-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.875rem; color: var(--muted); }
.side-foot a { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); text-underline-offset: 0.25em; }
.side-foot a:hover { color: var(--fg); }

/* The case: the original case composition, unchanged. One reading column of ~70ch in the middle
   of the space next to the sidebar; figures and the result table step out to a wider track. */
.case { display: flex; flex-direction: column; gap: 4.5rem; padding: 2.5rem clamp(1.5rem, 4vw, 3.5rem) 5rem; min-width: 0; }
.col { width: 100%; max-width: var(--text); margin-inline: auto; min-width: 0; }
.wide { width: 100%; max-width: var(--wide); margin-inline: auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 1rem; }

.case h1, .case h2, .case h3 { text-wrap: balance; }
.case h1 { font-size: clamp(2rem, 1.3rem + 2.4vw, 3.1rem); line-height: 1.1; font-weight: 600; letter-spacing: -0.013em; word-spacing: 0.013em; }
.case h2 { font-size: 1.6rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; word-spacing: 0.01em; }
.case h3 { font-size: 1.1rem; line-height: 1.35; font-weight: 600; }
.case p { text-wrap: pretty; }
.muted { color: var(--muted); }

.tldr {
  margin-top: 0.5rem; padding: 1.25rem 1.4rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-box);
  display: flex; flex-direction: column; gap: 0.6rem;
}
.tldr dd { line-height: 1.5; }
.tldr b { font-weight: 600; }

figure { display: flex; flex-direction: column; gap: 0.75rem; }
figure img { width: 100%; border-radius: var(--r-shot); border: 1px solid var(--line-strong); background: #f4f4f5; }
/* A caption stands in the text column, under a figure of any width */
figcaption { width: 100%; max-width: var(--text); margin-inline: auto; font-size: 0.92rem; line-height: 1.5; color: var(--muted); }
.phones { max-width: 60rem; }

.points { display: flex; flex-direction: column; gap: 0.6rem; }
.points li { padding-left: 1.1rem; position: relative; }
.points li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.decisions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 2.5rem; }
.decisions > div { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }

.meeting { background: var(--accent-soft); border-radius: var(--r-box); padding: 1.75rem; display: flex; flex-direction: column; gap: 1rem; }

/* Result: before → after per metric, figures in the data face so the digits line up */
.metrics { border-top: 1px solid var(--line-strong); }
.metric {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 1rem;
  align-items: baseline; padding-block: 0.85rem; border-bottom: 1px solid var(--line-strong);
}
.metric .name { font-weight: 500; }
.metric .vals { font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric .vals b { font-weight: 500; color: var(--accent); }
.metric .how { font-size: 0.88rem; color: var(--muted); }

/* Blocks several cases share, defined once */
.lead { font-size: 1.25rem; line-height: 1.5; }
.hypothesis { background: var(--accent-soft); border-radius: var(--r-box); padding: 1.25rem 1.5rem; }
.basis { font-size: 0.9rem; color: var(--muted); border-top: 1px dashed var(--line-strong); padding-top: 0.45rem; margin-top: 0.2rem; }
.tag { font-family: var(--font-data); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.quote { border-left: 2px solid var(--accent); padding-left: 1.1rem; font-size: 1.1rem; line-height: 1.55; }

/* Previous and next: the home page's cards */
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.card {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 1.25rem;
  min-height: 8.5rem; padding: 1.25rem 1.4rem;
  border-radius: var(--r-card); text-decoration: none;
  --hair: 55%;
  transition: translate 0.35s var(--ease), --hair 0.35s var(--ease);
}
.card::before, .card::after { content: ""; position: absolute; border-radius: inherit; }
.card::before {
  z-index: -2; inset: 14% 8% -8%;
  background: linear-gradient(135deg in oklch, var(--c1), var(--c2));
  filter: blur(30px); opacity: 0; transition: opacity 0.45s var(--ease);
}
.card::after {
  z-index: -1; inset: 0; border: 1.5px solid transparent;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    linear-gradient(135deg in oklch, color-mix(in oklch, var(--c1) var(--hair), transparent), color-mix(in oklch, var(--c2) var(--hair), transparent)) border-box;
}
a.card:hover { translate: 0 -3px; --hair: 100%; }
a.card:hover::before { opacity: 0.6; }
.card .label { display: flex; justify-content: space-between; }
.card b { font-size: 1.125rem; font-weight: 500; line-height: 1.35; text-wrap: pretty; }
.pager .next { text-align: right; }
.pager .next .label { flex-direction: row-reverse; }

/* Phones: the sidebar becomes a bar with the catalogue behind a button */
@media (max-width: 900px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: sticky; top: 0; z-index: 5; height: auto; max-height: 100vh;
    padding: 0.75rem 1rem; gap: 0;
    background: rgb(245 245 246 / 0.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .side-top { flex-direction: row; align-items: center; gap: 0.6rem; }
  .back { width: 2.25rem; padding: 0; flex: none; }
  .back-text { display: none; }
  .me { flex: 1; min-width: 0; }
  .side-toggle {
    display: inline-flex; align-items: center; gap: 0.4rem;
    height: 2.25rem; padding: 0 0.9rem; border: 0; border-radius: var(--r-pill);
    background: var(--tint); color: var(--fg); font: inherit; font-size: 0.9375rem; font-weight: 500; cursor: pointer;
  }
  .side nav, .side-foot { display: none; }
  .side.open nav { display: flex; padding: 1.25rem 0 0.5rem; }
  .side.open .side-foot { display: flex; padding: 0.75rem 0 0.5rem; }
  .side.open { overflow-y: auto; }
  .case { padding: 1.5rem 1rem 4rem; gap: 3.25rem; }
  .decisions, .pager { grid-template-columns: minmax(0, 1fr); }
  .metric { grid-template-columns: minmax(0, 1fr) auto; }
  .metric .how { grid-column: 1 / -1; margin-top: -0.4rem; }
  .meeting { padding: 1.25rem; }
  .hypothesis { padding: 1.1rem; }
}
/* Shots: a picture link in a case opens here, over the page, instead of a new tab (catalog.js
   builds it). The site's light scrim, the shot fitted to the screen in a white frame with the
   site's shadow; a tall one opens to full width on click. The close button is the quiet pill. */
html:has(.viewer[open]) { overflow: hidden; }
.viewer {
  width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0;
  background: transparent; overflow: auto; overscroll-behavior: contain;
}
.viewer[open] { display: grid; place-items: center; animation: viewer-in 0.3s var(--ease); }
.viewer.full { place-items: start center; }
.viewer::backdrop { background: rgb(255 255 255 / 0.9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.viewer[open]::backdrop { animation: viewer-in 0.3s var(--ease); }
@keyframes viewer-in { from { opacity: 0; } }
.viewer img {
  display: block; height: auto; margin: 4rem 1rem 1.5rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-shot); background: #fff;
  box-shadow: 0 1px 2px rgb(15 17 21 / 0.06), 0 12px 40px -12px rgb(15 17 21 / 0.18);
}
.viewer.can-zoom img { cursor: zoom-in; }
.viewer.full img { cursor: zoom-out; }
.viewer-close {
  position: fixed; top: 1rem; right: 1rem; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border: 0; border-radius: var(--r-pill);
  background: var(--tint); color: var(--fg); font: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer;
  transition: background-color 0.25s;
}
.viewer-close:hover { background: var(--tint-hover); }

@media (prefers-reduced-motion: reduce) {
  .viewer[open], .viewer[open]::backdrop { animation: none; }
  .card, .card::before, .side li a, .side .t { transition: none; }
  .side li a:is(:hover, :focus-visible) .t.is-long { text-overflow: ellipsis; text-indent: 0; }
}
