/* ==========================================================================
   Design system
   --------------------------------------------------------------------------
   Use these tokens and classes everywhere (home page and case studies).
   Raw hex codes, px font sizes and one-off shadows belong here only.

   COLOR (by role: never use a background token for text, or vice versa)
     Backgrounds   --color-bg-white       bright white (button hover fills)
                   --color-bg-paper       off-white page / hero desk
                   --color-bg-dark        dark gray section background
                   --color-bg-card        card panels on the dark section
     Text          --color-text           black text on light backgrounds
                   --color-text-inverse   white text on dark backgrounds
                   --color-text-muted     secondary text on dark
                   --color-link           links on dark
                   --color-signature      handwritten signature
     Borders       --color-border-subtle  card edges on dark
                   --color-border         dividers and outlines on dark
                   --color-border-strong  button outlines on dark
     Accent        --color-accent, --color-accent-selection
     Patterns      --color-dot-light, --color-dot-dark (dotted backgrounds)
     Tablet        --color-device-body, --color-device-stroke,
                   --gradient-device-screen, --effect-glow, --effect-glare

   TYPE
     Fonts         --font-sans (Poppins), --font-script (signature)
     Sizes         --text-2xs 12 · --text-xs 14 · --text-base 16 ·
                   --text-md 18 · --text-lg 20 · --text-xl 23 ·
                   --text-2xl 30 · --text-3xl 38 · --text-display 75 (px)
     Weights       --weight-regular 400 · -medium 500 · -semibold 600 · -bold 700
     Line height   --leading-none 1 · -tight 1.1 · -snug 1.25 · -normal 1.5
     Tracking      --tracking-tight · -tighter · -display

     Elements      h1–h4, p and small get these by default.
     Classes       .text-display .text-h1 .text-h2 .text-h3 .text-h4
                   .text-lead .text-body .text-small .text-caption
                   .text-muted — use these to give any element a role's look
                   regardless of its tag (e.g. an h2 that looks like .text-h3).

   SPACING         --space-1 4 · -2 8 · -3 12 · -4 16 · -5 20 · -6 24 ·
                   -7 28 · -8 32 · -10 40 · -12 48 · -16 64 (px)

   SHADOWS         --shadow-card, --shadow-device, --shadow-pen,
                   --shadow-portrait
   ========================================================================== */
:root {
  /* ---- Color: backgrounds ---- */
  --color-bg-white: #ffffff;
  --color-bg-paper: #f6f6f3;
  --color-bg-dark: #1d1f20;
  --color-bg-card: rgba(31, 34, 36, 0.92);

  /* ---- Color: text ---- */
  --color-text: #111314;
  --color-text-inverse: #ffffff;
  --color-text-muted: #999fa0;
  --color-link: var(--color-accent);
  --color-signature: #0872a1;

  /* ---- Color: borders (on dark) ---- */
  --color-border-subtle: rgba(255, 255, 255, 0.06);
  --color-border: rgba(255, 255, 255, 0.15);
  --color-border-strong: #ffffff;

  /* ---- Color: accent ---- */
  --color-accent: #3fa3f7;
  --color-accent-selection: rgba(28, 120, 210, 0.45);

  /* ---- Color: dotted background patterns ---- */
  --color-dot-light: rgba(20, 22, 22, 0.16);
  --color-dot-dark: rgba(255, 255, 255, 0.09);

  /* ---- Color: hero tablet ---- */
  --color-device-body: #303536;
  --color-device-stroke: #55595b;
  --gradient-device-screen: linear-gradient(100deg, #1c2c36 0%, #2b363d 50%, #4a5054 100%);
  --effect-glow: radial-gradient(
    ellipse at center,
    rgba(0, 150, 230, 0.14) 0%,
    rgba(0, 150, 230, 0.08) 35%,
    transparent 70%
  );
  --effect-glare: linear-gradient(
    62deg,
    transparent 51%,
    rgba(197, 238, 255, 0.08) 65%,
    rgba(197, 238, 255, 0.29) 100%
  );

  /* ---- Type ---- */
  --font-sans: Poppins, ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-script: "Segoe Script", "Bradley Hand", cursive;

  --text-2xs: 0.75rem; /* 12px: captions, labels */
  --text-xs: 0.875rem; /* 14px: small text, buttons */
  --text-base: 1rem; /* 16px: body */
  --text-md: 1.125rem; /* 18px */
  --text-lg: 1.25rem; /* 20px: lead paragraphs, h4 */
  --text-xl: 1.4375rem; /* 23px: h3 */
  --text-2xl: 1.875rem; /* 30px: h2 */
  --text-3xl: 2.375rem; /* 38px: h1 */
  --text-display: 4.6875rem; /* 75px: hero headline */
  --text-display-fluid: clamp(2.5rem, 9vw, 4rem); /* display on tablets/phones */

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --leading-none: 1;
  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;

  --tracking-tight: -0.01em;
  --tracking-tighter: -0.03em;
  --tracking-display: -0.05em;

  /* ---- Spacing ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ---- Shadows ---- */
  --shadow-card: 0 25px 50px rgba(0, 0, 0, 0.2);
  --shadow-device: 0 30px 50px rgba(0, 0, 0, 0.32), 0 70px 120px rgba(0, 0, 0, 0.22);
  --shadow-pen: drop-shadow(0 22px 18px rgba(0, 0, 0, 0.45)); /* filter */
  --shadow-portrait: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.28)); /* filter */

  /* ---- Layout ---- */
  --max-width: 832px;
  --max-width-wide: 1020px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--color-text);
  background: var(--color-bg-paper);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

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

/* ---- Type: element defaults ---- */
h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-4);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tighter);
}

h1 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
}

h2 {
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
}

h3 {
  font-size: var(--text-xl);
  line-height: var(--leading-none);
}

h4 {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
}

p {
  margin: 0 0 var(--space-4);
}

small {
  font-size: var(--text-xs);
}

/* ---- Type: role classes (any tag) ---- */
.text-display {
  font-size: var(--text-display);
  line-height: var(--leading-none);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-display);
}

.text-h1 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tighter);
}

.text-h2 {
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tighter);
}

.text-h3 {
  font-size: var(--text-xl);
  line-height: var(--leading-none);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tighter);
}

.text-h4 {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tighter);
}

.text-lead {
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  font-weight: var(--weight-regular);
}

.text-body {
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  font-weight: var(--weight-regular);
}

.text-small {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
}

.text-caption {
  font-size: var(--text-2xs);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-tight);
}

.text-muted {
  color: var(--color-text-muted);
}

/* ==========================================================================
   Home page
   ========================================================================== */
.hero {
  min-height: 1080px;
  /* Flexes with window height: tighter on laptops, roomier on tall screens */
  padding: clamp(32px, 7vh, 64px) 40px 116px;
  background-color: var(--color-bg-paper);
  background-image: radial-gradient(
    circle,
    var(--color-dot-light) 1px,
    transparent 1.2px
  );
  background-size: 20px 20px;
}

.hero__inner {
  width: min(100%, var(--max-width));
  margin: 0 auto;
}

.hero__meta {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
}

.hero__meta p {
  margin: 0;
  font-size: var(--text-md);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
}

.hero__pen {
  width: min(40%, 20rem);
  height: auto;
  filter: var(--shadow-pen);
}

.tablet {
  --screen-radius: 58px;
  position: relative;
  margin-top: var(--space-6);
}

/* Short desktop and tablet windows: scale the hero column down in steps so
   everything down to the signature fits on first load. The column needs about
   790px at full size; each step holds down to the next step's max-height.
   zoom scales layout too, unlike transform, so everything stays aligned. */
@media (min-width: 801px) and (max-height: 920px) {
  .hero__inner {
    zoom: 0.92; /* e.g. MacBook Pro 14" in Chrome */
  }
}

@media (min-width: 801px) and (max-height: 810px) {
  .hero__inner {
    zoom: 0.84; /* e.g. 1366×768 laptops */
  }
}

@media (min-width: 801px) and (max-height: 740px) {
  .hero__inner {
    zoom: 0.76; /* e.g. Galaxy Tab S6 landscape */
  }
}

@media (min-width: 801px) and (max-height: 670px) {
  .hero__inner {
    zoom: 0.68;
  }
}

/* Phones turned sideways keep their earlier scale */
@media (min-width: 801px) and (max-height: 500px) {
  .hero__inner {
    zoom: 0.87;
  }
}

/* Hardware buttons: two volume keys on top, power key on the left edge */
.tablet__controls {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.tablet__controls i {
  position: absolute;
  background: var(--color-device-body);
}

.tablet__controls i:nth-child(1),
.tablet__controls i:nth-child(2) {
  top: -5px;
  width: 39px;
  height: 5px;
  border-radius: 2px 2px 0 0;
}

.tablet__controls i:nth-child(1) {
  left: 100px;
}

.tablet__controls i:nth-child(2) {
  left: 149px;
}

.tablet__controls i:nth-child(3) {
  top: 80px;
  left: -5px;
  width: 5px;
  height: 67px;
  border-radius: 2px 0 0 2px;
}

.tablet__screen {
  position: relative;
  aspect-ratio: 832 / 468;
  overflow: hidden;
  border: 2px solid var(--color-device-stroke);
  border-radius: var(--screen-radius);
  isolation: isolate;
  background: var(--gradient-device-screen);
}

/* Shadow on its own layer so the reveal can fade it with opacity (no repaint) */
.tablet__shadow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: var(--screen-radius);
  box-shadow: var(--shadow-device);
}

/* Solid site-colored layer the hero hands off to (opacity driven by script.js) */
.tablet__blank {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: var(--color-bg-dark);
  opacity: 0;
}

/* "Abstract Abyss" halftone, matching Figma: multiply at 50% */
.tablet__texture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("images/Abstract%20Abyss.png") center / cover no-repeat;
  mix-blend-mode: multiply;
  opacity: 0.5;
}

/* Blue lighting glow: a soft ellipse of light in the top-left corner */
.tablet__screen::before {
  content: "";
  position: absolute;
  top: -30%;
  left: -20%;
  width: 95%;
  height: 140%;
  pointer-events: none;
  border-radius: 50%;
  background: var(--effect-glow);
  filter: blur(40px);
  opacity: var(--fx, 1);
}

/* Glass glare: a diagonal sheen that brightens toward the right edge */
.tablet__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: var(--fx, 1);
  background: var(--effect-glare);
}

.tablet__screen h1 {
  position: relative;
  z-index: 3;
  margin: 0;
  padding: 72px 0 0 116px;
  color: var(--color-text-inverse);
  font-size: var(--text-display);
  line-height: var(--leading-none);
  letter-spacing: var(--tracking-display);
  font-weight: var(--weight-bold);
}

.tablet__screen h1 .line {
  display: block;
}

.tablet__screen h1 .accent {
  color: var(--color-accent);
}

/* Text selection on "designed": highlight box plus two drag handles */
.selection {
  position: relative;
  display: inline-block;
}

.selection::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0.12em -0.1em 0.08em;
  background: var(--color-accent-selection);
}

.selection i {
  position: absolute;
  top: 0.12em;
  bottom: 0.08em;
  width: 2px;
  background: var(--color-accent);
}

.selection i::before {
  content: "";
  position: absolute;
  left: -7px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent);
}

.selection i:first-of-type {
  left: -0.1em;
}

.selection i:first-of-type::before {
  bottom: -8px;
}

.selection i:last-of-type {
  right: -0.1em;
}

.selection i:last-of-type::before {
  top: -8px;
}

.tablet__portrait {
  position: absolute;
  z-index: 4;
  bottom: -4px;
  left: 50%;
  /* Sized by screen height so the head always reaches the third headline line */
  width: auto;
  height: 84%;
  max-width: none;
  transform: translateX(-50%);
  filter: var(--shadow-portrait);
}

.scroll-button {
  position: absolute;
  z-index: 5;
  right: 44px;
  bottom: 40px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  color: var(--color-text-inverse);
  border: 2px solid var(--color-border-strong);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.scroll-button:hover,
.scroll-button:focus-visible {
  color: var(--color-text);
  background: var(--color-bg-white);
}

/* Drawn with currentColor, so it follows the text on hover */
.scroll-button__icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.scroll-button__label--touch {
  display: none;
}

/* Touch as the main input (phones, tablets): "Swipe Up" with the arrow
   pointing up. Keyed to input, not width, so a narrow desktop window still
   says "Scroll Down". display: none also drops the unused label for screen
   readers. */
@media (hover: none) and (pointer: coarse) {
  .scroll-button__label {
    display: none;
  }

  .scroll-button__label--touch {
    display: inline;
  }

  .scroll-button__icon {
    transform: rotate(180deg);
  }
}

.hero__intro {
  margin: var(--space-12) 0 0;
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
}

.signature {
  margin: var(--space-6) 0 0;
  color: var(--color-signature);
  font-family: var(--font-script);
  font-size: var(--text-xl);
  font-style: italic;
}

.work {
  padding: 0 var(--space-10) 88px;
  color: var(--color-text-inverse);
  background-color: var(--color-bg-dark);
  background-image: radial-gradient(
    circle,
    var(--color-dot-dark) 1px,
    transparent 1.2px
  );
  background-size: 22px 22px;
}

.work__inner {
  width: min(100%, var(--max-width-wide));
  margin: 0 auto;
}

.project-nav {
  /* Sticks while scrolling the case studies. The negative offset (top
     padding + one 12px title line) tucks "Marve’s Work" above the screen
     edge, leaving just the icons with the row gap above them. */
  position: sticky;
  top: calc(-1 * (8px + 0.75rem * 1.5));
  z-index: 10;
  width: min(340px, 100%);
  margin: 0 auto var(--space-16);
  padding: var(--space-2) var(--space-4);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4) var(--space-3);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-top: 0;
  border-radius: 0 0 20px 20px;
  box-shadow: var(--shadow-card);
}

/* Spans all three columns */
.project-nav__title {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-tight);
  text-align: center;
}

.project-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--color-text-inverse);
  font-size: var(--text-2xs);
  line-height: var(--leading-normal);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
}

.project-nav__thumb {
  display: block;
  width: 32px;
  max-width: 100%;
  height: auto;
  margin-bottom: var(--space-1);
  transition: transform 0.2s;
}

.project-nav a:hover .project-nav__thumb {
  transform: translateY(calc(-1 * var(--space-1)));
}

.case-study {
  /* Land below the sticky nav when jumped to */
  scroll-margin-top: 100px;
  min-height: 440px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: var(--space-12);
  padding: var(--space-12);
  margin-bottom: var(--space-16);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-card);
}

.case-study__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.archive-icon {
  position: relative;
  width: 72px;
  height: 74px;
  margin-bottom: var(--space-4);
}

.archive-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.case-study__copy > p {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--leading-snug);
}

.case-study__rule {
  width: 100%;
  height: 1px;
  margin: var(--space-6) 0 var(--space-5);
  background: var(--color-border);
}

.case-study__copy > .case-study__metrics {
  margin-bottom: var(--space-7);
  color: var(--color-text-muted);
}

.case-study__cta {
  margin-top: auto;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-strong);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-decoration: none;
}

.case-study__cta span {
  margin-left: var(--space-4);
}

.case-study__cta:hover,
.case-study__cta:focus-visible {
  color: var(--color-text);
  background: var(--color-bg-white);
}

.project-visual {
  position: relative;
  /* Full thumbnail at its natural shape, never cropped */
  align-self: center;
  overflow: hidden;
  background: var(--color-bg-dark);
}

.project-visual > img {
  display: block;
  width: 100%;
  height: auto;
}

.footer {
  padding: var(--space-8) var(--space-16) var(--space-10);
  color: var(--color-text-inverse);
  background: var(--color-bg-dark);
  border-top: 1px solid var(--color-border);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer p {
  margin: 0;
}

.footer__identity > p {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  font-size: var(--text-xs);
}

.footer__details {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
}

.footer__details strong {
  padding: var(--space-3);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}

.footer__details > div {
  padding: var(--space-2) var(--space-3);
  border-left: 1px solid var(--color-border);
  font-size: var(--text-xs);
}

.footer__details a {
  text-decoration: none;
}

.footer__link {
  color: var(--color-link);
}

.footer__details span {
  display: inline-block;
  margin: var(--space-1) var(--space-1) 0 0;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.footer__social {
  text-align: right;
}

.footer__social > p {
  margin-bottom: var(--space-4);
}

.footer__social > div {
  display: flex;
  justify-content: flex-end;
  /* Offset the 44px tap area so the 25px icons align visually */
  margin: -9.5px -9.5px -9.5px 0;
}

.footer__social a {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  transition: opacity 0.2s;
}

.footer__social a:hover,
.footer__social a:focus-visible {
  opacity: 0.7;
}

.footer__social img {
  display: block;
  width: 25px;
  height: 25px;
  filter: invert(1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 800px) {
  .hero {
    min-height: auto;
    padding: 48px 20px 72px;
  }

  .hero__meta p {
    font-size: var(--text-xs);
  }

  .tablet {
    --screen-radius: 34px;
  }

  .tablet__screen {
    aspect-ratio: auto;
    min-height: 430px;
  }

  .tablet__screen h1 {
    padding: var(--space-10) var(--space-6) 0 var(--space-8);
    font-size: var(--text-display-fluid);
  }

  .tablet__portrait {
    height: 90%;
  }

  .hero__intro {
    font-size: var(--text-base);
  }

  .work {
    padding: 0 var(--space-5) 60px;
  }

  /* Stacked layout: one even 28px rhythm for rule → metrics → CTA → image */
  .case-study {
    grid-template-columns: 1fr;
    padding: var(--space-7);
    gap: var(--space-7);
  }

  .case-study__rule {
    margin-bottom: var(--space-7);
  }

  /* Stacked layout: no min-height, so the CTA sits right under the metrics
     (the 28px metrics margin) instead of being pushed to the bottom. */
  .case-study__copy {
    min-height: 0;
  }

}

@media (max-width: 520px) {
  /* Phone cards: one column on an even 24px rhythm. display: contents lets
     the copy's children join the card's grid, so the gap spaces everything
     and the CTA can move below the image. */
  .case-study {
    padding: var(--space-6);
    gap: var(--space-6);
  }

  .case-study__copy {
    display: contents;
  }

  .case-study .archive-icon,
  .case-study h3,
  .case-study__copy > p,
  .case-study__rule,
  .case-study__copy > .case-study__metrics {
    margin: 0;
  }

  /* Full-width CTA under the image */
  .case-study__cta {
    order: 1;
    width: 100%;
    margin-top: 0;
    padding: var(--space-4);
    text-align: center;
  }

  .case-study__cta span {
    margin-left: var(--space-3);
  }

  .hero__pen {
    width: 48%;
  }

  .tablet__screen {
    min-height: 390px;
  }

  .tablet__screen h1 {
    font-size: var(--text-3xl);
  }

  .tablet__portrait {
    height: 100%;
  }

  .project-nav {
    gap: var(--space-2);
  }

  .case-study {
    scroll-margin-top: 116px;
  }

  /* Very narrow screens: let "Open Everydai" wrap rather than overflow */
  .project-nav a {
    white-space: normal;
  }

  .footer {
    padding: var(--space-7) var(--space-5);
  }

  /* Mobile footer: everything centered */
  .footer__inner {
    align-items: center;
    flex-direction: column;
    gap: var(--space-8);
  }

  .footer__social {
    text-align: center;
  }

  .footer__social > div {
    justify-content: center;
    margin: -9.5px 0;
  }
}

/* Phones turned sideways: little vertical room, so the sticky nav shows
   project names only */
@media (orientation: landscape) and (max-height: 500px) {
  .project-nav__thumb {
    display: none;
  }
}

/* Phones turned sideways (two-column cards): the thumbnail's top edge lines
   up with the top of the title's lowercase letters. Offset = archive icon
   (74px) + its margin (--space-4) + Poppins' x-height top within the title's
   line box (0.294em of the --text-xl title). */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 801px) {
  .project-visual {
    align-self: start;
    margin-top: calc(74px + var(--space-4) + var(--text-xl) * 0.294);
  }
}

/* ------------------------------------------------------------------
   Scroll reveal (see docs/hero-reveal.md)
   Only active when <html> has .has-reveal (JS + motion allowed).
   Stacking, back to front: desk (.hero) → site (.work, clipped to the
   tablet screen) → tablet frame + hero layers.
   ------------------------------------------------------------------ */
.has-reveal {
  scroll-behavior: auto;
}

/* The pin is native sticky: .reveal sticks while .reveal-spacer scrolls by.
   (No transforms afterwards, so sticky children like the case-study nav work.) */
.reveal-spacer {
  display: none;
}

.has-reveal .reveal {
  position: sticky;
  top: 0;
}

.has-reveal .reveal-spacer {
  display: block;
  height: 400vh; /* script.js sets the exact length */
}

.has-reveal .hero {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  min-height: 0;
  padding-block: clamp(32px, 7vh, 64px);
  overflow: hidden;
}

/* Center the hero vertically on tall screens (tablets, big monitors). Auto
   margins collapse to 0 when the content is taller than the screen, so short
   laptops stay top-aligned instead of being pushed off the top. */
.has-reveal .hero__inner {
  margin: auto;
}

.has-reveal .work {
  position: relative;
  z-index: 1;
  /* Fully clipped until script.js syncs it to the tablet screen */
  clip-path: inset(0 0 100% 0);
}

.has-reveal .tablet {
  z-index: 2;
  transform-origin: 0 0;
  /* Clicks pass through the frame to the site showing in the screen, so the
     case-study links work as soon as they're visible. */
  pointer-events: none;
}

.has-reveal .scroll-button {
  pointer-events: auto;
}

.has-reveal .tablet.is-animating {
  will-change: transform;
}

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

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

  .project-nav a:hover .project-nav__thumb {
    transform: none;
  }
}
