@use 'abstracts';

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.project-detail {
  min-height: calc(100vh - var(--nav-height));

  &__wrapper {
    @include abstracts.container-wrapper;
    width: 100%;

    &--narrow {
      max-width: 740px;
    }
  }

  // ── Hero ─────────────────────────────────────────────────────────────────────

  &__hero {
    position: relative;
  }

  &__hero-image {
    position: relative;
    width: 100%;
    height: clamp(400px, 60vh, 600px);
    overflow: hidden;

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

  &__hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to top,
      oklch(from var(--bg-surface) l c h) 0%,
      oklch(from var(--bg-surface) l c h / 0.8) 30%,
      oklch(from var(--bg-surface) l c h / 0.4) 60%,
      transparent 100%
    );
  }

  &__hero-content {
    position: relative;
    margin-top: -200px;
    padding-bottom: calc(var(--space-4) * 2);
    @include abstracts.container-wrapper;
    max-width: 800px;
    animation: fade-in-up 0.6s ease-out both;
  }

  &__back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
    transition: color 0.2s ease;

    &:hover {
      color: var(--accent);
    }
  }

  &__branch {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: var(--space-2);
  }

  &__title {
    font-size: clamp(var(--font-size-xl), 5vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-3);
  }

  &__description {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: var(--space-4);
  }

  &__result {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: linear-gradient(135deg, oklch(from var(--accent) l c h / 0.15) 0%, oklch(from var(--accent) l c h / 0.08) 100%);
    border: 1px solid oklch(from var(--accent) l c h / 0.2);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--accent);

    svg {
      flex-shrink: 0;
    }
  }

  // ── Features ─────────────────────────────────────────────────────────────────

  &__features {
    padding-block: calc(var(--space-4) * 2);
    background-color: var(--bg-muted);
  }

  &__section-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: calc(var(--space-4) * 1.5);
    text-align: center;
  }

  &__features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);

    @include abstracts.breakpoint('md') {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  &__feature {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.25s ease;

    animation: fade-in-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--delay, 0ms) both;

    &:hover {
      transform: translateY(-4px);
      box-shadow: 0 12px 32px oklch(0% 0 0 / 0.08);
    }
  }

  &__feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, oklch(from var(--accent) l c h / 0.15) 0%, oklch(from var(--accent) l c h / 0.08) 100%);
    color: var(--accent);
    flex-shrink: 0;
  }

  &__feature-content {
    h3 {
      font-size: var(--font-size-base);
      font-weight: 700;
      margin-bottom: var(--space-1);
    }

    p {
      font-size: var(--font-size-base);
      color: var(--text-muted);
      line-height: 1.6;
    }
  }

  // ── Testimonial ──────────────────────────────────────────────────────────────

  &__testimonial {
    padding-block: calc(var(--space-4) * 2);
    background-color: var(--bg-surface);
  }

  &__quote {
    position: relative;
    text-align: center;
    padding: var(--space-4);
  }

  &__quote-icon {
    color: var(--accent);
    opacity: 0.15;
    margin-bottom: var(--space-3);
  }

  &__quote p {
    font-size: var(--font-size-xl);
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-main);
    margin-bottom: var(--space-4);
    font-style: italic;
  }

  &__quote footer cite {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-style: normal;

    strong {
      font-weight: 700;
      color: var(--text-main);
    }

    span {
      font-size: 0.875rem;
      color: var(--text-muted);
    }
  }

  // ── CTA ─────────────────────────────────────────────────────────────────────

  &__cta {
    padding-block: calc(var(--space-4) * 2);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    text-align: center;

    h2 {
      font-size: var(--font-size-xl);
      font-weight: 700;
      color: var(--text-on-accent);
      margin-bottom: var(--space-2);
    }

    p {
      font-size: var(--font-size-lg);
      color: oklch(from var(--text-on-accent) l c h / 0.85);
      margin-bottom: var(--space-4);
    }
  }

  &__cta-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background-color: var(--bg-surface);
    color: var(--accent);
    font-weight: 700;
    font-size: var(--font-size-base);
    border-radius: 999px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;

    &:hover {
      transform: scale(1.05);
      box-shadow: 0 8px 24px oklch(0% 0 0 / 0.2);
    }
  }

  // ── More Projects ────────────────────────────────────────────────────────────

  &__more {
    padding-block: calc(var(--space-4) * 2);
  }

  &__more-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);

    @include abstracts.breakpoint('md') {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  &__more-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--bg-surface);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.25s ease;

    &:hover {
      transform: translateY(-4px);
      box-shadow: 0 12px 32px oklch(0% 0 0 / 0.08);
    }
  }

  &__more-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.4s ease;

      .project-detail__more-card:hover & {
        transform: scale(1.05);
      }
    }
  }

  &__more-content {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);

    h3 {
      font-size: var(--font-size-lg);
      font-weight: 700;
    }
  }

  &__more-branch {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
  }

  &__more-cta {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: var(--space-2);
    transition: gap 0.2s ease;

    .project-detail__more-card:hover & {
      gap: var(--space-2);
    }
  }

  // ── Not Found ────────────────────────────────────────────────────────────────

  &__not-found {
    padding-block: calc(var(--space-4) * 3);
    text-align: center;

    h1 {
      font-size: var(--font-size-xl);
      margin-bottom: var(--space-2);
    }

    p {
      color: var(--text-muted);
      margin-bottom: var(--space-4);
    }
  }

  &__back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background-color: var(--accent);
    color: var(--text-on-accent);
    font-weight: 600;
    border-radius: 999px;
    transition: background-color 0.2s ease;

    &:hover {
      background-color: var(--accent-hover);
    }
  }
}
