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

/* =========================================
   Page: Process Flow - 2025 Modern Design
   =========================================
   Features:
   - Bilingual typography (Japanese + English)
   - Grain texture overlays
   - Bold section headers
   - Card-based layout with hover effects
   - Staggered animations
   ========================================= */

@layer pages {

  /* Design Tokens */
  .page-process-flow {
    --pf-gold: #b38f2d;
    --pf-gold-light: #d8b768;
    --pf-gold-pale: #f5dfa6;
    --pf-dark: #0a0908;
    --pf-dark-warm: #141210;
    --pf-cream: #fffcf5;
    --pf-cream-dark: #f8f4eb;
    --pf-text: #1a1612;
    --pf-text-muted: rgba(26, 22, 18, 0.65);
    --pf-border: rgba(179, 143, 45, 0.15);
    --pf-border-strong: rgba(179, 143, 45, 0.35);
    --pf-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --pf-ease-out: cubic-bezier(0.0, 0, 0.2, 1);

    background: var(--pf-cream);
    color: var(--pf-text);
  }

  /* =========================================
     Hero Section
     ========================================= */
  .pf-hero {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    min-height: clamp(320px, 45vh, 420px);
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--pf-dark);
  }

  .pf-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
  }

  .pf-hero__bg-overlay {
    position: absolute;
    inset: 0;
    background: var(--pf-dark);
  }

  .pf-hero__bg-grain {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    mix-blend-mode: overlay;
  }

  .pf-hero__decor {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
  }

  .pf-hero__decor-line {
    position: absolute;
    background: var(--pf-gold);
    opacity: 0.25;
  }

  .pf-hero__decor-line--left {
    left: clamp(20px, 5vw, 60px);
    top: 20%;
    bottom: 20%;
    width: 1px;
  }

  .pf-hero__decor-line--right {
    right: clamp(20px, 5vw, 60px);
    top: 20%;
    bottom: 20%;
    width: 1px;
  }

  .pf-hero__inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 900px;
    padding: clamp(80px, 12vh, 120px) clamp(24px, 5vw, 48px);
  }

  .pf-hero__content {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vw, 24px);
  }

  .pf-hero__eyebrow {
    margin: 0;
    font-family: "DM Sans", var(--font-sans);
    font-size: clamp(0.7rem, 1vw, 0.8rem);
    font-weight: 600;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--pf-gold);
  }

  .pf-hero__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: #fff;
  }

  .pf-hero__lead {
    margin: 0;
    max-width: 600px;
    font-size: clamp(0.9rem, 1.3vw, 1rem);
    line-height: 1.9;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.7);
  }

  @media (max-width: 640px) {
    .pf-hero__decor-line {
      display: none;
    }
  }

  /* =========================================
     Body / Main Content
     ========================================= */
  .pf-body {
    padding: clamp(56px, 10vw, 96px) 0 clamp(72px, 12vw, 120px);
  }

  .pf-body__inner {
    display: grid;
    gap: clamp(64px, 10vw, 100px);
    max-width: 1100px;
  }

  /* =========================================
     Section Base
     ========================================= */
  .pf-section {
    display: grid;
    gap: clamp(32px, 5vw, 48px);
  }

  .pf-section__head {
    display: grid;
    gap: clamp(8px, 1.5vw, 12px);
    max-width: 700px;
  }

  .pf-section__eyebrow {
    font-family: "DM Sans", var(--font-sans);
    font-size: clamp(0.65rem, 0.9vw, 0.75rem);
    font-weight: 600;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--pf-gold);
  }

  .pf-section__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.3;
    color: var(--pf-text);
  }

  .pf-section__lead {
    margin: 0;
    font-size: clamp(0.9rem, 1.2vw, 0.98rem);
    line-height: 1.8;
    color: var(--pf-text-muted);
  }

  /* =========================================
     Steps Section - Horizontal Layout
     ========================================= */
  .pf-steps {
    display: grid;
    gap: clamp(20px, 3vw, 28px);
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
  }

  .pf-steps__item {
    position: relative;
  }

  /* Vertical connection line between steps */
  .pf-steps__item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: clamp(28px, 4vw, 36px);
    bottom: -14px;
    width: 2px;
    height: 28px;
    background: linear-gradient(to bottom, var(--pf-gold) 0%, var(--pf-border) 100%);
    z-index: 1;
  }

  .pf-steps__card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    gap: clamp(8px, 1.2vw, 12px) clamp(20px, 3vw, 32px);
    padding: clamp(24px, 4vw, 36px);
    background: #fff;
    border: 1px solid var(--pf-border);
    transition: all 0.3s var(--pf-ease);
  }

  .pf-steps__card:hover {
    border-color: var(--pf-border-strong);
    box-shadow: 0 12px 40px rgba(43, 32, 16, 0.1);
    transform: translateY(-4px);
  }

  .pf-steps__index {
    grid-row: 1 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(56px, 8vw, 72px);
    height: clamp(56px, 8vw, 72px);
    background: var(--pf-dark);
    color: var(--pf-gold);
    font-family: "DM Sans", var(--font-sans);
    font-size: clamp(1.2rem, 1.8vw, 1.5rem);
    font-weight: 700;
    letter-spacing: 0.05em;
    align-self: start;
  }

  .pf-steps__en {
    align-self: end;
    font-family: "DM Sans", var(--font-sans);
    font-size: clamp(0.68rem, 1vw, 0.78rem);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--pf-gold);
  }

  .pf-steps__title {
    margin: 0;
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--pf-text);
  }

  .pf-steps__desc {
    margin: 0;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    line-height: 1.8;
    color: var(--pf-text-muted);
    max-width: 640px;
  }

  @media (max-width: 640px) {
    .pf-steps__card {
      grid-template-columns: auto 1fr;
      grid-template-rows: auto auto auto;
      gap: 8px 16px;
      padding: 20px;
    }

    .pf-steps__index {
      width: 48px;
      height: 48px;
      font-size: 1rem;
    }

    .pf-steps__item:not(:last-child)::after {
      left: 24px;
      bottom: -10px;
      height: 20px;
    }
  }

  /* =========================================
     Support Section
     ========================================= */
  .pf-support {
    display: grid;
    gap: clamp(12px, 2vw, 16px);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .pf-support__item {
    position: relative;
    display: grid;
    gap: clamp(6px, 1vw, 10px);
    padding: clamp(20px, 3vw, 28px);
    padding-left: clamp(24px, 4vw, 32px);
    background: #fff;
    border: 1px solid var(--pf-border);
    border-left: 3px solid var(--pf-gold);
    transition: all 0.25s var(--pf-ease);
  }

  .pf-support__item:hover {
    border-left-color: var(--pf-gold-light);
    box-shadow: 0 4px 20px rgba(43, 32, 16, 0.06);
    transform: translateX(4px);
  }

  .pf-support__en {
    font-family: "DM Sans", var(--font-sans);
    font-size: clamp(0.6rem, 0.8vw, 0.68rem);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--pf-gold);
  }

  .pf-support__text {
    font-size: clamp(0.9rem, 1.1vw, 0.98rem);
    line-height: 1.7;
    color: var(--pf-text);
  }

  /* =========================================
     Lead Time Section
     ========================================= */
  .pf-leadtime {
    display: grid;
    gap: clamp(16px, 2.5vw, 24px);
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .pf-leadtime__card {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.5vw, 14px);
    padding: clamp(24px, 4vw, 32px);
    background: #fff;
    border: 1px solid var(--pf-border);
    border-top: 3px solid var(--pf-gold);
    transition: all 0.3s var(--pf-ease);
  }

  .pf-leadtime__card:hover {
    border-top-color: var(--pf-gold-light);
    box-shadow: 0 8px 32px rgba(43, 32, 16, 0.08);
    transform: translateY(-4px);
  }

  .pf-leadtime__en {
    font-family: "DM Sans", var(--font-sans);
    font-size: clamp(0.6rem, 0.8vw, 0.68rem);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--pf-gold);
  }

  .pf-leadtime__label {
    margin: 0;
    font-size: clamp(1.2rem, 1.8vw, 1.4rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--pf-text);
  }

  .pf-leadtime__value {
    margin: 0;
    font-size: clamp(0.88rem, 1.1vw, 0.96rem);
    line-height: 1.7;
    color: var(--pf-text-muted);
  }

  /* =========================================
     Animations
     ========================================= */
  @media (prefers-reduced-motion: no-preference) {
    .pf-steps__card,
    .pf-support__item,
    .pf-leadtime__card {
      opacity: 0;
      transform: translateY(20px);
      animation: pfFadeUp 0.6s var(--pf-ease) forwards;
    }

    .pf-steps__item:nth-child(1) .pf-steps__card { animation-delay: 0.05s; }
    .pf-steps__item:nth-child(2) .pf-steps__card { animation-delay: 0.12s; }
    .pf-steps__item:nth-child(3) .pf-steps__card { animation-delay: 0.19s; }
    .pf-steps__item:nth-child(4) .pf-steps__card { animation-delay: 0.26s; }
    .pf-steps__item:nth-child(5) .pf-steps__card { animation-delay: 0.33s; }

    .pf-support__item:nth-child(1) { animation-delay: 0.1s; }
    .pf-support__item:nth-child(2) { animation-delay: 0.15s; }
    .pf-support__item:nth-child(3) { animation-delay: 0.2s; }
    .pf-support__item:nth-child(4) { animation-delay: 0.25s; }

    .pf-leadtime__card:nth-child(1) { animation-delay: 0.1s; }
    .pf-leadtime__card:nth-child(2) { animation-delay: 0.2s; }
    .pf-leadtime__card:nth-child(3) { animation-delay: 0.3s; }

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

  /* Reduced Motion */
  @media (prefers-reduced-motion: reduce) {
    .pf-steps__card,
    .pf-support__item,
    .pf-leadtime__card {
      animation: none;
      opacity: 1;
      transform: none;
    }
  }

}
