/* ============================================================
   FEATURE TABS — components/feature-tabs.css
   Shared by the product pages (Site Designer, Email Designer,
   Form Designer): a list of tabs beside the real product video or
   screenshot. Each page keeps its own JS to swap the media; the
   look and the phone layout live here (logic: feature-tabs.js).

   Desktop: the active tab opens with its eyebrow and description.
   Tablets and phones: the tabs become rows of chips above the media
   (they wrap, so none is cut at the screen edge) and the description
   moves under it (.ftab-caption).
   The active state follows aria-selected, so every page's JS can
   keep its own class names.

   Modifiers on .ftab-layout:
   --reversed  media on the left, tabs on the right (desktop)
   --dark      for dark sections
   ============================================================ */

.ftab-layout {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
}
.ftab-layout--reversed { grid-template-columns: minmax(0, 1fr) minmax(0, 380px); }

/* ── Tabs ── */
.ftab-list { position: relative; display: flex; flex-direction: column; gap: 6px; }

.ftab {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 56px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
}
.ftab:hover { background: rgba(255, 255, 255, 0.32); }
/* Active: a soft lift of the section's own cream, not a white card */
.ftab[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(33, 26, 20, 0.07);
  box-shadow: 0 6px 20px rgba(33, 26, 20, 0.05);
}
/* Accent bar on the active tab */
.ftab::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 3px;
  background: var(--primary-solid);
  opacity: 0;
  transition: opacity var(--transition);
}
.ftab[aria-selected="true"]::before { opacity: 1; }
.ftab:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Icon: neutral at rest, solid accent when active */
.ftab-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(33, 26, 20, 0.06);
  color: var(--text-secondary);
  transition: background-color var(--transition), color var(--transition);
}
.ftab[aria-selected="true"] .ftab-icon { background: var(--primary-solid); color: #fff; }

.ftab-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 7px; }
.ftab[aria-selected="true"] .ftab-text { padding-top: 0; }

/* Collapsed tabs show only their title: eyebrow and description are
   display:none, so they are not part of the tab's accessible name */
.ftab-eyebrow {
  display: none;
  font-size: var(--fs-label);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
  color: var(--primary-on-light);
}
.ftab[aria-selected="true"] .ftab-eyebrow { display: block; }

.ftab-title {
  font-size: 17px;
  font-weight: var(--fw-bold);
  letter-spacing: var(--tr-h3);
  line-height: 1.25;
  color: var(--text-primary);
}

.ftab-desc {
  display: none;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--text-secondary);
}
.ftab[aria-selected="true"] .ftab-desc { display: block; animation: ftab-desc-in 0.35s var(--ease-out); }
@keyframes ftab-desc-in { from { opacity: 0; transform: translateY(-4px); } }

/* ── Media ── */
.ftab-player { position: sticky; top: calc(var(--nav-height, 58px) + var(--sp-4)); }

.ftab-frame {
  position: relative;
  /* Native ratio of the page's clips or screenshots: nothing cropped */
  aspect-ratio: var(--ftab-ratio, 16 / 10);
  overflow: hidden;
  border-radius: 16px;
  background: #2A2724;
  /* Soft bezel instead of a hard dark line: a translucent light ring
     around the screen, then a wide, low-contrast shadow */
  border: 0;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.55),
    0 0 0 7px rgba(33, 26, 20, 0.05),
    0 24px 60px rgba(33, 26, 20, 0.12);
}
.ftab-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}
/* Screenshots of varying size: show them whole on a neutral ground */
.ftab-frame--shots { background: #F7F5F1; }
.ftab-frame--shots .ftab-media { object-fit: contain; }

/* Caption row: the description on phones, the pause button always */
.ftab-caption {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: 14px;
}
.ftab-caption-text { display: none; flex: 1; margin: 0; font-size: var(--fs-small); line-height: 1.55; color: var(--text-secondary); }
.ftab-caption-text strong { display: block; margin-bottom: 2px; font-size: 15px; font-weight: var(--fw-bold); color: var(--text-primary); }
.ftab-caption .motion-toggle { position: static; flex-shrink: 0; }
.ftab-layout:not(.ftab-layout--dark) .ftab-caption .motion-toggle {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--border-strong);
}

/* ── Dark sections ── */
.ftab-layout--dark .ftab:hover { background: rgba(255, 255, 255, 0.04); }
.ftab-layout--dark .ftab[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 169, 138, 0.2);
}
.ftab-layout--dark .ftab::before { background: var(--primary-on-dark); }
.ftab-layout--dark .ftab-icon { background: rgba(255, 255, 255, 0.07); color: var(--text-muted-on-dark); }
.ftab-layout--dark .ftab[aria-selected="true"] .ftab-icon { background: var(--primary-solid); color: #fff; }
.ftab-layout--dark .ftab-eyebrow { color: var(--primary-on-dark); }
.ftab-layout--dark .ftab-title { color: var(--text-on-dark); }
.ftab-layout--dark .ftab-desc,
.ftab-layout--dark .ftab-caption-text { color: var(--text-muted-on-dark); }
.ftab-layout--dark .ftab-caption-text strong { color: var(--text-on-dark); }
.ftab-layout--dark .ftab-frame {
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.05),
    0 0 0 7px rgba(255, 255, 255, 0.06),
    0 40px 100px rgba(0, 0, 0, 0.5),
    0 0 100px rgba(255, 90, 31, 0.08);
}

/* ── Tablets and phones ── */
@media (max-width: 1024px) {
  .ftab-layout,
  .ftab-layout--reversed { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .ftab-player { position: static; order: 0; padding: 0 6px; }

  /* Tabs: chips that wrap onto as many rows as they need, always above
     the media. A sideways strip cut the last chips mid-word at the
     screen edge ("Eleme…"), and the hidden tabs were easy to miss. */
  .ftab-list {
    order: -1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .ftab {
    flex: 0 1 auto;
    min-width: 0;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 6px 16px 6px 6px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(33, 26, 20, 0.06);
  }
  .ftab-layout--dark .ftab { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.06); }
  .ftab::before { display: none; }
  .ftab-icon { width: 34px; height: 34px; border-radius: 50%; }
  .ftab-text { padding-top: 0; }
  .ftab-title { font-size: 15px; }
  .ftab[aria-selected="true"] .ftab-eyebrow,
  .ftab[aria-selected="true"] .ftab-desc { display: none; }

  /* The active tab's description, under the media */
  .ftab-caption { align-items: flex-start; justify-content: space-between; }
  .ftab-caption-text { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .ftab, .ftab::before, .ftab-icon, .ftab-media { transition: none; }
  .ftab[aria-selected="true"] .ftab-desc { animation: none; }
}
