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

/* Type-level CSS for post type: guide（技術ガイド） */

@layer pages {
  /* Archive page - Angular rich design with light background */
  .post-type-archive-guide .section {
    position: relative;
    background: #ffffff;
    padding: clamp(60px, 8vw, 100px) 0 clamp(80px, 10vw, 120px);
  }

  .post-type-archive-guide .section__head {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto clamp(48px, 6vw, 72px);
    padding: 0 clamp(32px, 5vw, 80px);
  }

  .post-type-archive-guide .section__title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #0f172a;
    margin: 0;
    position: relative;
    display: inline-block;
  }

  .post-type-archive-guide .section__title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100px;
    height: 4px;
    background: #0f172a;
    clip-path: polygon(0 0, 100% 0, 95% 100%, 0 100%);
  }

  /* Filters - Angular design */
  .post-type-archive-guide .filters {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto clamp(40px, 5vw, 60px);
    padding: clamp(28px, 4vw, 40px);
    background: #f8f9fa;
    border: 2px solid #e5e7eb;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
  }

  .post-type-archive-guide .filters__group {
    gap: 0.75rem;
  }

  .post-type-archive-guide .filters__label {
    color: #374151;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
  }

  .post-type-archive-guide .filters select,
  .post-type-archive-guide .filters input[type="search"] {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
    border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  }

  .post-type-archive-guide .filters select:hover,
  .post-type-archive-guide .filters input[type="search"]:hover {
    border-color: #9ca3af;
  }

  .post-type-archive-guide .filters select:focus-visible,
  .post-type-archive-guide .filters input[type="search"]:focus-visible {
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
  }

  .post-type-archive-guide .filters .chip {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #374151;
    border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
  }

  .post-type-archive-guide .filters .chip:has(input:checked) {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
  }

  .post-type-archive-guide .filters__actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
  }

  .post-type-archive-guide .filters__actions .btn {
    border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
    font-weight: 700;
    padding: 14px 32px;
    font-size: 0.875rem;
  }

  .post-type-archive-guide .filters__actions .btn--primary {
    background: #0f172a;
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
  }

  .post-type-archive-guide .filters__actions .btn--primary:hover {
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.4);
  }

  .post-type-archive-guide .filters__actions .btn:not(.btn--primary) {
    background: #ffffff;
    border: 2px solid #d1d5db;
    color: #374151;
  }

  .post-type-archive-guide .filters__actions .btn:not(.btn--primary):hover {
    border-color: #9ca3af;
    background: #f9fafb;
  }

  /* Card grid */
  .post-type-archive-guide .card-list {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(32px, 5vw, 80px);
  }

  /* Cards - Simple angular design */
  .post-type-archive-guide .card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%);
    min-height: auto;
    align-items: stretch;
  }

  .post-type-archive-guide .card::before {
    display: none;
  }

  .post-type-archive-guide .card::after {
    display: none;
  }

  .post-type-archive-guide .card:hover {
    border-color: #0f172a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
  }

  .post-type-archive-guide .card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #f3f4f6;
    overflow: hidden;
  }

  .post-type-archive-guide .card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: none;
  }

  .post-type-archive-guide .card__media.is-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
  }

  .post-type-archive-guide .card__media.is-logo img {
    width: 70%;
    height: auto;
    object-fit: contain;
  }

  .post-type-archive-guide .card:hover .card__media img {
    transform: scale(1.05);
  }

  .post-type-archive-guide .card:hover .card__media.is-logo img {
    transform: scale(1.02);
  }

  .post-type-archive-guide .card__body {
    position: static;
    padding: clamp(20px, 3vw, 28px);
    gap: 10px;
    display: flex;
    flex-direction: column;
    color: inherit;
  }

  .post-type-archive-guide .card__categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
  }

  .post-type-archive-guide .card__category {
    display: inline-block;
    padding: 4px 12px;
    background: #0f172a;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    clip-path: polygon(0 0, calc(100% - 4px) 0, 100% 4px, 100% 100%, 0 100%);
  }

  .post-type-archive-guide .card__date {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .post-type-archive-guide .card__title {
    color: #0f172a;
    font-size: clamp(1.1rem, 2vw, 1.25rem);
    font-weight: 700;
    line-height: 1.5;
    text-shadow: none;
  }

  .post-type-archive-guide .card__excerpt {
    display: none;
  }

  .post-type-archive-guide .card__meta {
    display: none;
  }

  /* Pagination */
  .post-type-archive-guide .pagination {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: clamp(48px, 6vw, 72px) auto 0;
    padding: 0 clamp(32px, 5vw, 80px);
  }

  .post-type-archive-guide .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 16px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
  }

  .post-type-archive-guide .page-numbers:hover {
    background: #f9fafb;
    border-color: #9ca3af;
  }

  .post-type-archive-guide .page-numbers.current {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
  }

  @media (max-width: 900px) {
    .post-type-archive-guide .filters {
      margin-left: clamp(24px, 4vw, 32px);
      margin-right: clamp(24px, 4vw, 32px);
    }
  }

  @media (max-width: 640px) {
    .post-type-archive-guide .section__title {
      font-size: clamp(2.5rem, 8vw, 3rem);
    }

    .post-type-archive-guide .filters__actions {
      flex-direction: column;
    }

    .post-type-archive-guide .filters__actions .btn {
      width: 100%;
    }
  }

  /* ========================================
     GUIDE SINGLE - Industrial Editorial Design
     Matching case single page style
     ======================================== */

  /* ----------------------------------------
     GUIDE HERO - Compact Header
     ---------------------------------------- */
  .guide-hero {
    position: relative;
    padding: clamp(64px, 10vw, 100px) 0 clamp(48px, 8vw, 72px);
    background: linear-gradient(135deg, #0c1220 0%, #1a2744 50%, #0f1729 100%);
    overflow: hidden;
  }

  .guide-hero__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .guide-hero__gradient {
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 80% 50% at 20% 40%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
      radial-gradient(ellipse 60% 40% at 80% 60%, rgba(99, 102, 241, 0.06) 0%, transparent 50%);
  }

  .guide-hero__pattern {
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
      linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 100% 80% at 50% 20%, black 0%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 100% 80% at 50% 20%, black 0%, transparent 70%);
  }

  .guide-hero__container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--gutter, 24px);
  }

  .guide-hero__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: clamp(20px, 3vw, 28px);
  }

  .guide-hero__label {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #ffffff;
    font-family: var(--font-display-en, 'Bebas Neue', sans-serif);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border-radius: 2px;
  }

  .guide-hero__date {
    font-family: var(--font-body-en, 'DM Sans', sans-serif);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.5);
  }

  .guide-hero__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: clamp(16px, 2.5vw, 24px);
  }

  .guide-hero__tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .guide-hero__tag:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
  }

  .guide-hero__tag--accent {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
  }

  .guide-hero__title {
    margin: 0 0 clamp(16px, 2.5vw, 24px);
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.02em;
    color: #ffffff;
    max-width: 900px;
  }

  .guide-hero__lead {
    margin: 0;
    font-size: clamp(0.95rem, 1.4vw, 1.05rem);
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.7);
    max-width: 700px;
  }

  /* ----------------------------------------
     GUIDE CONTENT - Featured Image
     ---------------------------------------- */
  .guide-content {
    background: #ffffff;
    padding: clamp(48px, 7vw, 80px) 0;
  }

  .guide-content__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--gutter, 24px);
  }

  .guide-featured {
    margin: 0;
    position: relative;
  }

  .guide-featured__frame {
    position: relative;
    overflow: hidden;
    background: #f8fafc;
    border-radius: 12px;
    box-shadow:
      0 1px 3px rgba(0, 0, 0, 0.04),
      0 8px 32px rgba(0, 0, 0, 0.08);
  }

  .guide-featured__frame::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    pointer-events: none;
    z-index: 1;
  }

  .guide-featured__frame img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .guide-featured:hover .guide-featured__frame img {
    transform: scale(1.02);
  }

  .guide-featured__caption {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 2;
  }

  .guide-featured__badge {
    display: inline-flex;
    padding: 6px 12px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 4px;
    font-family: var(--font-body-en, 'DM Sans', sans-serif);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
  }

  /* ----------------------------------------
     ARTICLE BODY - Content Section
     ---------------------------------------- */
  .guide-article {
    background: #f8fafc;
    padding: clamp(64px, 9vw, 100px) 0;
  }

  .guide-article__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--gutter, 24px);
  }

  .guide-article__header {
    text-align: center;
    margin-bottom: clamp(40px, 6vw, 64px);
  }

  .guide-article__label-en {
    display: block;
    font-family: var(--font-display-en, 'Bebas Neue', sans-serif);
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: transparent;
    -webkit-text-stroke: 1px rgba(59, 130, 246, 0.2);
    line-height: 1;
    margin-bottom: 8px;
  }

  .guide-article__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 2.8vw, 2rem);
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.02em;
  }

  .guide-article__body {
    background: #ffffff;
    padding: clamp(32px, 5vw, 56px);
    border-radius: 16px;
    box-shadow:
      0 1px 3px rgba(0, 0, 0, 0.02),
      0 8px 24px rgba(0, 0, 0, 0.04);
  }

  .guide-article__body h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.35rem, 2.2vw, 1.6rem);
    font-weight: 800;
    line-height: 1.4;
    margin: clamp(40px, 5vw, 56px) 0 clamp(16px, 2.5vw, 24px);
    color: #0f172a;
    padding-left: 18px;
    border-left: 4px solid #3b82f6;
    position: relative;
  }

  .guide-article__body h2:first-child {
    margin-top: 0;
  }

  .guide-article__body h3 {
    font-family: var(--font-serif);
    font-size: clamp(1.15rem, 1.8vw, 1.35rem);
    font-weight: 700;
    line-height: 1.45;
    margin: clamp(32px, 4vw, 44px) 0 clamp(12px, 2vw, 18px);
    color: #1e293b;
  }

  .guide-article__body p {
    font-size: clamp(0.95rem, 1.35vw, 1.05rem);
    line-height: 2;
    margin: 0 0 clamp(18px, 2.5vw, 24px);
    color: #374151;
  }

  .guide-article__body ul,
  .guide-article__body ol {
    margin: 0 0 clamp(18px, 2.5vw, 24px);
    padding-left: 1.5em;
  }

  .guide-article__body li {
    font-size: clamp(0.95rem, 1.35vw, 1.05rem);
    line-height: 1.9;
    margin-bottom: 8px;
    color: #374151;
  }

  .guide-article__body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: clamp(28px, 4vw, 40px) 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  }

  .guide-article__body blockquote {
    margin: clamp(28px, 4vw, 40px) 0;
    padding: clamp(20px, 3vw, 28px) clamp(24px, 3.5vw, 32px);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.04) 0%, rgba(99, 102, 241, 0.02) 100%);
    border-left: 4px solid #3b82f6;
    border-radius: 0 10px 10px 0;
    font-size: clamp(1rem, 1.4vw, 1.1rem);
    line-height: 1.85;
    color: #475569;
  }

  .guide-article__body blockquote p:last-child {
    margin-bottom: 0;
  }

  .guide-article__footer {
    margin-top: clamp(32px, 4vw, 48px);
    padding-top: clamp(24px, 3vw, 32px);
    border-top: 1px solid #e2e8f0;
  }

  .guide-article__dates {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(16px, 2.5vw, 24px);
  }

  .guide-article__date-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #64748b;
  }

  .guide-article__date-label {
    font-weight: 600;
    color: #475569;
  }

  /* ----------------------------------------
     SHARE TOOLS - Compact Inline
     ---------------------------------------- */
  .single-guide .section--share {
    background: #ffffff;
    padding: clamp(24px, 4vw, 40px) 0;
    border-top: 1px solid #f1f5f9;
  }

  .single-guide .share-tools {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--gutter, 24px);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(16px, 2.5vw, 24px);
  }

  .single-guide .share-tools__label {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.02em;
  }

  .single-guide .share-tools__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .single-guide .share-tools__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .single-guide .share-tools__btn:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #1e293b;
  }

  .single-guide .share-tools__btn--x {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
  }

  .single-guide .share-tools__btn--x:hover {
    background: #1e293b;
    border-color: #1e293b;
  }

  .single-guide .share-tools__feedback {
    font-size: 12px;
    color: #10b981;
    font-weight: 500;
    margin: 0;
  }

  .single-guide .share-tools__feedback.is-error {
    color: #ef4444;
  }

  /* ----------------------------------------
     RELATED CONTENT - Guide-specific overrides
     Base styles are in core-components.css
     ---------------------------------------- */
  .single-guide .section--related {
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
  }

  .single-guide .section--related .section__title::after {
    background: linear-gradient(90deg, #3b82f6 0%, #6366f1 100%);
  }

  .single-guide .related-group__title {
    border-left-color: #3b82f6;
  }

  /* Q&A - Blue accent */
  .single-guide .qa-accordion[open] {
    border-color: #3b82f6;
  }

  .single-guide .qa-q__label {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  }

  /* More Link - Blue hover */
  .single-guide .related-group .section__more:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.04);
  }

  /* ----------------------------------------
     RESPONSIVE
     ---------------------------------------- */
  @media (max-width: 640px) {
    .guide-hero {
      padding: clamp(48px, 8vw, 72px) 0 clamp(36px, 6vw, 56px);
    }

    .guide-hero__meta {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
    }

    .single-guide .share-tools {
      flex-direction: column;
      align-items: stretch;
      text-align: center;
    }

    .single-guide .share-tools__actions {
      flex-direction: column;
    }

    .single-guide .share-tools__btn {
      width: 100%;
      justify-content: center;
    }

    .single-guide .related-group .card-list {
      grid-template-columns: 1fr !important;
    }
  }

  /* ----------------------------------------
     ANIMATIONS
     ---------------------------------------- */
  @media (prefers-reduced-motion: no-preference) {
    .guide-hero__container > * {
      opacity: 0;
      transform: translateY(20px);
      animation: guideReveal 0.6s ease-out forwards;
    }

    .guide-hero__meta { animation-delay: 0.1s; }
    .guide-hero__tags { animation-delay: 0.2s; }
    .guide-hero__title { animation-delay: 0.3s; }
    .guide-hero__lead { animation-delay: 0.4s; }

    .guide-featured,
    .guide-article__header,
    .guide-article__body {
      opacity: 0;
      transform: translateY(30px);
      animation: guideReveal 0.7s ease-out forwards;
    }

    .guide-featured { animation-delay: 0.2s; }
    .guide-article__header { animation-delay: 0.15s; }
    .guide-article__body { animation-delay: 0.3s; }
  }

  @keyframes guideReveal {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
