/* The homepage's text sections: the shared section head and spacing,
   Features, How it works, the raid banners, the FAQ and the closing call to
   action. */

@layer layout {
  /* Homepage sections share one head: eyebrow and heading on the left, the
     supporting line on the right, bottoms aligned. */
  .home-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 72px;
    row-gap: 16px;
    align-items: end;
  }

  .home-head h2,
  .faq-section h2,
  .look-inside-copy h2,
  .planner-copy h2,
  .showcase-copy h2 {
    font-size: 34px;
    letter-spacing: -0.8px;
    line-height: 1.18;
    margin-top: 16px;
  }

  .home-head > p {
    max-width: 460px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
  }

  .section-border {
    border-top: 1px solid var(--border);
  }

  /* The previews' depth (product-preview, discord-section and
     planner-preview): a faint top highlight, a contact shadow and a long soft
     one, standing in warm lamplight and the hero's moonlight. */
  :root {
    --preview-shadow:
      inset 0 1px 0 rgb(255 255 255 / 5%),
      0 2px 6px rgb(0 0 0 / 32%),
      0 30px 64px -18px rgb(0 0 0 / 72%);
    --preview-glow:
      radial-gradient(closest-side at 66% 34%, rgb(208 147 87 / 24%), transparent),
      radial-gradient(closest-side at 30% 74%, rgb(112 156 196 / 17%), transparent);
    /* A card laid over a preview's corner: the signup log, the Ranks strip and
       the loot history. */
    --overlay-shadow:
      inset 0 1px 0 rgb(255 255 255 / 6%),
      0 18px 40px -10px rgb(0 0 0 / 75%);
  }

  /* The glow sits behind each preview; clip keeps it from widening the page. */
  .look-inside,
  .discord-section,
  .planner-section,
  .showcase {
    position: relative;
    isolation: isolate;
    overflow-x: clip;
  }

  .hero-product::before,
  .discord-flow::before,
  .planner-visual::before,
  .showcase-visual::before {
    position: absolute;
    inset: -14% -10%;
    z-index: -1;
    content: "";
    background: var(--preview-glow);
    pointer-events: none;
  }

  /* Player names in the planner and the showcases: bold, in their class colour. */
  .preview-character {
    font-weight: 700;
  }

  :is(.planner-visual, .showcase-visual) .c-druid {
    color: var(--class-druid);
  }

  :is(.planner-visual, .showcase-visual) .c-hunter {
    color: var(--class-hunter);
  }

  :is(.planner-visual, .showcase-visual) .c-paladin {
    color: var(--class-paladin);
  }

  :is(.planner-visual, .showcase-visual) .c-priest {
    color: var(--class-priest);
  }

  :is(.planner-visual, .showcase-visual) .c-rogue {
    color: var(--class-rogue);
  }

  :is(.planner-visual, .showcase-visual) .c-shaman {
    color: var(--class-shaman);
  }

  :is(.planner-visual, .showcase-visual) .c-warlock {
    color: var(--class-warlock);
  }

  :is(.planner-visual, .showcase-visual) .c-warrior {
    color: var(--class-warrior);
  }

  .features,
  .workflow,
  .banner-section,
  .faq-section,
  .discord-section,
  .planner-section {
    padding-block: 80px;
  }

  /* Features: nine groups, three across on desktop. */
  .feature-groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 40px;
  }

  .feature-group {
    display: flex;
    flex-direction: column;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
  }

  .feature-group-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
  }

  .feature-group-head .eyebrow {
    color: var(--text-muted);
  }

  .feature-group-head h3 {
    margin-top: 4px;
    font-size: 18px;
    letter-spacing: -0.3px;
  }

  .feature-items {
    display: grid;
    gap: 2px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
  }

  .feature-items li {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 14px;
    padding: 10px 8px;
    margin-inline: -8px;
    border-radius: 7px;
    transition: background-color 150ms ease;
  }

  .feature-items li:hover {
    background: var(--bg-elevated);
  }

  .feature-items .ui-icon {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: var(--accent);
  }

  .feature-item-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
  }

  .feature-items p {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
  }

  .feature-items code {
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
  }

  /* Showcases (the roster, assignments, loot and crafting): the copy beside a
     recreated dashboard screen, over a dimmed raid banner that each preview's
     own file names in --showcase-art. .is-flipped puts the picture on the
     left; the copy stays first for screen readers. */
  .showcase {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 72px;
    align-items: center;
    padding-block: 80px;
  }

  .showcase.is-flipped {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  }

  .showcase.is-flipped .showcase-copy {
    grid-column: 2;
    grid-row: 1;
  }

  .showcase.is-flipped .showcase-visual {
    grid-column: 1;
    grid-row: 1;
  }

  .showcase-visual {
    position: relative;
    min-width: 0;
  }

  /* The art reaches 80px into the sections above and below and fades out
     inside its own box, so it never stops at an edge or a divider. */
  .showcase::before {
    position: absolute;
    inset: -80px 0;
    z-index: -2;
    content: "";
    background: var(--showcase-art) center / cover no-repeat;
    opacity: 0.3;
    /* The banners carry their raid's name in large letters: blurred, the art
       is colour and light only. */
    filter: blur(28px);
    mask-image: radial-gradient(closest-side at 62% 50%, #000 30%, transparent);
    pointer-events: none;
  }

  .showcase.is-flipped::before {
    mask-image: radial-gradient(closest-side at 38% 50%, #000 30%, transparent);
  }

  /* A feature group's link down to its showcase. The tap area is 42px tall;
     the negative margins keep the header as tall as before. */
  .feature-group-link {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    min-height: 42px;
    margin: -12px -8px -12px auto;
    padding-inline: 8px;
    white-space: nowrap;
  }

  .look-inside-copy > p:not(.eyebrow),
  .planner-copy > p:not(.eyebrow),
  .showcase-copy > p:not(.eyebrow) {
    max-width: 440px;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
  }

  /* How it works. */
  .workflow-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 40px 0 0;
    padding: 0;
    list-style: none;
  }

  .step-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-content: start;
    column-gap: 14px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
  }

  .step-card .feature-icon {
    grid-row: span 3;
  }

  .step-number {
    color: var(--accent);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.3px;
    text-transform: uppercase;
  }

  .step-card h3 {
    margin: 4px 0 8px;
    font-size: 16px;
    letter-spacing: -0.3px;
  }

  .step-card p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
  }

  .hero-actions .button .ui-icon,
  .closing-actions .button .ui-icon {
    width: 18px;
    height: 18px;
  }

  /* The built-in raid banners. */
  .banner-section {
    padding-top: 0;
  }

  .banner-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 40px 0 0;
    padding: 0;
    list-style: none;
  }

  .banner-grid li {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    box-shadow:
      0 2px 6px rgb(0 0 0 / 30%),
      0 16px 32px -14px rgb(0 0 0 / 65%);
    transition: border-color 150ms ease;
  }

  /* Over the art: a lit top edge and a little shade at the foot, as on a
     plaque. */
  .banner-grid li::after {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    content: "";
    background: linear-gradient(180deg, transparent 55%, rgb(0 0 0 / 28%));
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 12%);
    pointer-events: none;
  }

  .banner-grid li:hover {
    border-color: var(--border-warm);
  }

  .banner-grid img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 1;
    object-fit: cover;
  }

  /* FAQ. */
  .faq-section {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 72px;
    align-items: start;
  }

  .faq-section > div > p:last-child {
    max-width: 340px;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
  }

  .faq-section .text-link {
    display: inline;
    font-size: inherit;
  }

  .faq-list details {
    border-bottom: 1px solid var(--border);
  }

  .faq-list details:first-child {
    border-top: 1px solid var(--border);
  }

  .faq-list summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 44px;
    padding-block: 16px;
    list-style: none;
  }

  .faq-list summary:hover {
    color: var(--accent);
  }

  .faq-list summary::-webkit-details-marker {
    display: none;
  }

  .faq-chevron {
    color: var(--text-secondary);
    transition: transform 150ms ease;
  }

  .faq-list details[open] .faq-chevron {
    transform: rotate(180deg);
    color: var(--accent);
  }

  .faq-list details p {
    max-width: 620px;
    padding: 0 32px 18px 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.75;
  }

  /* Closing call to action. */
  .closing {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 32px 0 40px;
    border-top: 1px solid var(--border);
  }

  .closing-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
  }

  .closing h2 {
    margin-top: 6px;
    font-size: 26px;
    letter-spacing: -0.6px;
  }

  .closing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
  }
}

@layer responsive {
  @media (max-width: 1100px) {
    .home-head,
    .faq-section,
    .look-inside,
    .planner-section {
      column-gap: 45px;
    }

    .look-inside,
    .planner-section,
    .showcase,
    .showcase.is-flipped {
      grid-template-columns: minmax(0, 1fr);
      row-gap: 40px;
    }

    .showcase.is-flipped .showcase-copy,
    .showcase.is-flipped .showcase-visual {
      grid-column: auto;
      grid-row: auto;
    }

    .look-inside-copy,
    .planner-copy,
    .showcase-copy {
      max-width: 640px;
    }

    .hero-product,
    .planner-visual,
    .showcase-visual {
      width: 100%;
      max-width: 680px;
    }

    /* Stacked: the art sits behind the picture, below the copy. */
    .showcase::before,
    .showcase.is-flipped::before {
      mask-image: radial-gradient(closest-side at 50% 62%, #000 30%, transparent);
    }

    .feature-groups {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Two across leaves the odd group last on its own, so it takes the row. */
    .feature-group:last-child:nth-child(odd) {
      grid-column: 1 / -1;
    }
  }

  @media (max-width: 900px) {
    .banner-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }
  }

  @media (max-width: 800px) {
    .home-head {
      grid-template-columns: minmax(0, 1fr);
    }

    .features,
    .workflow,
    .banner-section,
    .faq-section,
    .discord-section,
    .planner-section,
    .showcase {
      padding-block: 56px;
    }

    .banner-section {
      padding-top: 0;
    }

    .workflow-grid,
    .faq-section {
      grid-template-columns: minmax(0, 1fr);
    }

    .workflow-grid {
      gap: 12px;
    }

    .faq-section {
      gap: 32px;
    }

    .closing {
      flex-wrap: wrap;
      gap: 18px;
    }

    .closing-actions {
      margin-left: 0;
    }
  }

  @media (max-width: 640px) {
    .feature-groups {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  @media (max-width: 520px) {
    .home-head h2,
    .faq-section h2,
    .look-inside-copy h2,
    .planner-copy h2,
    .showcase-copy h2 {
      font-size: 28px;
    }

    .feature-group {
      padding: 18px 16px;
    }

    .step-card {
      padding: 16px;
    }

    .closing h2 {
      font-size: 24px;
    }

    .closing-actions {
      flex-direction: column;
      width: 100%;
    }

    .closing .button {
      width: 100%;
    }
  }

  /* Homepage illustrations keep text at 10px or more. These classes are shared
     with the demo, so their homepage size is scoped here instead of in the base. */
  .hero-product :is(.tiny-label, .badge),
  .discord-section :is(
    .tiny-label,
    .discord-author > span,
    .discord-author small,
    .discord-embed-footer
  ) {
    font-size: 10px;
  }

  /* GuildCore's Potato Crew role medallions; the artwork brings its own ring. */
  :is(.hero-product, .discord-section, .planner-visual) .role-icon {
    flex: none;
    width: 16px;
    height: 16px;
  }
}
