/* Keystone HOME styles. Loads after base.css. Section order: hero scene, results, services, work, process, voices + team. */

/* ---------- hero scene: headline on the wall, the room below ---------- */
.tf { --a1: 130%; --a2: 130%; --f: 1; --p: 0; position: relative; transition: --a1 1.2s var(--ease), --a2 1.6s var(--ease); }
[data-state="empty"] .tf { --a1: 0%; --a2: 0%; }
.tf.scrub { height: 260svh; transition: none; }
.tf-stick { height: 100svh; min-height: 540px; display: flex; flex-direction: column; padding-top: var(--nav); }
.tf.scrub .tf-stick { position: sticky; top: 0; }
.hero-top { width: 100%; max-width: calc(var(--max) + 2 * var(--pad)); margin: 0 auto; padding: clamp(12px, 2.6vh, 30px) var(--pad) clamp(14px, 2.2vh, 24px); }
/* one line that runs wall to wall: size from the character count (--n1), capped by the screen height */
.tf h1 { font-size: min(calc((100vw - 2 * var(--pad)) / (var(--n1) * .492)), 26svh); white-space: nowrap; line-height: .98; margin-left: -.04em; }
.tf h1 span, .tf h1 em { display: inline; }
.tf.scrub h1 { font-weight: calc(200 + 650 * var(--f)); transition: none; }
.hero-row { position: relative; margin-top: clamp(10px, 2vh, 22px); }
.hero-aside { display: grid; grid-template-columns: minmax(0, 46ch) auto minmax(0, 28ch); justify-content: space-between; align-items: center; gap: 20px 40px; transition: opacity .35s; }
.hero-sub { font-size: clamp(16px, 1.25vw, 19px); line-height: 1.4; color: var(--body2); }
.hero-cta { display: flex; align-items: center; gap: 24px; }
.hero-lead { font-size: 14px; line-height: 1.4; color: var(--mute); }
.tf-copy { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .35s; }
.tf.run .hero-aside { opacity: 0; visibility: hidden; }
.tf.run .tf-copy { opacity: 1; visibility: visible; }
.tf-stage { position: absolute; left: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: baseline; gap: 20px; opacity: 0; transition: opacity .3s; }
.tf-stage.on { opacity: 1; }
.tf-stage b { font-family: var(--display); font-weight: 700; font-size: clamp(20px, 2.3vw, 34px); letter-spacing: -.02em; line-height: 1.1; }
.tf-stage .lbl { flex: none; }
/* progress, drawn as a dimension line */
.tf-bar { display: none; position: relative; height: 24px; width: calc(100% - 2 * var(--pad)); max-width: var(--max); margin: 0 auto; font-size: 12px; font-weight: 500; color: var(--mute); }
.tf.scrub .tf-bar { display: block; }
.tf-bar i { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink); }
.tf-bar b { position: absolute; left: 0; bottom: -1px; height: 3px; width: calc(var(--p) * 100%); background: var(--tape); }
.tf-bar span { position: absolute; bottom: 5px; line-height: 1; }
.tf-bar span:nth-of-type(1) { left: 0; }
.tf-bar span:nth-of-type(2) { left: 50%; transform: translateX(-50%); }
.tf-bar span:nth-of-type(3) { right: 0; }
.tf-room { position: relative; flex: 1; min-height: 0; overflow: hidden; }
/* the masters end in a blown-out doorway on the right; the layers overhang the room so it is cropped away */
.tf-layer { position: absolute; inset: 0 -3.6% 0 0; }
.tf-layer.l1 .ph, .tf-layer.l2 .ph { background: none !important; }
.tf-layer.l1 img { -webkit-mask-image: linear-gradient(100deg, #000 calc(var(--a1) - 22%), transparent var(--a1)); mask-image: linear-gradient(100deg, #000 calc(var(--a1) - 22%), transparent var(--a1)); }
.tf-layer.l2 img { -webkit-mask-image: linear-gradient(100deg, #000 calc(var(--a2) - 22%), transparent var(--a2)); mask-image: linear-gradient(100deg, #000 calc(var(--a2) - 22%), transparent var(--a2)); }
.tf-layer.l0 { z-index: 1; } .tf-layer.l1 { z-index: 2; } .tf-layer.l2 { z-index: 3; }
[data-state="staged"] .marks { visibility: hidden; }

/* ---------- results strip ---------- */
.rgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.rgrid a { display: block; text-decoration: none; }
.rgrid .ph { aspect-ratio: 4 / 5; margin-bottom: 16px; }
.rgrid .res { font-family: var(--display); font-weight: 800; font-size: clamp(20px, 1.9vw, 27px); letter-spacing: -.025em; line-height: 1.15; }
.rgrid h3 { font-family: var(--font); font-weight: 500; font-size: 15px; letter-spacing: 0; margin: 8px 0 4px; }
.rgrid a:hover h3 { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- services ---------- */
.slist { border-bottom: 1px solid var(--line); }
.svc a { display: grid; grid-template-columns: 6fr 4fr auto; gap: 24px; align-items: baseline; padding: clamp(16px, 2.2vh, 24px) 0; border-top: 1px solid var(--line); text-decoration: none; transition: padding .35s var(--ease); }
.svc .t { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 3vw, 44px); letter-spacing: -.03em; line-height: 1.05; }
.svc .for { color: var(--mute); font-size: 15px; }
.svc .arr { font-size: 22px; align-self: center; }
.svc a:hover { padding-left: 14px; }
.svc a:hover .t { font-weight: 800; }
.svc a:hover .arr { transform: translateX(6px); }
.svc-img { display: none; }
@media (hover: hover) and (pointer: fine) {
  .js .svc-img { display: block; position: fixed; left: 0; top: 0; z-index: 30; width: 260px; aspect-ratio: 4 / 5; pointer-events: none; opacity: 0; transition: opacity .25s; }
  .js .svc-img.on { opacity: 1; }
}

/* ---------- work: three stacked slides ---------- */
.work { position: relative; }
.slide { position: sticky; top: 0; height: 100svh; min-height: 520px; overflow: hidden; background: var(--plaster); }
.slide .cap { position: absolute; z-index: 5; left: var(--pad); bottom: var(--pad); width: min(440px, calc(100% - 2 * var(--pad))); background: var(--plaster); color: var(--ink); padding: 22px 24px 24px; }
.slide .cap .lbl { color: var(--mute); }
.slide h3 { font-weight: 800; font-size: clamp(28px, 3vw, 44px); letter-spacing: -.035em; line-height: 1; margin: 12px 0 10px; }
.slide .res { font-size: 17px; margin-bottom: 18px; }
.slide .peek { left: auto; right: var(--pad); bottom: var(--pad); }

/* ---------- how it works: one static row ---------- */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 28px; }
.steps li { border-top: 1px solid var(--line); padding-top: 20px; }
.steps .n { display: block; margin: 22px 0 6px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--mute); }
.steps p { font-size: 15px; color: var(--body2); margin-top: 8px; }

/* ---------- voices + team ---------- */
.quotes { display: grid; }
.quote { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity .5s; }
.quote.on { opacity: 1; visibility: visible; }
.quote blockquote { font-size: clamp(30px, 4.6vw, 70px); line-height: 1.02; max-width: 22ch; letter-spacing: -.04em; }
.quote figcaption { margin-top: 28px; color: var(--mute); }
.quote figcaption b { color: var(--ink); font-weight: 600; margin-right: 8px; }
.qnav { display: flex; align-items: center; gap: 24px; margin-top: 36px; font-size: 15px; font-weight: 500; }
.qnav button { min-height: 44px; border-bottom: 1.5px solid currentColor; }
.qnav button .arr:not(.back) { margin-left: .35em; }
.qnav span { color: var(--mute); font-variant-numeric: tabular-nums; }
.team-head { margin-top: clamp(64px, 10vh, 120px); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .hero-aside { grid-template-columns: 1fr auto; }
  .hero-lead { grid-column: 1 / -1; }
  .steps { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  .tf.scrub { height: 230svh; }
  /* two lines on a phone */
  .tf h1 { font-size: min(calc((100vw - 2 * var(--pad)) / (var(--n2) * .5)), 13svh); line-height: .94; }
  .tf h1 span, .tf h1 em { display: block; }
  .hero-aside { grid-template-columns: 1fr; gap: 14px; }
  .hero-lead { font-size: 13px; }
  .hero-cta { flex-wrap: wrap; gap: 14px 20px; }
  .tf-stage { flex-direction: column; gap: 6px; top: 0; transform: none; }
  .rgrid { grid-template-columns: 1fr; gap: 40px; }
  .rgrid .ph { aspect-ratio: 4 / 3; }
  .svc a { grid-template-columns: 1fr auto; gap: 4px 16px; }
  .svc .for { grid-column: 1; grid-row: 2; }
  .svc .arr { grid-row: 1 / 3; }
  .slide { height: 88svh; }
  .slide .cap { left: 12px; right: 12px; bottom: 12px; width: auto; padding: 18px; }
  .slide .peek { right: 12px; bottom: auto; top: calc(var(--nav) + 12px); }
  .steps { grid-template-columns: 1fr; gap: 0; }
  .steps li { display: grid; grid-template-columns: 64px 1fr; column-gap: 20px; padding: 20px 0; }
  .steps .picto { grid-row: 1 / 4; }
  .steps .n { margin: 0 0 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .tf, .quote, .svc a, .hero-aside, .tf-copy { transition: none; }
}
