/* ================================================
   KONRAD CZERWINSKI — DEFENSE ANALYST PORTFOLIO
   2026 Design: Dark theme, scroll animations,
   glassmorphism, modern CSS features
   ================================================ */

/* ---------- CSS LAYERS ---------- */
@layer reset, base, layout, components, animations, utilities;

/* ---------- RESET ---------- */
@layer reset {
  *, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
  }

  img, svg {
    display: block;
    max-width: 100%;
  }

  a {
    text-decoration: none;
    color: inherit;
  }

  button {
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
  }

  ul, ol {
    list-style: none;
  }
}

/* ---------- DESIGN TOKENS ---------- */
@layer base {
  :root {
    /* Colors — Defense Dark */
    --bg-primary: #08080d;
    --bg-secondary: #0e0e16;
    --bg-card: #13131f;
    --bg-card-hover: #1a1a2e;
    --bg-elevated: #1e1e30;

    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --accent: #00d4ff;
    --accent-dim: rgba(0, 212, 255, 0.15);
    --accent-glow: rgba(0, 212, 255, 0.3);
    --accent-secondary: #7c3aed;
    --accent-secondary-dim: rgba(124, 58, 237, 0.15);

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    --danger: #ef4444;
    --success: #22c55e;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;

    /* Spacing */
    --section-pad: clamp(4rem, 8vw, 8rem);
    --container-max: 1200px;
    --card-radius: 16px;
    --nav-height: 72px;

    /* Transitions */
    --ease-out: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  }

  body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
  }

  ::selection {
    background: var(--accent-dim);
    color: var(--accent);
  }
}

/* ---------- LAYOUT ---------- */
@layer layout {
  .container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 4vw, 3rem);
  }

  .section {
    padding: var(--section-pad) 0;
    position: relative;
  }

  .section-header {
    margin-bottom: 3.5rem;
  }

  .section-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 0.35rem 1rem;
    border-radius: 100px;
    margin-bottom: 1.25rem;
  }

  .section-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }

  .section-desc {
    color: var(--text-secondary);
    max-width: 600px;
    margin-top: 1rem;
  }
}

/* ---------- SCROLL PROGRESS ---------- */
@layer components {
  .scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    z-index: 10000;
    transition: none;
  }
}

/* ---------- NAVIGATION ---------- */
@layer components {
  .nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 1000;
    transition: background 0.4s var(--ease-smooth),
                box-shadow 0.4s var(--ease-smooth),
                backdrop-filter 0.4s var(--ease-smooth);
  }

  .nav.scrolled {
    background: rgba(8, 8, 13, 0.85);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    box-shadow: 0 1px 0 var(--border);
  }

  .nav-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 4vw, 3rem);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .nav-logo-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
    position: relative;
  }

  .nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
  }

  .nav-link[data-accent] {
    color: var(--accent);
    background: var(--accent-dim);
  }

  .nav-link[data-accent]:hover {
    background: rgba(0, 212, 255, 0.25);
  }

  /* Mobile hamburger */
  .nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    z-index: 1001;
  }

  .nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ---------- HERO ---------- */
@layer components {
  .hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: calc(var(--nav-height) + 2rem) clamp(1.5rem, 4vw, 3rem) 2rem;
    overflow: hidden;
  }

  /* CSS fallback gradient — visible until WebGL takes over */
  .hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 255, 0.12), transparent),
      radial-gradient(ellipse 60% 40% at 80% 50%, rgba(124, 58, 237, 0.08), transparent),
      radial-gradient(ellipse 50% 50% at 20% 80%, rgba(0, 212, 255, 0.06), transparent);
    z-index: 0;
    animation: hero-pulse 8s ease-in-out infinite alternate;
    transition: opacity 0.6s ease;
  }

  /* Hide CSS fallback once WebGL canvas is active */
  .hero.gl-ready::after {
    opacity: 0;
    pointer-events: none;
  }

  @keyframes hero-pulse {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.05); }
  }

  /* Same pattern for expertise section */
  .expertise::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(0, 212, 255, 0.03), transparent);
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
  }

  .expertise.gl-ready::after {
    opacity: 0;
    pointer-events: none;
  }

  /* Grid overlay */
  .hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 1;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
  }

  .hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    text-align: center;
  }

  .hero-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    border: 1px solid rgba(0, 212, 255, 0.2);
    background: rgba(0, 212, 255, 0.06);
    padding: 0.5rem 1.5rem;
    border-radius: 100px;
    margin-bottom: 2rem;
    animation: fade-in-up 0.8s ease-out 0.2s both;
  }

  .hero-title {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
  }

  .hero-title-line {
    display: block;
    animation: fade-in-up 0.8s ease-out both;
  }

  .hero-title-line:nth-child(1) {
    animation-delay: 0.4s;
  }

  .hero-title-line:nth-child(2) {
    animation-delay: 0.6s;
  }

  .hero-subtitle {
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem;
    line-height: 1.8;
    animation: fade-in-up 0.8s ease-out 0.8s both;
  }

  .hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3.5rem;
    animation: fade-in-up 0.8s ease-out 1s both;
  }

  .hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    animation: fade-in-up 0.8s ease-out 1.2s both;
  }

  .stat {
    text-align: center;
  }

  .stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }

  .stat-suffix {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
  }

  .stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
  }

  .stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
  }

  /* Scroll indicator */
  .hero-scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: fade-in-up 0.8s ease-out 1.5s both;
  }

  .hero-scroll-indicator span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
  }

  .scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    animation: scroll-pulse 2s ease-in-out infinite;
  }

  @keyframes scroll-pulse {
    0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
    50% { opacity: 1; transform: scaleY(1); }
  }
}

/* ---------- BUTTONS ---------- */
@layer components {
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s var(--ease-smooth);
    position: relative;
    overflow: hidden;
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--accent), #0099cc);
    color: #000;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
  }

  .btn-primary:hover {
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.35);
    transform: translateY(-2px);
  }

  .btn-ghost {
    border: 1px solid var(--border-hover);
    color: var(--text-primary);
    background: transparent;
  }

  .btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
  }
}

/* ---------- ABOUT ---------- */
@layer components {
  .about-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 3rem;
    align-items: start;
  }

  .about-lead {
    font-size: clamp(1.1rem, 1.5vw, 1.3rem);
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 1.5rem;
    line-height: 1.7;
  }

  .about-text p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
  }

  .about-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .detail-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.3s, background 0.3s;
  }

  .detail-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
  }

  .detail-icon {
    font-size: 1.25rem;
    color: var(--accent);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border-radius: 10px;
    flex-shrink: 0;
  }

  .detail-card h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
  }

  .detail-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
  }
}

/* ---------- EXPERTISE ---------- */
@layer components {
  .expertise-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .expertise-card {
    position: relative;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    transition: border-color 0.4s, transform 0.4s var(--ease-smooth), box-shadow 0.4s;
    overflow: hidden;
  }

  .expertise-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  }

  /* Glow effect on hover */
  .expertise-card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, var(--accent-glow), transparent 70%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
  }

  .expertise-card:hover .expertise-card-glow {
    opacity: 0.08;
  }

  .expertise-icon {
    color: var(--accent);
    margin-bottom: 1.25rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border-radius: 12px;
  }

  .expertise-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    position: relative;
  }

  .expertise-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    position: relative;
  }
}

/* ---------- ARTICLES / WRITING ---------- */
@layer components {
  .articles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
  }

  .article-card-link {
    display: contents;
  }

  .article-card-link:first-child .article-card {
    grid-column: 1 / -1;
  }

  .article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    overflow: hidden;
    transition: border-color 0.4s, transform 0.3s var(--ease-smooth), box-shadow 0.4s;
    cursor: pointer;
  }

  .article-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  }

  .article-card.featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
  }

  .article-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--bg-secondary);
    overflow: hidden;
  }

  .article-card.featured .article-card-image {
    aspect-ratio: auto;
    min-height: 280px;
  }

  .article-placeholder-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    padding: 1.5rem;
    background:
      radial-gradient(ellipse at 30% 50%, rgba(0, 212, 255, 0.08), transparent),
      radial-gradient(ellipse at 70% 30%, rgba(124, 58, 237, 0.06), transparent);
    transition: transform 0.6s var(--ease-smooth);
  }

  .article-placeholder-img::after {
    content: attr(data-label);
  }

  .article-card:hover .article-placeholder-img {
    transform: scale(1.05);
  }

  /* Real article card images */
  .article-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-smooth);
  }

  .article-card:hover .article-card-image img {
    transform: scale(1.05);
  }

  .article-tag {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(0, 212, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    z-index: 2;
  }

  .article-card-body {
    padding: 1.75rem;
  }

  .article-card-body h3 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.75rem;
    transition: color 0.3s;
  }

  .article-card:hover .article-card-body h3 {
    color: var(--accent);
  }

  .article-card-body p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .article-meta {
    display: flex;
    gap: 1rem;
    margin-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
  }
}

/* ---------- QUOTE ---------- */
@layer components {
  .quote-section {
    padding: var(--section-pad) 0;
    position: relative;
    overflow: hidden;
  }

  .quote-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(0, 212, 255, 0.04), transparent);
  }

  .pull-quote {
    position: relative;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
  }

  .pull-quote p {
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
  }

  .pull-quote::before {
    content: '\201C';
    position: absolute;
    top: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-serif);
    font-size: 6rem;
    color: var(--accent);
    opacity: 0.15;
    line-height: 1;
  }
}

/* ---------- CONTACT ---------- */
@layer components {
  .contact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .contact-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    transition: border-color 0.4s, transform 0.3s var(--ease-smooth), box-shadow 0.4s;
    position: relative;
  }

  .contact-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  }

  .contact-card.coming-soon {
    opacity: 0.6;
    pointer-events: none;
  }

  .contact-icon {
    color: var(--accent);
    margin-bottom: 1rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border-radius: 14px;
  }

  .contact-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
  }

  .contact-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
  }

  .badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-secondary);
    background: var(--accent-secondary-dim);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
  }
}

/* ---------- FOOTER ---------- */
@layer components {
  .footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border);
  }

  .footer-inner {
    text-align: center;
  }

  .footer-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
  }

  .footer-text.muted {
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 0.8rem;
  }
}

/* ---------- ANIMATIONS ---------- */
@layer animations {
  @keyframes fade-in-up {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Reveal animation (triggered by JS IntersectionObserver) */
  .reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s var(--ease-smooth), transform 0.7s var(--ease-smooth);
  }

  .reveal.visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* Staggered children */
  .reveal:nth-child(2) { transition-delay: 0.1s; }
  .reveal:nth-child(3) { transition-delay: 0.2s; }
  .reveal:nth-child(4) { transition-delay: 0.3s; }
  .reveal:nth-child(5) { transition-delay: 0.4s; }
  .reveal:nth-child(6) { transition-delay: 0.5s; }
  .reveal:nth-child(7) { transition-delay: 0.6s; }
  .reveal:nth-child(8) { transition-delay: 0.7s; }
  .reveal:nth-child(9) { transition-delay: 0.8s; }

  /* Reduced motion — respect OS-level accessibility preference */
  .reduced-motion *,
  .reduced-motion *::before,
  .reduced-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reduced-motion .reveal {
    opacity: 1;
    transform: none;
  }

  .reduced-motion .hero::after {
    animation: none;
    opacity: 0.8;
  }

  .reduced-motion .scroll-line {
    animation: none;
    opacity: 0.5;
  }

  .reduced-motion .film-grain {
    display: none;
  }
}

/* ---------- UTILITIES ---------- */
@layer utilities {
  .accent {
    color: var(--accent);
  }
}

/* ---------- FILM GRAIN (CSS fallback) ---------- */
@layer components {
  .film-grain {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.035;
    mix-blend-mode: overlay;
    image-rendering: pixelated;
  }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
  .expertise-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-card.featured {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100svh;
    flex-direction: column;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    padding: calc(var(--nav-height) + 2rem) 2rem 2rem;
    gap: 0.5rem;
    transition: right 0.4s var(--ease-smooth);
    align-items: stretch;
  }

  .nav-links.open {
    right: 0;
  }

  .nav-toggle {
    display: flex;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .expertise-grid {
    grid-template-columns: 1fr;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1.5rem;
  }

  .stat-divider {
    width: 40px;
    height: 1px;
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }

  .pull-quote p {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
  }
}

@media (max-width: 480px) {
  .hero-badge {
    font-size: 0.65rem;
    padding: 0.4rem 1rem;
  }
}

/* ================================================
   ARTICLE PAGE STYLES
   ================================================ */

/* ---------- ARTICLE HERO ---------- */
/* Unlayered — higher cascade priority than @layer components */
.article-hero {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: flex-end;
    padding: calc(var(--nav-height) + 3rem) 0 3rem;
    overflow: hidden;
  }

  .article-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
  }

  /* Photo background layer — rendered behind the category gradient */
  .article-hero-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--hero-img, none);
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    z-index: -1;
  }

  /* Category-specific hero gradients */
  .article-hero-bg[data-category="cuas"] {
    background:
      radial-gradient(ellipse 70% 60% at 30% 40%, rgba(239, 68, 68, 0.12), transparent),
      radial-gradient(ellipse 50% 50% at 70% 60%, rgba(251, 146, 60, 0.08), transparent),
      var(--bg-primary);
  }

  .article-hero-bg[data-category="acquisition"] {
    background:
      radial-gradient(ellipse 70% 60% at 40% 30%, rgba(124, 58, 237, 0.12), transparent),
      radial-gradient(ellipse 50% 50% at 60% 70%, rgba(0, 212, 255, 0.06), transparent),
      var(--bg-primary);
  }

  .article-hero-bg[data-category="naval"] {
    background:
      radial-gradient(ellipse 70% 60% at 50% 40%, rgba(0, 212, 255, 0.1), transparent),
      radial-gradient(ellipse 50% 50% at 20% 70%, rgba(6, 182, 212, 0.08), transparent),
      var(--bg-primary);
  }

  .article-hero-bg[data-category="cyber"] {
    background:
      radial-gradient(ellipse 70% 60% at 60% 40%, rgba(34, 197, 94, 0.1), transparent),
      radial-gradient(ellipse 50% 50% at 30% 60%, rgba(0, 212, 255, 0.06), transparent),
      var(--bg-primary);
  }

  .article-hero-bg[data-category="ai"] {
    background:
      radial-gradient(ellipse 70% 60% at 50% 30%, rgba(0, 212, 255, 0.12), transparent),
      radial-gradient(ellipse 50% 50% at 70% 70%, rgba(124, 58, 237, 0.08), transparent),
      var(--bg-primary);
  }

  .article-hero-bg[data-category="personal"] {
    background:
      radial-gradient(ellipse 70% 60% at 40% 50%, rgba(251, 191, 36, 0.08), transparent),
      radial-gradient(ellipse 50% 50% at 60% 30%, rgba(0, 212, 255, 0.06), transparent),
      var(--bg-primary);
  }

  /* Grid overlay on article hero */
  .article-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 1;
    mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
  }

  .article-hero .container {
    position: relative;
    z-index: 2;
  }

  .article-category {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 0.35rem 1rem;
    border-radius: 100px;
    margin-bottom: 1.5rem;
  }

  .article-hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    max-width: 800px;
    margin-bottom: 1.5rem;
  }

  .article-hero-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    align-items: center;
  }

  .article-hero-meta .divider {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
  }

  .article-author {
    font-weight: 600;
    color: var(--text-primary);
  }

/* ---------- ARTICLE BODY ---------- */
.article-body {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 0 5rem;
  }

  .article-body p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.85;
    font-size: 1.05rem;
  }

  .article-body .lead {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.7;
    margin-bottom: 2rem;
  }

  .article-body h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 3rem 0 1.25rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
  }

  .article-body h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    color: var(--text-primary);
  }

  .article-body strong {
    color: var(--text-primary);
    font-weight: 600;
  }

  .article-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 0 0.5rem 1.5rem;
    margin: 2rem 0;
  }

  .article-body blockquote p {
    font-size: 1.15rem;
    color: var(--text-primary);
    font-style: italic;
    font-weight: 500;
    margin-bottom: 0;
  }

  .article-body ul, .article-body ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
  }

  .article-body li {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.7;
    list-style: disc;
  }

  .article-body ol li {
    list-style: decimal;
  }

  /* Stat callout box */
  .stat-callout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    margin: 2.5rem 0;
  }

  .stat-callout .stat-item {
    text-align: center;
  }

  .stat-callout .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.2;
  }

  .stat-callout .stat-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.25rem;
  }

  /* Horizontal rule */
  .article-body hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 3rem 0;
  }

  .faq-block {
    margin: 2.5rem 0;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 212, 255, 0.04));
  }

  .faq-block h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.4rem;
  }

  .faq-item + .faq-item {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
  }

  .faq-item h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: var(--text-primary);
  }

  .faq-item p {
    margin-bottom: 0;
    font-size: 0.98rem;
  }

  /* Article footer */
  .article-footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 0 4rem;
    border-top: 1px solid var(--border);
  }

  .article-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
  }

  .article-share {
    display: flex;
    gap: 0.75rem;
    align-items: center;
  }

  .article-share span {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
  }

  .share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all 0.3s;
  }

  .share-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
  }

  .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    transition: gap 0.3s;
  }

  .back-link:hover {
    gap: 0.75rem;
  }

/* ---------- ARTICLE RESPONSIVE ---------- */
@media (max-width: 768px) {
  .article-hero {
    min-height: 40vh;
  }

  .article-hero h1 {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
  }

  .article-body {
    padding: 2rem 0 3rem;
  }

  .article-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
