/* Styles for home/services (app/sections/).
   Every rule is scoped to .home-hero-services-section-services, so none of it reaches other
   parts of the page.

   Layout: the heading on the left, a line of text and the button on the
   right, then a row of large cards that share the full width.

   An open card (hovered, tapped, or focused) lifts, fills with gold and
   glows, as it always did; on large screens it also takes more of the row
   and the others make room (see "The open card" below). */

.home-hero-services-section-services {
    --color-brand-primary: #001e53;
    --color-brand-secondary: #f1ae22;
    --color-brand-accent: #feca16;
    --svc-ink: #060c22;
    --svc-cream: #f3eee2;
    --svc-sans: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --svc-ease: cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* =========================
     Base Section Styles
  ========================= */
  /* Starts on the dark ink the hero ends on, so the two read as one. */
  .home-hero-services-section-services {
    position: relative;
    z-index: 1;
    padding: clamp(56px, 8vw, 104px) clamp(20px, 6vw, 96px) clamp(64px, 8vw, 112px);
    background: linear-gradient(180deg, var(--svc-ink) 0%, var(--color-brand-primary) 42%, #00153d 100%);
    color: #fff;
    overflow: hidden;
  }

  .home-hero-services-section-services *,
  .home-hero-services-section-services *::before,
  .home-hero-services-section-services *::after {
    box-sizing: border-box;
  }

  .home-hero-services-section-services .home-hero-services-container {
    max-width: 1320px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
  }

  /* =========================
     Heading row
  ========================= */
  .home-hero-services-section-services .home-hero-services-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px 48px;
    flex-wrap: wrap;
  }

  .home-hero-services-section-services .home-hero-services-section-title {
    margin: 0;
    font-size: clamp(2.25rem, 5vw, 4.25rem);
    font-weight: 400;
    line-height: 1.05;
    color: #fff;
    text-wrap: balance;
  }

  .home-hero-services-section-services .home-hero-services-section-title span {
    color: var(--color-brand-accent);
  }

  .home-hero-services-section-services .home-hero-services-side {
    display: flex;
    align-items: center;
    gap: 16px 28px;
    flex-wrap: wrap;
    max-width: 560px;
  }

  .home-hero-services-section-services .home-hero-services-lead {
    flex: 1 1 240px;
    margin: 0;
    font-family: var(--svc-sans);
    font-size: 1.0625rem;
    font-weight: 400;
    line-height: 1.5;
    color: rgba(243, 238, 226, 0.88);
    text-wrap: pretty;
  }

  /* The gold button, as in the hero above */
  .home-hero-services-section-services .home-hero-services-primary-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-height: 50px;
    padding: 0 24px;
    border-radius: 999px;
    background: var(--color-brand-secondary);
    color: var(--color-brand-primary);
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 10px 28px rgba(6, 12, 34, 0.45);
    transition: background-color 0.25s ease, transform 0.35s var(--svc-ease), box-shadow 0.25s ease;
  }

  .home-hero-services-section-services .home-hero-services-primary-button svg {
    transition: transform 0.35s var(--svc-ease);
  }

  .home-hero-services-section-services .home-hero-services-primary-button:hover {
    background: #ffc94d;
    color: var(--color-brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(6, 12, 34, 0.5);
  }

  .home-hero-services-section-services .home-hero-services-primary-button:hover svg {
    transform: translateX(4px);
  }

  .home-hero-services-section-services a:focus-visible {
    outline: 2px solid #ffc94d;
    outline-offset: 4px;
  }

  /* =========================
     Services Grid & Cards
  ========================= */
  /* As many cards as there are share the row; they wrap when each would
     be narrower than 200px. */
  .home-hero-services-section-services .home-hero-services-grid {
    margin-top: clamp(32px, 5vw, 56px);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
  }

  .home-hero-services-section-services .home-hero-services-none {
    grid-column: 1 / -1;
    margin: 0;
    font-family: var(--svc-sans);
    color: rgba(243, 238, 226, 0.8);
  }

  /* A card at rest: the icon at the top left, the name and an arrow along
     the bottom. */
  .home-hero-services-section-services .home-hero-services-card {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    min-width: 0;
    min-height: clamp(180px, 17vw, 240px);
    padding: 26px 24px 22px;
    background-color: #021a42;
    border: 2px solid rgba(254, 202, 22, 0.5);
    border-radius: 16px;
    box-shadow: 0 0 2px #feca16, inset 0 0 2px #feca16;
    text-align: left;
    cursor: pointer;
    z-index: 0;
    /* opacity and transform: the entrance; translate: the lift;
       flex-grow: the extra width on large screens */
    transition:
      opacity 0.6s ease-out,
      transform 0.6s ease-out,
      translate 0.45s var(--svc-ease),
      flex-grow 0.5s var(--svc-ease),
      border-color 0.3s ease;
  }

  /* The cards are links: keep the card's own text colours. */
  .home-hero-services-section-services a.home-hero-services-card {
    color: inherit;
    text-decoration: none;
  }

  .home-hero-services-section-services .home-hero-services-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
  }

  .home-hero-services-section-services .home-hero-services-icon {
    font-size: 40px;
    color: var(--color-brand-accent);
    display: inline-block;
    align-self: flex-start;
  }

  .home-hero-services-section-services .home-hero-services-card h3 {
    font-size: clamp(1.25rem, 1.7vw, 1.625rem);
    font-weight: 400;
    color: #fff;
    margin: 0;
    line-height: 1.15;
    transform-origin: left bottom;
    /* a word breaks only when it cannot fit on a line of its own */
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .home-hero-services-section-services .home-hero-services-btn-icon {
    flex-shrink: 0;
    font-size: 18px;
    color: var(--color-brand-accent);
    display: inline-block;
    padding-bottom: 4px;
  }

  /* =========================
     Card coming into view (home-hero-services.js adds .scroll-show;
     the stagger is the inline transition-delay, dropped once it is in)
  ========================= */
  .home-hero-services-section-services .home-hero-services-card.scroll-hidden {
    opacity: 0;
    transform: translateY(30px);
  }

  .home-hero-services-section-services .home-hero-services-card.scroll-show {
    opacity: 1;
    transform: none;
  }

  .home-hero-services-section-services .home-hero-services-card h3,
  .home-hero-services-section-services .home-hero-services-card .home-hero-services-icon,
  .home-hero-services-section-services .home-hero-services-card .home-hero-services-btn-icon {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition:
      opacity 0.6s ease-out,
      transform 0.45s var(--svc-ease),
      color 0.3s ease,
      text-shadow 0.3s ease;
  }

  .home-hero-services-section-services .home-hero-services-card.scroll-show h3,
  .home-hero-services-section-services .home-hero-services-card.scroll-show .home-hero-services-icon,
  .home-hero-services-section-services .home-hero-services-card.scroll-show .home-hero-services-btn-icon {
    opacity: 1;
    transform: none;
  }

  /* =========================
     The open card: it lifts, fills with gold and glows, as it always did.
     Open = the mouse is over it, or it was tapped (.is-active, set by
     home-hero-services.js), or it has keyboard focus.
     The gold fill and the glow are two layers that only fade in and out,
     so nothing is redrawn while they change. The card no longer grows by
     zooming over its neighbours: on large screens it takes more of the
     row and the others make room (see "Large screens" below).
  ========================= */
  .home-hero-services-section-services .home-hero-services-card::before,
  .home-hero-services-section-services .home-hero-services-card::after {
    content: '';
    position: absolute;
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
  }

  /* the gold fill, inside the border */
  .home-hero-services-section-services .home-hero-services-card::before {
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--color-brand-secondary), var(--color-brand-accent));
    transition: opacity 0.45s ease;
  }

  /* the glow, around the border; it stays inside the gap between cards */
  .home-hero-services-section-services .home-hero-services-card::after {
    inset: -2px;
    box-shadow:
      0 0 16px rgba(254, 202, 22, 0.75),
      0 0 40px rgba(254, 202, 22, 0.45) inset,
      0 12px 26px rgba(0, 0, 0, 0.3);
    transition: opacity 0.45s ease;
  }

  html:not(.js) .home-hero-services-section-services .home-hero-services-card:hover,
  .home-hero-services-section-services .home-hero-services-card.is-active,
  .home-hero-services-section-services .home-hero-services-card:focus-visible {
    z-index: 2;
    translate: 0 -10px;
    border-color: var(--color-brand-accent);
  }

  html:not(.js) .home-hero-services-section-services .home-hero-services-card:hover::before,
  html:not(.js) .home-hero-services-section-services .home-hero-services-card:hover::after,
  .home-hero-services-section-services .home-hero-services-card.is-active::before,
  .home-hero-services-section-services .home-hero-services-card.is-active::after,
  .home-hero-services-section-services .home-hero-services-card:focus-visible::before,
  .home-hero-services-section-services .home-hero-services-card:focus-visible::after {
    opacity: 1;
  }

  html:not(.js) .home-hero-services-section-services .home-hero-services-card:hover h3,
  .home-hero-services-section-services .home-hero-services-card.is-active h3,
  .home-hero-services-section-services .home-hero-services-card:focus-visible h3 {
    color: #000;
    text-shadow: 0 0 6px var(--color-brand-accent);
    transform: scale(1.05);
  }

  html:not(.js) .home-hero-services-section-services .home-hero-services-card:hover .home-hero-services-icon,
  html:not(.js) .home-hero-services-section-services .home-hero-services-card:hover .home-hero-services-btn-icon,
  .home-hero-services-section-services .home-hero-services-card.is-active .home-hero-services-icon,
  .home-hero-services-section-services .home-hero-services-card.is-active .home-hero-services-btn-icon,
  .home-hero-services-section-services .home-hero-services-card:focus-visible .home-hero-services-icon,
  .home-hero-services-section-services .home-hero-services-card:focus-visible .home-hero-services-btn-icon {
    color: var(--color-brand-primary);
    text-shadow: 0 0 8px var(--color-brand-accent), 0 0 12px var(--color-brand-accent);
    transform: scale(1.2) rotate(-5deg);
  }

  /* =========================
     Scroll Animations (heading and button)
  ========================= */
  .home-hero-services-section-services .scroll-left,
  .home-hero-services-section-services .scroll-right {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .home-hero-services-section-services .scroll-left {
    transform: translateX(-40px);
  }

  .home-hero-services-section-services .scroll-right {
    transform: translateX(40px);
  }

  .home-hero-services-section-services .scroll-left.scroll-show,
  .home-hero-services-section-services .scroll-right.scroll-show {
    opacity: 1;
    transform: none;
  }

  .home-hero-services-section-services .home-hero-services-section-title { transition-delay: 0.05s; }
  .home-hero-services-section-services .home-hero-services-side { transition-delay: 0.15s; }

  /* =========================
     Large screens: one row, and the open card takes more of it. The
     others narrow to make room, so it never covers them. Its new edges
     always contain its old ones, so the pointer stays on it as it grows.
  ========================= */
  @media (min-width: 1024px) {
    .home-hero-services-section-services .home-hero-services-grid {
      display: flex;
      flex-wrap: wrap;
    }

    /* every card starts from nothing and takes an equal share; a row holds
       as many as fit at 180px or more, the rest wrap */
    .home-hero-services-section-services .home-hero-services-card {
      flex: 1 1 0;
      min-width: 180px;
    }

    html:not(.js) .home-hero-services-section-services .home-hero-services-card:hover,
    .home-hero-services-section-services .home-hero-services-card.is-active,
    .home-hero-services-section-services .home-hero-services-card:focus-visible {
      flex-grow: 1.4;
    }
  }

  /* Smaller screens: two cards a row; the open card lifts a little less,
     staying inside the gap. */
  @media (max-width: 1023px) {
    html:not(.js) .home-hero-services-section-services .home-hero-services-card:hover,
    .home-hero-services-section-services .home-hero-services-card.is-active,
    .home-hero-services-section-services .home-hero-services-card:focus-visible {
      translate: 0 -6px;
    }
  }

  /* =========================
     Smaller screens
  ========================= */
  @media (max-width: 900px) {
    .home-hero-services-section-services .home-hero-services-side {
      max-width: none;
      width: 100%;
    }

    .home-hero-services-section-services .home-hero-services-grid {
      gap: 16px;
    }
  }

  /* Tablets: two a row, so four cards make two even rows instead of
     three and one left over */
  @media (max-width: 1023px) {
    .home-hero-services-section-services .home-hero-services-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-hero-services-section-services .home-hero-services-card {
      min-height: 170px;
    }
  }

  /* Phones: two cards a row */
  @media (max-width: 600px) {
    .home-hero-services-section-services .home-hero-services-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14px;
    }

    .home-hero-services-section-services .home-hero-services-card {
      min-height: 150px;
      gap: 28px;
      padding: 20px 16px 16px;
    }

    .home-hero-services-section-services .home-hero-services-icon {
      font-size: 32px;
    }

    .home-hero-services-section-services .home-hero-services-card h3 {
      font-size: 1.125rem;
    }

    /* The arrow moves to the top right corner, level with the icon, so the
       title has the card's whole width: "Corporate" no longer breaks. */
    .home-hero-services-section-services .home-hero-services-btn-icon {
      position: absolute;
      top: 26px;
      right: 16px;
      padding: 0;
      font-size: 15px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .home-hero-services-section-services *,
    .home-hero-services-section-services *::before,
    .home-hero-services-section-services *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
