/* ==========================================================
   Wiktor Zbęk — Portfolio
   Bento layout · Afacad · #EB1B00 / #141414 / #FFFCFA / #BCBCBC
   ========================================================== */

:root {
  --red: #EB1B00;
  --ink: #141414;
  --bg: #000000;   /* pure black behind the tiles */
  --cream: #FFFCFA;
  --grey: #BCBCBC;
  --tile: #1F1F1F;
  --tile-2: #262626;
  --panel: #0E0E0E;

  --gap: 6px;
  --r: 14px;
  --r-sm: 10px;
  --bar-h: 38px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--cream);
  font-family: "Afacad", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }

/* ---------- Page shell ---------- */

.page {
  height: 100vh;
  height: 100dvh;
  padding: var(--gap);
  display: grid;
  gap: var(--gap);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-height: 0;
}
.stack > .tile { flex: 1; }

/* ---------- Tiles ---------- */

.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: var(--r);
  background: var(--tile);
  overflow: hidden;
  animation: page-in .6s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}

/* Tiles fade in gently, one after another */
@keyframes page-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
/* …and the page fades out on the way to another one */
@keyframes page-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes rise {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Photo tiles: drop an <img> inside. Photos are shown in B&W and
   gain colour on hover — a small reward for curious cursors. */
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05) brightness(.8);
  transition: filter .6s var(--ease), transform .8s var(--ease);
}
.photo:hover img {
  filter: grayscale(0) brightness(.95);
}
/* Project work keeps its colour — the colour is part of the design */
.proj img,
.case-grid img { filter: none; }
.proj:hover img,
.case-grid .photo:hover img { filter: none; }

/* Empty photo tiles match the "Other Stuff" panel until a picture is added */
.photo:not(:has(img, video)) {
  background: var(--panel);
  box-shadow: inset 0 0 0 1px #222;
}

/* Placeholder label while there is no image yet */
.photo:not(:has(img, video))::after {
  content: attr(data-ph);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #4a4a4a;
}

.card {
  background: var(--cream);
  color: var(--ink);
}

/* ---------- Nav ---------- */

.nav {
  flex: none;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: var(--bar-h);
  padding: 0 12px;
  border-radius: var(--r-sm);
  background: var(--cream);
}
.nav a {
  position: relative;
  padding: 2px 4px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  transition: color .2s;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  transform: translateX(-50%) scale(0);
  transition: transform .25s var(--ease);
}
/* a bigger, invisible click area around each link (the text stays the same) */
.nav a::before {
  content: "";
  position: absolute;
  inset: -10px -14px;
}
.nav a:hover { color: var(--red); scale: 1.1; }
.nav a { transition: color .2s, scale .25s var(--ease); }
.nav a[aria-current="page"]::after { transform: translateX(-50%) scale(1); }
/* With JS the marker is a single dot that slides between pages
   (the overshooting curve gives it a small bounce as it stops) */
.nav.has-dot a::after { content: none; }
.nav-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  margin-left: -1.5px;
  border-radius: 50%;
  background: var(--ink);
  pointer-events: none;
}
.nav-dot.sliding { transition: left .65s cubic-bezier(.34, 1.7, .5, 1); }

/* ---------- Shared type ---------- */

.muted { color: var(--grey); }

.split-title {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 34px);
  font-weight: 400;
  line-height: 1;
}
.split-title b { font-weight: 600; }

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--grey);
}

/* ==========================================================
   HOME
   ========================================================== */

.home {
  grid-template-columns: 28fr 18fr 25fr 28fr;
  grid-template-rows: 18fr 20fr 17.5fr;
  grid-template-areas:
    "car    car  portrait side"
    "tablet hero hero     city"
    "tablet car2 wro      hands";
}

.hero {
  grid-area: hero;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(18px, 2.2vw, 30px);
}
.hero p {
  margin: 0;
  font-size: clamp(12px, 1vw, 15px);
  color: var(--grey);
}
.hero p b {
  font-size: clamp(17px, 1.7vw, 26px);
  font-weight: 500;
  color: var(--ink);
}
.hero p:last-of-type { align-self: flex-end; }

.logo {
  align-self: center;
  width: min(72%, 520px);
}
.logo img { width: 100%; height: auto; }
.logo-text { display: none; }
.logo.no-img img { display: none; }
.logo.no-img .logo-text {
  display: block;
  text-align: center;
  font-size: clamp(56px, 7.5vw, 124px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.01em;
  color: transparent;
  background: repeating-linear-gradient(to bottom, var(--red) 0 .055em, transparent .055em .09em);
  -webkit-background-clip: text;
  background-clip: text;
}

/* ==========================================================
   ABOUT
   ========================================================== */

.about {
  grid-template-columns: 367fr 351fr 288fr;
  grid-template-rows: 198fr 186fr 172fr;
  grid-template-areas:
    "me   mid  side"
    "work mid  side2"
    "work mid2 side2";
}

.text-card {
  padding: clamp(16px, 1.6vw, 24px) clamp(16px, 1.6vw, 26px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.text-card h2 {
  margin: 0 0 .6em;
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 500;
  text-transform: uppercase;
}
.text-card p {
  margin: 0 0 1em;
  font-size: clamp(13px, 1vw, 15px);
  line-height: 1.45;
}
.text-card p:last-child { margin-bottom: 0; }

/* ==========================================================
   PROJECTS
   ========================================================== */

.projects {
  display: flex;
  gap: 0;
  --other-w: 28%;
}

.work {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: clip;
  container-type: inline-size;
}

/* Project grid */
.work-grid {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: calc((100% - 2 * var(--gap)) / 3);
  gap: var(--gap);
  overflow-y: auto;
  scrollbar-width: none;
}
.work-grid::-webkit-scrollbar { display: none; }

.work-intro {
  grid-column: 5 / 7;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: clamp(16px, 1.6vw, 24px);
}
/* "Selected work 03" sits in the top-right corner */
.wi-top {
  position: absolute;
  top: clamp(16px, 1.6vw, 24px);
  right: clamp(16px, 1.6vw, 24px);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.wi-top .eyebrow { margin: 0; }
.work-intro .count {
  font-size: clamp(22px, 2vw, 32px);
  font-weight: 600;
  line-height: 1;
  color: var(--red);
}
/* Big statement title, styled like "Let's talk." on Contact */
.wi-title {
  margin: .05em 0 12px;
  font-size: clamp(34px, 4.2vw, 72px);
  letter-spacing: -.01em;
  font-weight: 600;
  line-height: .95;
}
.wi-title span { color: var(--red); }
.work-intro p:not(.eyebrow) {
  margin: 0;
  font-size: clamp(13px, 1vw, 15px);
  line-height: 1.4;
  color: #555;
}

.proj { cursor: pointer; }

.proj-link {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
}
.proj-link:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

.proj-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--red);
}
.proj-title {
  flex: 1;
  min-width: 0;
}
.proj-title strong {
  display: block;
  font-size: clamp(15px, 1.3vw, 20px);
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-title span {
  font-size: 12px;
  color: #777;
}
.arrow {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  transition: background .3s, transform .4s var(--ease);
}
.proj:hover .arrow { background: var(--red); transform: rotate(-45deg); }

@container (max-width: 560px) {
  .work-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 46%;
  }
  .work-intro,
  .work-grid .proj:nth-child(n of .proj) { grid-column: 1; grid-row: auto; }
  .work-intro { order: -1; }
}

/* Case study view */
.case {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  scrollbar-width: none;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .4s var(--ease), transform .5s var(--ease), visibility 0s .5s;
}
.case::-webkit-scrollbar { display: none; }
.case.open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .4s var(--ease), transform .5s var(--ease);
}

.case-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--gap);
  height: var(--bar-h);
  padding: 0 5px;
  border-radius: var(--r-sm);
  background: var(--cream);
  color: var(--ink);
  transition: transform .4s var(--ease), opacity .3s var(--ease);
}
/* Slides away while reading (scrolling down), returns on scroll up.
   Stays visible if it holds keyboard focus. */
.case.bar-hidden .case-bar:not(:focus-within) {
  transform: translateY(calc(-100% - 12px));
  opacity: 0;
  pointer-events: none;
}
.case-bar .spacer { flex: 1; }
.case-bar .pos { font-size: 13px; color: #777; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.pill:hover { background: var(--ink); color: var(--cream); }
.pill.red { background: var(--red); color: var(--cream); }
.pill.red:hover { background: var(--ink); }

/* Case study: a stack of rows. Inside a row, media tiles get
   flex-grow = their aspect ratio and matching aspect-ratio, so every
   image in a row ends up the same height and the row is filled exactly. */
.case-grid {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
/* Case studies fade in row by row (and again when switching project) */
.case-grid .tile {
  animation: page-in .6s var(--ease) backwards;
  animation-delay: calc(min(var(--row, 0), 5) * 70ms + var(--col, 0) * 40ms);
}
.case-grid .tile .tile { animation: none; }
.case-row > :nth-child(2) { --col: 1; }
.case-row > :nth-child(3) { --col: 2; }
.case-row > :nth-child(4) { --col: 3; }
.case-row {
  display: flex;
  gap: var(--gap);
}
.case-row > * { min-width: 0; }

.case-media { display: block; }
.case-media img,
.case-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Title + details column that sits beside the hero */
.case-info {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.case-head {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(18px, 2vw, 30px);
}
.case-head .eyebrow { color: var(--red); }
.case-head h1 {
  margin: .15em 0 .25em;
  font-size: clamp(34px, 4vw, 64px);
  font-weight: 600;
  line-height: .95;
}
.case-head p { margin: 0; font-size: clamp(14px, 1.15vw, 17px); line-height: 1.45; color: #444; }
.case-meta {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  padding: 4px clamp(14px, 1.4vw, 20px);
  background: var(--tile);
}
.case-meta div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 0;
  border-bottom: 1px solid #333;
}
.case-meta div:nth-last-child(-n + 2) { border: 0; }
.case-meta dt { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #777; }
.case-meta dd { margin: 0; font-size: 15px; }

/* Text steps: stacked when sharing a row, heading-left / copy-right when alone */
.case-step {
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 2vw, 28px);
}
.case-step .n { font-size: 13px; color: var(--red); font-weight: 500; }
.case-step h3 { margin: .3em 0 .6em; font-size: clamp(20px, 1.8vw, 28px); font-weight: 500; line-height: 1; text-transform: uppercase; }
.case-step p { margin: 0; font-size: clamp(14px, 1.1vw, 16px); line-height: 1.55; }
.case-step.solo {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px 24px;
}
.case-step.solo .n,
.case-step.solo h3 { grid-column: 1; margin: 0; }
.case-step.solo p { grid-column: 2; grid-row: 1 / span 2; }

/* Diagrams & wireframes: click for full size */
.case-doc { cursor: zoom-in; }
.case-doc.contain img { object-fit: contain; }
/* Pictures stacked in one column of a row (each keeps its own shape) */
.case-stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.case-stack > * { flex: none !important; width: 100%; }
.doc-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .9;
  transition: background .2s, color .2s, opacity .2s;
}
.case-doc:hover .doc-tag { background: var(--red); color: var(--cream); opacity: 1; }
.case-doc:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

.case-next {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(18px, 2vw, 28px);
  border: 0;
  text-align: left;
  cursor: pointer;
}
.case-next .split-title { color: var(--ink); }
.case-next:hover .arrow { background: var(--red); transform: rotate(-45deg); }

@container (max-width: 560px) {
  .case-row { flex-direction: column; }
  .case-row > * { flex: none !important; }
  /* pictures sized by their row (no shape of their own) need one when stacked */
  .case-row > .case-media:not([style*="aspect-ratio"]) { aspect-ratio: 16 / 10; }
  .case-step.solo { display: flex; }
}



/* Other stuff panel */
.other {
  flex: none;
  width: var(--other-w);
  min-width: 0;
  /* keeps the wider gutter the old vertical divider used to leave */
  margin-left: 12px;
  transition: width .55s var(--ease);
}

.other-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  gap: var(--gap);
  padding: var(--gap);
  background: var(--panel);
}
/* Closed state: three separate project-style tiles filling the column.
   Darker than the project tiles, with black labels. */
.other-title {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  background: var(--bg);
  transition: opacity .35s var(--ease);
}
.ot-tile {
  flex: 1;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px #222;
  color: var(--cream);
  font: inherit;
  text-align: left;
  cursor: pointer;
  animation: none;
}
.ot-tile.contain img,
.ot-tile.contain:hover img { object-fit: contain; filter: none; transform: none; }
.ot-tile:has(img) { box-shadow: none; }
.ot-info {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 14px;
  border-radius: var(--r-sm);
  background: #000;
  box-shadow: inset 0 0 0 1px #1c1c1c;
  color: var(--cream);
  transform: translateY(4px);
  transition: transform .4s var(--ease);
}
.ot-info .proj-title span { color: #8a8a8a; }
.ot-info .arrow { background: var(--cream); color: var(--ink); }
.ot-tile:hover .ot-info { transform: none; }
.ot-tile:hover .arrow,
.ot-tile:focus-visible .arrow { background: var(--red); color: var(--cream); transform: rotate(-45deg); }
.ot-tile:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.other-open .other-title { opacity: 0; pointer-events: none; }

.other-item {
  border-radius: calc(var(--r) - 4px);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px #222;
  animation: none;
}
.other-item .label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.other-item:nth-child(1 of .other-item) { grid-row: span 2; }

/* ==========================================================
   CONTACT
   ========================================================== */

.contact {
  grid-template-columns: 205fr 140fr 192fr 215fr;
  grid-template-rows: 140fr 161fr 114fr;
  grid-template-areas:
    "a  a    b    side"
    "l  card card r2"
    "l  card card r3";
}

.contact-card {
  grid-area: card;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.4vw, 20px);
  padding: clamp(18px, 2.2vw, 32px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.contact-card header p {
  margin: 0;
  font-size: clamp(13px, 1vw, 15px);
  color: var(--grey);
}
.contact-card h1 {
  margin: .05em 0 0;
  font-size: clamp(36px, 4.2vw, 68px);
  font-weight: 600;
  line-height: .95;
}
.contact-card h1 span { color: var(--red); }

.form {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  min-height: 190px;
}
.field { position: relative; display: flex; }
.field.full { grid-column: 1 / -1; }
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #E4E0DD;
  border-radius: var(--r-sm);
  background: #F6F2EF;
  color: var(--ink);
  resize: none;
  transition: border-color .2s, background .2s;
}
.field input::placeholder,
.field textarea::placeholder { color: #9a9693; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--cream);
}
/* browser autofill keeps the cream too, instead of its own white/blue */
.field input:-webkit-autofill,
.field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px var(--cream) inset;
  -webkit-text-fill-color: var(--ink);
}
.form-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 12px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: var(--cream);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .25s;
}
.btn:hover { background: var(--ink); }
.btn svg { transition: transform .35s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

.copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  font-size: clamp(14px, 1.1vw, 17px);
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.copy .tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: #EEE9E5;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #666;
  transition: background .2s, color .2s;
}
.copy:hover .tag { background: var(--ink); color: var(--cream); }
.copy.done .tag { background: var(--red); color: var(--cream); }

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.socials a {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid #DDD8D4;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}
.socials a:hover { background: var(--ink); border-color: var(--ink); color: var(--cream); }

.info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(14px, 1.4vw, 22px);
  background: var(--panel);
}
.clock {
  font-size: clamp(36px, 4vw, 64px);
  font-weight: 500;
  line-height: .9;
  font-variant-numeric: tabular-nums;
}
.clock .colon { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(13px, 1vw, 15px);
}
.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(235, 27, 0, .6);
  animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(235, 27, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(235, 27, 0, 0); } }

.cv {
  text-decoration: none;
  transition: background .3s var(--ease);
}
.cv:hover { background: var(--red); }
.cv:hover .eyebrow { color: var(--cream); }
.cv .row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.cv .arrow { background: var(--cream); color: var(--ink); }
.cv:hover .arrow { transform: translateY(3px); }

/* ==========================================================
   Responsive — below tablet, bento becomes a scrolling stack
   ========================================================== */

@media (max-width: 860px) {
  .page {
    height: auto;
    display: flex;
    flex-direction: column;
  }
  .stack { display: contents; }
  .nav {
    order: -2;
    position: sticky;
    top: var(--gap);
    z-index: 20;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  }
  .photo { aspect-ratio: 4 / 3; }
  .priority { order: -1; }

  .hero { min-height: 62vw; gap: 24px; }
  .logo { width: 88%; }
  .text-card { overflow: visible; }

  .projects { --other-w: 100%; }
  .work { height: auto; }
  .work-grid { height: auto; overflow: visible; grid-auto-rows: auto; }
  .work-grid .photo { aspect-ratio: 4 / 3; }
  .work-intro { min-height: 180px; }
  /* the case study covers the screen: its .work container becomes the
     full-screen layer (container queries keep measuring the real width) */
  .case-open .work { position: fixed; inset: 0; z-index: 30; background: var(--bg); }
  .case { position: absolute; inset: 0; z-index: 30; padding: var(--gap); }
  .other { margin-left: 0; }
  .other { width: 100%; }
  .other-panel { aspect-ratio: 2 / 1; }
  .other-title { display: none; }

  .contact-card { overflow: visible; }
  .info { min-height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Brand work in Other Stuff: show the whole artboard, in colour */
.other-item.brand { background: #000; box-shadow: none; }
.other-item.brand img,
.other-item.brand:hover img { object-fit: contain; filter: none; transform: none; }

/* Figma link tile (case study) */
.figma-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(18px, 2vw, 28px);
  background: var(--tile);
  color: var(--cream);
  text-decoration: none;
  transition: background .35s var(--ease);
}
.figma-icon {
  width: 26px;
  height: 39px;
  color: var(--cream);
}
.figma-text { display: flex; flex-direction: column; gap: 6px; }
.figma-sub { font-size: 13px; color: #888; transition: color .35s; }
.figma-tile .arrow {
  position: absolute;
  top: clamp(18px, 2vw, 28px);
  right: clamp(18px, 2vw, 28px);
  background: var(--cream);
  color: var(--ink);
}
a.figma-tile:hover { background: var(--red); }
a.figma-tile:hover .figma-sub { color: var(--cream); }
a.figma-tile:hover .arrow { transform: rotate(-45deg); }
a.figma-tile:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.figma-tile.is-empty { cursor: default; }
.figma-tile.is-empty .figma-icon,
.figma-tile.is-empty .arrow { opacity: .35; }

/* Close cross, shown once "Other Stuff" is open */
.other-close {
  position: absolute;
  top: calc(var(--gap) + 10px);
  left: calc(var(--gap) + 10px);
  z-index: 4;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  transform: scale(.6) rotate(-90deg);
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .45s var(--ease), background .2s, color .2s;
}
.other-open .other-close {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition-delay: .25s, .25s, 0s, 0s;
}
.other-close:hover { background: var(--red); color: var(--cream); }
.other-close:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
@media (max-width: 860px) { .other-close { display: none; } }

/* Home: photo tiles are links. A small uppercase label follows the
   cursor on hover; it sits bottom-left for keyboard focus and touch. */
.go-tile {
  display: block;
  color: var(--cream);
  text-decoration: none;
  cursor: pointer;
}
.go-label {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 9px;
  border-radius: 999px;
  background: rgba(14, 14, 14, .72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(.96);
  transition: opacity .25s var(--ease), transform .3s var(--ease);
}
.go-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
}
.go-tile:hover .go-label,
.go-tile:focus-visible .go-label { opacity: 1; transform: none; }
.go-tile:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

/* While the mouse is inside, the label rides just below-right of the cursor */
.go-tile.tracking .go-label {
  left: 0;
  top: 0;
  bottom: auto;
  transform: translate(var(--x), var(--y));
  transition: opacity .25s var(--ease);
}

/* Touch screens have no hover: show the labels quietly all the time */
@media (hover: none) {
  .go-label { opacity: .9; transform: none; }
}

/* ==========================================================
   Case study side column (replaces "Other Stuff" while reading)
   ========================================================== */

.case-side {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: var(--gap);
}
.case-open .other-panel { display: none; }
.case-open .case-side { display: flex; animation: rise .5s var(--ease) both; }
.case-side .tile { animation: none; }

/* Spec card */
.side-spec {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(16px, 1.6vw, 22px);
}
.side-spec .eyebrow { color: var(--red); }
.side-spec h2 {
  margin: -4px 0 0;
  font-size: clamp(28px, 2.6vw, 42px);
  font-weight: 600;
  line-height: .95;
}
.side-sum {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: #555;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.side-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid #E8E3DF;
}
.side-meta dt { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #999; }
.side-meta dd { margin: 0; font-size: 14px; }
.side-figma {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 14px;
  text-decoration: none;
  transition: background .25s;
}
.side-figma b { font-weight: 600; }
.side-figma .figma-icon { width: 10px; height: 15px; flex: none; color: var(--cream); }
.side-figma .arrow { margin-left: auto; width: 28px; height: 28px; background: var(--cream); color: var(--ink); }
a.side-figma:hover { background: var(--red); }
a.side-figma:hover .arrow { transform: rotate(-45deg); }
.side-figma.is-empty { background: #EEE9E5; color: #999; padding: 12px 14px; }
.side-figma.is-empty .figma-icon { color: #bbb; }

/* Section list with progress line */
.side-toc {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(16px, 1.6vw, 22px);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px #222;
  overflow-y: auto;
  scrollbar-width: none;
}
.side-toc-head { display: flex; justify-content: space-between; align-items: baseline; }
.side-toc-head .pos { font-size: 12px; color: #666; }
.toc-wrap { position: relative; padding-left: 18px; }
.toc-wrap::before,
.toc-fill {
  content: "";
  position: absolute;
  left: 3px;
  top: 6px;
  width: 2px;
  border-radius: 2px;
}
.toc-wrap::before { bottom: 6px; background: #222; }
.toc-fill {
  height: calc((100% - 12px) * var(--progress, 0));
  background: var(--red);
  transition: height .15s linear;
}
.toc { margin: 0; padding: 0; list-style: none; }
.toc button {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 8px 0;
  border: 0;
  background: none;
  color: #6a6a6a;
  font-size: clamp(14px, 1.15vw, 17px);
  text-align: left;
  cursor: pointer;
  transition: color .25s;
}
.toc .n { font-size: 11px; letter-spacing: .06em; color: #444; transition: color .25s; }
.toc button:hover { color: var(--cream); }
.toc button.active { color: var(--cream); }
.toc button.active .n { color: var(--red); }
.toc button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* Back / next */
.side-foot { flex: none; display: flex; gap: var(--gap); }
.side-btn {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 16px;
  border: 0;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px #222;
  color: var(--cream);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: background .25s, box-shadow .25s;
}
.side-btn b { font-weight: 500; }
.side-btn:hover { background: #161616; box-shadow: inset 0 0 0 1px #333; }
/* Next: grey while reading, red once you reach the end */
.side-btn.next { flex: 1.3; transition: background .5s var(--ease), box-shadow .5s var(--ease); }
.side-btn.next .arrow { background: #2a2a2a; color: #888; transition: background .5s var(--ease), color .5s var(--ease), transform .4s var(--ease); }
.side-btn.next.ready { background: var(--red); box-shadow: none; }
.side-btn.next.ready .eyebrow { color: rgba(255, 252, 250, .7); }
.side-btn.next.ready .arrow { background: var(--cream); color: var(--ink); }
.side-btn.next.ready:hover { background: #c91700; }
.side-btn .arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  margin-top: -15px;
  width: 30px;
  height: 30px;
  background: var(--cream);
  color: var(--ink);
}
.side-btn.next:hover .arrow { transform: rotate(-45deg); }
.side-btn.next:not(.ready):hover .arrow { background: var(--red); color: var(--cream); }
.side-btn:focus-visible { outline: 2px solid var(--cream); outline-offset: -4px; }

/* Desktop reads from the side column; phones keep the top bar and title card */
@media (min-width: 861px) {
  .case-bar,
  .case .mobile-only { display: none; }
}
@media (max-width: 860px) {
  .case-side { display: none !important; }
  .case-open .other-panel { display: grid; }
}

/* ==========================================================
   Other Stuff mini pages (open over the expanded panel)
   ========================================================== */

.other-item[data-other] { cursor: pointer; }
.other-item[data-other] .label { transition: background .25s, color .25s; }
.other-item[data-other]:hover .label,
.other-item[data-other]:focus-visible .label { background: var(--red); color: var(--cream); }
.other-item[data-other]:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

.other-detail {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--gap);
  padding: var(--gap);
  background: var(--panel);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .35s var(--ease), transform .45s var(--ease), visibility 0s .45s;
}
.other-panel.detail-open .other-detail {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .35s var(--ease), transform .45s var(--ease);
}
.other-panel.detail-open .other-close { opacity: 0; pointer-events: none; }
.other-detail .tile { animation: none; }

/* Text card */
.od-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(16px, 1.6vw, 22px);
  overflow-y: auto;
  scrollbar-width: thin;
  border-radius: calc(var(--r) - 4px);
}
.od-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: auto; padding-bottom: 18px; }
.od-top .pill { margin-left: -8px; }
.od-x {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #EEE9E5;
  color: var(--ink);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.od-x:hover { background: var(--red); color: var(--cream); }
.od-x:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.od-text .eyebrow { color: var(--red); }
.od-text h2 {
  margin: -4px 0 4px;
  font-size: clamp(28px, 2.6vw, 42px);
  font-weight: 600;
  line-height: .95;
}
.od-text p:not(.eyebrow) { margin: 0; font-size: clamp(13px, 1vw, 15px); line-height: 1.5; color: #444; }
/* Mini page text tile: white on black, like the rest of Other Stuff */
.od-text.card { background: #000; color: var(--cream); box-shadow: inset 0 0 0 1px #1c1c1c; }
.od-text.card p:not(.eyebrow) { color: #a3a3a3; }
.od-text.card .od-x { background: #1d1d1d; color: var(--cream); }
.od-text.card .od-x:hover { background: var(--red); }

/* Gallery: up to four pictures that always fill the space */
.od-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  min-height: 0;
}
.od-gallery[data-count="0"] { display: none; }
/* a "wide" picture (e.g. a 16:9 video) takes the whole top row */
.od-gallery[data-count] > .od-img.wide { grid-column: 1 / -1; grid-row: auto; }
.od-gallery:has(> .wide:first-child) > :not(.wide) { grid-row: auto; }
.od-img video { display: block; width: 100%; height: 100%; object-fit: cover; }
.od-img.contain video { object-fit: contain; }
.od-img.contain img { padding: var(--pad, 0); }
.od-gallery[data-count="1"] > * { grid-column: 1 / -1; grid-row: 1 / -1; }
.od-gallery[data-count="2"] > * { grid-column: 1 / -1; }
.od-gallery[data-count="3"] > :first-child { grid-row: span 2; }
.od-img { border-radius: calc(var(--r) - 4px); min-height: 0; }
.od-img.contain img,
.od-img.contain:hover img { object-fit: contain; filter: none; transform: none; }

/* Phones: the panel is always open there, so the mini page stacks below */
@media (max-width: 860px) {
  .other-detail { display: none; }
  .other-panel.detail-open { display: block; aspect-ratio: auto; }
  .other-panel.detail-open > .other-item { display: none; }
  .other-panel.detail-open .other-detail {
    position: static;
    display: flex;
    flex-direction: column;
    padding: 0;
  }
  .od-gallery { aspect-ratio: 1; }
  .od-img { aspect-ratio: auto; }
}

/* Other Stuff tiles: pictures sit dim and black & white, colour in on hover */
.ot-tile img,
.ot-tile.contain img,
.other-item img,
.other-item.brand img {
  filter: grayscale(1) brightness(.55);
  transition: filter .6s var(--ease);
}
.ot-tile:hover img,
.ot-tile:focus-visible img,
.other-item:hover img,
.other-item:focus-visible img,
.other-item.brand:hover img {
  filter: none;
}

/* Desktop: the opened panel only ever shows a mini page — no item grid,
   so closing returns straight to the three tiles in the column */
@media (min-width: 861px) {
  .other-panel > .other-item,
  .other-close { display: none; }
}
.od-top { justify-content: flex-start; }

/* Closed state: just the three tiles, no frame around them */
.other-title {
  gap: var(--gap);
  padding: 0;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}
.ot-tile { border-radius: calc(var(--r) - 4px); }

/* About: "Check it out" tile at the bottom of the About my work card */
.work-card { display: flex; flex-direction: column; }
.cta-tile {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding: 12px 12px 12px 18px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--cream);
  text-decoration: none;
  transition: background .3s var(--ease);
}
.work-card p:last-of-type { margin-bottom: 18px; }
.cta-text { display: flex; flex-direction: column; gap: 2px; }
.cta-text .eyebrow { color: #8a8a8a; transition: color .3s; }
.cta-text b { font-size: clamp(17px, 1.5vw, 22px); font-weight: 500; }
.cta-tile .arrow { background: var(--cream); color: var(--ink); }
.cta-tile:hover { background: var(--red); }
.cta-tile:hover .eyebrow { color: rgba(255, 252, 250, .75); }
.cta-tile:hover .arrow { transform: rotate(-45deg); }
.cta-tile:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Home: the "portfolio" card grows on hover and links to Projects.
   Uses the separate `scale` property so it doesn't fight the entrance animation. */
.hero.go-tile {
  display: flex;
  color: var(--ink);
  text-decoration: none;
}
/* Every clickable tile on the site grows above its neighbours on hover.
   (Rules for all pages live in the "Grow on hover" block at the end.) */
.hero.go-tile:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.hero.go-tile .go-label { color: var(--cream); }

/* ==========================================================
   Grow on hover — every clickable tile, every page
   Uses the separate `scale` property so it never fights the
   entrance animation or other transforms.
   ========================================================== */

:root {
  --grow: 1.02;
  --grow-btn: 1.05;   /* small buttons need a bit more to read as the same movement */
  --grow-icon: 1.15;  /* round icon buttons (✕) are tiny, so they grow the most */
  --grow-figma: 1.03; /* the Figma button is wide, so it needs less */
  --grow-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}

.go-tile,
.proj,
.ot-tile,
.cv,
.cta-tile,
.side-btn,
.side-btn.next {
  transition: scale .5s var(--ease), box-shadow .5s var(--ease), background .4s var(--ease);
}

.go-tile:hover, .go-tile:focus-visible,
.proj:hover, .proj:has(.proj-link:focus-visible),
.ot-tile:hover, .ot-tile:focus-visible,
.cv:hover, .cv:focus-visible,
.cta-tile:hover, .cta-tile:focus-visible,
.side-btn:hover, .side-btn:focus-visible {
  z-index: 5;
  scale: var(--grow);
  box-shadow: var(--grow-shadow);
}
/* Keep the thin outline on tiles that use one */
.ot-tile:not(:has(img)):hover,
.ot-tile:not(:has(img)):focus-visible { box-shadow: inset 0 0 0 1px #2a2a2a, var(--grow-shadow); }
.side-btn:hover,
.side-btn:focus-visible { box-shadow: inset 0 0 0 1px #333, var(--grow-shadow); }
.side-btn.next.ready:hover,
.side-btn.next.ready:focus-visible { box-shadow: var(--grow-shadow); }

/* Projects grid: room for edge tiles to grow without being cropped
   by the grid's scroll area */
@media (min-width: 861px) {
  .projects { overflow: hidden; }
  .work { overflow: visible; }
  .work-grid {
    height: calc(100% + 28px);
    margin: -14px;
    padding: 14px;
  }
}

@media (hover: none) {
  .go-tile:hover, .proj:hover, .ot-tile:hover, .cv:hover, .cta-tile:hover, .side-btn:hover { scale: none; }
}

/* The case study always sits above the project grid, and the grid hides
   once the case study has faded in (so no tile can show through) */
.case { z-index: 10; }
.work-grid { transition: visibility 0s; }
.case-open .work-grid { visibility: hidden; transition: visibility 0s .45s; }

/* Buttons and the nav bar grow too */
.nav { transition: scale .4s var(--ease), box-shadow .4s var(--ease); }
@media (min-width: 861px) { .nav { position: relative; } }  /* phones keep it pinned (sticky) */
.nav:hover,
.nav:focus-within {
  z-index: 6;
  scale: var(--grow);
  box-shadow: var(--grow-shadow);
}

.side-figma,
.btn,
.copy,
.socials a {
  transition: scale .35s var(--ease), box-shadow .35s var(--ease),
              background .25s, color .2s, border-color .2s;
}
a.side-figma:hover, a.side-figma:focus-visible,
.btn:hover, .btn:focus-visible,
.copy:hover, .copy:focus-visible,
.socials a:hover, .socials a:focus-visible {
  scale: var(--grow-btn);
}
a.side-figma:hover, a.side-figma:focus-visible,
.btn:hover, .btn:focus-visible {
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
}

@media (hover: none) {
  .nav:hover, .side-figma:hover, .btn:hover, .copy:hover, .socials a:hover { scale: none; box-shadow: none; }
}

/* Other Stuff mini page: the ✕ grows on hover */
.od-x { transition: scale .3s var(--ease), background .2s, color .2s; }
.od-x:hover,
.od-x:focus-visible { scale: var(--grow-icon); }
@media (hover: none) { .od-x:hover { scale: none; } }
a.side-figma:hover,
a.side-figma:focus-visible { scale: var(--grow-figma); }

/* Captioned photos (About: "Me", "My cat Fresco") — same cursor label as the
   Home links, but they don't grow since they aren't clickable */
.tag-tile:hover .go-label { opacity: 1; transform: none; }
.tag-tile.tracking .go-label {
  left: 0;
  top: 0;
  bottom: auto;
  transform: translate(var(--x), var(--y));
  transition: opacity .25s var(--ease);
}

/* Projects marked "coming soon": greyed out, no hover, not clickable */
.proj.soon {
  cursor: default;
  filter: grayscale(1) brightness(.45);  /* (opacity is driven by the entrance animation) */
}
.proj.soon:hover { scale: none; box-shadow: none; }
.proj.soon .proj-num { color: #777; }

/* ==========================================================
   Page transitions, image drift, scroll-to-next
   ========================================================== */

.leaving .page .tile,
.leaving .about-page .tile {
  animation: page-out .25s var(--ease) forwards;
}



/* ==========================================================
   Home: intro screen, hero card, background tiles
   ========================================================== */

.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 22px);
  background: var(--bg);
  color: var(--cream);
  text-align: center;
  cursor: pointer;
  transition: background-color .7s var(--ease);
}
.intro-playing .intro,
.intro-flying .intro { display: flex; }
/* Typed greeting */
.intro-type {
  min-height: 1.3em;
  margin: 0;
  font-size: clamp(16px, 1.6vw, 25px);
  color: var(--cream);
  transition: opacity .35s var(--ease);
}
.intro-type b { font-weight: 500; color: var(--cream); }
.intro-type::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -.12em;
  background: var(--cream);
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* The sign draws itself: each line is a stroke revealed along its own curve */
.intro-logo { position: relative; width: min(66vw, 760px); }
.intro-logo svg { display: block; width: 100%; height: auto; overflow: visible; }
.intro-logo path { opacity: 0; }
.intro.drawing .intro-logo path {
  animation: line-draw var(--dur) cubic-bezier(.55, 0, .25, 1) var(--delay) forwards;
}
@keyframes line-draw {
  0%   { opacity: 1; }
  100% { opacity: 1; stroke-dashoffset: 0; }
}
/* a soft red glow while it's being drawn */
.intro-logo svg { transition: filter 1s var(--ease); }
.intro.drawing .intro-logo svg { filter: drop-shadow(0 0 10px rgba(235, 27, 0, .45)); }
.intro.out .intro-logo svg { filter: none; }

.intro-skip {
  position: absolute;
  right: 22px;
  bottom: 20px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #555;
  transition: opacity .3s;
}

/* Leaving the intro: background fades away, the logo flies into the card */
.intro.out { background-color: transparent; pointer-events: none; }
.intro.out .intro-type,
.intro.out .intro-skip { opacity: 0; }
/* While the intro plays, the tiles wait; the hero card is already in place
   underneath so the logo has somewhere to land */
.intro-playing .page .tile,
.intro-playing .page .nav { animation-play-state: paused; }
.intro-done .hero { animation: none; }
.intro-flying .hero .logo img { opacity: 0; }

/* Hero card: name + UI/UX top-left, the logo centred */
.hero { justify-content: flex-start; }
.hero p.hero-name {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  color: var(--ink);
}
.hero .hero-name b {
  font-size: clamp(17px, 1.6vw, 26px);
  font-weight: 500;
  line-height: 1.05;
}
.hero .hero-name span {
  font-size: clamp(12px, .95vw, 15px);
  font-weight: 500;
  letter-spacing: .08em;
}
/* centre the logo in the whole card (balances the name block) */
.hero .logo { margin: auto; }
.hero::after { content: ""; flex: none; height: clamp(36px, 3.4vw, 52px); }
/* the logo grows with the card and picks up a soft shadow */
.hero .logo img {
  transition: scale .6s var(--ease), filter .6s var(--ease);
}
.hero.go-tile:hover .logo img,
.hero.go-tile:focus-visible .logo img {
  scale: 1.07;
  filter: drop-shadow(0 12px 18px rgba(20, 20, 20, .18));
}

/* Home photos read as a calm background until you hover one */
.home .go-tile.photo img { filter: grayscale(1) contrast(1.1) brightness(.62); }
.home .go-tile.photo:hover img { filter: grayscale(0) brightness(.95); }

/* ==========================================================
   Projects: right column = "Selected work" card (2/3) + Other Stuff (1/3)
   Other Stuff shows labels only; hovering one opens it into a picture
   tile and the column rebalances to give it room.
   ========================================================== */

.other > .work-intro,
.other > .other-panel {
  transition: flex-grow .55s var(--ease);
}
.other > .work-intro { flex: 2 1 0; grid-column: auto; }
.other > .other-panel { flex: 1 1 0; }
/* Opened Other Stuff or a case study takes the whole column */
.other-open .other > .work-intro,
.case-open .other > .work-intro { display: none; }

/* Closed list: the three Other Stuff tiles (.ot-active is set by js/projects.js) */
.other-title .ot-tile {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 44px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  transition: flex-grow .55s var(--ease), padding .45s var(--ease), background .4s, box-shadow .4s;
}
.ot-tile .ot-info {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  padding: 7px 7px 7px 14px;
  transform: none;
}
.ot-tile .ot-info .arrow { width: 30px; height: 30px; }
.ot-tile:not(:has(img))::after { content: none; }

.other-title .ot-tile.ot-active .arrow { background: var(--red); color: var(--cream); transform: rotate(-45deg); }
/* The active label grows slightly in place; the others dim back */
.other-title .ot-tile:hover,
.other-title .ot-tile:focus-visible { scale: none; box-shadow: none; z-index: auto; }
.other-title .ot-tile { transition: scale .35s var(--ease), opacity .35s var(--ease); }
.other-title .ot-tile.ot-active { scale: 1.01; z-index: 1; }
.other-title:has(.ot-active) .ot-tile:not(.ot-active) { opacity: .45; }

/* ==========================================================
   About: scrolling page with a sticky right column
   ========================================================== */

.about-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28.6%;
  align-items: start;
  gap: var(--gap);
  padding: var(--gap);
}
.about-main { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }


/* Sticky column: menu, chapter counter, portrait */
.about-side {
  position: sticky;
  top: var(--gap);
  height: calc(100vh - 2 * var(--gap));
  height: calc(100dvh - 2 * var(--gap));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

/* Chapters: rows of tiles, sized like the case studies */
.about-sec { display: flex; flex-direction: column; gap: var(--gap); scroll-margin-top: var(--gap); }
.a-row { display: flex; gap: var(--gap); }
.a-row > * { min-width: 0; }
.a-contain img,
.a-contain:hover img { object-fit: contain; }


.case-step .eyebrow { margin: 10px 0 0; color: #999; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; padding: 0; list-style: none; }
.chips li {
  padding: 5px 12px;
  border: 1px solid #DDD8D4;
  border-radius: 999px;
  font-size: 13px;
}
.a-process { display: grid; gap: 14px; margin: 4px 0 0; padding: 0; list-style: none; counter-reset: step; }
.a-process li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 30px 1fr;
  font-size: clamp(13px, 1vw, 15px);
  line-height: 1.45;
  color: #555;
}
.a-process li::before { content: counter(step, decimal-leading-zero); grid-row: span 2; font-size: 12px; color: var(--red); padding-top: 3px; }
.a-process li b { display: block; font-weight: 500; color: var(--ink); }

/* Off-screen + What's next share one set of columns so their edges line up */
.a-row.a-cols3 { display: grid; grid-template-columns: .75fr 1.1fr 1.081fr; }
.a-cols3 .a-span2 { grid-column: span 2; }
.cta-tile.red { background: var(--red); }
.cta-tile.red .eyebrow { color: rgba(255, 252, 250, .75); }
.cta-tile.red:hover { background: var(--ink); }

/* Placeholders for your own details — easy to spot, replace them */
.fill {
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(235, 27, 0, .08);
  color: var(--red);
}
.chips li.fill { border: 1px dashed var(--red); background: rgba(235, 27, 0, .05); }

/* Chapters fade in when you scroll to them */
.about-sec .a-row > * { animation: none; }
.js .about-sec:not(.in) .a-row > * { opacity: 0; }
.about-sec.in .a-row > * {
  animation: page-in .6s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@media (max-width: 860px) {
  .about-page { display: flex; flex-direction: column; align-items: stretch; }
  .about-side { display: contents; }
  .about-toc { display: none; }
  .a-row { flex-direction: column; }
  .a-row > * { flex: none !important; }
}

@media (max-width: 860px) {
  .projects .nav { order: -3; }
  .other > .work-intro { order: -2; min-height: 180px; flex: none; }  /* after the menu, before the projects */
}

@media (max-width: 860px) {
  .a-row.a-cols3 { display: flex; }
}

/* ==========================================================
   Overhaul: pictures on the left, words in the side column.
   No cream text cards on Projects / About — dark tiles only.
   ========================================================== */

/* ---------- Projects: four equal tiles, labels ride the cursor ---------- */
@media (min-width: 861px) {
  @container (min-width: 561px) {
    .work-grid {
      grid-template-columns: repeat(2, 1fr);
      grid-auto-rows: calc((100% - var(--gap)) / 2);
    }
  }
}
.proj .go-label { color: var(--cream); }
.proj:has(.proj-link:focus-visible) .go-label { opacity: 1; transform: none; }
.proj.soon { filter: none; background: #121212; }
.proj.soon::after { color: #555; }

/* "My most recent projects" */
/* same dark panel as the side columns on About and in the case studies */
.work-intro { background: var(--panel); box-shadow: inset 0 0 0 1px #222; color: var(--cream); }

/* Other Stuff list at the bottom of the tile, like the chapter counters;
   the item under the cursor grows like the chapter you're reading */
.wi-other { margin-top: clamp(20px, 3vh, 40px); display: flex; flex-direction: column; gap: 12px; }
.wi-other .toc button:hover,
.wi-other .toc button:focus-visible { color: var(--cream); font-size: clamp(20px, 1.9vw, 28px); }
.wi-other .toc button:hover .n,
.wi-other .toc button:focus-visible .n { color: var(--red); }

@media (min-width: 861px) {
  /* the tile takes the whole column; the Other Stuff panel only appears
     when an item is opened */
  .other > .work-intro { flex: 1 1 0; }
  .projects:not(.other-open) .other > .other-panel { display: none; }
}
@media (max-width: 860px) {
  .wi-other { display: none; }   /* phones keep the picture tiles below */
}
.work-intro p:not(.eyebrow) { color: #8a8a8a; }
.wi-top .eyebrow { color: #666; }

/* ---------- Other Stuff: three picture tiles fill the box ---------- */
.other-title .ot-tile {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  box-shadow: none;
}
.other-title .ot-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px #222;
  pointer-events: none;
}
.ot-media { position: absolute; inset: 0; }
.ot-media img,
.ot-media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.ot-media.contain img,
.ot-media.contain video { object-fit: contain; }
/* logos have a lot of empty space around them: zoom in so they read in the strip */
.ot-media.contain img { scale: 2.3; }
/* grey and dim at rest (backgrounds too), in colour while hovered */
.ot-media { filter: grayscale(1) brightness(.42); }
.ot-tile.ot-active .ot-media { transition: filter .4s var(--ease); }
.ot-tile .ot-media img,
.ot-tile .ot-media video { filter: none; }
.ot-tile.ot-active .ot-media,
.ot-tile:focus-visible .ot-media { filter: none; }
.other-title .ot-tile .ot-info {
  z-index: 1;
  border-radius: 0;
  box-shadow: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .85), rgba(0, 0, 0, .35) 55%, rgba(0, 0, 0, 0));
}
.other-title .ot-tile .ot-info { flex: 1; padding: 0 12px 0 18px; gap: 14px; }
.ot-info .proj-title strong { font-size: clamp(18px, 1.6vw, 26px); line-height: 1.05; }
.ot-info .proj-title span { display: block; margin-top: 3px; font-size: 12px; color: #555; letter-spacing: .04em; }
.ot-tile .ot-info .arrow { width: 36px; height: 36px; }

/* ---------- Case study side column ---------- */
.side-meta { grid-template-columns: repeat(4, auto); }

/* The chapter you're reading is set bigger in the list */
.toc button { line-height: 1.15; transition: color .25s, font-size .35s var(--ease); }
.toc button.active { font-size: clamp(20px, 1.9vw, 28px); }
.toc-fill { transition: height .2s linear; }

/* Its text sits right under the list and scrolls on its own if long */
.side-toc { overflow: hidden; }
.toc-wrap { flex: none; }
.side-desc {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid #1f1f1f;
  color: #b8b8b8;
  font-size: clamp(14px, 1.05vw, 16px);
  line-height: 1.55;
  transition: opacity .16s var(--ease);
}
.side-desc.swapping { opacity: 0; }
.side-desc:empty { display: none; }

/* Text blocks (side column on desktop, inline on phones) */
:is(.side-desc, .a-desc) p { margin: 0 0 .85em; }
:is(.side-desc, .a-desc) p:last-child { margin-bottom: 0; }
:is(.side-desc, .a-desc) .a-lead {
  margin-bottom: .6em;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 500;
  line-height: 1.05;
  color: var(--cream);
}
:is(.side-desc, .a-desc) .eyebrow { margin: 14px 0 0; color: #666; }
:is(.side-desc, .a-desc) .chips li { border-color: #333; color: #cfcfcf; }
:is(.side-desc, .a-desc) .chips li.fill { border-color: var(--red); color: var(--red); }
:is(.side-desc, .a-desc) .a-process li { color: #a8a8a8; }
:is(.side-desc, .a-desc) .a-process li b { color: var(--cream); }
.a-facts { display: grid; gap: 10px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid #1f1f1f; }
.a-facts dt { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #666; }
.a-facts dd { margin: 2px 0 0; color: var(--cream); }

/* Phones: chapter text tiles + title card, dark too */
.case-step,
.case-head { background: var(--panel); box-shadow: inset 0 0 0 1px #222; color: var(--cream); }
.case-step p,
.case-head p { color: #b8b8b8; }

/* ---------- About ---------- */
.about-intro { display: block; }
.a-intro-grid {
  height: calc(100vh - 2 * var(--gap));
  height: calc(100dvh - 2 * var(--gap));
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr 1.25fr;
  grid-template-rows: 1.15fr 1fr;
  grid-template-areas:
    "face books"
    "face sign";
}
.about-side > .about-toc { flex: 1; min-height: 0; }
.side-ctas .side-btn.next { padding-right: 54px; }  /* room for the arrow */
a.side-btn { text-decoration: none; }

@media (min-width: 861px) {
  .a-desc { display: none; }
}
@media (max-width: 860px) {
  .a-desc { padding: 20px; background: var(--panel); box-shadow: inset 0 0 0 1px #222; color: #b8b8b8; }
  .about-intro { display: flex; flex-direction: column; gap: var(--gap); }
  .a-intro-grid { height: auto; display: flex; flex-direction: column; }
  .a-intro-grid > * { aspect-ratio: 4 / 3; }
  .side-ctas { order: 1; }  /* the buttons close the page */
}

/* Other Stuff tiles may grow a little on hover: don't clip them */
.other-panel:not(.detail-open) { overflow: visible; }

/* Arrows: just the rounded arrow glyph — no circle behind it.
   It takes the colour of the button it sits in. */
.arrow {
  background: transparent !important;
  box-shadow: none !important;
  color: inherit !important;
}
.arrow svg { width: 18px; height: 18px; }
/* Next (case studies / About): grey while you read, red on hover */
.side-btn.next:not(.ready) .arrow { color: #888 !important; }
.side-btn.next:not(.ready):hover .arrow { color: var(--red) !important; }

/* Case study Next + Open in Figma: on hover the arrow slides forward a
   little (and back when the cursor leaves) instead of tilting */
a.side-figma .arrow,
.side-btn.next .arrow { transition: translate .35s var(--ease), color .3s var(--ease); }
a.side-figma:hover .arrow,
a.side-figma:focus-visible .arrow,
.side-btn.next:hover .arrow,
.side-btn.next:focus-visible .arrow {
  transform: none;
  translate: 5px 0;
}

/* Download CV: the arrow slides down a little on hover (and back after) */
.cv .arrow { transition: translate .35s var(--ease), color .25s var(--ease) !important; }
.cv:hover .arrow,
.cv:focus-visible .arrow {
  transform: none;
  translate: 0 10px;
  color: var(--red) !important;
}

/* Project overview under the big title while a project picture is hovered */
.wi-preview {
  /* as tall as the longest overview (set in js/projects.js), so the
     Other Stuff list sits right below it and never moves */
  flex: none;
  overflow: hidden;
  max-width: 30ch;
  margin-top: clamp(18px, 2vw, 32px);
  color: #b8b8b8;
  font-size: clamp(17px, 1.45vw, 24px);
  line-height: 1.45;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.wi-preview p { margin: 0 0 .5em; }
.work-intro .wi-preview p:not(.eyebrow) { font-size: inherit; line-height: inherit; color: inherit; }
/* the summary reads as a quote: lighter (Afacad's thinnest weight is 400,
   so it's softened with a dimmer grey instead) */
.work-intro .wi-preview p.wi-quote { font-weight: 400; font-style: italic; font-size: .85em; color: #8c8c8c; }
.wi-preview .eyebrow { margin-bottom: .7em; color: var(--cream); font-size: clamp(12px, .85vw, 14px); }
.wi-preview .eyebrow .n { margin-right: 10px; color: var(--red); }
.wi-preview.show { opacity: 1; }
.wi-preview.show > * { animation: wi-in .4s var(--ease) both; }
.wi-preview.show > :nth-child(2) { animation-delay: .05s; }
@keyframes wi-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 860px) { .wi-preview { display: none; } }

/* With a pure black page, black-backed pictures (the Lyre logo) and the
   Other Stuff text tile get a hairline outline so they still read as tiles */
.a-contain::after,
.od-img.contain::after,
.other-item.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px #1f1f1f;
  pointer-events: none;
}
.od-text.card { background: var(--panel); box-shadow: inset 0 0 0 1px #222; }

/* Opened Other Stuff: just the mini page's tiles on the black page —
   no extra panel or padding behind them */
@media (min-width: 861px) {
  .other-panel,
  .other-detail { padding: 0; background: transparent; box-shadow: none; }
}

/* ---------- Projects: the right-hand tile in white ---------- */
.work-intro { background: var(--cream); box-shadow: none; color: var(--ink); }
.wi-top .eyebrow { color: #999; }
.work-intro .wi-preview { color: #555; }
.wi-preview .eyebrow { color: var(--ink); }
.work-intro .wi-preview p.wi-quote { color: #777; }

/* Other Stuff: its own dark tile under the white one */
.other > .other-list {
  flex: none;
  padding: clamp(16px, 1.6vw, 22px);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px #222;
  overflow: visible;
}
.other-list .wi-other { margin-top: 0; }
.other-open .other > .other-list,
.case-open .other > .other-list { display: none; }
@media (max-width: 860px) { .other > .other-list { display: none; } }

/* Other Stuff list: an arrow slides in after the item you hover */
.wi-other .toc button { align-items: center; }
.wi-other .toc .arrow {
  width: auto;
  height: auto;
  margin-left: 10px;          /* right after the item's name */
  opacity: 0;
  translate: -8px 0;
  transition: opacity .25s var(--ease), translate .35s var(--ease) !important;
}
.wi-other .toc button:hover .arrow,
.wi-other .toc button:focus-visible .arrow { opacity: 1; translate: 0 0; color: var(--cream) !important; }

/* Title in capitals, a lighter weight */
.wi-title { text-transform: uppercase; font-weight: 500; }
/* Other Stuff tile a little taller */
.other > .other-list { padding-top: clamp(22px, 2.2vw, 32px); padding-bottom: clamp(22px, 2.2vw, 32px); }

/* ---------- Projects right column: title tile · overview tile · Other Stuff ---------- */
@media (min-width: 861px) {
  .other > .work-intro { flex: none; }
  .other > .wi-mid { flex: 1 1 0; min-height: 0; }
}
.wi-mid {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 1.6vw, 24px);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px #222;
  color: var(--cream);
}
.wi-mid .wi-preview { margin-top: 0; color: #b8b8b8; }
.wi-mid .wi-preview p { font-size: inherit; line-height: inherit; }
.wi-mid .wi-preview .eyebrow { color: var(--cream); font-size: clamp(12px, .85vw, 14px); }
.wi-mid .wi-preview p.wi-quote { font-style: italic; font-size: .85em; color: #8c8c8c; }
/* a quiet hint while nothing is hovered */
.wi-hint {
  position: absolute;
  left: clamp(16px, 1.6vw, 24px);
  bottom: clamp(16px, 1.6vw, 24px);
  margin: 0;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #4a4a4a;
  transition: opacity .2s var(--ease);
}
.wi-mid:has(.wi-preview.show) .wi-hint { opacity: 0; }
.other-open .other > .wi-mid,
.case-open .other > .wi-mid { display: none; }
@media (max-width: 860px) { .other > .wi-mid { display: none; } }

/* Project tiles: a tiny white arrow appears in the bottom-right corner on hover */
.proj-arrow {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  display: grid;
  color: var(--cream);
  opacity: 0;
  translate: -6px 6px;
  pointer-events: none;
  transition: opacity .25s var(--ease), translate .35s var(--ease);
}
.proj-arrow svg { width: 14px; height: 14px; }
.proj:hover .proj-arrow,
.proj:has(.proj-link:focus-visible) .proj-arrow { opacity: 1; translate: 0 0; }
@media (hover: none) { .proj-arrow { opacity: .9; translate: 0 0; } }

/* Next / Check out my work, once you reach the end: white with a black arrow
   (instead of the bright red button) */
.side-btn.next.ready { background: var(--cream); color: var(--ink); box-shadow: none; }
.side-btn.next.ready .eyebrow { color: #999; }
.side-btn.next.ready .arrow { color: var(--ink) !important; }
.side-btn.next.ready:hover { background: #EEE9E5; }

/* Contact: the CV tile stays dark and just lifts a shade on hover (the arrow
   slides down) — no big bright-red hover, red stays an accent */
.cv:hover,
.cv:focus-visible { background: #1a1a1a; color: var(--cream); }
.cv:hover .eyebrow,
.cv:focus-visible .eyebrow { color: #8a8a8a; }

/* Project tiles can zoom their picture in a little (coverScale in js/projects.js).
   The picture is laid out larger (not scaled as an effect), so it stays sharp. */
.proj[style*="--scale"] img {
  position: absolute;
  left: calc((1 - var(--scale)) * 50%);
  top: calc((1 - var(--scale)) * 50%);
  width: calc(var(--scale) * 100%);
  height: calc(var(--scale) * 100%);
  max-width: none;
}

/* Case-study pictures shown whole on a colour (fit: "contain" in js/projects.js) */
.case-media.contain img { object-fit: contain; padding: var(--pad, 0); filter: none; }

/* A project tile can show its whole picture on a colour (coverFit: "contain") */
.proj.cover-contain img { object-fit: contain; }

/* "Coming soon" tile: a dark tint over the whole tile (artwork and its
   background together) so it sits back */
.proj.soon img { filter: none; }
.proj.soon::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, .5);
  pointer-events: none;
}

/* Contact form: hidden honeypot field + the "sent" / error line */
.form .hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.form-status {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 1.3em;
  font-size: 13px;
  color: #6b6b6b;
}
.form-status.ok { color: var(--ink); }
.form-status.err { color: var(--red); }
.btn:disabled { opacity: .6; cursor: progress; }

/* Projects: the cursor label passes over the little corner arrow, not under it */
.proj .go-label { z-index: 4; }

/* Opened Other Stuff: the title and description sit at the top of the text tile */
.od-top { margin-bottom: 0; }
