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

/* Type-level CSS for Solution single page - 2025 Premium Industrial Design */

@layer pages {
  body.single-solution {
    /* Premium industrial color palette */
    --sol-bg: #fafafa;
    --sol-surface: #ffffff;
    --sol-surface-elevated: #ffffff;
    --sol-text: #0f0f0f;
    --sol-text-secondary: #525252;
    --sol-text-muted: #a3a3a3;
    --sol-accent: #b38f2d;
    --sol-accent-hover: #d4a833;
    --sol-accent-subtle: rgba(179, 143, 45, 0.08);
    --sol-accent-glow: rgba(179, 143, 45, 0.25);
    --sol-border: rgba(0, 0, 0, 0.06);
    --sol-border-strong: rgba(0, 0, 0, 0.12);
    --sol-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --sol-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --sol-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
    --sol-shadow-glow: 0 0 40px var(--sol-accent-glow);
    --sol-radius-sm: 8px;
    --sol-radius-md: 16px;
    --sol-radius-lg: 24px;
    --sol-transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --sol-transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sol-transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    background: var(--sol-bg);
  }

  .solution-single {
    margin-bottom: clamp(80px, 12vw, 160px);
  }

  /* ─────────────────────────────────────────────
     Solution Case Container
     ───────────────────────────────────────────── */
  .solution-case {
    padding-block: clamp(40px, 6vw, 64px);
  }

  /* ─────────────────────────────────────────────
     Content Grid
     ───────────────────────────────────────────── */
  .solution-case__content {
    display: grid;
    gap: clamp(32px, 6vw, 56px);
  }

  /* ─────────────────────────────────────────────
     Panel - Glass Morphism Cards
     Wider layout to match other single pages
     ───────────────────────────────────────────── */
  .solution-panel {
    max-width: min(1100px, 94vw);
    margin: 0 auto;
    position: relative;
  }

  .solution-panel__inner {
    background: var(--sol-surface);
    border-radius: var(--sol-radius-lg);
    padding: clamp(32px, 6vw, 56px);
    box-shadow: var(--sol-shadow-md);
    position: relative;
    overflow: hidden;
    transition: all var(--sol-transition-smooth);
    border: 1px solid var(--sol-border);
  }

  /* Subtle gradient overlay */
  .solution-panel__inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--sol-accent), var(--sol-accent-hover), var(--sol-accent));
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
  }

  @keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
  }

  .solution-panel:hover .solution-panel__inner {
    box-shadow: var(--sol-shadow-lg);
    transform: translateY(-2px);
  }

  .solution-panel__title {
    margin: 0 0 clamp(24px, 4vw, 36px);
    font-family: "DM Sans", var(--font-sans);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--sol-accent);
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .solution-panel__title::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--sol-accent);
    border-radius: 50%;
    flex-shrink: 0;
  }

  .solution-panel__title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--sol-border-strong), transparent);
  }

  .solution-panel__body {
    font-size: 1rem;
    line-height: 2;
    color: var(--sol-text);
    font-weight: 400;
  }

  .solution-panel__body p {
    margin: 0 0 1.5em;
  }

  .solution-panel__body p:last-child {
    margin-bottom: 0;
  }

  .solution-panel--before-after .solution-panel__body {
    display: grid;
    gap: clamp(24px, 4vw, 40px);
  }

  /* ─────────────────────────────────────────────
     Before/After Comparison - Premium Slider
     ───────────────────────────────────────────── */
  .solution-before-after {
    position: relative;
    overflow: hidden;
    border-radius: var(--sol-radius-md);
    box-shadow: var(--sol-shadow-lg);
    transition: all var(--sol-transition-smooth);
    cursor: ew-resize;
  }

  .solution-before-after::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid var(--sol-border);
    border-radius: var(--sol-radius-md);
    pointer-events: none;
    z-index: 10;
  }

  .solution-before-after:hover {
    box-shadow: var(--sol-shadow-lg), var(--sol-shadow-glow);
  }

  .solution-before-after > img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
  }

  .solution-before-after > img.after {
    position: absolute;
    inset: 0;
    clip-path: inset(0 0 0 50%);
    transition: clip-path 0.08s ease-out;
  }

  /* Vertical divider line */
  .solution-before-after__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background: #fff;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
    transition: left 0.08s ease-out;
  }

  .solution-before-after input[type="range"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    z-index: 20;
  }

  .solution-before-after__knob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(52px, 8vw, 64px);
    height: clamp(52px, 8vw, 64px);
    background: #fff;
    color: var(--sol-text);
    display: grid;
    place-items: center;
    font-size: clamp(18px, 3vw, 24px);
    font-weight: 400;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    border-radius: 50%;
    z-index: 6;
    transition: left 0.08s ease-out, transform var(--sol-transition-spring);
  }

  .solution-before-after:hover .solution-before-after__knob {
    transform: translate(-50%, -50%) scale(1.1);
  }

  /* Labels */
  .solution-before-after__labels {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 8;
  }

  .solution-before-after__label {
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-family: "DM Sans", var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 100px;
  }

  .solution-before-after__single {
    border-radius: var(--sol-radius-md);
    box-shadow: var(--sol-shadow-md);
    overflow: hidden;
    transition: all var(--sol-transition-smooth);
  }

  .solution-before-after__single:hover {
    box-shadow: var(--sol-shadow-lg);
    transform: scale(1.01);
  }

  .solution-before-after__single img {
    display: block;
    width: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .solution-before-after__single:hover img {
    transform: scale(1.03);
  }

  .solution-before-after__captions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: clamp(16px, 3vw, 24px);
  }

  .solution-before-after__captions p {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--sol-surface);
    border-radius: 100px;
    box-shadow: var(--sol-shadow-sm), inset 0 0 0 1px var(--sol-border);
    font-family: "DM Sans", var(--font-sans);
    font-weight: 600;
    letter-spacing: 0.02em;
    font-size: 0.75rem;
    color: var(--sol-text-secondary);
  }

  .solution-before-after__captions p strong {
    color: var(--sol-accent);
    font-weight: 700;
  }

  /* ─────────────────────────────────────────────
     Specification Table - Modern Data Grid
     ───────────────────────────────────────────── */
  .solution-spec {
    display: grid;
    gap: 2px;
    background: var(--sol-border);
    border-radius: var(--sol-radius-md);
    overflow: hidden;
    box-shadow: var(--sol-shadow-sm);
  }

  .solution-spec__row {
    display: grid;
    grid-template-columns: clamp(100px, 25vw, 160px) 1fr;
    gap: 0;
    background: var(--sol-surface);
    transition: all var(--sol-transition-fast);
  }

  .solution-spec__row:hover {
    background: var(--sol-accent-subtle);
  }

  .solution-spec__row dt {
    margin: 0;
    padding: clamp(16px, 3vw, 24px);
    font-family: "DM Sans", var(--font-sans);
    font-weight: 600;
    color: var(--sol-text-secondary);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
    border-right: 2px solid var(--sol-accent);
  }

  .solution-spec__row dt::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--sol-accent);
    border-radius: 50%;
    flex-shrink: 0;
  }

  .solution-spec__row dd {
    margin: 0;
    padding: clamp(16px, 3vw, 24px);
    color: var(--sol-text);
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.6;
    display: flex;
    align-items: center;
  }

  /* ─────────────────────────────────────────────
     Typography within panels
     ───────────────────────────────────────────── */
  .solution-panel__body h2 {
    margin-top: clamp(40px, 6vw, 56px);
    margin-bottom: clamp(16px, 3vw, 24px);
    font-family: var(--font-serif);
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
    font-weight: 700;
    line-height: 1.4;
    color: var(--sol-text);
    position: relative;
    padding-left: clamp(20px, 3vw, 28px);
  }

  .solution-panel__body h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 4px;
    background: linear-gradient(180deg, var(--sol-accent), var(--sol-accent-hover));
    border-radius: 2px;
  }

  .solution-panel__body h3 {
    margin-top: clamp(28px, 4vw, 40px);
    margin-bottom: clamp(12px, 2vw, 18px);
    font-family: var(--font-serif);
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    font-weight: 600;
    line-height: 1.45;
    color: var(--sol-text);
  }

  /* Lists */
  .solution-panel__body ul,
  .solution-panel__body ol {
    margin: clamp(20px, 3vw, 28px) 0;
    padding-left: 0;
    list-style: none;
  }

  .solution-panel__body ul li,
  .solution-panel__body ol li {
    position: relative;
    padding-left: clamp(28px, 4vw, 36px);
    margin-bottom: 0.75em;
    line-height: 1.85;
  }

  .solution-panel__body ul li::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0.65em;
    width: 8px;
    height: 8px;
    background: var(--sol-accent);
    border-radius: 50%;
    opacity: 0.7;
  }

  .solution-panel__body ol {
    counter-reset: sol-counter;
  }

  .solution-panel__body ol li {
    counter-increment: sol-counter;
  }

  .solution-panel__body ol li::before {
    content: counter(sol-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    background: var(--sol-accent-subtle);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: "DM Sans", var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--sol-accent);
  }

  /* Blockquotes */
  .solution-panel__body blockquote {
    margin: clamp(28px, 5vw, 44px) 0;
    padding: clamp(24px, 4vw, 36px);
    background: linear-gradient(135deg, var(--sol-accent-subtle), transparent);
    border-left: 4px solid var(--sol-accent);
    border-radius: 0 var(--sol-radius-md) var(--sol-radius-md) 0;
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--sol-text);
    font-style: italic;
  }

  .solution-panel__body blockquote p {
    margin-bottom: 0;
  }

  /* Strong emphasis */
  .solution-panel__body strong {
    color: var(--sol-text);
    font-weight: 600;
  }

  /* Links */
  .solution-panel__body a {
    color: var(--sol-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: all var(--sol-transition-fast);
  }

  .solution-panel__body a:hover {
    color: var(--sol-accent-hover);
    text-underline-offset: 5px;
  }

  /* ─────────────────────────────────────────────
     Responsive Design
     ───────────────────────────────────────────── */
  @media (max-width: 768px) {
    .solution-panel__inner {
      padding: clamp(24px, 6vw, 40px);
      border-radius: var(--sol-radius-md);
    }

    .solution-spec__row {
      grid-template-columns: 1fr;
    }

    .solution-spec__row dt {
      border-right: none;
      border-bottom: 2px solid var(--sol-accent);
      padding-bottom: 12px;
    }

    .solution-spec__row dd {
      padding-top: 12px;
    }

    .solution-before-after__knob {
      width: 48px;
      height: 48px;
      font-size: 16px;
    }

    .solution-before-after__labels {
      bottom: 12px;
      left: 12px;
      right: 12px;
    }

    .solution-before-after__label {
      padding: 5px 10px;
      font-size: 0.65rem;
    }
  }

  @media (max-width: 560px) {
    .solution-panel__inner {
      padding: 20px;
      border-radius: var(--sol-radius-sm);
    }

    .solution-panel__title {
      font-size: 0.65rem;
      gap: 12px;
    }

    .solution-panel__title::before {
      width: 6px;
      height: 6px;
    }

    .solution-before-after {
      border-radius: var(--sol-radius-sm);
    }

    .solution-before-after__captions p {
      padding: 8px 14px;
      font-size: 0.7rem;
    }

    .solution-spec {
      border-radius: var(--sol-radius-sm);
    }
  }

  /* High contrast / reduced motion */
  @media (prefers-reduced-motion: reduce) {
    .solution-panel__inner::before {
      animation: none;
    }

    *,
    *::before,
    *::after {
      transition-duration: 0.01ms !important;
    }
  }

  /* Focus states for accessibility */
  body.single-solution :focus-visible {
    outline: 2px solid var(--sol-accent);
    outline-offset: 2px;
  }

  .solution-before-after input[type="range"]:focus-visible + .solution-before-after__knob {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 0 0 4px var(--sol-accent-glow);
  }
}
