/* ---------------------------------------------------------------------------
 * Companion products — "Other Great Tools"
 *
 * A logo-led editorial showcase: a quiet tab rail in the carousel's idiom, then
 * one airy split per product with the real app icon beside its story. No nested
 * cards; hairlines and the shell width do the separating. Every colour routes
 * through the site tokens in css/site.css, so light and dark both follow.
 * --companion-accent is set inline per product from a validated hex value and
 * falls back to the site accent.
 * ------------------------------------------------------------------------- */

.tw-companions {
  scroll-margin-top: 72px;
}

.tw-companions__intro {
  margin-bottom: 36px;
}

.tw-companions__intro .tw-lede {
  margin: 0;
}

/* ---- Tab rail ------------------------------------------------------------- */
.tw-companions__tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 clamp(32px, 5vw, 52px);
  border-bottom: 1px solid var(--panel-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tw-companions__tabs::-webkit-scrollbar {
  display: none;
}

.tw-companions__tab {
  --companion-accent: var(--accent);
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: -1px;
  padding: 10px 14px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--motion-fast) var(--motion-ease-out);
}

.tw-companions__tab::after {
  content: '';
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background var(--motion-fast) var(--motion-ease-out);
}

.tw-companions__tab:hover {
  color: var(--text-primary);
}

.tw-companions__tab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

.tw-companions__tab[aria-selected='true'] {
  color: var(--text-primary);
}

.tw-companions__tab[aria-selected='true']::after {
  background: color-mix(in srgb, var(--companion-accent) 85%, var(--text-primary));
}

.tw-companions__tab-label {
  line-height: 1.2;
}

/* ---- App marks ------------------------------------------------------------ */
.tw-companion__logo {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.tw-companion__logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* macOS squircle clip. Inset icons already have transparent corners, so this
   * only trims the filled corners of full-bleed artwork. */
  border-radius: 22.5%;
  user-select: none;
}

/* Full-bleed artwork is padded to the same visual size as inset macOS icons. */
.tw-companion__logo--bleed img {
  width: 82%;
  height: 82%;
}

.tw-companion__logo--tab {
  width: 22px;
  height: 22px;
  opacity: 0.72;
  filter: saturate(0.8);
  transition:
    opacity var(--motion-fast) var(--motion-ease-out),
    filter var(--motion-fast) var(--motion-ease-out);
}

.tw-companions__tab:hover .tw-companion__logo--tab,
.tw-companions__tab[aria-selected='true'] .tw-companion__logo--tab {
  opacity: 1;
  filter: none;
}

.tw-companion__logo--hero {
  position: relative;
  width: min(100%, 236px);
  aspect-ratio: 1;
  filter: drop-shadow(
    0 18px 34px color-mix(in srgb, var(--companion-accent) 26%, rgba(0, 0, 0, 0.32))
  );
}

/* Text monogram when a product has no usable logo. Same squircle footprint. */
.tw-companion__logo--text {
  border: 1px solid color-mix(in srgb, var(--companion-accent) 30%, var(--panel-border));
  border-radius: 22%;
  background: color-mix(in srgb, var(--companion-accent) 14%, var(--surface-2));
  color: color-mix(in srgb, var(--companion-accent) 70%, var(--text-primary));
  font-family: var(--font-mono);
  font-weight: 650;
  letter-spacing: 0.04em;
}

.tw-companion__logo--tab.tw-companion__logo--text {
  font-size: 9px;
}

.tw-companion__logo--hero.tw-companion__logo--text {
  font-size: clamp(40px, 6vw, 64px);
  filter: none;
}

/* ---- Product showcase ----------------------------------------------------- */
.tw-companions__panel[hidden] {
  display: none;
}

.tw-companions__panel:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 10px;
  border-radius: var(--radius-sm);
}

.tw-companion {
  --companion-accent: var(--accent);
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
  min-width: 0;
}

.tw-companion__art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2vw, 24px);
}

/* A soft accent wash behind the icon, not another surface. */
.tw-companion__art::before {
  content: '';
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--companion-accent) 18%, transparent),
    transparent 74%
  );
  pointer-events: none;
}

.tw-companion__copy {
  min-width: 0;
}

.tw-companion__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 14px;
  color: color-mix(in srgb, var(--companion-accent) 45%, var(--text-primary));
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tw-companion__status {
  padding: 3px 9px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.tw-companion__status--available {
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  background: var(--success-soft);
  color: var(--text-primary);
}

.tw-companion__name {
  margin: 0 0 12px;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.tw-companion__description {
  max-width: 46ch;
  margin: 0;
  color: var(--text-secondary);
  font-size: 15.5px;
  line-height: 1.6;
}

/* Feature highlights share the carousel's hairline-row idiom. */
.tw-companion__features {
  display: flex;
  flex-direction: column;
  margin: 26px 0 0;
  padding: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--text-primary) 10%, var(--panel-border));
  list-style: none;
}

.tw-companion__features li {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0 11px;
  border-top: 1px solid color-mix(in srgb, var(--text-primary) 10%, var(--panel-border));
  color: color-mix(in srgb, var(--text-secondary) 72%, var(--text-primary));
  font-size: 13.5px;
  line-height: 1.48;
}

.tw-companion__features li::before {
  content: '';
  position: relative;
  top: 0.55em;
  display: block;
  width: 5px;
  height: 5px;
  margin-left: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--companion-accent) 70%, var(--text-primary));
  box-shadow: 0 0 8px color-mix(in srgb, var(--companion-accent) 30%, transparent);
  transform: rotate(45deg);
}

.tw-companion__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 18px 0 0;
}

.tw-companion__connection {
  flex: 1 1 100%;
  max-width: 52ch;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.tw-companion__platform,
.tw-companion__version {
  margin: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.tw-companion__release {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 24px;
}

.tw-companion__notes {
  color: var(--text-secondary);
  font-size: 12.5px;
  text-underline-offset: 3px;
}

.tw-companion__screenshot {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
}

.tw-companion__screenshot img {
  display: block;
  width: 100%;
  height: auto;
}

.tw-companion__screenshot figcaption {
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.tw-companions__note {
  max-width: 62ch;
  margin: clamp(32px, 5vw, 52px) 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--panel-border);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 880px) {
  .tw-companion {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .tw-companion__art {
    justify-content: flex-start;
    padding: 0;
  }

  .tw-companion__art::before {
    display: none;
  }

  .tw-companion__logo--hero {
    width: 128px;
  }

  .tw-companion__description {
    max-width: 54ch;
  }
}

@media (max-width: 640px) {
  .tw-companions__intro {
    margin-bottom: 28px;
  }

  .tw-companions__tab {
    gap: 8px;
    padding: 8px 10px 14px;
    font-size: 12.5px;
  }

  .tw-companions__tab::after {
    right: 10px;
    left: 10px;
  }

  .tw-companion__logo--tab {
    width: 20px;
    height: 20px;
  }

  .tw-companion__logo--hero {
    width: 104px;
  }

  .tw-companion__logo--hero.tw-companion__logo--text {
    font-size: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tw-companions__tab,
  .tw-companions__tab::after,
  .tw-companion__logo--tab {
    transition: none;
  }
}
