/* ═══════════════════════════════════════════════════════════════
   PROJECT DETAIL — MOBILE TEMPLATE
   Landing hero section for case study pages.
   Shared by all mobile-based project detail pages.
   ═══════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════
   TYPE SYSTEM
   Every text style on a case study page is one of these seven roles.
   Components apply a role with `font: var(--pd-type-…)` and never set
   family, size, weight or line-height on their own.

     H1          Archivo 44 / 800 / 1.0    section headings, page title
     H2          Archivo 32 / 300 / 1.2    pull quotes (use sparingly)
     H3          Archivo 36 / 700 / 1.15   sub-sections inside a section
     H4          Archivo 22 / 600 / 1.25   eyebrows, card titles
     Body Large  Geist   20 / 400 / 1.55   running copy
     Body Small  Geist   16 / 400 / 1.5    captions, labels, chips, meta
     Callout     Geist   19 / 600 / 1.45   decisions, highlights

   A section reads: H4 eyebrow → H1 heading → Body Large.
   The role tokens live in globals.css so the home page shares them.
   Fonts are loaded by a <link> in each page's <head>.
   ═══════════════════════════════════════════════════════════════ */

.pd-page {
  /* Single-line heights, for wrappers that reserve space for animated text */
  --pd-line-h4: calc(1.375rem * 1.25);
  --pd-line-body-lg: calc(1.25rem * 1.55);
}

/* Case-study content only — the shared nav and footer keep the site font. */
.pd-hero,
.pd-layout {
  --font-sans: var(--pd-font-body);
  --f-display: var(--pd-font-heading);
  --f-head: var(--pd-font-heading);
  --f-body: var(--pd-font-body);
  font: var(--pd-type-body-lg);
  letter-spacing: 0;
}


/* ═══════════════════════════════════════════════════════════════
   DELICUT PAGE SHELL
   Sticky TOC only above 1200px. App Flow black is full-bleed via
   a pseudo-element so no beige edge gaps remain.
   ═══════════════════════════════════════════════════════════════ */

.pd-page {
  --pd-max: 1320px;
  --pd-toc-width: 10.5rem;
  --pd-layout-gap: clamp(3.5rem, 5vw, 5.5rem);
  --pd-layout-pad: clamp(1.5rem, 3vw, 2.5rem);
  /* Long-form reading measure — between full column and tight prose */
  --pd-prose-max: 52rem;
  --pd-flow-escape: calc(
    max(0px, (100vw - var(--pd-max)) / 2)
    + var(--pd-layout-pad)
    + var(--pd-toc-width)
    + var(--pd-layout-gap)
  );
  /* Soft off-white — whiter than site beige, not pure white */
  background-color: var(--color-bg-primary);
  --pd-toc-accent: #FF5900;
}

[data-project="darkroast"].pd-page {
  --pd-toc-accent: #1e6042;
}

.pd-layout {
  display: grid;
  grid-template-columns: var(--pd-toc-width) minmax(0, 1fr);
  gap: var(--pd-layout-gap);
  width: 100%;
  max-width: var(--pd-max);
  margin-inline: auto;
  padding-inline: var(--space-gutter);
  box-sizing: border-box;
  align-items: start;
  background: transparent;
  overflow: visible;
}

.pd-layout-main {
  min-width: 0;
  overflow: visible;
  /* Keep content in the right column so width stays the same without TOC */
  grid-column: 2;
}

.pd-layout-main > section,
.pd-layout-main #pd-problem {
  scroll-margin-top: 1.25rem;
}

/* Cream sections stay in the content column */
.pd-layout-main .pd-tldr {
  padding-inline: 0;
}

/*
   App Flow stays in the content column; ::before paints the
   full-viewport black band (avoids 100vw scrollbar gaps).
*/
.pd-layout-main .pd-flow {
  position: relative;
  z-index: 0;
  width: 100%;
  max-width: none;
  margin-left: 0;
  padding-inline: 0;
  overflow: visible;
  isolation: isolate;
  gap: clamp(2rem, 4vw, 4.5rem);
  grid-template-columns: minmax(0, 1fr);
  padding: var(--space-section) var(--space-gutter);
}

.pd-layout-main .pd-flow::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(-1 * var(--pd-flow-escape));
  width: 100vw;
  background: var(--color-bg-primary);
  z-index: -1;
  pointer-events: none;
}


/* ── Table of contents (temporarily hidden; column reserved) ── */

.pd-toc {
  position: sticky;
  top: clamp(5rem, 10vh, 7rem);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-self: start;
  width: 100%;
  max-height: calc(100dvh - clamp(7rem, 16vh, 11rem));
  overflow-y: auto;
  padding: 0.25rem 0.25rem 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.75rem);
  transition: opacity 320ms var(--ease-out), transform 420ms var(--ease-out), visibility 0s linear 420ms;
}

.pd-toc.pd-toc--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.pd-toc-back {
  font: var(--pd-type-body-sm);
  text-decoration: none;
  color: var(--c-ink);
  opacity: 0.72;
  width: fit-content;
  transition: opacity 0.2s ease, color 0.25s ease;
}

.pd-toc-back:hover {
  opacity: 0.85;
}

.pd-toc-project {
  font: var(--pd-type-h4);
  color: var(--c-ink);
  margin: 0;
  transition: color 0.25s ease;
}

.pd-toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
  margin-top: clamp(1.5rem, 3vh, 2.25rem);
}

.pd-toc-link {
  font: var(--pd-type-body-sm);
  text-decoration: none;
  color: var(--c-ink);
  opacity: 0.42;
  width: fit-content;
  transition: opacity 0.2s ease, color 0.25s ease;
}

.pd-toc-link:hover {
  opacity: 0.7;
}

.pd-toc-link.is-active {
  opacity: 1;
  color: var(--pd-toc-accent);
}

/* Light TOC while it sits over the full-bleed App Flow band */
.pd-toc--on-dark {
  --color-text-primary: #F7F7F7;
  --color-text-secondary: #8C8984;
}

.pd-toc--on-dark .pd-toc-back,
.pd-toc--on-dark .pd-toc-project,
.pd-toc--on-dark .pd-toc-link {
  color: var(--color-text-primary);
}

.pd-toc--on-dark .pd-toc-link.is-active {
  color: var(--pd-toc-accent);
}

/* TOC desktop-only; ≤1200px returns to the simple full-width layout */
@media (max-width: 1200px) {
  .pd-page {
    --pd-toc-width: 0px;
    --pd-layout-gap: 0px;
    --pd-layout-pad: 0px;
    --pd-flow-escape: 0px;
  }

  .pd-toc {
    display: none;
  }

  .pd-layout {
    display: block;
    max-width: none;
    padding-inline: 0;
  }

  .pd-layout-main .pd-tldr,
  .pd-layout-main .pd-context,
  .pd-layout-main .pd-flow,
  .pd-layout-main .pd-contact-cta,
  .pd-layout-main .pd-related {
    padding-inline: max(clamp(2rem, 6vw, 7rem), calc((100% - var(--site-max)) / 2));
  }

  .pd-layout-main .pd-flow {
    width: 100%;
    margin-left: 0;
    gap: clamp(1.5rem, 3vw, 3.25rem);
    grid-template-columns: 52% 48%;
  }

  .pd-layout-main .pd-flow::before {
    display: none;
  }
}

@media (max-width: 768px) {
  .pd-layout-main .pd-tldr,
  .pd-layout-main .pd-context,
  .pd-layout-main .pd-flow,
  .pd-layout-main .pd-contact-cta,
  .pd-layout-main .pd-related {
    padding-inline: max(clamp(1.5rem, 4vw, 3rem), calc((100% - var(--site-max)) / 2));
  }
}


/* ══════════════════════════════════════════════════════════════
   PAGE-LOAD ANIMATIONS
   Hero elements animate in on arrival — no scroll trigger needed.
   ══════════════════════════════════════════════════════════════ */

@keyframes pd-fade-up {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes pd-fade-up-from-below {
  from { opacity: 0; transform: translateY(48px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* Staggered entrance for every hero element */
.pd-hero-meta   { animation: pd-fade-up            0.8s var(--ease-expo) 0.05s both; }
.pd-hero-title  { animation: pd-fade-up            0.9s var(--ease-expo) 0.12s both; }
.pd-hero-btn    { animation: pd-fade-up            0.8s var(--ease-expo) 0.22s both; }
.pd-hero-media  { animation: pd-fade-up-from-below 1s   var(--ease-expo) 0.2s  both; }


/* ── Hero Section ─────────────────────────────────────────────── */

.pd-hero {
  position: relative;
  width: 100%;
  min-height: 78dvh;
  box-sizing: border-box;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 3.5vw, 2.75rem);
  padding-top: clamp(5.5rem, 11vh, 7.25rem);
  padding-bottom: clamp(2.25rem, 4vw, 3.5rem);
  padding-inline: max(clamp(1.5rem, 3vw, 2.5rem), calc((100% - var(--pd-max)) / 2));
  background: transparent;
  background-image: none;
}

.pd-hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(0.7rem, 1.35vw, 1.05rem);
  width: 100%;
  max-width: none;
}

.pd-hero-meta {
  margin: 0;
  font: var(--pd-type-body-sm);
  color: var(--c-ink);
  opacity: 0.6;
}

.pd-hero-title {
  margin: 0;
  font: var(--pd-type-h1);
  color: var(--c-ink);
  text-align: left;
  position: static;
  pointer-events: auto;
  user-select: text;
}

.pd-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  margin-top: 0.15rem;
  font: var(--pd-type-body-sm);
  color: var(--c-ink);
  text-decoration: none;
  width: fit-content;
  padding-bottom: 0.3em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  transition:
    border-color var(--t-fast) var(--ease-out),
    opacity      var(--t-fast) var(--ease-out);
}

.pd-hero-btn:hover {
  border-bottom-color: var(--c-ink);
  opacity: 0.65;
}

.pd-btn-arrow {
  display: inline-block;
  transition: transform var(--t-mid) var(--ease-expo);
}

.pd-hero-btn:hover .pd-btn-arrow {
  transform: translateX(5px);
}

.pd-hero-media {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: max(55dvh, 28rem);
  border-radius: 0;
  overflow: hidden;
  background: #d5ebe3;
}

.pd-hero-media img {
  display: block;
  width: 100%;
  height: max(55dvh, 28rem);
  object-fit: cover;
  object-position: center center;
}


/* ── Responsive (hero) ───────────────────────────────────────── */

@media (max-width: 767px) {
  .pd-hero {
    min-height: 0;
    padding-top: clamp(4.75rem, 10vh, 6rem);
  }

  .pd-hero-media {
    min-height: max(48dvh, 20rem);
  }

  .pd-hero-media img {
    height: max(48dvh, 20rem);
  }
}

@media (max-width: 480px) {
  .pd-hero-media {
    min-height: max(40dvh, 17rem);
  }

  .pd-hero-media img {
    height: max(40dvh, 17rem);
  }
}


/* ═══════════════════════════════════════════════════════════════
   SHARED SECTION TYPE
   Every section opens the same way:

     eyebrow   H4          — where am I
     heading   H1          — the section's point (h2 in the markup)
     body      Body Large  — what you actually read

   An h3.pd-context-heading is a sub-section inside a section and
   takes H3. Eyebrow, heading and body sit tight together as one
   group; the air goes between sections instead.
   ═══════════════════════════════════════════════════════════════ */

.pd-tldr-eyebrow,
.pd-context-eyebrow,
.pd-flow-eyebrow {
  display: block;
  font: var(--pd-type-h4);
  color: var(--c-ink);
  margin: 0 0 0.75rem;
}

.pd-tldr-heading,
.pd-context-heading,
.pd-flow-heading {
  font: var(--pd-type-h1);
  color: var(--c-ink);
  margin: 0 0 1rem;
  max-width: none;
}

h3.pd-context-heading {
  font: var(--pd-type-h3);
  margin-bottom: 0.75rem;
}

.pd-tldr-body,
.pd-context-body,
.pd-flow-desc,
.pd-states-body {
  font: var(--pd-type-body-lg);
  color: var(--c-ink);
  opacity: 0.78;
  max-width: none;
  margin: 0;
}

.pd-tldr-body + .pd-tldr-body {
  margin-top: 0.7em;
}

/* Dark band overrides — App Flow uses the dark theme tokens. */
.pd-flow-eyebrow {
  color: var(--color-text-secondary);
  opacity: 1;
}

.pd-flow-heading {
  color: var(--color-text-primary);
}

.pd-flow-desc {
  color: var(--color-text-primary);
  opacity: 1;
}


/* ═══════════════════════════════════════════════════════════════
   TLDR — METADATA · PROBLEM
   ═══════════════════════════════════════════════════════════════ */

.pd-tldr {
  background: transparent;
  padding-block: clamp(2.75rem, 4.75vw, 4.75rem);
  padding-inline: max(clamp(2rem, 6vw, 7rem), calc((100% - var(--site-max)) / 2));
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 3vw, 2.75rem);
  box-sizing: border-box;
  width: 100%;
  max-width: var(--pd-prose-max);
}


/* ═══════════════════════════════════════════════════════════════
   CONTEXT / OVERVIEW — plain section
   ═══════════════════════════════════════════════════════════════ */

.pd-context {
  padding-block: clamp(2.35rem, 3.85vw, 3.85rem);
  box-sizing: border-box;
  width: 100%;
  max-width: var(--pd-prose-max);
  overflow: visible;
}

.pd-context-body + .pd-context-body,
.pd-problem-figures + .pd-context-body {
  margin-top: 0.9em;
}

.pd-problem-figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  width: 100%;
  margin: clamp(1.75rem, 3vw, 2.75rem) 0;
}

.pd-problem-figures:has(> :only-child),
.pd-problem-figures--stack {
  grid-template-columns: 1fr;
}

.pd-problem-figure {
  margin: 0;
  min-width: 0;
}

.pd-problem-figure img,
.pd-problem-slot {
  display: block;
  width: 100%;
  height: auto;
}

.pd-problem-slot {
  aspect-ratio: 4 / 3;
  height: auto;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.03);
}

.pd-problem-caption {
  margin: 0.5rem 0 0;
  font: var(--pd-type-body-sm);
  color: var(--c-ink);
  opacity: 0.55;
}

@media (max-width: 768px) {
  .pd-problem-figures {
    grid-template-columns: 1fr;
  }
}


/* ═══════════════════════════════════════════════════════════════
   GOALS — stacked user / business pairs
   ═══════════════════════════════════════════════════════════════ */

.pd-goals-list {
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 3vw, 2.5rem);
  margin-top: clamp(0.35rem, 0.8vw, 0.6rem);
}

.pd-goal-pair {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}

.pd-goal-icon {
  width: clamp(2.25rem, 3.5vw, 2.75rem);
  height: clamp(2.25rem, 3.5vw, 2.75rem);
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 0.35rem;
  background: transparent;
  /* Swap this empty slot for an <img> later */
}

.pd-goal-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pd-goal-copy {
  display: flex;
  flex-direction: column;
  gap: clamp(0.85rem, 1.5vw, 1.15rem);
  min-width: 0;
}

.pd-goal {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pd-goal-label {
  font: var(--pd-type-body-sm);
  color: var(--c-ink);
  opacity: 0.55;
}

.pd-goal-text {
  font: var(--pd-type-body-lg);
  color: var(--c-ink);
  opacity: 0.78;
  margin: 0;
}


/* ═══════════════════════════════════════════════════════════════
   DESIGN PROCESS
   ═══════════════════════════════════════════════════════════════ */

.pd-process-list {
  list-style: none;
  margin: 0.8em 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.pd-process-list li {
  position: relative;
  padding-left: 1.1em;
  font: var(--pd-type-body-lg);
  color: var(--c-ink);
  opacity: 0.78;
}

/* Dot is centred on the x-height of the first line, not its box */
.pd-process-list li::before {
  content: '';
  position: absolute;
  left: 0.1em;
  top: 0.65em;
  width: 0.28em;
  height: 0.28em;
  border-radius: 50%;
  background: var(--c-ink);
  opacity: 0.38;
}

.pd-process-decision {
  margin-top: clamp(1.25rem, 2vw, 1.75rem);
}

.pd-process-decision-label {
  margin: 0 0 0.35rem;
  font: var(--pd-type-body-sm);
  color: var(--c-ink);
  opacity: 0.55;
}

.pd-process-decision-text {
  margin: 0;
  font: var(--pd-type-callout);
  color: var(--c-ink);
}

.pd-process-block {
  margin-top: clamp(2.1rem, 3.75vw, 3.25rem);
  padding-top: clamp(1.65rem, 2.85vw, 2.35rem);
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  overflow: visible;
}

.pd-process-block .pd-context-body + .pd-context-body,
.pd-process-list + .pd-context-body {
  margin-top: 0.75em;
}

.pd-process-media {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  width: 100%;
  margin: clamp(1.75rem, 3vw, 2.75rem) 0;
}

.pd-process-video-wrap {
  width: 100%;
  aspect-ratio: 5 / 4;
  overflow: hidden;
  background: transparent;
}

.pd-process-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  /* Zoom past recording chrome / Figma UI on all edges */
  transform: scale(1.14);
  transform-origin: center center;
  background: transparent;
}

.pd-process-figure {
  margin: 0;
  width: 100%;
}

.pd-process-figure img {
  display: block;
  width: 100%;
  height: auto;
}

/*
   States table: title cropped from the PNG and shown as a caption.
   Fade starts after ~8 data rows so the map feels longer than what
   is shown, then dissolves into the page above the caption.
*/
.pd-process-states-table {
  margin: clamp(1.75rem, 3vw, 2.75rem) 0 0;
}

.pd-process-states-table-media {
  position: relative;
  overflow: hidden;
  /* Cropped image is 1448×994; clip through the fading rows */
  aspect-ratio: 1448 / 860;
}

.pd-process-states-table-media::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 20%;
  background: linear-gradient(
    to bottom,
    rgba(245, 244, 241, 0) 0%,
    var(--color-bg-primary) 85%,
    var(--color-bg-primary) 100%
  );
  pointer-events: none;
}

.pd-process-figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  width: 100%;
  margin: clamp(1.75rem, 3vw, 2.75rem) 0 0;
}


/* ═══════════════════════════════════════════════════════════════
   KEY INTERACTION PATTERNS
   Two equal columns: cropped image card, caption, then copy.
   ═══════════════════════════════════════════════════════════════ */

.pd-patterns-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 3.5vw, 2.5rem);
  width: 100%;
  margin-top: clamp(1.5rem, 2.5vw, 2.25rem);
  align-items: start;
}

.pd-pattern {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pd-pattern-figure {
  margin: 0;
  width: 100%;
}

.pd-pattern-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.pd-pattern-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.pd-pattern-figure .pd-problem-caption {
  margin-top: 0.85rem;
}

.pd-pattern-figure + .pd-context-body {
  margin-top: 0.55em;
}


/* ═══════════════════════════════════════════════════════════════
   EXPIRY SCREEN FLOW
   Composite figure, then two labeled states, then a decision.
   ═══════════════════════════════════════════════════════════════ */

.pd-expiry-figure {
  margin: clamp(1.75rem, 3vw, 2.75rem) 0 0;
}

.pd-expiry-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.pd-expiry-states {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 3.5vw, 2.5rem);
  width: 100%;
  margin-top: clamp(1.5rem, 2.5vw, 2.25rem);
  align-items: start;
}

.pd-expiry-state-title {
  margin: 0 0 0.5rem;
  font: var(--pd-type-h4);
  color: var(--c-ink);
}

.pd-expiry-state .pd-context-body + .pd-context-body {
  margin-top: 0.85em;
}


/* ═══════════════════════════════════════════════════════════════
   WHAT I LEARNED
   Lead, then two takeaways, then a closing thought.
   ═══════════════════════════════════════════════════════════════ */

.pd-learned-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 3.5vw, 2.5rem);
  width: 100%;
  margin-top: clamp(1.5rem, 2.5vw, 2.25rem);
  align-items: start;
}

.pd-learned-title {
  margin: 0 0 0.55rem;
  font: var(--pd-type-h4);
  color: var(--c-ink);
}


/* ═══════════════════════════════════════════════════════════════
   CONTACT CTA — full-block mailto at the end of the case study
   ═══════════════════════════════════════════════════════════════ */

.pd-contact-cta {
  display: block;
  width: 100%;
  max-width: var(--pd-prose-max);
  margin-top: clamp(2.75rem, 4.5vw, 4.5rem);
  padding-top: clamp(2rem, 3.5vw, 2.75rem);
  padding-bottom: clamp(2.75rem, 4.5vw, 4.5rem);
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  text-decoration: none;
  color: var(--c-ink);
  box-sizing: border-box;
}

.pd-contact-cta:has(+ .pd-related:not([hidden])) {
  padding-bottom: clamp(2rem, 3.5vw, 2.75rem);
}

.pd-contact-cta-title {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  margin: 0 0 1rem;
  font: var(--pd-type-h1);
}

.pd-contact-cta-copy {
  display: block;
  font: var(--pd-type-body-lg);
  opacity: 0.78;
}

.pd-contact-cta-arrow {
  display: inline-block;
  transition: transform var(--t-mid) var(--ease-expo);
}

.pd-contact-cta:hover .pd-contact-cta-arrow,
.pd-contact-cta:focus-visible .pd-contact-cta-arrow {
  transform: translateX(5px);
}

.pd-contact-cta:focus-visible {
  outline: 2px solid var(--c-ink);
  outline-offset: 6px;
}


/* ═══════════════════════════════════════════════════════════════
   ALSO CHECK OUT — other published case studies
   ═══════════════════════════════════════════════════════════════ */

.pd-related {
  width: 100%;
  max-width: var(--pd-prose-max);
  margin-top: 0;
  padding-top: clamp(2rem, 3.5vw, 2.75rem);
  padding-bottom: clamp(2.75rem, 4.5vw, 4.5rem);
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
}

.pd-related[hidden] {
  display: none;
}

.pd-related-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 3.5vw, 2.5rem);
  width: 100%;
  margin-top: clamp(1.15rem, 2vw, 1.75rem);
}

.pd-related-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-decoration: none;
  color: var(--c-ink);
}

.pd-related-media {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #eceae6;
}

.pd-related-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.pd-related-meta {
  margin: 0.85rem 0 0;
  font: var(--pd-type-body-sm);
  color: var(--c-ink);
  opacity: 0.55;
}

.pd-related-title {
  margin: 0.35rem 0 0;
  font: var(--pd-type-h4);
  color: var(--c-ink);
}

.pd-related-card:hover .pd-related-title,
.pd-related-card:focus-visible .pd-related-title {
  opacity: 0.65;
}

.pd-related-card:focus-visible {
  outline: 2px solid var(--c-ink);
  outline-offset: 6px;
}

@media (max-width: 768px) {
  .pd-process-figures,
  .pd-patterns-list,
  .pd-expiry-states,
  .pd-learned-grid,
  .pd-related-grid {
    grid-template-columns: 1fr;
  }

  .pd-process-video-wrap {
    aspect-ratio: 4 / 5;
  }

  .pd-process-video {
    transform: scale(1.22);
  }
}

@media (max-width: 480px) {
  .pd-process-video-wrap {
    aspect-ratio: 3 / 4;
  }

  .pd-process-video {
    transform: scale(1.28);
  }
}


/* ── Metadata grid ──────────────────────────────────────────── */

.pd-tldr-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1rem, 2vw, 1.75rem);
  border-top: 1px solid var(--color-border);
  padding-top: clamp(1.35rem, 2.2vw, 2rem);
}

.pd-tldr-meta-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem; /* label ↔ value */
}

.pd-tldr-meta-label {
  display: block;
  font: var(--pd-type-body-sm);
  color: var(--c-ink);
  opacity: 0.55;
}

.pd-tldr-meta-value {
  font: var(--pd-type-body-sm);
  color: var(--c-ink);
  margin: 0;
}


/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .pd-tldr-meta {
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(1.25rem, 2.5vw, 2rem);
    row-gap: clamp(1.5rem, 3vw, 2.25rem);
  }

  .pd-tldr-heading,
  .pd-context-heading,
  .pd-flow-heading {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .pd-tldr {
    padding-block: clamp(2.75rem, 5.5vw, 4rem);
    padding-inline: max(clamp(1.5rem, 4vw, 3rem), calc((100% - var(--site-max)) / 2));
    gap: clamp(1.75rem, 3.5vw, 2.75rem);
  }
}

@media (max-width: 767px) {
  .pd-tldr-meta {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.15rem;
    row-gap: 1.75rem;
  }
}


/* ═══════════════════════════════════════════════════════════════
   APP FLOW SECTION
   Dark two-column: animated text left, phone mockup right.
   ═══════════════════════════════════════════════════════════════ */

.pd-flow {
  --color-bg-primary: #0A0A0A;
  --color-bg-secondary: #1A1A1A;
  --color-text-primary: #F7F7F7;
  --color-text-secondary: #8C8984;
  --color-border: #2A2A2A;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-height: 100dvh;
  padding: var(--space-section) var(--space-gutter);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  box-sizing: border-box;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 3.25rem);
}


/* ── Left panel ───────────────────────────────────────────────── */

.pd-flow-left {
  display: flex;
  flex-direction: column;
  gap: 0; /* shared type owns label → heading → body spacing */
}


/* ── Description text with swipe-up animation ─────────────────── */

.pd-flow-desc-wrap {
  position: relative;
  overflow: hidden;
  /*
    Fixed height accommodates ~4 lines of body text.
    Prevents layout shift during the animation swap.
  */
  min-height: calc(var(--pd-line-body-lg) * 4);
}

.pd-flow-desc {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;

  /* Transitions are disabled until .pd-flow--active is added by JS,
     so the initial positioning snap is invisible to the user.       */
  transition: none;
}

/* JS adds this to the section after initial positions are set */
.pd-flow--active .pd-flow-desc {
  transition:
    transform 0.55s var(--ease-expo),
    opacity   0.55s ease;
}

/* ── Three positional states ──────────────────────────────────── */

.pd-flow-desc.is-visible {
  transform: translateY(0);
  opacity: 1;
}

/* Outgoing: slides up and out */
.pd-flow-desc.is-above {
  transform: translateY(-115%);
  opacity: 0;
  pointer-events: none;
}

/* Waiting below: slides up into view on next step */
.pd-flow-desc.is-below {
  transform: translateY(115%);
  opacity: 0;
  pointer-events: none;
}


/* ── Right panel: phone mockup ────────────────────────────────── */

.pd-flow-right {
  display: flex;
  justify-content: center;
  align-items: center;
}

.pd-flow-phone {
  position: relative;
  width: clamp(200px, 24vw, 340px);
  aspect-ratio: 9 / 19.5;
  background: #111111;
  border-radius: clamp(28px, 3.5vw, 48px);
  overflow: hidden;
  box-shadow:
    0 0 0 1.5px rgba(255, 255, 255, 0.13),
    0 0 0 10px  rgba(255, 255, 255, 0.03),
    0 50px 100px rgba(0, 0, 0, 0.7);
}

/* Subtle glass gloss across the top half */
.pd-flow-phone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.06) 0%,
    transparent 52%
  );
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
}

/* Dynamic island / notch */
.pd-flow-phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 33%;
  height: clamp(16px, 2.2%, 22px);
  background: #000000;
  border-radius: 0 0 14px 14px;
  z-index: 3;
}

.pd-flow-phone-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.pd-flow-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/*
   Onboarding video is 1918×1030 with a centered phone on beige bg.
   Equal crop with the Use Cases videos: x=746 y=75 w=426 h=879
*/
.pd-flow-phone--video {
  aspect-ratio: 426 / 879;
  background: #111111;
}

.pd-flow-phone--video .pd-flow-phone-notch {
  display: none;
}

.pd-flow-phone--video::before {
  display: none;
}

.pd-flow-media-video {
  position: absolute;
  width: calc(1918 / 426 * 100%);
  height: calc(1030 / 879 * 100%);
  left: calc(-746 / 426 * 100%);
  top: calc(-75 / 879 * 100%);
  max-width: none;
  object-fit: fill;
  pointer-events: none;
}


/* ── Responsive (flow section) ────────────────────────────────── */

@media (min-width: 768px) {
  .pd-flow,
  .pd-layout-main .pd-flow {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  }
}

@media (max-width: 767px) {
  .pd-flow,
  .pd-layout-main .pd-flow {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
    padding: var(--space-section) var(--space-gutter);
    gap: clamp(1.75rem, 4vw, 2.75rem);
  }

  /* Phone stays below the text on narrow screens */
  .pd-flow-right {
    order: 0;
  }

  .pd-flow-phone {
    width: clamp(160px, 42vw, 240px);
  }

  .pd-flow-desc-wrap {
    min-height: calc(var(--pd-line-body-lg) * 5);
  }
}

@media (max-width: 480px) {
  .pd-flow-phone {
    width: clamp(150px, 52vw, 210px);
  }

  .pd-flow-desc-wrap {
    min-height: calc(var(--pd-line-body-lg) * 6);
  }
}


/* ═══════════════════════════════════════════════════════════════
   TYPE ROLE CLASSES
   For new markup that has no component class of its own.
   Kept last so a role class wins over a component's default.
   ═══════════════════════════════════════════════════════════════ */

.pd-h1      { font: var(--pd-type-h1); }
.pd-h2      { font: var(--pd-type-h2); }
.pd-h3      { font: var(--pd-type-h3); }
.pd-h4      { font: var(--pd-type-h4); }
.pd-body-lg { font: var(--pd-type-body-lg); }
.pd-body-sm { font: var(--pd-type-body-sm); }
.pd-callout { font: var(--pd-type-callout); }
