/*
  lapslie.com — one-page portfolio styles.
  Mostly monochrome: off-white page, black text, soft grey shadows.
  Colour comes only from project logos and the contact objects.
*/

:root {
  --bg: #fafaf7;
  --ink: #111111;
  --ink-soft: #444444;
  --ink-faint: #767672;
  --card: #ffffff;
  --line: #e8e8e3;
  --shadow-sm: 0 2px 6px rgba(20, 20, 18, 0.06), 0 8px 20px rgba(20, 20, 18, 0.07);
  --shadow-md: 0 4px 10px rgba(20, 20, 18, 0.08), 0 16px 36px rgba(20, 20, 18, 0.12);
  --shadow-lg: 0 8px 18px rgba(20, 20, 18, 0.1), 0 28px 60px rgba(20, 20, 18, 0.18);
  --radius: 18px;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* The hidden attribute always wins, even over display rules — this
   class of bug has bitten .show-more, .modal-logo and .modal-meta. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
}

img {
  max-width: 100%;
  display: block;
}

section {
  scroll-margin-top: 2rem;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

a,
button {
  -webkit-tap-highlight-color: transparent;
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.75rem;
}

/* ---------------------------------------------------------------- *
 *  Header
 * ---------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  padding: 1.25rem 0 0.75rem;
}

.header-inner {
  --logo-h: 64px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0;
  position: relative;
}

.logo-animated {
  display: inline-block;
  height: var(--logo-h);
  flex-shrink: 0;
  color: var(--ink);
}

.logo-animated svg {
  display: block;
  height: 100%;
  width: auto;
  overflow: visible;
}

.logo-text-container {
  animation: driftFade 0.6s ease-out both;
}

.reveal-mask-path {
  fill: none;
  stroke: white;
  stroke-width: 60;
  stroke-linecap: square;
  stroke-linejoin: round;
  stroke-dasharray: 800;
  animation: drawMask 1s cubic-bezier(0.59, 0.28, 0.91, 0.17) 0.2s both;
}

@keyframes drawMask {
  from { stroke-dashoffset: 800; }
  to { stroke-dashoffset: 0; }
}

@keyframes driftFade {
  from {
    opacity: 0;
    transform: translateX(-15px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Thin black line continuing seamlessly from the logo's underline,
   running beneath the nav links to the right edge of the header.
   The SVG line is 8/91 units thick and sits 12/91 above its bottom edge. */
.header-line {
  flex: 1;
  min-width: 30px;
  height: calc(var(--logo-h) * 0.088);
  background: var(--ink);
  align-self: flex-end;
  margin-left: -2px;
  margin-bottom: calc(var(--logo-h) * 0.132);
  transform-origin: left;
  animation: extendLine 1s cubic-bezier(0.1, 1, 0.7, 1) 1.2s both;
}

@keyframes extendLine {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Nav sits on top of the line, right-aligned */
.site-nav {
  position: absolute;
  right: 0;
  bottom: calc(var(--logo-h) * 0.28);
}

.site-nav ul {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.site-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

/* ---------------------------------------------------------------- *
 *  Hero
 * ---------------------------------------------------------------- */

.hero-cards {
  position: absolute;
  inset: 0;
  max-width: 1140px;
  margin: 0 auto;
  pointer-events: none;
  z-index: 1;
}

/* Hero cards drift left-to-right across the hero on a slow conveyor;
   when a card loops back around, main.js swaps in a new random project.
   Three layers keep every @keyframes free of var() (buggy in older
   Safari): the button drifts, .hero-card-tilt holds the static
   rotation and card visuals, .hero-card-inner bobs. Width and height
   are explicit (not aspect-ratio, which Safari doesn't reliably apply
   to buttons) so cards are always square. */
.hero-card {
  --card-size: clamp(84px, 10vw, 128px);
  position: absolute;
  left: calc(-1 * var(--card-size) - 40px);
  width: var(--card-size);
  height: var(--card-size);
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  pointer-events: auto;
  animation: drift 42s linear infinite;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(calc(100vw + 200px)); }
}

/* The whole card bobs (not just the logo inside it), and the tilt
   layer clips its content so logos never poke outside the card. */
.hero-card-bob {
  display: block;
  width: 100%;
  height: 100%;
  animation: floaty 6s ease-in-out infinite;
  animation-delay: var(--bob-delay, 0s);
}

.hero-card-tilt {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transform: rotate(var(--rot, 0deg));
  transition: box-shadow 0.25s ease;
}

.hero-card-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: clamp(6px, 0.7vw, 10px);
}

.hero-card:hover .hero-card-tilt,
.hero-card:focus-visible .hero-card-tilt {
  box-shadow: var(--shadow-lg);
}

.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

/* Lanes: above and below the heading; delays spread the nine cards
   evenly along the belt. */
.hero-card-1 { --rot: -8deg; top: 3%;  animation-delay: 0s;      --bob-delay: -0.5s; }
.hero-card-2 { --rot: 7deg;  top: 70%; animation-delay: -4.7s;   --bob-delay: -2.2s; }
.hero-card-3 { --rot: -6deg; top: 12%; animation-delay: -9.3s;   --bob-delay: -3.6s; }
.hero-card-4 { --rot: 6deg;  top: 82%; animation-delay: -14s;    --bob-delay: -1.4s; }
.hero-card-5 { --rot: 5deg;  top: 21%; animation-delay: -18.7s;  --bob-delay: -4.8s; }
.hero-card-6 { --rot: -5deg; top: 62%; animation-delay: -23.3s;  --bob-delay: -2.9s; }
.hero-card-7 { --rot: -7deg; top: 76%; animation-delay: -28s;    --bob-delay: -1.9s; }
.hero-card-8 { --rot: 6deg;  top: 7%;  animation-delay: -32.7s;  --bob-delay: -4.1s; }
.hero-card-9 { --rot: -4deg; top: 66%; animation-delay: -37.3s;  --bob-delay: -0.9s; }

/* ---------------------------------------------------------------- *
 *  About
 * ---------------------------------------------------------------- */

.about {
  padding: 5rem 0;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(260px, 5fr) 7fr;
  gap: 3.5rem;
  align-items: center;
}

.about h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.9rem);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.about-role {
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 2.25rem;
}

.carousel-hints {
  display: grid;
  gap: 0.85rem;
  list-style: none;
}

.carousel-hints li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.hint-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
}

.hint-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Stacked image carousel */

.image-stack {
  position: relative;
  aspect-ratio: 5 / 4;
  max-width: 560px;
  margin-left: auto;
  width: 100%;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Peek strip: big front photo on the left, the rest peeking in a
   strip along the right edge. Every slot is defined with the same
   animatable properties (left, width, transform) so a strip photo
   grows smoothly into the front position instead of jumping. */
.stack-card {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--card);
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--shadow-md);
  transition:
    left 0.5s cubic-bezier(0.3, 1.1, 0.4, 1),
    width 0.5s cubic-bezier(0.3, 1.1, 0.4, 1),
    transform 0.5s cubic-bezier(0.3, 1.1, 0.4, 1);
}

.stack-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  pointer-events: none;
}

.stack-card[data-pos="0"] { left: 0;   width: 79%; transform: rotate(-1.5deg);            z-index: 5; }
.stack-card[data-pos="1"] { left: 63%; width: 34%; transform: rotate(2deg) scale(0.97);   z-index: 4; }
.stack-card[data-pos="2"] { left: 69%; width: 34%; transform: rotate(4deg) scale(0.9);    z-index: 3; }
.stack-card[data-pos="3"] { left: 74%; width: 34%; transform: rotate(6deg) scale(0.83);   z-index: 2; }
.stack-card[data-pos="4"] { left: 78%; width: 34%; transform: rotate(8deg) scale(0.76);   z-index: 1; }

/* While being dragged, the front card follows the pointer directly */
.stack-card.dragging {
  transition: none;
}

/* Invisible button covering the stack: click or swipe browses,
   hold = fullscreen */
.stack-control {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: transparent;
  border: 0;
  border-radius: 18px;
  cursor: grab;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------------------------------------------------------- *
 *  Projects
 * ---------------------------------------------------------------- */

.projects {
  padding: 4rem 0 5rem;
}

.projects h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

.projects-loc {
  color: var(--ink-faint);
  font-size: 0.9rem;
  margin: -1.25rem 0 1.75rem;
}

/* Tight flush mosaic: square tiles, no gaps, no rounded corners.
   Tile height comes from a padding-top spacer (not aspect-ratio,
   which Safari doesn't reliably apply to buttons). */
.project-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  background: var(--card);
}

.project-tile {
  position: relative;
  display: block;
  padding: 0;
  background: var(--card);
  border: 0;
  border-radius: 0;
  box-shadow: inset 0 0 0 0.5px var(--line);
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.project-tile::before {
  content: "";
  display: block;
  padding-top: 100%;
}

.project-tile:hover,
.project-tile:focus-visible {
  z-index: 2;
  box-shadow: inset 0 0 0 0.5px var(--line), var(--shadow-md);
}

.project-tile img {
  position: absolute;
  inset: 6%;
  width: 88%;
  height: 88%;
  object-fit: contain;
  transition: transform 0.2s ease, opacity 0.25s ease;
}

.project-tile:hover img,
.project-tile:focus-visible img {
  transform: scale(1.07);
}

/* Hover video: sits over the logo and fades in on hover/focus for the
   few projects that have a clip in their asset folder. */
.project-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  background: var(--card);
}

.project-tile.has-video:hover video,
.project-tile.has-video:focus-visible video {
  opacity: 1;
}

.project-tile.has-video:hover img,
.project-tile.has-video:focus-visible img {
  opacity: 0;
}

/* Collapsed grid shows 4 x 2 = 8 tiles; the button below reveals the rest. */
.project-grid[data-collapsed] .project-tile:nth-child(n + 9) {
  display: none;
}

.show-more[hidden] {
  display: none;
}

.show-more {
  display: block;
  margin: 1.5rem auto 0;
  padding: 0.6rem 1.4rem;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.show-more:hover {
  background: var(--bg);
  transform: translateY(-1px);
}

.grid-error {
  color: var(--ink-faint);
}

/* ---------------------------------------------------------------- *
 *  Project modal + lightbox
 * ---------------------------------------------------------------- */

/* Centered explicitly (fixed + transform) — Safari's default dialog
   positioning can leave it pinned to the top-left. */
dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  border: 0;
  border-radius: 22px;
  padding: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  max-width: min(560px, calc(100vw - 2rem));
  width: 100%;
  max-height: calc(100dvh - 3rem);
  overflow: auto;
}

dialog:focus {
  outline: none;
}

/* Vertical scrolling stays native; horizontal drags feed the swipe
   navigation (between projects / fullscreen images). */
dialog {
  touch-action: pan-y;
}

dialog img {
  -webkit-user-drag: none;
  user-select: none;
}

/* The project modal is a full-viewport transparent stage, so slivers
   of the previous / next project can peek in at the screen edges —
   the same affordance as the photo carousel. */
#project-modal {
  top: 0;
  left: 0;
  transform: none;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.modal-deck {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#project-modal .modal-body {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 4.5rem));
  max-height: calc(100dvh - 3rem);
  overflow: auto;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  touch-action: pan-y;
}

.modal-peek {
  --peek-w: 150px;
  --peek-show: 56px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.95);
  width: var(--peek-w);
  height: min(56vh, 430px);
  background: var(--card);
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.modal-peek:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-50%) scale(0.97);
}

.modal-peek img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.modal-peek-prev {
  left: calc(var(--peek-show) - var(--peek-w));
  justify-content: flex-end;
  padding-right: 8px;
}

.modal-peek-next {
  right: calc(var(--peek-show) - var(--peek-w));
  justify-content: flex-start;
  padding-left: 8px;
}

dialog::backdrop {
  background: rgba(15, 15, 14, 0.45);
  backdrop-filter: blur(4px);
}

.modal-body {
  padding: 2rem;
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background 0.15s ease;
}

.modal-close:hover {
  background: var(--bg);
}

.modal-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 1rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.chip {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

.modal-description {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

.modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin-bottom: 1.25rem;
}

.modal-tech li {
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: var(--bg);
  border-radius: 8px;
  padding: 0.25rem 0.6rem;
}

.modal-link {
  display: inline-block;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

/* ---- Case-study modal (content/case-studies/<slug>.json) ---- */

#project-modal.modal-case .modal-body {
  width: min(700px, calc(100vw - 4.5rem));
}

/* Full-bleed media band at the top of the modal. */
.modal-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -2rem -2rem 1.5rem;
  min-height: 180px;
  max-height: 300px;
  overflow: hidden;
  border-radius: 22px 22px 0 0;
  background: var(--bg);
}

.modal-hero img,
.modal-hero video {
  width: 100%;
  height: 100%;
  max-height: 300px;
  object-fit: cover;
}

/* Brand fallback: the logo floating on a tint of the project colour. */
.modal-hero img.modal-hero-brand {
  width: auto;
  height: auto;
  max-width: 65%;
  max-height: 120px;
  object-fit: contain;
}

.modal-tagline {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 1rem;
  margin: -0.4rem 0 1.1rem;
}

.modal-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.8rem 1.2rem;
  padding: 0.9rem 1.1rem;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 1.4rem;
}

.modal-facts .fact-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.1rem;
}

.modal-facts .fact-value {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}

.modal-sections h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 1.15rem 0 0.3rem;
}

.modal-sections h4:first-child {
  margin-top: 0;
}

.modal-sections p {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.modal-sections {
  margin-bottom: 1.4rem;
}

/* Horizontal thumbnail strip; each opens the lightbox. */
.modal-gallery {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  margin-bottom: 1.2rem;
}

.modal-gallery button {
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: 10px;
}

.modal-gallery img {
  height: 88px;
  width: auto;
  border-radius: 10px;
  display: block;
  border: 1px solid var(--line);
  transition: transform 0.15s ease;
}

.modal-gallery button:hover img {
  transform: translateY(-2px);
}

/* Fullscreen image lightbox */

/* Sized by its image, so it can't use the base left:50% shrink-to-fit
   centering (which halves the available width) — centre horizontally
   with inset + auto margins instead. */
#lightbox {
  background: transparent;
  box-shadow: none;
  max-width: none;
  width: fit-content;
  inset: 0;
  margin: auto;
  height: fit-content;
  max-height: none;
  /* No transform: a transformed dialog would become the containing
     block for the position:fixed peek buttons, pinning them to the
     dialog instead of the screen edges. */
  transform: none;
  overflow: visible;
}

#lightbox .lightbox-main {
  max-width: min(92vw, 1100px);
  max-height: 86vh;
  border-radius: 16px;
  background: var(--card);
  padding: 10px;
  box-shadow: var(--shadow-lg);
}

#lightbox .lightbox-main {
  display: block;
}

/* Close button floats inside the photo's top-right corner so it can
   never be clipped by the viewport edge. */
#lightbox .modal-close {
  top: 22px;
  right: 22px;
  box-shadow: var(--shadow-sm);
}

/* Slivers of the neighbouring images peek at the screen edges. */
.lightbox-peek {
  position: fixed;
  top: 50%;
  transform: translateY(-50%) scale(0.94);
  border: 0;
  padding: 5px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  max-width: 36vw;
  transition: box-shadow 0.2s ease;
}

.lightbox-peek:hover {
  box-shadow: var(--shadow-lg);
}

.lightbox-peek img {
  display: block;
  max-height: 46vh;
  max-width: 100%;
  border-radius: 8px;
}

.lightbox-peek-prev { right: calc(100vw - 36px); }
.lightbox-peek-next { left: calc(100vw - 36px); }

/* ---------------------------------------------------------------- *
 *  Let's talk
 * ---------------------------------------------------------------- */

.contact {
  padding: 3rem 0 5rem;
}

.contact h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 2.5rem;
  max-width: 22ch;
}

.contact-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1.25rem;
  max-width: 880px;
}

.contact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}

.contact-icon {
  width: clamp(72px, 9vw, 96px);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 10px 14px rgba(20, 20, 18, 0.16));
  transition: transform 0.2s ease;
}

.contact-icon svg,
.contact-icon img {
  width: 100%;
  height: 100%;
}

a.contact-item:hover .contact-icon,
a.contact-item:focus-visible .contact-icon {
  transform: translateY(-5px) rotate(-3deg);
}

.contact-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.contact-item.is-coming-soon {
  opacity: 0.55;
  cursor: default;
}

/* ---------------------------------------------------------------- *
 *  Footer
 * ---------------------------------------------------------------- */

.site-footer {
  padding: 2rem 0 2.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-faint);
}

/* ---------------------------------------------------------------- *
 *  Responsive
 * ---------------------------------------------------------------- */

@media (max-width: 900px) {
  .project-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .project-grid[data-collapsed] .project-tile:nth-child(n + 9) {
    display: none;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .image-stack {
    margin: 0 auto;
    max-width: 480px;
  }

  .contact-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 600px) {
  /* Keep the sticky header compact: less padding above the nav row
     and a tighter gap before the logo + line row. */
  .site-header {
    padding: 0.6rem 0 0.5rem;
  }

  /* Nav links right-aligned on the first row, above the logo + line. */
  .header-inner {
    --logo-h: 42px;
    flex-wrap: wrap;
  }

  .site-nav {
    position: static;
    width: 100%;
    order: -1;
  }

  .site-nav ul {
    justify-content: flex-end;
    gap: 1.1rem;
    padding: 0 0 0.35rem;
  }

  .site-nav a {
    font-size: 0.8rem;
  }

  .hero-card {
    --card-size: 68px;
    border-radius: 16px;
  }

  .hero-card-inner {
    padding: 5px;
  }

  .about {
    padding: 3.5rem 0;
  }

  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-grid[data-collapsed] .project-tile:nth-child(n + 9) {
    display: none;
  }

  .modal-body {
    padding: 1.5rem;
  }

  .modal-hero {
    margin: -1.5rem -1.5rem 1.25rem;
    min-height: 150px;
  }

  .contact-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
  }

  /* Halve the white space at the very bottom of the page. */
  .contact {
    padding-bottom: 2.5rem;
  }

  .site-footer {
    padding: 1rem 0 1.25rem;
  }
}

/* ---------------------------------------------------------------- *
 *  Reduced motion
 * ---------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  /* Without the conveyor animation, park the hero cards in a static
     spread around the heading instead of off-screen. */
  .hero-card-1 { left: 16%; top: 6%; }
  .hero-card-2 { left: 72%; top: 10%; }
  .hero-card-3 { left: 5%;  top: 42%; }
  .hero-card-4 { left: 82%; top: 44%; }
  .hero-card-5 { left: 21%; top: 76%; }
  .hero-card-6 { left: 68%; top: 72%; }
  .hero-card-7 { left: 44%; top: 4%; }
  .hero-card-8 { left: 40%; top: 80%; }
  .hero-card-9 { left: 90%; top: 74%; }
}
