/*
 * Components — reusable building blocks shared by more than one section.
 */
@layer components {
  /* ---------- Brand mark (wordmark) ---------- */
  .brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-display);
    font-size: calc(28rem / 16);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1;
  }

  .brand-mark svg {
    flex: none;
  }

  .brand-mark__accent {
    color: var(--color-violet);
    font-style: italic;
  }

  /* The "a" sits between upright letters; slanted, it runs into the "s". */
  .brand-mark__accent--upright {
    font-style: normal;
  }

  /* "fastgent" inside running text; the accents spell out "agent" */
  .brand-name {
    font-weight: 700;
    white-space: nowrap;
  }

  .brand-name__accent {
    color: var(--color-violet);
  }

  .brand-mark--sm {
    font-size: calc(15rem / 16);
    gap: 5px;
    letter-spacing: -0.02em;
  }

  .brand-mark--sm svg {
    width: 13px;
    height: 9px;
  }

  /* ---------- Buttons ---------- */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--radius-pill);
  }

  .btn--sm {
    font-size: calc(16rem / 16);
    padding: 13px 22px;
  }

  .btn--md {
    font-size: calc(17rem / 16);
    padding: 17px 30px;
  }

  .btn--lg {
    font-size: calc(18rem / 16);
    padding: 18px 32px;
  }

  .btn--dark {
    background: var(--color-ink);
    color: var(--color-cream);
  }

  .btn--primary {
    background: var(--color-violet);
    color: var(--color-white);
  }

  .btn--cream {
    background: var(--color-cream);
    color: var(--color-ink);
  }

  /* Text colour is inherited so the global link hover applies. */
  .btn--white {
    background: var(--color-white);
    border: 1px solid var(--color-line);
  }

  .btn--md.btn--white {
    padding: 16px 28px;
  }

  .btn--on-violet {
    color: var(--color-white);
    border: 1px solid rgba(255, 255, 255, 0.55);
  }

  .btn--lg.btn--on-violet {
    padding: 17px 28px;
  }

  /* ---------- Section headings ---------- */
  .section-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: calc(60rem / 16);
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -0.025em;
  }

  .section-lead {
    margin: 0;
    font-size: calc(19rem / 16);
    line-height: 1.6;
    color: var(--color-ink-soft);
  }

  @media (max-width: 900px) {
    .section-title {
      font-size: calc(40rem / 16);
    }
  }

  /* ---------- Tags & status pills ---------- */
  .tag {
    font-size: calc(13rem / 16);
    font-weight: 700;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
  }

  .tag--compact {
    padding: 4px 10px;
  }

  .tag--violet {
    background: var(--color-violet-tint);
    color: var(--color-violet-strong);
  }

  .tag--brand {
    background: var(--color-violet);
    color: var(--color-white);
  }

  .tag--dark {
    background: var(--color-ink);
    color: var(--color-cream);
  }

  .tag--success {
    background: var(--color-green-tint);
    color: var(--color-green);
  }

  /* ---------- Robot mascot ---------- */
  .robot__eye {
    transform-box: fill-box;
    transform-origin: center;
    animation: robot-blink 5s infinite;
  }

  .robot__antenna {
    transform-box: fill-box;
    transform-origin: center;
    animation: robot-pulse 2.4s ease-in-out infinite;
  }

  @keyframes robot-blink {
    0%,
    92%,
    100% {
      transform: scaleY(1);
    }

    95% {
      transform: scaleY(0.1);
    }
  }

  @keyframes robot-pulse {
    0%,
    100% {
      opacity: 1;
    }

    50% {
      opacity: 0.45;
    }
  }

  /* ---------- Channel icons ---------- */
  .channel-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Small variant for inline labels (dashboard, inbox). */
  .channel-icon {
    flex: none;
  }

  .channel-icon--sm {
    width: 22px;
    height: 22px;
  }

  .channel-icon--sm svg {
    width: 13px;
    height: 13px;
  }

  .channel-icon--whatsapp { background: #DDF3E6; color: #1E6B45; }
  .channel-icon--instagram { background: #FCE3EC; color: #9C2B5A; }
  .channel-icon--facebook { background: #E1E9FF; color: #2A4BB8; }
  .channel-icon--linkedin { background: #E1ECF7; color: #1D5A8C; }
  .channel-icon--messenger { background: #EDE7FF; color: #5A3FE6; }
  .channel-icon--tiktok { background: #F1EFE9; color: #1C1A3A; }
  .channel-icon--website { background: #FFF0D6; color: #8A5A00; }
  .channel-icon--email { background: #E3F1F7; color: #1D6A86; }

  /* ---------- Scroll-driven entrances ---------- */
  @supports (animation-timeline: scroll()) {
    .section-reveal {
      animation: section-reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 90%;
    }

    @keyframes section-reveal {
      from {
        clip-path: inset(0 7% round 64px);
      }

      to {
        clip-path: inset(0 0 round 0px);
      }
    }

    .pop-in {
      animation: pop-in linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 35%;
    }

    @keyframes pop-in {
      from {
        opacity: 0;
        scale: 0.9;
      }
    }
  }

  /* ---------- Floating buttons: contact dock (left) and back to top (right) ---------- */
  .contact-dock,
  .back-to-top {
    position: fixed;
    z-index: 50;
    bottom: max(var(--float-offset), env(safe-area-inset-bottom));
  }

  .contact-dock a:focus-visible,
  .back-to-top:focus-visible {
    outline: 2px solid transparent;
    box-shadow: 0 0 0 3px var(--color-cream), 0 0 0 6px var(--color-ink);
  }

  /*
   * Revealed by BackToTop (assets/js/components/back-to-top.js) once the hero
   * scrolls away. Sits above the accessibility-menu button in the right corner.
   */
  .back-to-top {
    bottom: calc(max(var(--float-offset), env(safe-area-inset-bottom)) + 68px);
    inset-inline-start: var(--float-offset);
    box-sizing: border-box;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-white);
    border: 1px solid var(--color-line);
    color: var(--color-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-float);
    transition: opacity 0.2s ease, translate 0.2s ease, visibility 0.2s;
  }

  .back-to-top:hover {
    background: var(--color-violet);
    border-color: var(--color-violet);
    color: var(--color-white);
  }

  .back-to-top[data-state="hidden"] {
    opacity: 0;
    translate: 0 8px;
    visibility: hidden;
  }

  @media (prefers-reduced-motion: reduce) {
    .back-to-top {
      transition: none;
    }
  }

  .contact-dock {
    inset-inline-end: var(--float-offset);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .contact-dock__whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: calc(16rem / 16);
    font-weight: 700;
    text-decoration: none;
    background: var(--color-green);
    color: var(--color-white);
    padding: 12px 20px 12px 14px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-float);
  }

  .contact-dock__whatsapp:hover {
    background: var(--color-green-strong);
    color: var(--color-white);
  }

  .contact-dock__badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-whatsapp);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
  }

  .contact-dock__call {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-float);
  }

  .contact-dock__call:hover {
    background: var(--color-violet);
  }

  @media (max-width: 900px) {
    .contact-dock__whatsapp {
      font-size: calc(15rem / 16);
    }
  }
}
