/* ==========================================================================
   home.css — the front page only.

   Two parts. The opening fills the screen with the WebGL tunnel and carries
   the name and the three ways in. Below it, #work is an ordinary page in the
   site's own vocabulary (site.css tokens, .container, .eyebrow), so scrolling
   down lands somewhere that already looks like the apps pages and the CV.
   ========================================================================== */

/* ——— opening ————————————————————————————————————————————————————————————— */

.hero {
  position: relative;
  isolation: isolate;
  height: 100vh;
  height: 100svh;
  min-height: 30rem;
  background: #000;
  overflow: hidden;
  --hero-pad: clamp(1.5rem, 4vw, 3rem);
  --hero-pad-top: calc(var(--hero-pad) + env(safe-area-inset-top, 0px));
  --hero-pad-bottom: calc(var(--hero-pad) + env(safe-area-inset-bottom, 0px));
}

/* The artwork takes pointer events, so hover parallax and click-to-boost
   work anywhere that isn't a control. */
#backdrop { position: absolute; inset: 0; z-index: 0; }

/* Darkens the top behind the name and runs the bottom edge into the page
   ground, so the seam with #work is a fade and not a hard line. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to bottom,
    rgba(0, 0, 0, 0.35), transparent 25%, transparent 62%, var(--bg) 100%);
}

/* Everything above the artwork lets the pointer through by default and takes
   it back per element — otherwise the overlay would swallow every hover. */
.hero-overlay { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

.identity {
  position: absolute;
  top: var(--hero-pad-top);
  left: var(--hero-pad);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
}
.identity h1 {
  font-size: clamp(0.8rem, 1.6vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.identity p {
  margin-top: 0.35em;
  font-size: clamp(0.66rem, 1.3vw, 0.78rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Below centre: clear of the vanishing point, which is the busiest and
   brightest part of the frame, and in the darker lower third where off-white
   type holds up on its own. */
.hero-nav {
  position: absolute;
  left: 50%;
  top: min(72%, calc(100% - 9rem));
  transform: translate(-50%, -50%);
  display: flex;
  gap: clamp(1.75rem, 5vw, 3.5rem);
  width: max-content;
  max-width: calc(100% - var(--hero-pad) * 2);
}

/* Type only, no box. The padding keeps a finger-sized target. */
.hero-nav a {
  pointer-events: auto;
  display: block;
  padding: 0.9rem 0.4rem;
  color: #f2f2ee;
  text-decoration: none;
  font-size: clamp(0.78rem, 1.6vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.84;
  transition: opacity 0.25s ease, color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  /* This sits on moving artwork; the shadow keeps it legible when a bright
     gate passes behind. */
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.9), 0 0 3px rgba(0, 0, 0, 0.6);
}
.hero-nav a:hover, .hero-nav a:focus-visible { opacity: 1; color: #fff; }
.hero-nav a:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.75); outline-offset: 6px; }

.scroll-cue {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  bottom: var(--hero-pad-bottom);
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--text-dim);
  transition: color 0.25s ease, transform 0.25s ease;
}
.scroll-cue:hover { color: #fff; transform: translateX(-50%) translateY(3px); }
.scroll-cue svg { width: 24px; height: 24px; }

.pause {
  pointer-events: auto;
  position: absolute;
  right: var(--hero-pad);
  bottom: var(--hero-pad-bottom);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 0.25rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-dim);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.25s ease;
}
.pause:hover { color: #fff; }
.pause:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.75); outline-offset: 4px; }
.pause svg { width: 16px; height: 16px; }
.pause .icon-play, .pause[aria-pressed="true"] .icon-pause { display: none; }
.pause[aria-pressed="true"] .icon-play { display: inline; }
.pause[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .scroll-cue { transition: none; }
  .scroll-cue:hover { transform: translateX(-50%); }
}

/* ——— the page below ——————————————————————————————————————————————————————— */

#work { outline: none; }

.home-section { padding-block: 6rem; border-top: 1px solid var(--line); }
.home-section:first-child { border-top: 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.home-section h2 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.95rem;
}
.arrow-link svg { width: 16px; height: 16px; flex-shrink: 0; transition: transform 0.2s ease; }
.arrow-link:hover svg { transform: translate(2px, -2px); }

/* Things I've made — a row that scrolls sideways and snaps to each card. */
.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * 1.5rem) / 3);
  gap: 1.5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  list-style: none;
  /* Room for the focus ring, taken back by the negative margin. */
  padding: 6px;
  margin: -6px;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel:focus-visible { outline: 1px solid var(--line-strong); outline-offset: 2px; }
.carousel > li { min-width: 0; scroll-snap-align: start; scroll-margin-inline: 6px; }

.card-image {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.card-image:hover img { transform: scale(1.025); }
.card-image.top img { object-fit: cover; object-position: top; }

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.25rem 0 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 500;
}
.card-title:hover { text-decoration: underline; text-underline-offset: 5px; }
.card-title svg { width: 18px; height: 18px; flex-shrink: 0; }
.carousel p { color: var(--text-muted); font-size: 0.98rem; line-height: 1.55; }

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.carousel-buttons { display: flex; gap: 0.5rem; }
.carousel-buttons button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--text);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.carousel-buttons button:hover:not(:disabled) { border-color: var(--text-muted); background: var(--surface); }
.carousel-buttons button:disabled { opacity: 0.35; cursor: default; }
.carousel-buttons button:focus-visible { outline: 1px solid var(--text-muted); outline-offset: 3px; }
.carousel-buttons svg { width: 18px; height: 18px; }

/* Clients — logo, name and what I did. */
.clients {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem 1.5rem;
}
/* Logos as the organisations supply them, adjusted only to read on black:
   Novo's blue mark goes white, and DR's white-on-black PNG is screened so its
   black box drops out. Sources are in clients/README.md. */
.client-logo {
  display: flex;
  align-items: center;
  height: 4rem;
  margin-bottom: 1rem;
  overflow: hidden;
}
.client-logo img { width: 9rem; max-width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.client-logo-novo img { width: 11rem; max-width: none; height: 11rem; margin-left: -1.125rem; filter: brightness(0) invert(1); }
.client-logo-lego img { width: 3.5rem; height: 3.5rem; }
.client-logo-dr img { margin-left: -1.5625rem; mix-blend-mode: screen; }

.clients strong { display: block; font-size: 1.15rem; font-weight: 500; }
.clients span:not(.client-logo) { display: block; margin-top: 0.25rem; color: var(--text-muted); font-size: 0.95rem; }

/* A bit of background */
.about {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2.5rem;
}
.about .eyebrow { margin-top: 0.6rem; align-self: start; }
.about .lede { margin-top: 1.25rem; max-width: 46ch; }
.outline-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  margin-top: 2rem;
  padding: 0 1.1rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.outline-button:hover { border-color: var(--text-muted); background: var(--surface); }
.outline-button svg { width: 16px; height: 16px; }

/* The quote at the end */
.quote blockquote { font-size: clamp(1.3rem, 2.6vw, 1.7rem); font-weight: 400; line-height: 1.35; max-width: 30ch; text-wrap: balance; }
.home-section h2, .about .lede, .carousel p { text-wrap: pretty; }
.quote figcaption { margin-top: 0.75rem; color: var(--text-muted); font-size: 0.95rem; }

@media (max-width: 960px) {
  .carousel { grid-auto-columns: calc((100% - 1.5rem) / 2); }
  .clients { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .home-section { padding-block: 4rem; }
  .carousel { grid-auto-columns: 88%; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 0.5rem; margin-bottom: 2rem; }
  .about { grid-template-columns: 1fr; gap: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .card-image img, .arrow-link svg { transition: none; }
  .card-image:hover img, .arrow-link:hover svg { transform: none; }
}
