/* ==========================================================================
   Card overlay (Figma "Selected Card (Grátis)" 563:4684 and "Selected Card (Sem plano)" 563:5149; redesign of
   04/11/2026). Built by js/card-overlay.js.
   The box sits in the site's 1600px framed column (dashed side lines), 40px from the top and bottom of the window,
   square, on #0a0a0a with a soft warm glow. Left column (791px): preview, how to use, more templates, support; it
   scrolls inside. Right column: tags, title, description, the button and its note; "available for" at the bottom.
   ========================================================================== */

:root {
  --overlay-top: 40px;
  --overlay-bottom: 40px;
}

/* Page behind the overlay does not scroll */
html.has-card-overlay { overflow: hidden; }
html.has-card-overlay body { padding-right: var(--scrollbar-gap, 0); }
html.has-card-overlay .header { right: var(--scrollbar-gap, 0); }

.card-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.card-overlay[hidden] { display: none; }
.card-overlay.is-open { opacity: 1; }

/* Figma Overlay: Cinza/950 at 25% + 40px background blur (the page shows through, blurred) */
.card-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.25);
  -webkit-backdrop-filter: blur(40px);
  backdrop-filter: blur(40px);
}

/* Figma "All" 563:5002: the 1600px column with the dashed side lines, the whole height of the window */
.card-overlay__column {
  position: absolute;
  top: 0;
  right: var(--frame-gutter);
  bottom: 0;
  left: var(--frame-gutter);
  max-width: var(--frame-max);
  margin-inline: auto;
  background-image: var(--dash-y), var(--dash-y);
  background-size: 1px 4px, 1px 4px;
  background-position: left top, right top;
  background-repeat: repeat-y;
}

/* Figma Wrapper 563:5003: inside the lines, 40px from the top and bottom, square, #0a0a0a */
.card-overlay__panel {
  position: absolute;
  top: var(--overlay-top);
  right: 1px;
  bottom: var(--overlay-bottom);
  left: 1px;
  isolation: isolate;
  overflow: hidden;
  background: var(--gray-950);
  transform: translateY(16px);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.card-overlay.is-open .card-overlay__panel { transform: none; }

/* Figma Bg 563:5004: two blurred ellipses (warm brown over a dark teal) behind the right column, tilted into a
   diagonal band that comes down from the top edge. Each ellipse uses the Figma's exact transform (a 33deg turn
   with a slant: relativeTransform [[0.839 0.795] [-0.544 0.606]]) from its top-left corner; the blur is on the
   whole layer so it stays round on screen. The left edges follow the box width (745 and 792 of 1598px). */
.card-overlay__glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  filter: blur(63px);
  pointer-events: none;
}
.card-overlay__glow::before,
.card-overlay__glow::after {
  content: "";
  position: absolute;
  width: 898.42px;
  border-radius: 50%;
  opacity: 0.7;
  transform-origin: 0 0;
  transform: matrix(0.839, -0.544, 0.795, 0.606, 0, 0);
}
.card-overlay__glow::before { top: 230.74px; left: 46.62%; height: 59.62px; background: #7e4c3d; }
.card-overlay__glow::after { top: 322.74px; left: 49.56%; height: 153.24px; background: #0e171c; }

.card-overlay__close {
  position: absolute;
  top: 40px;
  right: 40px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--glass-10);
  border-radius: 10px;
  background: var(--glass-5);
  transition: background-color 0.2s ease;
}
.card-overlay__close:hover { background: var(--glass-10); }

.card-overlay__scroller {
  height: 100%;
  padding: 0 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.card-overlay__scroller::-webkit-scrollbar { display: none; }
.card-overlay__scroller:focus { outline: none; }

/* Desktop: the left column is 791px (61% when the box is narrower), the right one takes the rest */
.card-overlay__layout {
  display: grid;
  grid-template-columns: min(791px, 61%) minmax(0, 1fr);
  gap: 12px;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Left column (Figma 563:5007): 20px inside, 60px between blocks, dashed line on its right; only it scrolls
   -------------------------------------------------------------------------- */
.card-box {
  display: flex;
  flex-direction: column;
  gap: 60px;
  min-width: 0;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background: var(--dash-y) right top / 1px 4px repeat-y;
}
.card-box::-webkit-scrollbar { display: none; }
.card-box:focus { outline: none; }
.card-box > * { flex-shrink: 0; }

.card-box__preview {
  position: relative;
  aspect-ratio: 750 / 449;
  overflow: hidden;
  border-radius: 24px;
  background: var(--gray-900);
}
.card-box__preview .preview-video,
.template-card__preview .preview-video {
  position: absolute;
  inset: 0 auto 0 0;
  width: 101.5%; /* cuts the scrollbar recorded on the right edge of many previews (see .library-card__preview) */
  height: 100%;
  object-fit: cover;
  object-position: left center;
}

.card-box__divider {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--gray-900);
}

.card-box__section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0 30px;
}
.card-box__section--templates { gap: 40px; }

.card-box__heading {
  margin: 0;
  font-size: 20px;
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: -0.2px;
  color: var(--gray-50);
}

/* How to use (Step Item 193:228) */
.card-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.card-step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.card-step img { width: 28px; height: 28px; }
.card-step p { margin: 0; line-height: 1.5; }
.card-step__title { font-size: 16px; color: var(--gray-50); }
.card-step__text { font-size: 14px; color: var(--gray-500); }

/* More templates */
.templates { position: relative; }

.templates__arrows {
  position: absolute;
  top: -52px;
  right: 43px;
  display: flex;
  gap: 8px;
}
.arrow-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--glass-10);
  border-radius: 12px;
  background: var(--glass-5);
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
.arrow-button:hover:not(:disabled) { background: var(--glass-10); }
.arrow-button:disabled { opacity: 0.4; cursor: default; }
.arrow-button img { width: 18px; height: 18px; }
.arrow-button--prev img { transform: scaleX(-1); }

.templates__track {
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  list-style: none;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.templates__track::-webkit-scrollbar { display: none; }

/* Figma Frame 34: the last card fades into the box */
.templates__fade {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 244px;
  max-width: 40%;
  background: linear-gradient(90deg, rgba(21, 21, 21, 0), var(--gray-950));
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.templates.is-end .templates__fade { opacity: 0; }

/* Library Card / Mini (Figma 563:5022) */
.template-card {
  flex: 0 0 318px;
  min-width: 0;
  scroll-snap-align: start;
}
.template-card__link {
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-radius: 24px;
}
.template-card__frame {
  display: block;
  padding: 12px;
  border: 1px solid var(--glass-10);
  border-radius: 24px;
  background-image: linear-gradient(141.77deg, rgb(10, 10, 10) 6.1039%, rgb(21, 21, 21) 45.51%, rgb(10, 10, 10) 93.896%);
  transition: border-color 0.3s ease;
}
.template-card__link:hover .template-card__frame { border-color: rgba(229, 238, 244, 0.35); }
.template-card__preview {
  position: relative;
  display: block;
  aspect-ratio: 292 / 170;
  overflow: hidden;
  border-radius: 10px;
}
.template-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.template-card__title {
  min-width: 0;
  overflow: hidden;
  font-size: 24px;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.24px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.template-card__row .plan-crown { width: 26px; height: 26px; }

/* Support (Support Banner 193:246): only a line, no fill */
.card-box__support { padding: 0 30px; }
.support-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--glass-10);
  border-radius: 20px;
}
.support-banner__text {
  max-width: 331px;
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
}
.support-banner__button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--glass-5);
  font-size: 14px;
  line-height: 1.5;
  transition: background-color 0.2s ease;
}
.support-banner__button:hover { background: var(--glass-10); }
.support-banner__button img { width: 20px; height: 20px; }

/* --------------------------------------------------------------------------
   Right column (Figma 563:5031): 80px top and bottom, 40px on the sides; stays still
   -------------------------------------------------------------------------- */
.card-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  min-width: 0;
  min-height: 0;
  padding: 80px 40px;
  /* Only scrolls on very short screens */
  overflow-y: auto;
  scrollbar-width: none;
}
.card-info::-webkit-scrollbar { display: none; }

.card-info__main {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.card-info__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-right: 48px; /* clear of the close button */
}
.info-tag {
  padding: 6px 12px;
  border: 1px solid var(--glass-10);
  border-radius: 999px;
  background: var(--glass-5);
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
}

/* "Licença comercial": a small box opens under the tag on hover or keyboard focus */
.info-tag--tip { position: relative; cursor: default; }
.info-tag--tip:focus-visible { outline: 2px solid var(--gray-50); outline-offset: 2px; }
.info-tip {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 6;
  width: 320px;
  max-width: calc(100vw - 80px);
  padding: 16px 18px;
  border: 1px solid var(--glass-10);
  border-radius: 12px;
  background: var(--gray-900);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
  text-align: left;
  color: var(--gray-50);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
  pointer-events: none;
}
.info-tag--tip:hover .info-tip,
.info-tag--tip:focus-visible .info-tip {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.card-info__text {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-info__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.card-info__title {
  min-width: 0;
  margin: 0;
  font-size: 40px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.8px;
  overflow-wrap: anywhere;
}
.card-info__meta {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 24px;
}
/* Category (Figma Toggles 563:5041): #151515 with a Glass 10% line, like the "New" tag of the cards */
.card-info__category {
  padding: 2px 10px;
  border-radius: 16px;
  background: var(--gray-900);
  box-shadow: inset 0 0 0 1px var(--glass-10);
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  color: #fff;
  white-space: nowrap;
}
.card-info__description {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray-400);
  text-wrap: pretty;
}

.card-info__buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

/* Copy (Figma Action Button 563:5045): full width, 50px, 14px corners, a faint fill that lightens towards the
   bottom, and the Figma's coloured line (orange on one side, white to teal on the other) running around it in a
   loop all the time, like the white beams of the cards. A faint fixed line sits under it so the edge never vanishes.
   --beam-angle and card-beam come from styles.css. */
.copy-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.25) 47%, rgba(247, 247, 247, 0.05) 196%);
  box-shadow: inset 0 0 0 1.5px rgba(247, 247, 247, 0.06);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--gray-50);
  white-space: nowrap;
  transition: background-color 0.2s ease;
}
.copy-button::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--beam-angle),
    transparent 0deg,
    transparent 30deg,
    rgba(230, 90, 52, 0.25) 55deg,
    #e65a34 85deg,
    #e49782 105deg,
    rgba(228, 151, 130, 0.2) 130deg,
    transparent 155deg,
    transparent 210deg,
    rgba(41, 84, 107, 0.4) 235deg,
    #29546b 255deg,
    #e5eef4 280deg,
    rgba(229, 238, 244, 0.2) 305deg,
    transparent 330deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  animation: card-beam 3.2s linear infinite;
}
.copy-button:hover { background-color: rgba(247, 247, 247, 0.04); }
.copy-button:active { transform: scale(0.995); }
.copy-button[hidden] { display: none; }
.copy-button img { width: 16px; height: 16px; }

/* Pro card without a plan (Figma Upgrade Button 563:5621): silver, full width, 45px */
.upgrade-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 45px;
  padding: 0 16px;
  border-radius: 9px;
  background: linear-gradient(90deg, #aec5d7 0%, #f7f7f7 49.038%, #aec5d7 100%);
  box-shadow: inset 0 0 0 1px var(--glass-10);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: var(--blue-950);
  white-space: nowrap;
  transition: filter 0.2s ease, transform 0.2s ease;
}
.upgrade-cta[hidden] { display: none; }
.upgrade-cta:hover { filter: brightness(1.06); }
.upgrade-cta:active { transform: scale(0.995); }
.upgrade-cta img { width: 15px; height: 15px; }

/* Download the source code (active plan only): a quiet glass button under the copy button */
.source-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  padding: 0 22px;
  border: 1px solid var(--glass-10);
  border-radius: 14px;
  background: var(--glass-5);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--gray-50);
  white-space: nowrap;
  transition: background-color 0.2s ease;
}
.source-button[hidden] { display: none; }
.source-button:hover:not(:disabled) { background: var(--glass-10); }
.source-button:disabled { cursor: default; opacity: 0.7; }
.source-button img { width: 16px; height: 16px; }

/* The line under the button (state and short messages) */
.card-info__note {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-400);
  text-align: center;
  text-wrap: balance;
}
.card-info__note[hidden] { display: none; }

/* Free-copy limit notice (Figma "Sign in toggle" 316:3739). Floats over the top of the preview, centred on the
   left column. Fill = Glass 10% over a dark base + blur so it stays readable on bright previews. */
.limit-notice {
  position: absolute;
  top: 36px;
  left: calc(24px + min(791px, (100% - 60px) * 0.61) / 2);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100% - 48px);
  padding: 8px 24px 8px 8px;
  border: 1px solid var(--glass-10);
  border-radius: 14px;
  background: linear-gradient(var(--glass-10), var(--glass-10)), rgba(10, 10, 10, 0.72);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.limit-notice[hidden] { display: none; }
.limit-notice.is-shown { opacity: 1; transform: translate(-50%, 0); }
.limit-notice__icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--glass-10);
  border-radius: 10px;
  background: var(--glass-5);
}
.limit-notice__icon img { width: 14.6667px; height: 14.6667px; }
.limit-notice__text {
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray-400);
}
.limit-notice__text span { color: var(--gray-50); }
.limit-notice:hover .limit-notice__text span { text-decoration: underline; text-underline-offset: 3px; }

/* Available For (Figma 563:5047): text on two lines, small app tiles */
.available-for {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.available-for__label {
  max-width: 120px; /* two lines, like the Figma's 119px box */
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-50);
}
.available-for__apps {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.app-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35.43px;
  height: 35.43px;
  border-radius: 8.5px;
}
.app-tile--claude-code { background: #d97757; }
.app-tile--gemini { background: #4285f4; }
.app-tile--codex { background: #7c5cf5; }
.app-tile--cursor { background: #f5f5f5; }
.app-tile--lovable { background: var(--gray-900); box-shadow: inset 0 0 0 0.7px var(--gray-800); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1040px) {
  /* One column: info first, then the preview and the rest; the whole box scrolls */
  .card-overlay__layout { grid-template-columns: minmax(0, 1fr); gap: 0; height: auto; }
  .card-box {
    overflow: visible;
    padding: 20px 0 40px;
    background: var(--dash-x) left top / 4px 1px repeat-x;
  }
  .card-info {
    order: -1;
    padding: 64px 20px 40px;
    overflow: visible;
  }
  .card-info__tags { padding-right: 40px; }
  /* The preview box is far down, so the notice sits at the bottom edge of the box (which stays put while the
     content scrolls), centred, and wraps on narrow screens */
  .limit-notice {
    top: auto;
    bottom: 20px;
    left: 50%;
    width: max-content;
    max-width: calc(100% - 32px);
    transform: translate(-50%, 8px);
  }
  .limit-notice.is-shown { transform: translate(-50%, 0); }
}

@media (max-width: 768px) {
  :root { --overlay-top: 20px; --overlay-bottom: 20px; }
  .card-overlay__close { top: 20px; right: 20px; }
  .card-overlay__scroller { padding: 0 12px; }
  .card-info { padding: 60px 8px 32px; }
  .card-box { gap: 40px; }
  .card-box__preview { border-radius: 16px; }
  .card-box__section,
  .card-box__support { padding: 0 8px; }
  .templates__arrows { right: 0; }
}

@media (max-width: 640px) {
  .card-info__title { font-size: 32px; }
  .card-steps { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .template-card { flex-basis: 260px; }
  .template-card__title { font-size: 22px; }
  .support-banner { flex-direction: column; align-items: flex-start; padding: 20px; }
  .support-banner__text { font-size: 16px; }
}

@media (max-width: 400px) {
  .card-info__top { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .card-overlay,
  .card-overlay__panel,
  .limit-notice { transition: none; }
  .card-overlay__panel { transform: none; }
  /* No loop: the Figma's still line (orange on the left, white to teal on the right) */
  .copy-button::before {
    animation: none;
    background: linear-gradient(90deg, #e65a34 6%, #e49782 18%, rgba(11, 11, 21, 0) 50%, #e5eef4 89%, #29546b 100%);
  }
}
