/* ============================================================
   Ferrum Apps — app detail page (design preview)
   Loads AFTER home.css and reuses its fh- primitives (sheets,
   marquee, buttons, app visual frames, footer, mini cards).
   Everything page-specific is namespaced `fh-ad-`.
   ============================================================ */

/* ------------------------------------------------------------
   Hero (dark canvas)
   ------------------------------------------------------------ */

.fh-ad-hero {
  /* longhands only — a padding shorthand would zero the horizontal
     padding that .section-width provides */
  padding-top: clamp(2.5rem, 5vw, 4.5rem);
  padding-bottom: clamp(4.5rem, 8vw, 7rem);
}

.fh-ad-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(2.5rem, 5vw, 5.5rem);
  align-items: center;
}

.fh-ad-app-lockup {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.7rem;
}

.fh-ad-app-lockup img {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.9rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.fh-ad-app-lockup .fh-eyebrow {
  color: rgba(247, 247, 247, 0.6);
}

.fh-ad-app-lockup .fh-eyebrow::before {
  display: none;
}

.fh-ad-hero h1 {
  margin: 0;
  max-width: 15ch;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5vw, 4.7rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #f7f7f7;
  text-wrap: balance;
}

.fh-ad-hero-lede {
  max-width: 33rem;
  margin: 1.5rem 0 0;
  color: rgba(247, 247, 247, 0.74);
  font-size: 1.1rem;
  line-height: 1.75;
}

.fh-ad-hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.1rem 1.7rem;
  margin-top: 2.3rem;
}

.fh-ad-hero .fh-link {
  color: rgba(247, 247, 247, 0.72);
}

.fh-ad-hero .fh-link:hover {
  color: #f7f7f7;
}

.fh-ad-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.fh-ad-hero-meta li {
  padding: 0.5rem 0.95rem;
  border: 1px solid rgba(247, 247, 247, 0.16);
  border-radius: 999px;
  color: rgba(247, 247, 247, 0.78);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

/* ------------------------------------------------------------
   Tinted hero shell — app pages that keep their brand color
   background swap the dark canvas for the app gradient and
   flip the hero text back to ink.
   ------------------------------------------------------------ */

.fh-ad-hero-shell-tint {
  position: relative;
  background: var(--app-hero-bg, var(--fh-paper));
  color: var(--fh-ink);
}

.fh-ad-hero-shell-tint .fh-ad-hero h1 {
  color: var(--fh-ink);
}

.fh-ad-hero-shell-tint .fh-ad-hero-lede {
  color: var(--fh-ink-soft);
}

.fh-ad-hero-shell-tint .fh-ad-app-lockup .fh-eyebrow {
  color: rgba(16, 20, 21, 0.62);
}

/* The marquee lives INSIDE the tinted shell so the hero gradient runs
   continuously behind both and they read as one section. Re-applying the
   gradient to the marquee separately would restart it and show a seam. */
.fh-ad-hero-shell-tint .fh-marquee {
  background: none;
  color: var(--fh-ink);
}

/* outlined (even) items: light stroke would vanish on the tint */
.fh-ad-hero-shell-tint .fh-marquee-item:nth-child(even) {
  -webkit-text-stroke-color: rgba(16, 20, 21, 0.42);
}

/* the hero already pads its own bottom; avoid doubling it up */
.fh-ad-hero-shell-tint .fh-ad-hero {
  padding-bottom: clamp(2.5rem, 4.5vw, 4rem);
}

/* hero screenshot: plain image with the standard 1px border */
.fh-ad-hero-shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1rem;
  border: 1px solid rgba(16, 20, 21, 0.14);
  background: #ffffff;
  box-shadow: 0 30px 60px rgba(16, 20, 21, 0.14);
}

/* ------------------------------------------------------------
   Feature showcase — switchable tabs + stage
   The active tab's progress bar animates over the autoplay
   interval; its animationend event advances the rotation.
   ------------------------------------------------------------ */

.fh-ad-showcase {
  --fh-showcase-ms: 6500ms;
}

.fh-ad-showcase-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: clamp(1.2rem, 2.6vw, 2.6rem);
  border-bottom: 1px solid var(--fh-line-light);
}

.fh-ad-showcase-tab {
  position: relative;
  padding: 0.2rem 0 1.15rem;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--fh-ink-faint);
  transition: color 240ms ease;
}

.fh-ad-showcase-tab:hover,
.fh-ad-showcase-tab.is-active {
  color: var(--fh-ink);
}

.fh-ad-showcase-tab:focus-visible {
  outline: 2px solid var(--fh-accent);
  outline-offset: 4px;
  border-radius: 0.35rem;
}

.fh-ad-showcase-tab-index {
  display: block;
  margin-bottom: 0.55rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--fh-ink-faint);
  transition: color 240ms ease;
}

.fh-ad-showcase-tab.is-active .fh-ad-showcase-tab-index {
  color: var(--fh-accent);
}

.fh-ad-showcase-tab-label {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(0.98rem, 1.3vw, 1.14rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-wrap: balance;
}

/* progress underline: sits on the tablist's bottom border */
.fh-ad-showcase-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--fh-accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* static indicator once autoplay is off (after manual interaction) */
.fh-ad-showcase-tab.is-active .fh-ad-showcase-progress {
  transform: scaleX(1);
  transition: transform 420ms var(--fh-ease-out);
}

/* autoplay: the bar fills over the interval, then animationend advances */
.fh-ad-showcase.is-auto .fh-ad-showcase-tab.is-active .fh-ad-showcase-progress {
  transition: none;
  animation: fh-showcase-progress var(--fh-showcase-ms) linear forwards;
}

.fh-ad-showcase.is-paused .fh-ad-showcase-progress,
.fh-ad-showcase.is-offscreen .fh-ad-showcase-progress {
  animation-play-state: paused;
}

@keyframes fh-showcase-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* stage: panels stack in one grid cell so height = tallest panel */
.fh-ad-showcase-stage {
  display: grid;
  margin-top: clamp(2.2rem, 4vw, 3.6rem);
}

.fh-ad-showcase-panel {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(2rem, 4.5vw, 4.5rem);
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  pointer-events: none;
  transition:
    opacity 480ms var(--fh-ease-out),
    transform 480ms var(--fh-ease-out),
    visibility 0s linear 480ms;
}

.fh-ad-showcase-panel.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition:
    opacity 480ms var(--fh-ease-out) 120ms,
    transform 480ms var(--fh-ease-out) 120ms,
    visibility 0s;
}

.fh-ad-showcase-copy h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fh-ink);
  text-wrap: balance;
}

.fh-ad-showcase-copy p {
  margin: 1.1rem 0 0;
  color: var(--fh-ink-soft);
  font-size: 1.02rem;
  line-height: 1.7;
}

/* width:auto + max-width lets a per-image `max-height` (set via the
   feature's imageMaxHeight) scale tall portrait shots down proportionally,
   so the border hugs the picture instead of a wide half-empty box. Landscape
   shots are wider than the column, so they still fill it exactly as before. */
.fh-ad-showcase-media img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border-radius: 1rem;
  border: 1px solid rgba(16, 20, 21, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .fh-ad-showcase-panel,
  .fh-ad-showcase-panel.is-active,
  .fh-ad-showcase-tab.is-active .fh-ad-showcase-progress {
    transition: none;
  }
}

/* smaller section titles across the detail page */
.fh-title {
  font-size: clamp(2rem, 3.8vw, 3.4rem);
}

/* marquee: a notch smaller on the detail page */
.fh-marquee-item {
  font-size: clamp(1.75rem, 3.8vw, 3.3rem);
}

/* The shared 30s animation moves the track by -50%, so the pixel speed
   scales with content width. Detail pages carry ~6 keywords vs the
   homepage's 3, which made them run ~1.8x faster. 52s brings them back
   to the homepage's ~92px/s. */
.fh-marquee-track {
  animation-duration: 52s;
}

/* ------------------------------------------------------------
   How it works — numbered steps
   ------------------------------------------------------------ */

.fh-ad-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.6rem);
}

.fh-ad-step {
  padding: clamp(1.6rem, 2.6vw, 2.4rem);
  border-radius: var(--fh-radius-panel);
  background: var(--fh-card);
  border: 1px solid var(--fh-line-light);
}

.fh-ad-step-num {
  display: block;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--fh-accent);
}

.fh-ad-step h3 {
  margin: 1.1rem 0 0;
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fh-ink);
}

.fh-ad-step p {
  margin: 0.7rem 0 0;
  color: var(--fh-ink-soft);
  font-size: 0.99rem;
  line-height: 1.65;
}

/* ------------------------------------------------------------
   Pricing
   ------------------------------------------------------------ */

.fh-ad-pricing {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.6rem);
  max-width: 62rem;
}

.fh-ad-plan {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: clamp(1.8rem, 3vw, 2.6rem);
  border-radius: var(--fh-radius-panel);
  background: var(--fh-card);
  border: 1px solid var(--fh-line-light);
}

.fh-ad-plan-dark {
  background:
    radial-gradient(120% 130% at 84% -8%, rgba(20, 184, 166, 0.28), transparent 48%),
    linear-gradient(180deg, #14181a 0%, var(--fh-dark) 100%);
  border-color: transparent;
  color: #f7f7f7;
}

.fh-ad-plan-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fh-ink-faint);
}

.fh-ad-plan-dark .fh-ad-plan-name {
  color: rgba(247, 247, 247, 0.6);
}

.fh-ad-plan-tag {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.16);
  color: #2ea592;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.fh-ad-plan-dark .fh-ad-plan-tag {
  background: rgba(116, 220, 198, 0.16);
  color: #74dcc6;
}

.fh-ad-plan-price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
}

.fh-ad-plan-price strong {
  font-size: clamp(2.6rem, 4vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.fh-ad-plan-price span {
  color: var(--fh-ink-faint);
  font-size: 1rem;
}

.fh-ad-plan-dark .fh-ad-plan-price span {
  color: rgba(247, 247, 247, 0.6);
}

.fh-ad-plan-note {
  margin: -0.5rem 0 0;
  color: var(--fh-ink-faint);
  font-size: 0.92rem;
}

.fh-ad-plan-dark .fh-ad-plan-note {
  color: rgba(247, 247, 247, 0.6);
}

.fh-ad-plan ul {
  display: grid;
  gap: 0.7rem;
  margin: 0.4rem 0 0.8rem;
  padding: 0;
  list-style: none;
}

.fh-ad-plan li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--fh-ink-soft);
  font-size: 0.99rem;
  line-height: 1.4;
}

.fh-ad-plan-dark li {
  color: rgba(247, 247, 247, 0.82);
}

.fh-ad-plan li svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  color: #2ea592;
}

.fh-ad-plan-dark li svg {
  color: #74dcc6;
}

.fh-ad-plan .fh-btn {
  margin-top: auto;
  width: 100%;
}

.fh-ad-pricing-note {
  max-width: 62rem;
  margin: 1.1rem 0 0;
  color: var(--fh-ink-faint);
  font-size: 0.92rem;
}

/* ------------------------------------------------------------
   App lineup — last section inside the light sheet, before the
   dark CTA/footer (reuses .app-related-* from global.css)
   ------------------------------------------------------------ */

.fh-ad-lineup {
  padding: clamp(4rem, 8vw, 7rem) 0 0;
  background: transparent;
}

.fh-ad-lineup .app-related-card {
  background: #ffffff;
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 980px) {
  .fh-ad-hero-grid {
    grid-template-columns: 1fr;
    gap: 2.4rem;
  }

  .fh-ad-hero h1 {
    max-width: none;
  }

  .fh-ad-steps,
  .fh-ad-pricing {
    grid-template-columns: 1fr;
  }

  .fh-ad-showcase-panel {
    grid-template-columns: 1fr;
    gap: 1.8rem;
    align-items: start;
    /* rows are auto-sized; without this the stage's extra height is
       distributed between them, opening a gap under the image */
    align-content: start;
  }

  .fh-ad-showcase-panel .fh-ad-showcase-media {
    order: -1;
  }
}

@media (max-width: 720px) {
  /* tab bar becomes a swipeable row */
  .fh-ad-showcase-tabs {
    display: flex;
    gap: 1.7rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .fh-ad-showcase-tabs::-webkit-scrollbar {
    display: none;
  }

  .fh-ad-showcase-tab {
    flex: 0 0 auto;
    max-width: 13rem;
  }
}
