/* Device bezel: soft graphite rather than pure black, shared by every thumbnail */
:root { --bezel: #3d4047; }
/* "table-tennis coach" starts the ping-pong game: make it read as playable */
.roles li.play { --tt: #d42a22; position: relative; border-radius: 6px; transition: color .2s ease, transform .25s ease; }
.roles li.play:hover, .roles li.play:focus-visible { color: var(--tt); outline: none; }
.roles li.play:focus-visible { box-shadow: 0 0 0 2px var(--tt); }
.roles li.play::after { display: none; } /* the red "play" pill replaces the hover icon here */
.play-hint {
  font: 600 11px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: var(--tt); padding: 5px 8px 5px 18px; border-radius: 999px;
  /* sits beside the words without taking up width, so "table-tennis coach" centres like the other roles on mobile */
  position: absolute; left: calc(100% + 10px); top: 50%; margin-top: -11px; white-space: nowrap;
  opacity: 0; transform: translateX(-6px); transition: opacity .2s ease, transform .2s ease;
}
.play-hint::before { content: ""; position: absolute; left: 7px; top: 50%; translate: 0 -50%; border: 4px solid transparent; border-left: 6px solid #fff; border-right: 0; }
.roles li.play:hover .play-hint, .roles li.play:focus-visible .play-hint { opacity: 1; transform: none; }
/* while a rally is running the hint stays out of the way */
body.pp-playing .play-hint { opacity: 0 !important; }
@media (hover: none) { .play-hint { opacity: 1; transform: none; } }
:root[data-theme="dark"] .roles li.play { --tt: #ff6b5e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .roles li.play { --tt: #ff6b5e; } }
/* the photo is now a link to the About page */
a.avatar { text-decoration: none; color: inherit; }


/* Keep-ups: tell first-time players to click the ball itself */
.ball-tip {
  position: absolute; left: 50%; bottom: calc(100% + 14px); translate: -50% 0;
  padding: 5px 10px; border-radius: 999px; background: var(--text); color: var(--bg);
  font: 600 12px/1 var(--font-body); white-space: nowrap; opacity: 0; transition: opacity .2s ease;
}
.ball-tip::after { content: ""; position: absolute; left: 50%; top: 100%; translate: -50% 0; border: 5px solid transparent; border-top-color: var(--text); }
.ball.fresh .ball-tip { opacity: 1; }
.ball.fresh::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid #e8891c;
  animation: tip-pulse 1s ease-out infinite;
}
@keyframes tip-pulse { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }

/* Typed words always start on their own line, so the sentence never reflows while typing */
.tagline .typed { display: table; min-height: 1.55em; }
@media (max-width: 720px) { .tagline .typed { margin-inline: auto; } }


/* ---------- Universal "Read more of my case studies" block (js/more-work) ---------- */
.more-work { padding-top: var(--section-gap); }
.more-work h2 { margin: 0 0 28px; text-align: center; font-family: var(--font-display); font-weight: 500; font-size: var(--fs-h2); }
.mw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.mw-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.mw-thumb { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 6 / 5; border-radius: var(--radius); background: var(--tint); overflow: hidden; transition: translate .4s cubic-bezier(.22, 1, .36, 1), box-shadow .4s ease; }
.mw-card:hover .mw-thumb { translate: 0 -4px; box-shadow: 0 24px 48px -24px rgba(0, 0, 0, .3); }
/* Device frames: bezel only, no keyboard or stand */
.mw-tablet, .mw-phone { display: block; background: var(--bezel); box-shadow: 0 0 0 1px rgba(255, 255, 255, .06) inset, 0 20px 36px -18px rgba(0, 0, 0, .45); transition: transform .6s cubic-bezier(.22, 1, .36, 1); }
.mw-tablet { height: 66%; aspect-ratio: 16 / 10; padding: 5px; border-radius: 12px; }
.mw-phones { display: flex; gap: 6%; height: 80%; justify-content: center; }
.mw-phone { height: 100%; aspect-ratio: 9 / 19; padding: 3px; border-radius: 16px; }
.mw-screen { display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 6px; background: #fff; }
.mw-phone .mw-screen { border-radius: 13px; }
.mw-tablet .mw-screen { border-radius: 7px; }
.mw-screen img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; transition: transform .8s cubic-bezier(.22, 1, .36, 1); transform-origin: top left; }
.mw-phone .mw-screen img { object-position: top center; }
/* screens are 16:10 like a laptop: full width always visible, taller pages trim at the bottom */
.mw-tablet .mw-screen img { width: 100%; height: auto; }
.mw-phones .mw-phone:nth-child(2) { transform: translateY(8%); }
/* hover: the whole device grows, screen and frame together */
.mw-phones { transition: transform .6s cubic-bezier(.22, 1, .36, 1); }
.mw-card:hover .mw-tablet { transform: scale(1.07); }
/* phones grow more so their small screens read clearly; they may spill past the tile while hovered */
.mw-thumb:has(.mw-phones) { overflow: visible; min-height: 0; }
.mw-card:hover .mw-thumb:has(.mw-phones) { z-index: 2; }
.mw-card:hover .mw-phones { transform: scale(1.22); }
.mw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 16px; }
.mw-head .tag { margin-top: 2px; }
.mw-head b { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-h3); }
.mw-blurb { margin-top: 6px; font-size: var(--fs-card); color: var(--muted); }
@media (max-width: 860px) { .mw-grid { grid-template-columns: 1fr; gap: 32px; } }

/* ---------- Home cards: same device frames as the case-study thumbnails ---------- */
.card-media .shot.device {
  width: 78%; aspect-ratio: 16 / 10; border: 5px solid var(--bezel); border-radius: 12px; background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 24px 44px -22px rgba(0, 0, 0, .45);
}
.card:hover .card-media .shot.device { box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 40px 64px -28px rgba(0, 0, 0, .5); }
.shot.device img {
  border-radius: 7px; object-fit: cover; object-position: top left;
  inset: 0 auto auto 0; width: 100%; height: auto;
}
.shot.device .slide-dots { z-index: 3; }
.card-media .phones { align-items: center; }
.card-media .phone { width: 31%; height: auto; aspect-ratio: 9 / 19; border: 3px solid var(--bezel); border-radius: 16px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 20px 36px -18px rgba(0, 0, 0, .45); }
.card-media .phone img { border-radius: 13px; }

/* Home Car ADAS card: phones grow well past the tile on hover so the screens read clearly */
.card-media:has(.phones) { overflow: visible; }
.card:hover .card-media .phones { scale: 1.24; translate: 0 -18px; }
.card:hover:has(.phones) { z-index: 2; position: relative; }

/* ---------- About photo stack: every photo fills the same frame, captions stay in the white strip ---------- */
.about .deck .deck-card img { height: 100%; width: 100%; object-fit: cover; border: 0; border-radius: 3px; }
.about .deck-card figcaption { color: var(--text); z-index: 1; }
.deck-card[data-key="me"] img { object-position: 50% 35%; }
.deck-card[data-key="hike"] img { object-position: 45% 50%; }
.deck-card[data-key="tt"] img { object-position: 55% 50%; }
.deck-card[data-key="dog"] img { object-position: 50% 35%; }

/* ---------- About: company pop-out for each domain pill ---------- */
.domains button.open { border-color: var(--text); }
.co-pop {
  position: absolute; z-index: 60; width: max-content; min-width: 180px; max-width: min(280px, calc(100vw - 32px));
  padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 24px 48px -20px rgba(0, 0, 0, .35);
  opacity: 0; translate: 0 -4px; transform-origin: var(--arrow, 24px) 0;
  transition: opacity .28s ease, translate .32s cubic-bezier(.22, 1, .36, 1);
}
.co-pop.show { opacity: 1; translate: 0 0; }
.co-pop.glide { transition: opacity .28s ease, translate .32s cubic-bezier(.22, 1, .36, 1), left .35s cubic-bezier(.22, 1, .36, 1), top .35s cubic-bezier(.22, 1, .36, 1); }
.co-pop::before { transition: left .35s cubic-bezier(.22, 1, .36, 1); }
.co-pop::before {
  content: ""; position: absolute; top: -6px; left: var(--arrow, 24px); width: 10px; height: 10px; translate: -50% 0; rotate: 45deg;
  background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line);
}
.co-pop ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.co-pop li > a, .co-pop li > span { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: inherit; }
.co-pop li > a { transition: background-color .2s ease; }
.co-pop li > a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.co-pop li b { font-family: var(--font-display); font-weight: 500; font-size: 14px; }
.co-mono { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; font: 600 11px/1 var(--font-display); color: var(--text); letter-spacing: .02em; }
.co-note { margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* slideshow dots retired: the cards are links, so dots could never be tapped */
.slide-dots { display: none; }

/* Home cards: on hover the device grows clearly, spilling past the tile, so the screen is easy to read */
.card-media:has(.shot.device) { overflow: visible; }
.card:hover:has(.shot.device) { z-index: 2; position: relative; }
.card-media .shot.device { transition: translate .7s cubic-bezier(.22, 1, .36, 1), scale .7s cubic-bezier(.22, 1, .36, 1), box-shadow .7s ease; }
.card:hover .card-media .shot.device { scale: 1.22; translate: 0 -22px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 50px 80px -30px rgba(0, 0, 0, .5); }
@media (max-width: 720px) { .card:hover .card-media .shot.device { scale: 1.1; translate: 0 -10px; } }

/* Domains section on the home page: centred like the other home sections */
.container > .domains { text-align: center; padding-top: var(--section-gap); }
.container > .domains h2 { margin-bottom: 28px; }
.container > .domains ul { justify-content: center; }
.co-pop { text-align: left; }

/* ---------- Home: 1 × 4 rows variation (not in use; add class "rows" to .work-grid to switch) ---------- */
.work-grid.rows { grid-template-columns: minmax(0, 1fr); gap: clamp(48px, 7vw, 88px); }
.work-grid.rows .card { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: center; gap: clamp(32px, 5vw, 64px); }
.work-grid.rows .card:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.work-grid.rows .card:nth-child(even) .card-media { order: 2; }
.work-grid.rows .card-info { padding: 0; }
.work-grid.rows .card-head { flex-direction: column-reverse; align-items: flex-start; gap: 12px; }
.work-grid.rows .card-info h3 { font-size: var(--fs-h2); }
.work-grid.rows .card-info p { margin-top: 10px; font-size: 17px; max-width: 34ch; }
@media (max-width: 760px) {
  .work-grid.rows .card, .work-grid.rows .card:nth-child(even) { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .work-grid.rows .card:nth-child(even) .card-media { order: 0; }
  .work-grid.rows .card-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .work-grid.rows .card-info h3 { font-size: var(--fs-h3); }
  .work-grid.rows .card-info p { font-size: var(--fs-card); }
}

/* ---------- Home: "Experience at a glance": domains and organizations as two tabs ---------- */
.xp { padding: var(--section-gap) 0; text-align: center; }
.xp-tablist {
  position: relative; isolation: isolate; display: inline-flex; gap: 4px; padding: 5px; margin: 24px 0 32px;
  border-radius: 999px; border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--card-yellow), var(--card-lavender) 50%, var(--card-mint));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 12px 28px -18px rgba(0, 0, 0, .35);
}
/* the dark pill glides to whichever tab is selected */
.xp-thumb {
  position: absolute; z-index: -1; top: 5px; bottom: 5px; left: var(--x, 5px); width: var(--w, 0px);
  border-radius: 999px; background: var(--text);
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .45);
  transition: left .5s cubic-bezier(.3, 1.35, .5, 1), width .5s cubic-bezier(.3, 1.35, .5, 1);
}
.xp-tablist button {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 15px var(--font-display); padding: 10px 18px 10px 16px; border-radius: 999px; border: 0; background: none; color: var(--text); cursor: pointer;
  transition: color .35s ease, translate .25s ease;
}
.xp-tablist button .ico { width: 17px; height: 17px; transition: rotate .45s cubic-bezier(.3, 1.6, .5, 1); }
.xp-tablist button:hover:not([aria-selected="true"]) { translate: 0 -1px; }
.xp-tablist button:hover .ico { rotate: -8deg; }
.xp-tablist button[aria-selected="true"] { color: var(--bg); }
.xp-tablist button:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.xp-count {
  min-width: 26px; padding: 2px 8px; border-radius: 999px; font: 600 12px/1.4 var(--font-body); font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--text) 10%, transparent); transition: background-color .35s ease;
}
.xp-tablist button[aria-selected="true"] .xp-count { background: var(--accent); color: #1a1a1a; }
/* panels slide in from the side of the tab you chose */
.xp-panel.from-left { animation: xp-left .5s cubic-bezier(.22, 1, .36, 1); }
.xp-panel.from-right { animation: xp-right .5s cubic-bezier(.22, 1, .36, 1); }
@keyframes xp-left { from { opacity: 0; translate: -24px 0; } }
@keyframes xp-right { from { opacity: 0; translate: 24px 0; } }
.xp-panel { animation: xp-in .45s cubic-bezier(.22, 1, .36, 1); }
@keyframes xp-in { from { opacity: 0; translate: 0 8px; } }
.xp .domains { padding: 0; }
.xp .domains ul { justify-content: center; }
.xp .orgs { padding: 0; }
.xp .orgs .logo-row { text-align: left; }
.xp-hint { margin: 0 0 18px; font-size: 14px; color: var(--muted); }

/* "+ more" tile closing the client logo row */
.logo-row li.more::after { display: none; }
.logo-row li.more:hover { scale: none; }
.logo-row li.more button {
  font: 500 15px var(--font-display); color: var(--muted); padding: 8px 14px; border-radius: 999px;
  border: 1px dashed var(--line); background: none; cursor: pointer; transition: color .25s ease, border-color .25s ease;
}
.logo-row li.more button:hover { color: var(--text); border-color: var(--text); }
