/* Components for case-study pages + about: header menu, media scroll, takeover sheet.
   Loads after styles.css and reuses its tokens. */

:root {
  --dark: #16130f;
  --dark-text: #f5f1ea;
  --dark-soft: #a39c90;
  --dark-line: rgba(245, 241, 234, 0.16);
  --menu: #c9f24c;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
}

/* ---------- header (wordmark + burger, How&How homepage setup) ---------- */

.case-header {
  border-bottom: none;
  align-items: center;
}

body.dark .case-header {
  background: color-mix(in srgb, var(--dark) 80%, transparent);
}

.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 34px;
  padding: 4px 0;
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  transition: background 0.15s ease;
}

.menu-toggle:hover span {
  background: var(--accent);
}

body.dark .menu-toggle span {
  background: var(--dark-text);
}

body.dark .menu-toggle:hover span {
  background: var(--accent);
}

/* ---------- slide-in menu panel ---------- */

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(22, 19, 15, 0.35);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

body.menu-open .menu-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.menu-panel {
  position: fixed;
  z-index: 50;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(440px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  padding: 36px;
  background: var(--menu);
  color: var(--ink);
  border-radius: 18px;
  transform: translateX(calc(100% + 28px));
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
}

body.menu-open .menu-panel {
  transform: translateX(0);
}

.menu-close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.menu-close:hover {
  transform: rotate(90deg);
}

.menu-primary {
  list-style: none;
  margin-top: 96px;
}

.menu-primary a {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(38px, 5vw, 52px);
  line-height: 1.18;
  letter-spacing: -0.015em;
  transition: color 0.15s ease;
}

.menu-primary a:hover {
  color: var(--accent);
}

.menu-secondary {
  list-style: none;
  margin-top: 64px;
}

.menu-secondary li {
  border-top: 1px solid rgba(26, 24, 21, 0.25);
}

.menu-secondary a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px;
  font-size: 16px;
  font-weight: 500;
  transition: color 0.15s ease, padding-left 0.2s ease;
}

.menu-secondary a:hover {
  color: var(--accent);
  padding-left: 12px;
}

.menu-secondary a::after {
  content: "→";
}

.menu-email {
  display: inline-block;
  margin-top: auto;
  padding-top: 48px;
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 22px);
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}

.menu-email:hover {
  color: var(--accent);
}

.menu-foot {
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-socials {
  display: flex;
  gap: 10px;
}

.menu-socials a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 11px;
  transition: background 0.15s ease, color 0.15s ease;
}

.menu-socials a:hover {
  background: var(--ink);
  color: var(--menu);
}

.menu-copy {
  font-size: 11px;
  color: rgba(26, 24, 21, 0.6);
}

/* ---------- case study media scroll ---------- */

.case-hero {
  height: min(86vh, 900px);
  border-radius: 0;
}

/* full-frame film hero — never crop the chrome out of a screen recording */
.case-hero.hero-16x9 {
  height: auto;
  aspect-ratio: 16 / 9;
}

/* portrait phones: never cover-crop a hero — full width, natural ratio */
@media (max-width: 760px) {
  .case-hero,
  .case-hero.hero-16x9 {
    height: auto;
    aspect-ratio: auto;
  }

  .case-hero video,
  .case-hero > img {
    height: auto;
    object-fit: contain;
  }
}

.case-caption {
  padding: 56px var(--space-gutter) 64px;
}

.case-kicker {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.case-title {
  margin-top: 18px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(27px, 3.6vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.read-more {
  margin-top: 28px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: clamp(20px, 2.4vw, 28px);
  color: var(--accent);
  cursor: pointer;
}

.read-more:hover {
  text-decoration: underline;
  text-underline-offset: 6px;
}

.case-media {
  display: grid;
  gap: 20px;
  padding: 0 var(--space-gutter) 20px;
}

.case-media .duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ---------- placeholder cards ---------- */

.ph {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, rgba(228, 87, 46, 0.035) 14px 28px),
    #f1ebe1;
  overflow: hidden;
}

.ph-hero {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.ph-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  padding: 0 16px;
}

/* ---------- real media ---------- */

.media {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
}

.media video,
.media > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.r-16x9  { aspect-ratio: 16 / 9; }
.r-16x10 { aspect-ratio: 16 / 10; }
.r-21x9  { aspect-ratio: 21 / 9; }
.r-4x5   { aspect-ratio: 4 / 5; }
.r-1x1   { aspect-ratio: 1 / 1; }

/* ---------- perq character tiles (slots 08/09) ----------
   The delivered animated SVGs (skater cup, mobile launch screen) play
   live as <img>. Contained on a shared lavender ground instead of
   cover-cropped — the artwork sets its own frame. */

.perq-sticker {
  background: #e4d9f3;
}

.perq-sticker > img {
  object-fit: contain;
  padding: 7%;
}

/* ---------- store walkthrough steps (PERQ slot 07b) ----------
   Boards from the Figma store build with one-line captions — the only
   captioned media on case pages, because the sequence IS the point. */

.step-note {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- rings explainer — live V3 landing section (slot 04) ----------
   A ~4-viewport scroll-driven scene living in the media grid like any
   other card. On desktop the card look (cream, radius, clip) is on the
   component's PINNED STAGE inside the bundle; this wrapper clip rounds
   the mobile full-bleed band's ends. overflow: clip (not hidden) — hidden
   would re-anchor the sticky stage to this box and the pin would never
   engage. */

#rings-explainer {
  border-radius: 10px;
  overflow: clip;
}

/* ---------- before/after compare (slot 08) ----------
   Two stacked screens; the as-is layer is clipped to --reveal and a
   pointer-driven handle wipes between them. No scroll hijack —
   touch-action: pan-y keeps vertical swipes scrolling the page. */

.compare {
  --reveal: 25%;
  /* both boards are exported at this exact ratio — no cover-crop */
  aspect-ratio: 1880 / 1080;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.compare img {
  position: absolute;
  inset: 0;
}

.compare .compare-before {
  clip-path: inset(0 calc(100% - var(--reveal)) 0 0);
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--reveal);
  width: 2px;
  transform: translateX(-1px);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(7, 8, 13, 0.35);
}

.compare-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #1e1a38;
  box-shadow: 0 2px 12px rgba(7, 8, 13, 0.35);
}

.compare-tag {
  position: absolute;
  top: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  padding: 5px 9px;
  border-radius: 999px;
  pointer-events: none;
}

.compare-tag-before {
  left: 14px;
  color: #f4efe3;
  background: rgba(30, 26, 56, 0.75);
}

.compare-tag-after {
  right: 14px;
  color: #1e1a38;
  background: rgba(244, 239, 227, 0.9);
}

/* ---------- orb session-flow diagram (slot 01) ---------- */

/* Fixed 646×807 stage scaled to the slot width so the diagram stays
   pixel-faithful to the design at every viewport size. */
.orb-flow {
  background: #f1ebe1;
}

.orb-flow-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 646px;
  height: 807px;
  transform-origin: 0 0;
  transform: scale(var(--orb-scale, 1));
}

.orb-flow-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.orb-flow-head {
  position: absolute;
  left: 32px;
  top: 36px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.orb-flow.is-live .orb-flow-head {
  opacity: 1;
}

.orb-flow-title {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.18em;
  line-height: 14px;
  color: #191b26;
}

.orb-flow-fig {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  line-height: 10px;
  color: rgba(25, 27, 38, 0.8);
}

.orb-flow-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 6px rgba(15, 20, 32, 0.35));
}

.orb-flow-links path {
  stroke: #fff;
  stroke-width: 1.5;
  stroke-dasharray: 2 4;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.orb-flow-links .orb-flow-arrow {
  stroke: none;
  fill: #fff;
}

.orb-flow.is-live .orb-flow-links path {
  opacity: 1;
}

.orb-flow-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.orb-step {
  position: absolute;
  width: 348px;
  padding: 14px 32px;
  border-radius: 999px;
  background: rgba(250, 250, 250, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 36px rgba(15, 20, 32, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 14px;
  line-height: 18px;
  color: #191b26;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.orb-flow.is-live .orb-step {
  opacity: 1;
  transform: none;
}

.orb-step:nth-child(1) { left: 60px;  top: 128px; }
.orb-step:nth-child(2) { left: 98px;  top: 228px; }
.orb-step:nth-child(3) { left: 136px; top: 328px; }
.orb-step:nth-child(4) { left: 174px; top: 428px; }
.orb-step:nth-child(5) { left: 212px; top: 528px; }
.orb-step:nth-child(6) { left: 250px; top: 628px; }

/* progressive reveal: each step lands, then the connector to the next */
.orb-flow.is-live .orb-step:nth-child(1) { transition-delay: 0.15s; }
.orb-flow.is-live .orb-step:nth-child(2) { transition-delay: 0.4s; }
.orb-flow.is-live .orb-step:nth-child(3) { transition-delay: 0.65s; }
.orb-flow.is-live .orb-step:nth-child(4) { transition-delay: 0.9s; }
.orb-flow.is-live .orb-step:nth-child(5) { transition-delay: 1.15s; }
.orb-flow.is-live .orb-step:nth-child(6) { transition-delay: 1.4s; }

.orb-flow.is-live .orb-flow-links path:nth-of-type(1) { transition-delay: 0.35s; }
.orb-flow.is-live .orb-flow-links path:nth-of-type(2) { transition-delay: 0.6s; }
.orb-flow.is-live .orb-flow-links path:nth-of-type(3) { transition-delay: 0.85s; }
.orb-flow.is-live .orb-flow-links path:nth-of-type(4) { transition-delay: 1.1s; }
.orb-flow.is-live .orb-flow-links path:nth-of-type(5) { transition-delay: 1.35s; }
.orb-flow.is-live .orb-flow-links path:nth-of-type(6) { transition-delay: 0.5s; }
.orb-flow.is-live .orb-flow-links path:nth-of-type(7) { transition-delay: 0.75s; }
.orb-flow.is-live .orb-flow-links path:nth-of-type(8) { transition-delay: 1s; }
.orb-flow.is-live .orb-flow-links path:nth-of-type(9) { transition-delay: 1.25s; }
.orb-flow.is-live .orb-flow-links path:nth-of-type(10) { transition-delay: 1.5s; }

.orb-step-num {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  line-height: 10px;
  color: rgba(0, 0, 0, 0.35);
  margin-bottom: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .orb-flow .orb-step,
  .orb-flow .orb-flow-head,
  .orb-flow .orb-flow-links path {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- view more work ---------- */

.more-work {
  padding: clamp(80px, 14vh, 160px) var(--space-gutter) 40px;
}

.more-work-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 8px;
}

.more-card .ph {
  aspect-ratio: 4 / 3;
}

/* Same rounding + clip as .media so the cards sit in the page's card language. */
.more-card-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
}

.more-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.more-card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 2px 0;
}

.more-card-name {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}

.more-card:hover .more-card-name {
  color: var(--accent);
}

.more-card-index {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
}

/* ---------- takeover sheet ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--dark);
  color: var(--dark-text);
  transform: translateY(100%);
  transition: transform 0.55s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: hidden;
}

body.sheet-open .sheet {
  transform: translateY(0);
  visibility: visible;
}

body.sheet-open,
body.menu-open {
  overflow: hidden;
}

.sheet-inner,
.about-sheet {
  padding: 48px var(--space-gutter) 120px;
}

.sheet-close {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: clamp(18px, 2vw, 24px);
  color: var(--accent);
  cursor: pointer;
}

.sheet-close:hover {
  text-decoration: underline;
  text-underline-offset: 6px;
}

.sheet-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 760px);
  justify-content: space-between;
  gap: 64px;
  margin-top: clamp(48px, 8vh, 96px);
}

.sheet-info {
  font-size: 15px;
  line-height: 1.7;
}

.info-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dark-soft);
  margin-bottom: 14px;
}

.sheet-info ul {
  list-style: none;
}

.info-note {
  font-style: italic;
  color: var(--dark-soft);
  margin-top: 28px;
}

.info-divider {
  border: none;
  border-top: 1px dashed var(--dark-line);
  margin: 28px 0;
}

.info-credits li span {
  color: var(--dark-soft);
}

.info-credits a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.info-download {
  display: inline-block;
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dark-text);
  border-bottom: 1px solid var(--dark-line);
  padding-bottom: 3px;
}

.info-download:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.sheet-body h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
}

.sheet-body p {
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.65;
  margin-bottom: 1.4em;
}

.sheet-body h2 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--dark-soft);
  margin: 56px 0 20px;
}

.sheet-body blockquote {
  margin: 56px 0 16px;
  padding-left: 24px;
  border-left: 2px solid var(--accent);
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.sheet-body cite {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 14px;
  color: var(--dark-soft);
}

.sheet-body cite strong {
  display: block;
  color: var(--dark-text);
  font-weight: 500;
}

/* ---------- dark page (about) ---------- */

body.dark {
  background: var(--dark);
  color: var(--dark-text);
}

body.dark .wordmark:hover {
  color: var(--accent);
}

.about-email {
  display: inline-block;
  margin-top: 64px;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.about-email:hover {
  color: var(--accent);
}

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  .case-media .duo,
  .more-work-row {
    grid-template-columns: 1fr;
  }

  .sheet-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .menu-panel {
    padding: 28px;
  }

  .menu-primary {
    margin-top: 72px;
  }
}

/* ---------- golf guru live demo (slot 05) ---------- */

/* Fixed 900×1125 iframe scaled to the slot width so the app keeps its
   desktop phone frame instead of collapsing to the mobile full-bleed
   layout at tile sizes (see site.js). */
.gg-phone {
  background: #060f11;
}

.gg-phone iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 900px;
  height: 1125px;
  border: 0;
  transform-origin: 0 0;
  transform: scale(var(--gg-scale, 1));
}

/* ---------- nuvolari build screens (slot 05) ---------- */

/* Single 1:1 design-system board (two halves baked into the image). */
.ds-screens {
  background: #cfd4e2;
}

.ds-screens img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Full-width V1 screen still (16:9). */
.v1-screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
