@layer base, layout, components, utilities, pages;

/**
 * Related Resources Section - Refined Editorial Design
 * Clean, magazine-inspired layout with subtle interactions
 */

@layer components {

  /* --------------------------------------------------------------------------
     Design Tokens
     -------------------------------------------------------------------------- */
  .related-resources {
    --rr-color-text: #1a1a1a;
    --rr-color-text-secondary: #6b7280;
    --rr-color-accent: #0f172a;
    --rr-color-highlight: #3b82f6;
    --rr-color-border: #e5e7eb;
    --rr-color-bg: #fafafa;
    --rr-color-surface: #fff;
    --rr-radius: 4px;
    --rr-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --rr-font-display: 'Outfit', system-ui, sans-serif;
    --rr-font-body: 'Zen Kaku Gothic New', system-ui, sans-serif;
  }

  /* --------------------------------------------------------------------------
     Section Container
     -------------------------------------------------------------------------- */
  .related-resources {
    background: var(--rr-color-bg);
    padding: 88px 0;
  }

  .related-resources__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 32px;
  }

  /* --------------------------------------------------------------------------
     Section Header
     -------------------------------------------------------------------------- */
  .related-resources__header {
    margin-bottom: 56px;
  }

  .related-resources__eyebrow {
    display: block;
    font-family: var(--rr-font-display);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rr-color-text-secondary);
    margin-bottom: 8px;
  }

  .related-resources__title {
    font-family: var(--rr-font-body);
    font-size: 28px;
    font-weight: 600;
    color: var(--rr-color-text);
    margin: 0;
    letter-spacing: -0.01em;
  }

  /* --------------------------------------------------------------------------
     Group
     -------------------------------------------------------------------------- */
  .related-group {
    margin-bottom: 48px;
  }

  .related-group:last-child {
    margin-bottom: 0;
  }

  .related-group__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
  }

  .related-group__titles {
    display: flex;
    align-items: baseline;
    gap: 12px;
  }

  .related-group__eyebrow {
    font-family: var(--rr-font-display);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rr-color-text-secondary);
  }

  .related-group__title {
    font-family: var(--rr-font-body);
    font-size: 16px;
    font-weight: 600;
    color: var(--rr-color-text);
    margin: 0;
  }

  .related-group__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--rr-font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--rr-color-text-secondary);
    text-decoration: none;
    padding: 8px 0;
    transition: color 0.2s var(--rr-ease);
  }

  .related-group__more:hover {
    color: var(--rr-color-text);
  }

  .related-group__more svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s var(--rr-ease);
  }

  .related-group__more:hover svg {
    transform: translateX(3px);
  }

  /* --------------------------------------------------------------------------
     Q&A List - Clean editorial style
     -------------------------------------------------------------------------- */
  .related-qa-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--rr-color-border);
  }

  .related-qa-item {
    margin: 0;
    border-bottom: 1px solid var(--rr-color-border);
  }

  .related-qa-accordion {
    background: transparent;
  }

  .related-qa-question {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 20px 0;
    cursor: pointer;
    list-style: none;
    position: relative;
  }

  .related-qa-question::-webkit-details-marker {
    display: none;
  }

  /* Expand indicator */
  .related-qa-question::after {
    content: '+';
    position: absolute;
    right: 0;
    font-family: var(--rr-font-display);
    font-size: 20px;
    font-weight: 300;
    color: var(--rr-color-text-secondary);
    transition: transform 0.25s var(--rr-ease);
  }

  .related-qa-accordion[open] .related-qa-question::after {
    content: '−';
  }

  /* Q Label - Minimal circle */
  .related-qa-label {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--rr-color-accent);
    border-radius: 50%;
    color: #fff;
    font-family: var(--rr-font-display);
    font-size: 12px;
    font-weight: 600;
  }

  .related-qa-text {
    flex: 1;
    font-family: var(--rr-font-body);
    font-size: 15px;
    font-weight: 500;
    color: var(--rr-color-text);
    line-height: 1.5;
    padding-right: 32px;
  }

  /* Answer section */
  .related-qa-answer {
    padding: 0 0 24px;
  }

  .related-qa-answer-inner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-left: 44px;
  }

  /* A Label - Minimal outline */
  .related-qa-answer-label {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1.5px solid var(--rr-color-border);
    border-radius: 50%;
    color: var(--rr-color-text-secondary);
    font-family: var(--rr-font-display);
    font-size: 12px;
    font-weight: 600;
  }

  .related-qa-answer-body {
    flex: 1;
    font-family: var(--rr-font-body);
    font-size: 14px;
    line-height: 1.8;
    color: var(--rr-color-text-secondary);
  }

  .related-qa-answer-body p {
    margin: 0;
  }

  /* --------------------------------------------------------------------------
     Cards Grid
     -------------------------------------------------------------------------- */
  .related-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .related-cards__item {
    margin: 0;
  }

  .related-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--rr-color-surface);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition:
      border-color 0.2s var(--rr-ease),
      box-shadow 0.2s var(--rr-ease);
  }

  .related-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  }

  .related-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    margin: 0;
    background: #f3f4f6;
    overflow: hidden;
  }

  .related-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--rr-ease);
  }

  .related-card:hover .related-card__media img {
    transform: scale(1.03);
  }

  .related-card__media--logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
  }

  .related-card__media--logo img {
    width: 40%;
    height: auto;
    object-fit: contain;
    opacity: 0.6;
    transition: opacity 0.3s var(--rr-ease);
  }

  .related-card:hover .related-card__media--logo img {
    opacity: 0.8;
  }

  .related-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px 18px;
  }

  .related-card__category {
    font-family: var(--rr-font-display);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rr-color-text-secondary);
    margin-bottom: 8px;
  }

  .related-card__title {
    font-family: var(--rr-font-body);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--rr-color-text);
    margin: 0;
    transition: color 0.2s var(--rr-ease);
  }

  .related-card:hover .related-card__title {
    color: var(--rr-color-highlight);
  }

  /* Arrow - Simple text */
  .related-card__arrow {
    display: block;
    margin-top: auto;
    padding-top: 12px;
    font-family: var(--rr-font-display);
    font-size: 13px;
    color: var(--rr-color-text-secondary);
    transition: transform 0.2s var(--rr-ease);
  }

  .related-card:hover .related-card__arrow {
    transform: translateX(4px);
    color: var(--rr-color-text);
  }

  /* --------------------------------------------------------------------------
     Responsive: Tablet
     -------------------------------------------------------------------------- */
  @media (max-width: 1024px) {
    .related-cards {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (max-width: 768px) {
    .related-resources {
      padding: 64px 0;
    }

    .related-resources__inner {
      padding: 0 20px;
    }

    .related-resources__header {
      margin-bottom: 40px;
    }

    .related-resources__title {
      font-size: 24px;
    }

    .related-group {
      margin-bottom: 40px;
    }

    .related-group__header {
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
    }

    .related-group__titles {
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
    }

    .related-qa-question {
      padding: 16px 0;
      gap: 12px;
    }

    .related-qa-label {
      width: 24px;
      height: 24px;
      font-size: 11px;
    }

    .related-qa-text {
      font-size: 14px;
    }

    .related-qa-answer-inner {
      padding-left: 36px;
      gap: 12px;
    }

    .related-qa-answer-label {
      width: 24px;
      height: 24px;
      font-size: 11px;
    }

    .related-card__body {
      padding: 14px 16px;
    }

    .related-card__title {
      font-size: 13px;
    }
  }

  /* --------------------------------------------------------------------------
     Responsive: Mobile
     -------------------------------------------------------------------------- */
  @media (max-width: 600px) {
    .related-resources {
      padding: 48px 0;
    }

    .related-resources__header {
      margin-bottom: 32px;
    }

    .related-resources__eyebrow {
      font-size: 11px;
    }

    .related-resources__title {
      font-size: 20px;
    }

    .related-group {
      margin-bottom: 32px;
    }

    .related-group__title {
      font-size: 15px;
    }

    /* Cards: horizontal layout */
    .related-cards {
      grid-template-columns: 1fr;
      gap: 12px;
    }

    .related-card {
      flex-direction: row;
    }

    .related-card__media {
      width: 100px;
      flex-shrink: 0;
      aspect-ratio: 1;
    }

    .related-card__body {
      justify-content: center;
      padding: 12px 14px;
    }

    .related-card__category {
      margin-bottom: 4px;
    }

    .related-card__arrow {
      display: none;
    }

    /* Q&A compact */
    .related-qa-question {
      padding: 14px 0;
      gap: 10px;
    }

    .related-qa-question::after {
      font-size: 18px;
    }

    .related-qa-label {
      width: 22px;
      height: 22px;
      font-size: 10px;
    }

    .related-qa-text {
      font-size: 13px;
      padding-right: 28px;
    }

    .related-qa-answer {
      padding-bottom: 16px;
    }

    .related-qa-answer-inner {
      flex-direction: column;
      padding-left: 32px;
      gap: 8px;
    }

    .related-qa-answer-label {
      width: 22px;
      height: 22px;
      font-size: 10px;
    }

    .related-qa-answer-body {
      font-size: 13px;
      line-height: 1.7;
    }
  }
}
