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

/**
 * Download (資料ダウンロード) - Page Styles
 *
 * Archive hero/filter styles are handled by core-archive.css
 * This file contains download-specific card and single page styles
 */

@layer pages {

  /* ==========================================================================
     ARCHIVE PAGE - Download Specific Components
     ========================================================================== */

  /* --------------------------------------------------------------------------
     Download Card Grid
     -------------------------------------------------------------------------- */

  .download-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 32px 64px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }

  /* --------------------------------------------------------------------------
     Download Card
     -------------------------------------------------------------------------- */

  .download-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .download-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
    transform: translateY(-4px);
  }

  .download-card__media {
    aspect-ratio: 210 / 297; /* A4 portrait */
    margin: 0;
    background: #f8fafc;
    overflow: hidden;
    position: relative;
  }

  .download-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .download-card:hover .download-card__media img {
    transform: scale(1.05);
  }

  .download-card__media.is-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
  }

  .download-card__media.is-logo img {
    width: 50%;
    height: auto;
    object-fit: contain;
  }

  .download-card__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 12px;
    font-family: 'Outfit', var(--font-sans, system-ui, sans-serif);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 20px;
    text-transform: uppercase;
  }

  .download-card__body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex: 1;
    padding: 16px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
  }

  .download-card__category {
    font-family: 'Outfit', var(--font-sans, system-ui, sans-serif);
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .download-card__title {
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    color: #0f172a;
    margin: 0;
  }

  .download-card__excerpt {
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 13px;
    line-height: 1.6;
    color: #64748b;
    margin: 8px 0 0;
  }

  .download-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
  }

  .download-card__size {
    font-family: 'Outfit', var(--font-sans, system-ui, sans-serif);
    font-size: 12px;
    color: #64748b;
  }

  .download-card__action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 600;
    color: #3b82f6;
  }

  .download-card__icon {
    flex-shrink: 0;
  }

  .download-card__action--disabled {
    color: #94a3b8;
  }

  .download-card:hover .download-card__action:not(.download-card__action--disabled) {
    text-decoration: underline;
  }

  .download-card--no-file {
    opacity: 0.6;
    cursor: not-allowed;
  }

  .download-card--no-file:hover {
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: none;
    transform: none;
  }

  /* --------------------------------------------------------------------------
     Pagination
     -------------------------------------------------------------------------- */

  .download-pagination {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px 64px;
    display: flex;
    justify-content: center;
    gap: 8px;
  }

  .download-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    font-family: 'Outfit', var(--font-sans, system-ui, sans-serif);
    font-size: 14px;
    color: #475569;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s;
  }

  .download-pagination .page-numbers:hover {
    border-color: #3b82f6;
  }

  .download-pagination .page-numbers.current {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: transparent;
    color: #fff;
  }

  .download-pagination .page-numbers.dots {
    border: none;
    background: none;
  }

  /* --------------------------------------------------------------------------
     Empty State
     -------------------------------------------------------------------------- */

  .download-empty {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 32px;
    text-align: center;
  }

  .download-empty p {
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 16px;
    color: #64748b;
  }

  /* --------------------------------------------------------------------------
     Responsive
     -------------------------------------------------------------------------- */

  @media (max-width: 1024px) {
    .download-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  @media (max-width: 768px) {
    .download-grid {
      grid-template-columns: repeat(2, 1fr);
      padding: 32px 20px 48px;
      gap: 16px;
    }
  }

  @media (max-width: 480px) {
    .download-grid {
      grid-template-columns: 1fr;
    }
  }

  /* ==========================================================================
     SINGLE DOWNLOAD - Form Page
     ========================================================================== */

  .single-download {
    background: #f8fafc;
    padding: 48px 0 80px;
  }

  .single-download__container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 32px;
  }

  .single-download__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
  }

  /* Preview */
  .single-download__preview {
    position: sticky;
    top: 32px;
  }

  .single-download__media {
    aspect-ratio: 210 / 297;
    margin: 0;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    position: relative;
  }

  .single-download__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .single-download__media.is-logo {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .single-download__media.is-logo img {
    width: 50%;
    height: auto;
    object-fit: contain;
  }

  .single-download__badge {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 14px;
    font-family: 'Outfit', var(--font-sans, system-ui, sans-serif);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 20px;
    text-transform: uppercase;
  }

  /* Header */
  .single-download__header {
    margin-bottom: 32px;
  }

  .single-download__category {
    display: inline-block;
    font-family: 'Outfit', var(--font-sans, system-ui, sans-serif);
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }

  .single-download__title {
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    color: #0f172a;
    margin: 0 0 16px;
  }

  .single-download__excerpt {
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 15px;
    line-height: 1.7;
    color: #64748b;
    margin: 0 0 16px;
  }

  .single-download__meta {
    font-family: 'Outfit', var(--font-sans, system-ui, sans-serif);
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
  }

  /* Form Box */
  .single-download__form-box {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  }

  .single-download__form-title {
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
  }

  .single-download__form-desc {
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 14px;
    color: #64748b;
    margin: 0 0 24px;
  }

  .single-download__form {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .single-download__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .single-download__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 14px;
    font-weight: 600;
    color: #334155;
  }

  .single-download__required {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-family: 'Outfit', var(--font-sans, system-ui, sans-serif);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    border-radius: 9999px;
  }

  .single-download__optional {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-family: 'Outfit', var(--font-sans, system-ui, sans-serif);
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 9999px;
  }

  .single-download__input {
    width: 100%;
    padding: 14px 18px;
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 16px;
    line-height: 1.5;
    color: #0f172a;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.15);
    border-radius: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .single-download__input::placeholder {
    color: #94a3b8;
  }

  .single-download__input:hover {
    border-color: rgba(59, 130, 246, 0.4);
  }

  .single-download__input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
  }

  .single-download__error {
    min-height: 1.25rem;
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 14px;
    color: #ef4444;
    line-height: 1.4;
  }

  .single-download__error:empty {
    display: none;
  }

  .single-download__actions {
    margin-top: 8px;
  }

  .single-download__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 18px 28px;
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  }

  .single-download__submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  }

  .single-download__submit:active {
    transform: translateY(-1px);
  }

  .single-download__submit:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
  }

  .single-download__submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }

  .single-download__submit-icon {
    flex-shrink: 0;
  }

  /* No File */
  .single-download__no-file {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 48px 32px;
    text-align: center;
  }

  .single-download__no-file p {
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 16px;
    color: #64748b;
    margin: 0 0 24px;
  }

  .single-download__back {
    display: inline-flex;
    align-items: center;
    padding: 14px 28px;
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    background: #f1f5f9;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
  }

  .single-download__back:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
  }

  /* Success */
  .single-download__success {
    text-align: center;
    padding: 32px 0;
  }

  .single-download__success p {
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 18px;
    font-weight: 600;
    color: #22c55e;
    margin: 0 0 20px;
  }

  .single-download__success a {
    display: inline-flex;
    align-items: center;
    padding: 14px 28px;
    font-family: 'Zen Kaku Gothic New', var(--font-sans, system-ui, sans-serif);
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    background: #f1f5f9;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
  }

  .single-download__success a:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
  }

  /* ==========================================================================
     Single Responsive
     ========================================================================== */

  @media (max-width: 900px) {
    .download-single-content {
      padding: 48px 0 64px;
    }

    .download-single-content__inner {
      padding: 0 24px;
    }

    .single-download__grid {
      grid-template-columns: 1fr;
      gap: 32px;
    }

    .single-download__preview {
      position: static;
      max-width: 400px;
      margin: 0 auto;
    }
  }

  @media (max-width: 600px) {
    .download-single-content {
      padding: 40px 0 56px;
    }

    .download-single-content__inner {
      padding: 0 20px;
    }

    .download-single-content .entry-content {
      font-size: 15px;
    }

    .download-single-content .entry-content h2 {
      font-size: 20px;
      margin-top: 36px;
    }

    .download-single-content .entry-content h3 {
      font-size: 17px;
      margin-top: 28px;
    }

    .single-download {
      padding: 32px 0 64px;
    }

    .single-download__container {
      padding: 0 20px;
    }

    .single-download__title {
      font-size: 24px;
    }

    .single-download__form-box {
      padding: 24px;
      border-radius: 12px;
    }

    .single-download__form-title {
      font-size: 18px;
    }
  }
}
