/* ============================================================
   Roche Digital — homepage only
   1 the intro (.ri)          4 the feature card and offer grid
   2 the photo hero           5 built lately (the dark surface)
   3 the ticker               (device frames live in site.css)
   Phone first; the same two breakpoints as site.css (620, 980).
   ============================================================ */

/* --- 1. Intro ------------------------------------------------
   Hidden unless the <head> script added .rd-intro-on. intro.js
   drives every frame; the failsafe animation clears the screen
   after 7s if the script never runs. */
.ri { display: none; }
.rd-intro-on .ri { display: block; position: fixed; inset: 0; z-index: 300; animation: ri-failsafe .4s 7s forwards; }
.rd-intro-on .ri.is-held { animation: none; }
@keyframes ri-failsafe { to { opacity: 0; visibility: hidden; } }
.ri-paper { position: absolute; inset: 0; background: var(--paper); will-change: transform; }
.ri-paper::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--hairline-strong); }
.ri-stage { position: absolute; inset: 0; pointer-events: none; transform-origin: 0 0; }
.ri-row { position: absolute; left: 0; top: 0; white-space: pre; line-height: 1; }
.ri-row span { display: inline-block; will-change: transform, opacity; }
.ri-mono { font-family: var(--font-mono); font-weight: 500; color: var(--ink); letter-spacing: .02em; }
.ri-serif { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
.ri-serif .it { font-style: italic; font-weight: 400; font-variation-settings: "SOFT" 60; }
/* Italic letters (the l of Digital most) lean past their own box. Each letter is
   its own layer while it animates, and Safari clips a layer at the box, so the
   top of the l got cut. Padding grows the box; the negative margin keeps the spacing. */
.ri-serif span { padding: .25em .2em; margin: -.25em -.2em; }
.ri-prompt { position: absolute; font-family: var(--font-mono); color: var(--accent); }
.ri-caret { position: absolute; width: .55em; height: 1.1em; background: var(--accent); }
.ri-dot { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); }
.ri-note { position: absolute; font-family: var(--font-mono); font-size: var(--text-label); letter-spacing: .14em; text-transform: uppercase; color: var(--label); white-space: nowrap; }
.ri-skip { position: absolute; right: clamp(1.25rem, 4vw, 3.5rem); bottom: 1.5rem; padding: .8rem 0; border: 0; background: none; cursor: pointer; }
.ri-skip:hover { color: var(--ink); }
/* while the intro plays, the nav's wordmark waits for the flying one to land */
.rd-intro-on .nav .brand { opacity: 0; }
.rd-intro-on.ri-done .nav .brand { opacity: 1; }
/* the hero copy waits for the reveal */
html.js .home [data-hero] { opacity: 0; transform: translateY(22px); transition: opacity .9s ease, transform 1.1s var(--ease-out); }
html.js .home.is-revealed [data-hero] { opacity: 1; transform: none; }
html.js .home.is-revealed [data-hero]:nth-child(2), html.js .home.is-revealed .hero-aside { transition-delay: .12s; }
html.js .home.is-revealed .hero-foot { transition-delay: .3s; }

/* --- 2. Photo hero ------------------------------------------- */
.hero--photo { min-height: 100svh; color: var(--paper); background: var(--ink); padding-bottom: 1.75rem; }
.hero-media { position: absolute; inset: 0; }
.slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 1.6s ease; }
.slide.is-on { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.08); transition: transform 9s linear; }
.slide.is-on img { transform: scale(1); }
.hero-shade { position: absolute; inset: 0; background:
  linear-gradient(to top, rgba(22,21,19,.9) 0%, rgba(22,21,19,.66) 34%, rgba(22,21,19,.22) 66%, rgba(22,21,19,.4) 100%); }
.hero--photo .kicker, .hero--photo h1, .hero--photo .lead { text-shadow: 0 1px 18px rgba(22,21,19,.35); }
.hero--photo .kicker { color: rgba(247,246,243,.82); }
.hero--photo .kicker::before { background: var(--accent-on-ink); }
.hero--photo h1 { color: var(--paper); max-width: 13ch; }
.hero--photo .lead { color: rgba(247,246,243,.84); margin-top: 0; }
.hero--photo .hero-aside { margin-top: 1.5rem; }
.hero--photo .hero-foot { margin-top: 2.5rem; border-top-color: rgba(247,246,243,.22); gap: 1rem; }
.hero--photo .mono { color: rgba(247,246,243,.72); }
.hero-cap { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: opacity .5s ease; }
.hero-cap.is-swapping { opacity: 0; }
.hero-bars { flex: 1; display: flex; gap: 6px; min-width: 60px; }
.hero-bars i { flex: 1; height: 2px; background: rgba(247,246,243,.22); position: relative; overflow: hidden; }
.hero-bars i::after { content: ""; position: absolute; inset: 0; background: var(--paper); transform: scaleX(0); transform-origin: left; }
.hero-bars i.is-done::after { transform: scaleX(1); }
.hero-bars i.is-on::after { animation: bar var(--slide-ms, 6000ms) linear forwards; }
.hero--photo.is-paused .hero-bars i.is-on::after { animation-play-state: paused; }
@keyframes bar { to { transform: scaleX(1); } }
.hero-pause { flex: none; padding: .7rem 0 .7rem .5rem; border: 0; background: none; cursor: pointer; }
.hero-pause:hover { color: var(--paper); }
.btn--light { background: var(--paper); color: var(--ink); }
.btn--light:hover { background: #fff; }
.btn--glass { background: rgba(247,246,243,.08); color: var(--paper); box-shadow: inset 0 0 0 1px rgba(247,246,243,.4); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn--glass:hover { background: rgba(247,246,243,.18); }

/* the nav sits on the photograph until the page scrolls */
.nav--on-photo:not(.is-scrolled):not(.is-open) .brand,
.nav--on-photo:not(.is-scrolled):not(.is-open) .nav-links a { color: var(--paper); }
.nav--on-photo:not(.is-scrolled):not(.is-open) .nav-links a { opacity: .82; }
.nav--on-photo:not(.is-scrolled):not(.is-open) .nav-links a:hover { opacity: 1; }
.nav--on-photo:not(.is-scrolled):not(.is-open) .burger span { background: var(--paper); }
.nav--on-photo:not(.is-scrolled):not(.is-open) .nav-cta { background: var(--paper); color: var(--ink); }

/* --- 3. Ticker ----------------------------------------------- */
.ticker { overflow: hidden; border-bottom: 1px solid var(--hairline); padding-block: 1.1rem; color: var(--ink-2); }
.ticker-track { display: flex; width: max-content; animation: tick 60s linear infinite; }
.ticker span { display: inline-flex; align-items: center; gap: 2.25rem; padding-right: 2.25rem; white-space: nowrap; }
.ticker span::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
@keyframes tick { to { transform: translateX(-50%); } }

/* --- 4. Feature card and the offer grid ---------------------- */
.feature { display: grid; gap: 2rem; margin-top: 2.5rem; padding: clamp(1.5rem, 1rem + 2vw, 2.75rem); background: var(--paper-raised); border: 1px solid var(--hairline); border-radius: var(--radius-card); box-shadow: var(--shadow-card); text-decoration: none; color: inherit; overflow: hidden; transition: border-color var(--dur-fast) ease; }
.feature:hover { border-color: var(--hairline-strong); }
.feature-copy { display: flex; flex-direction: column; gap: .9rem; align-self: center; }
.feature-copy h3.d { font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.6rem); line-height: 1.08; max-width: 16ch; }
.feature-copy p { color: var(--ink-2); max-width: 48ch; }
.feature .go { display: inline-flex; align-items: center; gap: .5em; margin-top: .5rem; font-size: var(--text-small); font-weight: 500; }
.feature .go .arw { transition: transform var(--dur-fast) var(--ease-hover); }
.feature:hover .go .arw { transform: translateX(4px); }
.feature-media { position: relative; padding-bottom: 20%; margin-right: 4%; }
.feature-media .browser { transition: transform var(--dur-mid) var(--ease-out); }
.feature:hover .feature-media .browser { transform: translateY(-4px); }
.phone--float { position: absolute; right: -4%; bottom: 0; width: 24%; min-width: 84px; transition: transform var(--dur-mid) var(--ease-out); }
.feature:hover .phone--float { transform: translateY(-10px); }

.offer { margin-top: 1rem; }
.card--img { padding: .75rem .75rem 1.5rem; gap: .6rem; }
.card--img > :not(.card-img) { margin-inline: .75rem; }
.card-img { aspect-ratio: 4 / 3; border-radius: 9px; overflow: hidden; background: var(--paper-deep); margin-bottom: .6rem; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.card-img--screen img { object-position: top left; }
a.card--img:hover .card-img img { transform: scale(1.04); }
.card--img h3.d { font-size: 1.25rem; }
.card--img p { font-size: .93rem; }

/* --- 5. Built lately ----------------------------------------- */
.work-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; }
.work-head .tlink { padding-block: .6rem; }
.work { display: grid; gap: 3rem; margin-top: 3rem; }
.work-item { display: grid; gap: 1.25rem; align-content: start; }
.work-copy .mono { color: var(--accent-on-ink); }
.work-copy h3.d { margin-top: .6rem; font-size: clamp(1.4rem, 1.2rem + .8vw, 1.9rem); }
.work-copy .spec { margin-top: .8rem; }
.work-copy p { margin-top: .5rem; color: rgba(247,246,243,.72); max-width: 46ch; text-wrap: pretty; }
.work-media { border-radius: var(--radius-card); }
/* the three smaller tiles share one frame shape, whatever is inside it */
.work-frame { position: relative; aspect-ratio: 5 / 4; background: rgba(247,246,243,.05); border: 1px solid var(--hairline-on-ink); border-radius: var(--radius-card); overflow: hidden; }
.work-frame .browser { position: absolute; left: 9%; top: 11%; width: 125%; }
.work-frame .phone { position: absolute; left: 50%; top: 10%; width: 44%; transform: translateX(-50%); }

/* the beach band: keep their heads in frame */
.band--people img { object-position: 50% 30%; }

/* --- Contact: two stacked cards, not three across ------------ */
.acts--stack { max-width: 24rem; }

/* ============================================================
   620px and up
   ============================================================ */
@media (min-width: 620px) {
  .work { grid-template-columns: 1fr 1fr; gap: 3.5rem 2rem; }
  .work-item--wide { grid-column: 1 / -1; }
  .cards--4.offer { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   980px and up
   ============================================================ */
@media (min-width: 980px) {
  .hero--photo { padding-bottom: 2.25rem; }
  .hero--photo h1 { font-size: clamp(3.6rem, 1rem + 5vw, 6rem); max-width: 12ch; }
  .hero--photo .hero-grid { grid-template-columns: 1.25fr .75fr; }
  .hero--photo .hero-aside { margin-top: 0; }
  .feature { grid-template-columns: .85fr 1.15fr; gap: clamp(2rem, 1rem + 3vw, 4rem); }
  .cards--4.offer { grid-template-columns: repeat(4, 1fr); }
  .work { grid-template-columns: repeat(3, 1fr); }
  .work-item--wide { grid-template-columns: 1.6fr 1fr; gap: 2.5rem; align-items: center; }
  .work-item--wide .work-copy h3.d { font-size: clamp(1.8rem, 1.2rem + 1.4vw, 2.5rem); }
  .acts--stack { grid-template-columns: 1fr; }
}

/* 980 to 1180: five nav links and the button only just fit, so tighten */
@media (min-width: 980px) and (max-width: 1180px) {
  .nav-links { gap: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .slide, .slide img { transition: none; transform: none; }
  .ticker-track { animation: none; }
  html.js .home [data-hero] { opacity: 1; transform: none; transition: none; }
}
