/* ==========================================================================
   Breves strip — horizontal scroll-snap carousel + leave-site confirm
   ========================================================================== */

.breves-strip__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  max-width: 42rem;
}

.breves-strip__heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.breves-strip__title {
  margin: 0;
}

.breves-strip__icon {
  flex-shrink: 0;
}

.breves-strip__lede {
  margin: 0;
  color: rgb(var(--color-ink-muted));
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* Horizontal carousel shell */
.breves-strip__carousel {
  --breves-gap: 0.75rem;
  --breves-card-width: min(18.5rem, 86vw);
  --breves-thumb: 5rem; /* 80px */
  position: relative;
  container-type: inline-size;
}

@media (min-width: 640px) {
  .breves-strip__carousel {
    --breves-gap: 0.85rem;
    --breves-card-width: 19rem;
  }

  /* Room for prev/next so controls don’t cover card edges. */
  .breves-strip__track {
    padding-inline: 2rem;
  }
}

@media (min-width: 1024px) {
  .breves-strip__carousel {
    --breves-card-width: 20rem;
    --breves-thumb: 5.5rem; /* 88px */
  }
}

.breves-strip__track {
  display: flex;
  align-items: stretch;
  gap: var(--breves-gap);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem 0.15rem 0.65rem;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--color-brand) / 0.55) rgb(var(--color-surface-elevated, var(--color-surface)));
}

.breves-strip__track:focus-visible {
  outline: 2px solid rgb(var(--color-brand));
  outline-offset: 2px;
}

.breves-strip__track::-webkit-scrollbar {
  height: 0.4rem;
}

.breves-strip__track::-webkit-scrollbar-track {
  background: rgb(var(--color-surface-elevated, var(--color-surface)));
}

.breves-strip__track::-webkit-scrollbar-thumb {
  background: rgb(var(--color-brand) / 0.45);
  border: 2px solid transparent;
  background-clip: content-box;
}

.breves-strip__track::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--color-brand) / 0.7);
  background-clip: content-box;
}

/* Prev / next — shape/states in ui.css; placement here. sm+ only. */
.breves-strip__nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: none;
  transform: translateY(-50%);
}

@media (min-width: 640px) {
  .breves-strip__nav {
    display: inline-flex;
  }
}

.breves-strip__nav--prev {
  left: 0;
  transform: translate(-0.35rem, -50%);
}

.breves-strip__nav--next {
  right: 0;
  transform: translate(0.35rem, -50%);
}

@media (min-width: 1024px) {
  .breves-strip__nav--prev {
    transform: translate(-0.75rem, -50%);
  }

  .breves-strip__nav--next {
    transform: translate(0.75rem, -50%);
  }
}

.breves-strip__nav-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Compact horizontal card: left thumb + text */
.breve-card {
  position: relative;
  display: flex;
  flex: 0 0 var(--breves-card-width);
  width: var(--breves-card-width);
  min-width: var(--breves-card-width);
  max-width: var(--breves-card-width);
  align-items: stretch;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: rgb(var(--color-surface) / 0.96);
  border: 1px solid rgb(var(--color-border));
  border-radius: 0;
  color: rgb(var(--color-ink));
  transition:
    border-color var(--duration-base, 0.25s) var(--ease-standard, ease),
    background-color var(--duration-base, 0.25s) var(--ease-standard, ease);
}

.breve-card:not(.breve-card--static):hover,
.breve-card:not(.breve-card--static):focus-within {
  border-color: rgb(var(--color-brand));
  background: rgb(var(--color-brand) / 0.04);
}

.breve-card__hit {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 0.7rem;
  min-width: 0;
  margin: 0;
  padding: 0.65rem 0.55rem 0.65rem 0.65rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.breve-card__hit--static {
  cursor: default;
}

.breve-card__hit:focus-visible {
  outline: 2px solid rgb(var(--color-brand));
  outline-offset: -2px;
}

.breve-card__media {
  position: relative;
  display: block;
  flex: 0 0 var(--breves-thumb);
  width: var(--breves-thumb);
  height: var(--breves-thumb);
  overflow: hidden;
  isolation: isolate;
  background: rgb(var(--color-surface-elevated, var(--color-surface)));
  border: 1px solid rgb(var(--color-border));
}

/* Blurred + darkened letterbox from the same thumb. */
.breve-card__media:not(.is-fallback)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--breve-thumb) center / cover no-repeat;
  filter: blur(8px) brightness(0.55);
  transform: scale(1.12);
  pointer-events: none;
}

.breve-card__media .breve-card__img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.breve-card__media.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(var(--color-surface-elevated));
}

.breve-card__media.is-fallback .breve-card__fallback-img {
  width: 58%;
  height: auto;
  max-height: 58%;
  object-fit: contain;
  opacity: 0.45;
}

.breve-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 auto;
  padding-top: 0.05rem;
}

.breve-card__tag {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
  color: rgb(var(--color-brand));
}

.breve-card__tag--empty {
  display: none;
  height: 0;
  margin: 0;
  padding: 0;
}

.breve-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.015em;
  color: rgb(var(--color-ink));
  transition: color var(--duration-base, 0.25s) var(--ease-standard, ease);
}

.breve-card:not(.breve-card--static):hover .breve-card__title,
.breve-card:not(.breve-card--static):focus-within .breve-card__title {
  color: rgb(var(--color-brand));
}

.breve-card__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgb(var(--color-ink-muted));
}

.breve-card__excerpt:empty {
  display: none;
}

.breve-card__host {
  display: block;
  overflow: hidden;
  margin-top: 0.1rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.6875rem;
  line-height: 1.3;
  color: rgb(var(--color-ink-muted));
  opacity: 0.85;
}

.breve-card__external {
  flex: 0 0 auto;
  align-self: center;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0 0.45rem 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgb(var(--color-ink-muted));
  text-decoration: none;
  opacity: 0.75;
  transition:
    color 0.2s ease,
    opacity 0.2s ease,
    background-color 0.2s ease;
}

.breve-card__external:hover,
.breve-card__external:focus-visible {
  color: rgb(var(--color-brand));
  opacity: 1;
  background: rgb(var(--color-brand) / 0.08);
  outline: none;
}

.breve-card__external:focus-visible {
  outline: 2px solid rgb(var(--color-brand));
  outline-offset: -2px;
}

.breve-card__external-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

/* Leave-site confirm — true viewport overlay (ported to body in JS) */
.breve-leave[hidden] {
  display: none !important;
}

.breve-leave {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  box-sizing: border-box;
}

/* Beat .gg-section-atmosphere > * { position: relative } if still nested. */
.gg-section-atmosphere > .breve-leave,
.breves-strip > .breve-leave {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.breve-leave__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 62%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.breve-leave.is-open .breve-leave__backdrop {
  opacity: 1;
}

.breve-leave__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(28rem, 100%);
  max-height: min(88vh, calc(100vh - 2rem));
  overflow: auto;
  padding: 0 0 1.25rem;
  background: rgb(var(--color-surface));
  border: 1px solid rgb(var(--color-border));
  border-radius: 0;
  box-shadow: var(--shadow-md, 0 10px 24px rgb(0 0 0 / 18%));
  transform: translateY(0.5rem);
  opacity: 0;
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}

.breve-leave__panel.is-open {
  transform: translateY(0);
  opacity: 1;
}

.breve-leave__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  color: rgb(var(--color-ink-muted));
  background: rgb(var(--color-surface) / 0.92);
  border: 1px solid rgb(var(--color-border));
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.breve-leave__close:hover,
.breve-leave__close:focus-visible {
  color: rgb(var(--color-brand));
  border-color: rgb(var(--color-brand));
  background: rgb(var(--color-surface));
  outline: none;
}

.breve-leave__media {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  isolation: isolate;
  background: rgb(var(--color-surface-elevated, var(--color-surface)));
  border-bottom: 1px solid rgb(var(--color-border));
}

.breve-leave__media:not(.is-fallback)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--breve-thumb) center / cover no-repeat;
  filter: blur(12px) brightness(0.55);
  transform: scale(1.12);
  pointer-events: none;
}

.breve-leave__media[hidden] {
  display: none !important;
}

.breve-leave__img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.breve-leave__media.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  background: rgb(var(--color-surface-elevated));
}

.breve-leave__media.is-fallback .breve-leave__img,
.breve-leave__img--fallback {
  width: min(42%, 7.5rem);
  height: auto;
  max-height: 48%;
  object-fit: contain;
  opacity: 0.45;
}

.breve-leave__eyebrow {
  margin: 1.1rem 1.35rem 0;
  padding-right: 2.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
  color: rgb(var(--color-brand));
}

.breve-leave__tag {
  margin: 0.45rem 1.35rem 0;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
  color: rgb(var(--color-ink-muted));
}

.breve-leave__tag[hidden] {
  display: none;
}

.breve-leave__title {
  margin: 0.35rem 1.35rem 0;
  padding-right: 1.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: rgb(var(--color-ink));
}

.breve-leave__excerpt {
  margin: 0.65rem 1.35rem 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: rgb(var(--color-ink));
  white-space: pre-wrap;
}

.breve-leave__excerpt[hidden] {
  display: none;
}

.breve-leave__host {
  margin: 0.55rem 1.35rem 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: rgb(var(--color-brand));
  word-break: break-all;
}

.breve-leave__host[hidden] {
  display: none;
}

.breve-leave__warn {
  margin: 0.9rem 1.35rem 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgb(var(--color-border));
  font-size: 0.875rem;
  line-height: 1.5;
  color: rgb(var(--color-ink-muted));
}

.breve-leave__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.15rem;
  padding: 0 1.35rem;
}

body.breve-leave-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .breve-card,
  .breves-strip__nav,
  .breves-strip__track,
  .breve-leave__panel,
  .breve-leave__backdrop {
    transition: none;
  }

  .breves-strip__track {
    scroll-behavior: auto;
  }
}
