*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

    :root {
      --bg: #0f0f13;
      --bg-card: #1a1a22;
      --bg-card-hover: #22222e;
      --text: #e4e4e7;
      --text-muted: #9393a0;
      --accent: #ff8c00;
      --accent-hover: #ffb347;
      --border: #2a2a36;
      --radius: 16px;
      --radius-sm: 10px;
    }

    html { scroll-behavior: smooth; }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.6;
      min-height: 100vh;
    }

    /* Scroll-driven cinematic end fade (JS sets --end-fade: 0..1) */
    body {
      --end-fade: 0;
    }

    .portfolio-page .nebula-layer {
      opacity: calc(0.55 * (1 - var(--end-fade)));
      filter: blur(18px) saturate(calc(1.2 - 0.55 * var(--end-fade))) brightness(calc(1 - 0.35 * var(--end-fade)));
    }

    .portfolio-page .ambient-stars {
      opacity: calc(0.95 * (1 - 0.10 * var(--end-fade)));
      filter: saturate(calc(1 - 0.15 * var(--end-fade)));
    }

    .alias {
      color: #888888;       /* Slightly grey color */
      font-size: 0.5em;     /* Makes text half the size of the main header */
      font-weight: normal;  /* Removes bold styling inherited from h1 */
      margin-left: 10px;    /* Adds a small space between name and alias */
      vertical-align: middle; /* Ensures it sits nicely inline */
    }

    a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
    a:hover { color: var(--accent-hover); }

    /* Portfolio homepage: brighter body / secondary text than global defaults */
    .portfolio-page {
      --text: #f4f4f7;
      --text-muted: #cfcfdd;
    }

    .portfolio-page .alias {
      color: #a2a2ad;
    }

    /* Improve readability against nebula/stars by lifting text contrast */
    .portfolio-page .hero-desc,
    .portfolio-page .exp-desc,
    .portfolio-page .project-info p,
    .portfolio-page .project-link,
    .portfolio-page .section-label,
    .portfolio-page .section-title,
    .portfolio-page .about-heading,
    .portfolio-page .about-title {
      text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.35),
        0 0 18px rgba(0, 0, 0, 0.35);
    }

    /* --- NAV --- */
    nav {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 2147483647;
      transform: none;
      filter: none;
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      background: rgba(15, 15, 19, 0.51);
      border-bottom: 1px solid var(--border);
    }

    .nav-inner {
      max-width: 960px;
      margin: 0 auto;
      padding: 0 24px;
      height: 64px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .nav-logo {
      font-weight: 700;
      font-size: 1.1rem;
      color: var(--text);
      letter-spacing: -0.02em;
    }

    .nav-links { display: flex; gap: 28px; }

    .nav-links a {
      color: var(--text-muted);
      font-size: 0.9rem;
      font-weight: 500;
      position: relative;
      padding: 4px 0;
    }

    .nav-links a::after {
      content: '';
      position: absolute;
      bottom: -2px;
      left: 0;
      width: 0;
      height: 2px;
      background: var(--accent);
      border-radius: 1px;
      transition: width 0.25s ease;
    }

    .nav-links a:hover { color: var(--text); }
    .nav-links a:hover::after { width: 100%; }

    /* --- HERO / ABOUT --- */
    .hero {
      max-width: 960px;
      margin: 0 auto;
      padding: 80px 24px 60px;
    }

    .hero-greeting {
      font-size: 0.95rem;
      color: var(--accent);
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      margin-bottom: 12px;
    }

    .hero h1 {
      font-size: clamp(2rem, 5vw, 3rem);
      font-weight: 700;
      letter-spacing: -0.03em;
      line-height: 1.15;
      margin-bottom: 20px;
    }

    .hero h1 .accent { color: var(--accent); }

    .hero-desc {
      font-size: 1.1rem;
      color: var(--text-muted);
      max-width: 560px;
      line-height: 1.7;
      margin-bottom: 32px;
    }

    .hero-links { display: flex; gap: 12px; flex-wrap: wrap; }

    .btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 10px 22px;
      border-radius: var(--radius-sm);
      font-size: 0.9rem;
      font-weight: 600;
      border: none;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .btn-primary {
      background: var(--accent);
      color: #fff;
    }

    .btn-primary:hover {
      background: var(--accent-hover);
      color: #fff;
      transform: translateY(-1px);
      box-shadow: 0 4px 20px rgba(255, 140, 0, 0.35);
    }

    .btn-outline {
      background: transparent;
      color: var(--text-muted);
      border: 1px solid var(--border);
    }

    .btn-outline:hover {
      border-color: var(--accent);
      color: var(--text);
      transform: translateY(-1px);
    }

    .btn svg {
      width: 16px;
      height: 16px;
      fill: currentColor;
    }

    /* --- SECTION --- */
    /* Reduce spacing on project-tags container */
    .project-tags-container {
    margin: 0;
    padding: 0;
    }
    .section {
      max-width: 960px;
      margin: 0 auto;
      padding: 40px 24px 80px;
    }

    .section-label {
      font-size: 0.85rem;
      color: var(--accent);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      margin-bottom: 8px;
    }

    .section-title {
      font-size: 1.8rem;
      font-weight: 700;
      letter-spacing: -0.02em;
      margin-bottom: 40px;
    }

    .section-compact {
    padding: 0px 24px 20px;
    }

    .section-compact .section-title {
    margin-bottom: 20px;
    }

    /* --- PROJECT CARD --- */
    .project-card {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      transition: all 0.3s ease;
      cursor: pointer;
    }

    /* FX on: let more background/black-hole visuals show through cards */
    .portfolio-page:not(.fx-off) .project-card {
      background: rgba(26, 26, 34, 0.48);
      backdrop-filter: blur(2px);
      -webkit-backdrop-filter: blur(2px);
      border-color: rgba(255, 255, 255, 0.12);
    }

    .portfolio-page:not(.fx-off) .project-card:hover {
      background: rgba(34, 34, 46, 0.56);
    }

    .project-card:hover {
      border-color: rgba(255, 140, 0, 0.4);
      background: var(--bg-card-hover);
      transform: translateY(-4px);
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    }

    .project-card + .project-card { margin-top: 28px; }

    .project-thumb {
      position: relative;
      overflow: hidden;
      aspect-ratio: 16 / 10;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    .project-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: var(--radius);
      transition: transform 0.4s ease;
    }

    .project-thumb::after {
      content: '';
      position: absolute;
      inset: 20px;
      border-radius: var(--radius);
      box-shadow: inset 0 0 25px 12px var(--bg-card);
      pointer-events: none;
      z-index: 1;
    }


    .project-card:hover .project-thumb::after {
      box-shadow: inset 0 0 25px 12px var(--bg-card-hover);
    }

    .project-info {
      padding: 32px;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .project-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 14px;
    }

    .tag {
      font-size: 0.75rem;
      font-weight: 600;
      padding: 4px 12px;
      border-radius: 20px;
      background: rgba(255, 140, 0, 0.12);
      color: var(--accent);
      letter-spacing: 0.02em;
    }

    .project-info h3 {
      font-size: 1.3rem;
      font-weight: 700;
      margin-bottom: 10px;
      letter-spacing: -0.01em;
    }

    .project-info p {
      color: var(--text-muted);
      font-size: 0.92rem;
      line-height: 1.65;
      margin-bottom: 20px;
    }

    .project-links { display: flex; gap: 12px; margin-top: auto; }

    .project-link {
      font-size: 0.85rem;
      font-weight: 600;
      padding: 8px 18px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      color: var(--text-muted);
      transition: all 0.2s ease;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .project-link:hover {
      border-color: var(--accent);
      color: var(--text);
      background: rgba(255, 140, 0, 0.08);
    }

    .project-link.primary-link {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }

    .project-link.primary-link:hover {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
      color: #fff;
    }

    .project-card:hover .project-link.primary-link {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
      color: #fff;
    }

    .project-card:hover .project-links:has(.project-link:not(.primary-link):hover) .project-link.primary-link {
      background: transparent;
      border-color: var(--border);
      color: var(--text-muted);
    }

    /* --- ABOUT SECTIONS --- */
    .about-section {
      max-width: 960px;
      margin: 0 auto;
      padding: 0 24px 60px;
    }

    .about-section + .about-section { padding-top: 20px; }

    .about-heading {
      font-size: 0.85rem;
      color: var(--accent);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      margin-bottom: 8px;
    }

    .about-title {
      font-size: 1.5rem;
      font-weight: 700;
      letter-spacing: -0.02em;
      margin-bottom: 24px;
    }

    /* Skills grid */
    .skills-grid {
      display: flex;
      flex-direction: column;
      gap: 20px;
    }

    .skill-category h4 {
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 10px;
    }

    .skill-pills {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .skill-pill {
      font-size: 0.82rem;
      font-weight: 500;
      padding: 6px 16px;
      border-radius: 20px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      color: var(--text);
      transition: all 0.2s ease;
    }

    .skill-pill:hover {
      border-color: var(--accent);
      background: rgba(255, 140, 0, 0.08);
      transform: translateY(-1px);
    }

    .skill-pill.highlight {
      border-color: rgba(255, 140, 0, 0.35);
      background: rgba(255, 140, 0, 0.1);
    }

    /* Experience timeline */
    .exp-list {
      display: flex;
      flex-direction: column;
      gap: 0;
    }

    .exp-item {
      display: grid;
      grid-template-columns: 160px 1fr;
      gap: 24px;
      padding: 24px 0;
      border-bottom: 1px solid var(--border);
      transition: background 0.2s ease;
    }

    .exp-item:first-child { padding-top: 0; }
    .exp-item:last-child { border-bottom: none; }

    .exp-date {
      font-size: 0.82rem;
      color: var(--text-muted);
      font-weight: 500;
      padding-top: 2px;
    }

    .exp-content h4 {
      font-size: 1rem;
      font-weight: 700;
      margin-bottom: 4px;
      letter-spacing: -0.01em;
    }

    .exp-org {
      font-size: 0.88rem;
      color: var(--accent);
      font-weight: 600;
      margin-bottom: 8px;
    }

    .exp-desc {
      font-size: 0.88rem;
      color: var(--text-muted);
      line-height: 1.6;
    }

    .exp-techs {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
    }

    .exp-tech {
      font-size: 0.72rem;
      font-weight: 600;
      padding: 3px 10px;
      border-radius: 14px;
      background: rgba(255, 140, 0, 0.08);
      color: var(--accent);
    }

    /* Divider line between major sections */
    .section-divider {
      max-width: 960px;
      margin: 0 auto;
      padding: 0 24px;
    }

    .section-divider hr {
      border: none;
      border-top: 1px solid var(--border);
      margin: 0;
    }

    .fx-blurb {
      max-width: 960px;
      margin: 0 auto;
      padding: 28px 24px 56px;
      text-align: center;
    }

    .fx-blurb p {
      font-size: 0.86rem;
      line-height: 1.75;
      color: rgba(244, 244, 248, 0.76);
      font-style: italic;
      font-weight: 300;
      letter-spacing: 0.01em;
      max-width: 860px;
      margin: 0 auto;
      padding: 14px 18px;
      background: rgba(8, 8, 12, 0.42);
      border: 1px solid rgba(255, 255, 255, 0.10);
      border-radius: 12px;
      box-shadow:
        0 8px 26px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
      text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.48),
        0 0 12px rgba(0, 0, 0, 0.28);
    }

    .fx-off .fx-blurb {
      display: none !important;
    }

    @media (max-width: 700px) {
      .exp-item {
        grid-template-columns: 1fr;
        gap: 4px;
      }

      .about-section { padding: 0 20px 40px; }
    }

    /* --- FOOTER --- */
    footer {
      border-top: 1px solid var(--border);
      text-align: center;
      padding: 32px 24px;
      color: var(--text-muted);
      font-size: 0.85rem;
    }

    /* --- RESPONSIVE --- */
    @media (max-width: 700px) {
      .portfolio-page {
        padding-top: 18px;
      }

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

      .project-thumb {
        aspect-ratio: 16 / 9;
      }

      .project-info {
        padding: 24px;
      }

      .hero { padding: 88px 20px 40px; }
      .section { padding: 24px 20px 60px; }
    }

    /* --- IMAGE GALLERY --- */
.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.gallery-card:hover {
  border-color: rgba(255, 140, 0, 0.4);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.gallery-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
}

.gallery-preview-item {
  aspect-ratio: 16 / 10;
  background: var(--bg-card-hover);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.gallery-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-preview-item:hover img {
  transform: scale(1.05);
}

.gallery-preview-item:nth-child(1) { grid-column: span 2; }

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-card:hover .gallery-overlay {
  opacity: 1;
}

.gallery-overlay svg {
  width: 48px;
  height: 48px;
  fill: var(--text);
}

.gallery-info {
  padding: 24px;
}

.gallery-info h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.gallery-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.gallery-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 12px;
}

/* --- SLIDESHOW MODAL --- */
.slideshow-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 19, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.slideshow-modal.active {
  display: flex;
  opacity: 1;
}

.slideshow-content {
  position: relative;
  max-width: 1200px;
  width: 90%;
  max-height: 85vh;
}

.slideshow-image-container {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.slideshow-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slideshow-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: var(--text-muted);
}

.slideshow-placeholder svg {
  width: 64px;
  height: 64px;
  fill: var(--text-muted);
}

.slideshow-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 140, 0, 0.2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.slideshow-nav:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.slideshow-nav svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.slideshow-nav.prev { left: -60px; }
.slideshow-nav.next { right: -60px; }

.slideshow-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s ease;
}

.slideshow-close:hover {
  color: var(--text);
}

.slideshow-close svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.slideshow-counter {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.slideshow-thumbnails {
  position: absolute;
  bottom: -90px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.slideshow-thumb {
  width: 60px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s ease;
  opacity: 0.6;
}

.slideshow-thumb.active {
  opacity: 1;
  border-color: var(--accent);
}

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

.slideshow-caption {
  position: absolute;
  bottom: -130px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 600px;
}

@media (max-width: 900px) {
  .slideshow-nav.prev { left: 10px; }
  .slideshow-nav.next { right: 10px; }
  .slideshow-nav {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
  }
  .slideshow-counter,
  .slideshow-thumbnails,
  .slideshow-caption {
    position: static;
    transform: none;
    margin-top: 16px;
  }
  .slideshow-content {
    max-height: none;
  }
  .slideshow-image-container {
    aspect-ratio: 4 / 3;
  }
}

/* ============================================================
   EXAMPLE UI COMPONENTS
   ============================================================ */

/* --- 1. BEFORE / AFTER COMPARISON SLIDER --- */
.ba-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.ba-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
}

.ba-layer {
  position: absolute;
  inset: 0;
}

.ba-layer img,
.ba-layer .ba-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ba-placeholder {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.ba-layer.before { background: #1a1a2a; }
.ba-layer.after  { background: #121218; clip-path: inset(0 0 0 50%); }

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: var(--accent);
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
}

.ba-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(255, 140, 0, 0.5);
}

.ba-handle svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  fill: #fff;
  z-index: 6;
  pointer-events: none;
}

.ba-label {
  position: absolute;
  bottom: 16px;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  z-index: 4;
  pointer-events: none;
}

.ba-label.left  { left: 16px;  background: rgba(255,140,0,0.85); color: #fff; }
.ba-label.right { right: 16px; background: rgba(255,255,255,0.15); color: var(--text); backdrop-filter: blur(6px); }

.ba-info { padding: 20px 24px; }
.ba-info h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.ba-info p  { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }

/* --- 2. VERTICAL TIMELINE --- */
.vt-timeline {
  position: relative;
  padding-left: 36px;
}

.vt-timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.vt-item {
  position: relative;
  padding-bottom: 32px;
}

.vt-item:last-child { padding-bottom: 0; }

.vt-dot {
  position: absolute;
  left: -36px;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  z-index: 2;
}

.vt-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  transition: all 0.2s ease;
}

.vt-content:hover {
  border-color: rgba(255, 140, 0, 0.4);
  transform: translateX(4px);
}

.vt-content h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.vt-content p  { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }

.vt-image {
  width: 100%;
  height: 120px;
  background: var(--bg-card-hover);
  border-radius: 8px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  overflow: hidden;
}

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

/* --- 3. STAT COUNTER CARDS --- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: rgba(255, 140, 0, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stat-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border-radius: 10px;
  background: rgba(255, 140, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg { width: 20px; height: 20px; fill: var(--accent); }

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

@media (max-width: 700px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

/* --- 4. MASONRY GRID --- */
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 160px;
  gap: 8px;
}

.masonry-item {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

.masonry-item:hover {
  border-color: rgba(255, 140, 0, 0.4);
  transform: scale(1.02);
  z-index: 2;
}

.masonry-item.tall  { grid-row: span 2; }
.masonry-item.wide  { grid-column: span 2; }

.masonry-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, rgba(0,0,0,0.8));
  display: flex;
  align-items: flex-end;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.masonry-item:hover .masonry-overlay { opacity: 1; }

.masonry-overlay span {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

@media (max-width: 700px) {
  .masonry-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 140px; }
  .masonry-item.wide { grid-column: span 1; }
}

/* --- 5. SIDE-BY-SIDE COMPARISON --- */
.compare-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.compare-col { padding: 24px; }

.compare-col.recommended {
  border-left: 3px solid var(--accent);
  background: rgba(255, 140, 0, 0.04);
}

.compare-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.compare-header h4 { font-size: 1rem; font-weight: 700; }

.compare-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.compare-row:last-child { border-bottom: none; }
.compare-row .label { color: var(--text-muted); }
.compare-row .value { font-weight: 600; }

@media (max-width: 700px) {
  .compare-card { grid-template-columns: 1fr; }
  .compare-col.recommended { border-left: none; border-top: 3px solid var(--accent); }
}

/* --- 6. ANNOTATED DIAGRAM --- */
.annotated-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.annotated-area {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.anno-dot {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 10px rgba(255, 140, 0, 0.5);
}

.anno-dot:hover { transform: scale(1.2); }
.anno-dot.pulse { animation: annoPulse 2s infinite; }

@keyframes annoPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,140,0,0.5); }
  50%      { box-shadow: 0 0 0 10px rgba(255,140,0,0); }
}

.anno-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.anno-dot:hover .anno-tooltip { opacity: 1; }

.annotated-legend {
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.annotated-legend span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.annotated-legend strong {
  color: var(--accent);
  margin-right: 4px;
}

/* --- 7. HORIZONTAL SCROLL CAROUSEL --- */
.hscroll-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.hscroll-track {
  display: flex;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.hscroll-track::-webkit-scrollbar { height: 6px; }
.hscroll-track::-webkit-scrollbar-track { background: transparent; }
.hscroll-track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.hscroll-item {
  flex: 0 0 200px;
  scroll-snap-align: start;
}

.hscroll-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-card-hover);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.hscroll-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hscroll-item:hover .hscroll-thumb { transform: scale(1.03); }

.hscroll-caption {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 2px;
}

/* --- 8. ACCORDION --- */
.accordion-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.accordion-card details {
  border-bottom: 1px solid var(--border);
}

.accordion-card details:last-child { border-bottom: none; }

.accordion-card summary {
  padding: 18px 24px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s ease;
}

.accordion-card summary::-webkit-details-marker { display: none; }

.accordion-card summary:hover { background: var(--bg-card-hover); }

.accordion-card summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 400;
  transition: transform 0.2s ease;
}

.accordion-card details[open] summary::after {
  content: '-';
}

.accordion-body {
  padding: 0 24px 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* --- 9. PROGRESS CHECKLIST --- */
.checklist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.checklist-header h4 { font-size: 1rem; font-weight: 700; }

.checklist-count {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.checklist-bar-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.checklist-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.checklist-items { display: flex; flex-direction: column; gap: 8px; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.checklist-item:hover { background: var(--bg-card-hover); }

.checklist-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.checklist-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checklist-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checklist-item label {
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checklist-item input[type="checkbox"]:checked + label {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* --- 10. COST BAR CHART --- */
.bar-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.bar-chart { display: flex; flex-direction: column; gap: 20px; }

.bar-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.bar-track {
  width: 100%;
  height: 32px;
  background: var(--bg-card-hover);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  width: 0;
  transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bar-fill.accent  { background: var(--accent); }
.bar-fill.muted   { background: rgba(147, 147, 160, 0.4); }
.bar-fill.success  { background: rgba(34, 197, 94, 0.7); }
.bar-fill.warning  { background: rgba(234, 179, 8, 0.7); }

.bar-chart-card.animated .bar-fill { width: var(--bar-width); }

.bar-legend {
  display: flex;
  gap: 20px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.bar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bar-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* --- 11. CALLOUT / QUOTE --- */
.callout-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 24px 28px;
  position: relative;
  display: flex;
  gap: 16px;
}

.callout-card.warning { border-left-color: #eab308; }
.callout-card.danger  { border-left-color: #ef4444; }
.callout-card.success { border-left-color: #22c55e; }

.callout-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.callout-body h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.callout-body p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  font-style: italic;
}

/* --- 12. TABBED CONTENT --- */
.tabs-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 14px 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tab-btn:hover { color: var(--text); background: var(--bg-card-hover); }

.tab-btn.active {
  color: var(--accent);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.tab-panel {
  padding: 24px;
  display: none;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.tab-panel.active { display: block; }

/* --- 13. INLINE SLIDESHOW --- */
.inline-slideshow {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.is-viewport {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.is-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.is-slide.active { opacity: 1; }
.is-slide img { width: 100%; height: 100%; object-fit: cover; }

.is-slide .is-placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.is-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s ease;
}

.is-nav-btn:hover { background: var(--accent); border-color: var(--accent); }
.is-nav-btn svg { width: 18px; height: 18px; fill: currentColor; }

.is-nav-btn.prev { left: 12px; }
.is-nav-btn.next { right: 12px; }

.is-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px;
}

.is-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.is-dot.active { background: var(--accent); transform: scale(1.3); }

.is-caption-bar {
  padding: 0 24px 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- 14. 3D FLIP CARDS --- */
.flip-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.flip-card {
  perspective: 800px;
  cursor: pointer;
  height: 280px;
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-inner { transform: rotateY(180deg); }

.flip-front,
.flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.flip-front {
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}

.flip-front-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255, 140, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.flip-front-icon svg { width: 28px; height: 28px; fill: var(--accent); }

.flip-front h4 { font-size: 1rem; font-weight: 700; text-align: center; }
.flip-front p  { font-size: 0.78rem; color: var(--text-muted); }

.flip-back {
  background: var(--bg-card);
  transform: rotateY(180deg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.flip-back h4 { font-size: 0.92rem; font-weight: 700; margin-bottom: 12px; color: var(--accent); }
.flip-back ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.flip-back li {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}

.flip-back li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.flip-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: auto;
  padding-top: 12px;
  opacity: 0.6;
}

@media (max-width: 700px) {
  .flip-row { grid-template-columns: 1fr; }
  .flip-card { height: 240px; }
}

/* --- 15. ANIMATED COUNTERS --- */
.counter-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.counter-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 16px;
  text-align: center;
}

.counter-value {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1.2;
}

.counter-suffix {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.counter-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 6px;
}

@media (max-width: 700px) {
  .counter-row { grid-template-columns: repeat(2, 1fr); }
}

/* --- 16. TORQUE SEQUENCE VISUALIZER --- */
.tsv-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tsv-diagram {
  position: relative;
  aspect-ratio: 2 / 1;
  background: var(--bg-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tsv-cover {
  width: 70%;
  height: 60%;
  border: 2px solid var(--border);
  border-radius: 12px;
  position: relative;
  background: rgba(255, 140, 0, 0.03);
}

.tsv-bolt {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.3s ease;
  transform: translate(-50%, -50%);
}

.tsv-bolt.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 140, 0, 0.6);
  transform: translate(-50%, -50%) scale(1.3);
}

.tsv-bolt.done {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #22c55e;
}

.tsv-controls {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--border);
}

.tsv-play-btn {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.tsv-play-btn:hover { background: var(--accent-hover); }
.tsv-play-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tsv-readout {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tsv-readout strong { color: var(--text); }

/* --- 17. ZOOM / PAN LIGHTBOX --- */
.zoom-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.zoom-thumb {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.zoom-thumb img { width: 100%; height: 100%; object-fit: cover; }
.zoom-thumb:hover { border-color: var(--accent); transform: scale(1.04); }

.zoom-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 19, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.zoom-lightbox.active { display: flex; }
.zoom-lightbox.dragging { cursor: grabbing; }

.zoom-image-wrap {
  position: relative;
  transition: transform 0.1s linear;
}

.zoom-image-wrap img {
  max-width: 90vw;
  max-height: 85vh;
  transition: transform 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.zoom-controls {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 1002;
}

.zoom-ctrl-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all 0.2s ease;
  font-family: inherit;
}

.zoom-ctrl-btn:hover { background: var(--accent); border-color: var(--accent); }

.zoom-close-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1003;
}

.lightbox-close-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 15, 19, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  font-family: inherit;
}

.lightbox-close-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.05);
}

.lightbox-close-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

@media (max-width: 700px) {
  .zoom-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- 18. RESEARCH LINK PREVIEW CARDS --- */
.link-shelf {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-preview {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.link-preview::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.link-preview:hover {
  border-color: rgba(255, 140, 0, 0.45);
  background: var(--bg-card-hover);
  transform: translateX(4px);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.link-preview:hover::before { opacity: 1; }

.link-preview-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 1.5rem;
}

.link-preview-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 11px;
}

.link-preview-text { min-width: 0; }

.link-preview-site {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.link-preview-site img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.link-preview-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-preview-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview-arrow {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 140, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.link-preview:hover .link-preview-arrow {
  background: var(--accent);
}

.link-preview-arrow svg {
  width: 16px;
  height: 16px;
  fill: var(--accent);
  transition: fill 0.25s ease;
}

.link-preview:hover .link-preview-arrow svg { fill: #fff; }

/* Featured variant — larger, with thumbnail image on the right */
.link-preview.featured {
  grid-template-columns: 56px 1fr 180px;
  padding: 20px 0 20px 20px;
}

.link-preview-thumb {
  width: 180px;
  height: 100%;
  min-height: 100px;
  background: var(--bg-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.link-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Category tag inside link preview */
.link-preview-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 140, 0, 0.1);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 6px;
}

@media (max-width: 700px) {
  .link-preview { grid-template-columns: 44px 1fr auto; gap: 12px; padding: 14px 16px; }
  .link-preview-icon { width: 44px; height: 44px; border-radius: 10px; }
  .link-preview.featured { grid-template-columns: 44px 1fr; }
  .link-preview-thumb { display: none; }
  .link-preview-title { white-space: normal; }
}

/* ============================================================
   BLOG-SPECIFIC STYLES
   ============================================================ */

/* --- TABLE OF CONTENTS --- */
.toc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
}

.toc-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.toc-list {
  list-style: none;
  counter-reset: toc;
  display: flex;
  flex-direction: column;
}

.toc-list li {
  counter-increment: toc;
  border-bottom: 1px solid var(--border);
}

.toc-list li:last-child { border-bottom: none; }

.toc-list li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.toc-list li a::before {
  content: counter(toc, decimal-leading-zero);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 24px;
}

.toc-list li a:hover {
  color: var(--text);
  transform: translateX(4px);
}

/* --- BLOG PROSE --- */
.blog-prose {
  color: var(--text);
  line-height: 1.8;
  font-size: 0.95rem;
}

.blog-prose p {
  margin-bottom: 20px;
}

.blog-prose p:last-child {
  margin-bottom: 0;
}

.blog-prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blog-prose a:hover {
  color: var(--accent-hover);
}

.blog-page .hero-desc {
  color: var(--text);
}

/* --- IMAGE PLACEHOLDER --- */
.image-placeholder {
  width: 100%;
  min-height: 200px;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: border-color 0.2s ease;
}

.image-placeholder:hover {
  border-color: rgba(255, 140, 0, 0.4);
}

.image-placeholder img[src=""]{
  display: none;
}

.image-placeholder img:not([src=""]) {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: min(50vh, 640px);
  object-fit: contain;
  border-radius: 8px;
  cursor: zoom-in;
}

.image-placeholder:has(img:not([src=""])) {
  padding: 4px;
  align-items: center;
  justify-content: center;
}

.image-placeholder:has(img:not([src=""])) img:not([src=""]) {
  flex: 0 1 auto;
  min-height: 0;
  border-radius: 6px;
}

.image-placeholder img:not([src=""]) ~ span {
  display: none;
}

/* Side-by-side image placeholders (e.g. tall portrait photos) */
.blog-image-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 20px 0;
  align-items: stretch;
}

.blog-image-row .image-placeholder {
  flex: 1 1 calc(50% - 8px);
  min-width: min(100%, 200px);
  margin: 0;
}

.blog-image-row .image-placeholder img:not([src=""]) {
  max-height: min(70vh, 720px);
}

@media (max-width: 640px) {
  .blog-image-row .image-placeholder {
    flex: 1 1 100%;
  }

  .blog-image-row .image-placeholder img:not([src=""]) {
    max-height: min(50vh, 640px);
  }
}

/* --- EMBEDDED VIDEO (YouTube iframe or local HTML5 video) --- */
.blog-video-embed {
  width: 100%;
  max-width: min(100%, 420px);
  margin: 20px auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px dashed var(--border);
  background: var(--bg-card);
  transition: border-color 0.2s ease;
}

.blog-video-embed:hover {
  border-color: rgba(255, 140, 0, 0.4);
}

.blog-video-embed__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
}

.blog-video-embed__frame iframe,
.blog-video-embed__frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  object-fit: contain;
  background: #000;
}

.blog-video-embed__fallback {
  margin: 0;
  padding: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.blog-video-embed__fallback a {
  color: var(--accent);
}

.blog-video-embed__caption {
  padding: 10px 14px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

/* --- IMAGE COLLAGE (multi-image grid) --- */
.image-collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 10px;
  width: 100%;
  margin: 20px 0;
}

.image-collage__item {
  min-height: 140px;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: border-color 0.2s ease;
}

.image-collage__item:hover {
  border-color: rgba(255, 140, 0, 0.4);
}

.image-collage__item img[src=""] {
  display: none;
}

.image-collage__item img:not([src=""]) {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
}

.image-collage__item:has(img:not([src=""])) {
  padding: 6px;
  align-items: stretch;
}

.image-collage__item:has(img:not([src=""])) img:not([src=""]) {
  border-radius: 6px;
}

.image-collage__item img:not([src=""]) ~ span {
  display: none;
}

@media (max-width: 700px) {
  .image-collage {
    grid-template-columns: 1fr;
  }

  .image-collage__item {
    min-height: 120px;
  }
}

/* --- IMAGE COMPARE (before / after, drag on track) --- */
.image-compare {
  width: 100%;
  margin: 20px 0;
}

.image-compare__track {
  position: relative;
  aspect-ratio: 16 / 10;
  min-height: 180px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px dashed var(--border);
  background: var(--bg-card);
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.image-compare__track:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.image-compare__layer {
  position: absolute;
  inset: 3px;
  pointer-events: none;
}

.image-compare__layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-compare__layer img[src=""] {
  display: none;
}

.image-compare__layer--after {
  clip-path: inset(0 50% 0 0);
  z-index: 1;
}

.image-compare__layer .image-compare__slot-label {
  position: absolute;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(15, 15, 19, 0.75);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  pointer-events: none;
}

.image-compare__layer--before .image-compare__slot-label {
  left: 10px;
}

.image-compare__layer--after .image-compare__slot-label {
  left: 25%;
  right: auto;
  transform: translateX(-50%);
}

.image-compare__layer img:not([src=""]) ~ .image-compare__slot-label {
  display: none;
}

.image-compare__divider {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
  z-index: 2;
  pointer-events: none;
}

.image-compare__divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  pointer-events: none;
}

/* --- IMAGE GALLERY (thumbs → slideshow) --- */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  margin: 20px 0;
}

.image-gallery__thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  min-height: 100px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.image-gallery__thumb:hover {
  border-color: rgba(255, 140, 0, 0.45);
  transform: translateY(-2px);
}

.image-gallery__thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.image-gallery__thumb img[src=""] {
  display: none;
}

.image-gallery__thumb:has(img:not([src=""])) {
  padding: 3px;
}

.image-gallery__thumb img:not([src=""]) {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
}

.image-gallery__thumb .image-gallery__caption {
  display: block;
  padding: 8px 10px;
  text-align: center;
  line-height: 1.35;
}

.image-gallery__thumb img:not([src=""]) ~ .image-gallery__caption {
  padding: 6px 8px 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

@media (max-width: 700px) {
  .image-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- SLIDESHOW LIGHTBOX --- */
.slideshow-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 19, 0.96);
  backdrop-filter: blur(10px);
  z-index: 1003;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px 100px;
}

.slideshow-lightbox.active {
  display: flex;
}

.slideshow-lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  pointer-events: auto;
}

.slideshow-lightbox__frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: calc(100vh - 200px);
  pointer-events: auto;
}

.slideshow-lightbox__frame img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 200px);
  object-fit: contain;
  border-radius: var(--radius-sm);
  pointer-events: auto;
}

.slideshow-lightbox__nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  z-index: 1010;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-family: inherit;
}

.slideshow-lightbox__nav:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
}

.slideshow-lightbox__nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.slideshow-lightbox__nav svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.slideshow-lightbox__prev {
  left: 16px;
}

.slideshow-lightbox__next {
  right: 16px;
}

.slideshow-lightbox__stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  max-width: min(96vw, 1200px);
  pointer-events: none;
}

.slideshow-lightbox__caption {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  z-index: 1010;
}

.slideshow-lightbox__caption:empty {
  display: none;
}

/* Accordion body prose spacing */
.accordion-body .blog-prose {
  margin-bottom: 0;
}

.accordion-body .blog-prose p {
  margin-bottom: 16px;
}

.accordion-body .image-placeholder {
  margin: 16px 0 0;
}

@media (max-width: 700px) {
  .toc-card { padding: 20px; }
  .image-placeholder { min-height: 140px; }
}

/* Prevent any FX layers from creating page overflow */
    html, body {
      overflow-x: hidden;
    }

    /* View Projects: pulse + press + particle "explosion" (respects reduced motion) */
    .btn.btn-view-projects {
      position: relative;
      overflow: visible;
      transform: translateZ(0);
      will-change: transform, filter;
      isolation: isolate;
      -webkit-user-select: none;
      user-select: none;
      -webkit-touch-callout: none;
    }

    .btn.btn-view-projects::before {
      content: "";
      position: absolute;
      inset: -2px;
      border-radius: inherit;
      background: radial-gradient(120px 60px at 30% 20%, rgba(255, 255, 255, 0.35), transparent 60%),
        radial-gradient(140px 80px at 80% 70%, rgba(120, 220, 255, 0.25), transparent 65%);
      opacity: 0;
      pointer-events: none;
      z-index: -1;
      filter: blur(0.5px);
      transition: opacity 220ms ease;
    }

    .btn.btn-view-projects.is-pulsing {
      animation: btnPulse 1.8s ease-in-out infinite;
    }

    .btn.btn-view-projects.is-pulsing::before {
      opacity: 1;
    }

    .btn.btn-view-projects.is-pressing {
      animation: btnPress 420ms cubic-bezier(.2,.9,.2,1) 1;
    }

    .btn.btn-view-projects.is-pressing::before {
      opacity: 1;
    }

    .btn.btn-view-projects:focus-visible {
      outline: 2px solid rgba(120, 220, 255, 0.65);
      outline-offset: 3px;
    }

    @keyframes btnPulse {
      0%, 100% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 0 0 rgba(120, 220, 255, 0));
      }
      50% {
        transform: translateY(-1px) scale(1.02);
        filter: drop-shadow(0 10px 22px rgba(120, 220, 255, 0.22));
      }
    }

    @keyframes btnPress {
      0% { transform: translateY(0) scale(1); }
      20% { transform: translateY(2px) scale(0.98); }
      55% { transform: translateY(-2px) scale(1.03); }
      100% { transform: translateY(0) scale(1); }
    }

    .btn-explosion-layer {
      position: absolute;
      inset: 0;
      overflow: visible;
      pointer-events: none;
      z-index: 10;
      -webkit-user-select: none;
      user-select: none;
      -webkit-touch-callout: none;
    }

    /* Full-screen cinematic burst layer (for bottom-origin gamma beams) */
    .btn-explosion-layer.is-global {
      position: fixed;
      inset: 0;
      z-index: 12;
      display: block;
      width: auto;
      height: auto;
      overflow: hidden;
      contain: paint;
      clip-path: inset(0 0 0 0);
    }

    .btn-explosion-particle {
      position: absolute;
      width: 10px;
      height: 10px;
      border-radius: 999px;
      -webkit-user-select: none;
      user-select: none;
      -webkit-touch-callout: none;
      background: var(--pcolor, rgba(120, 220, 255, 0.9));
      transform: translate(-50%, -50%);
      opacity: 0;
      filter: blur(0px);
      /* Ease-out = slows down as it gets farther */
      animation: particleFly var(--dur, 220ms) cubic-bezier(.05,.9,.2,1) forwards;
      box-shadow:
        0 0 0 1px rgba(255,255,255,0.14),
        0 0 18px rgba(120,220,255,0.22),
        0 12px 22px rgba(0,0,0,0.22);
      mix-blend-mode: normal;
    }

    /* "Laser beam" variant */
    .btn-explosion-particle.is-beam {
      width: var(--w, 3px);
      height: var(--h, 120px);
      border-radius: 999px;
      background:
        linear-gradient(
          180deg,
          rgba(255, 255, 255, 0.85) 0%,
          rgba(255, 210, 120, 0.95) 15%,
          rgba(255, 140, 0, 0.95) 55%,
          rgba(60, 30, 10, 0.0) 100%
        );
      transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
      filter: blur(0.2px) drop-shadow(0 0 10px rgba(255, 140, 0, 0.55));
      box-shadow: none;
      animation-name: beamFly;
      animation-duration: var(--dur, 160ms);
      /* Ease-out so beams decelerate */
      animation-timing-function: cubic-bezier(.05,.9,.2,1);
      mix-blend-mode: screen;
    }

    /* Smoke / ember bloom variant */
    .btn-explosion-particle.is-smoke {
      width: var(--sz, 26px);
      height: var(--sz, 26px);
      border-radius: 999px;
      background: radial-gradient(circle at 35% 35%,
        rgba(255, 210, 140, 0.55),
        rgba(255, 140, 0, 0.25) 45%,
        rgba(25, 20, 18, 0.0) 75%
      );
      filter: blur(1.4px);
      box-shadow: 0 0 22px rgba(255, 140, 0, 0.18);
      animation-duration: var(--dur, 520ms);
      /* Smoke should drift and slow */
      animation-timing-function: cubic-bezier(.05,.85,.2,1);
    }

    @keyframes particleFly {
      0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
      12%  { opacity: 1; }
      82%  { opacity: 1; }
      100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(var(--s, 1)); }
    }

    @keyframes beamFly {
      0%   { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scaleY(0.6); }
      10%  { opacity: 1; }
      78%  { opacity: 1; }
      100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) rotate(var(--rot, 0deg)) scaleY(1.05); }
    }

    @media (prefers-reduced-motion: reduce) {
      .btn.btn-view-projects.is-pulsing,
      .btn.btn-view-projects.is-pressing,
      .btn-explosion-particle {
        animation: none !important;
      }
      .btn.btn-view-projects::before {
        transition: none !important;
      }
      .nebula-layer {
        animation: none !important;
      }
      .project-card:hover::before {
        animation: none !important;
      }
      .scroll-hint .arrow {
        animation: none !important;
      }
    }

    /* --- Extra motion layer (approved set) --- */
    .nebula-layer {
      position: fixed;
      inset: 0;
      width: 100vw;
      height: 100vh;
      z-index: -1;
      pointer-events: none;
      opacity: 0.55;
      filter: blur(18px) saturate(1.2);
      mix-blend-mode: screen;
      overflow: hidden;
      background:
        radial-gradient(900px 520px at 20% 30%, rgba(120, 90, 255, 0.22), transparent 60%),
        radial-gradient(760px 520px at 80% 20%, rgba(255, 140, 0, 0.20), transparent 60%),
        radial-gradient(820px 620px at 70% 80%, rgba(50, 220, 255, 0.14), transparent 62%),
        radial-gradient(680px 480px at 30% 78%, rgba(255, 80, 160, 0.12), transparent 60%);
      animation: nebulaDrift 18s ease-in-out infinite alternate;
      transform: translateZ(0);
    }

    @keyframes nebulaDrift {
      0% { transform: translate3d(-1.5%, -1.2%, 0) scale(1.10); }
      100% { transform: translate3d(1.5%, 1.0%, 0) scale(1.16); }
    }

    .ambient-stars {
      position: fixed;
      inset: 0;
      width: 100vw;
      height: 100vh;
      z-index: 0;
      pointer-events: none;
      opacity: 0.95;
      mix-blend-mode: screen;
      overflow: hidden;
    }

    /* Subtle readability ribbon: transparent at top, fades in lower down */
    .content-ribbon {
      position: fixed;
      top: 0;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: min(1040px, 96vw);
      pointer-events: none;
      z-index: 6;
      mix-blend-mode: normal;
      opacity: clamp(0.52, calc(0.52 + var(--end-fade) * 0.75), 1);
      background:
        linear-gradient(
          180deg,
          rgba(8, 8, 12, 0.00) 0%,
          rgba(8, 8, 12, 0.00) 26%,
          rgba(8, 8, 12, 0.07) 42%,
          rgba(8, 8, 12, 0.15) 60%,
          rgba(8, 8, 12, 0.24) 78%,
          rgba(8, 8, 12, 0.34) 100%
        ),
        radial-gradient(
          140% 120% at 50% 100%,
          rgba(0, 0, 0, 0.00) 0%,
          rgba(0, 0, 0, 0.10) 58%,
          rgba(0, 0, 0, 0.20) 100%
        );
      border-left: 1px solid rgba(255, 255, 255, 0.03);
      border-right: 1px solid rgba(255, 255, 255, 0.03);
      /* Apply real alpha falloff across the ribbon layer */
      -webkit-mask-image: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.44) 18%,
        rgba(0, 0, 0, 1) 42%,
        rgba(0, 0, 0, 1) 66%,
        rgba(0, 0, 0, 1) 100%
      );
      mask-image: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.44) 18%,
        rgba(0, 0, 0, 1) 42%,
        rgba(0, 0, 0, 1) 66%,
        rgba(0, 0, 0, 1) 100%
      );
    }

    /* Keep page content above FX layers (ribbon now overlays content for readability) */
    .portfolio-page > *:not(.nebula-layer):not(.ambient-stars):not(.content-ribbon) {
      position: relative;
      z-index: 4;
    }

    .hero-greeting.typewriter {
      white-space: nowrap;
      overflow: hidden;
      border-right: 2px solid rgba(255, 180, 120, 0.9);
      width: fit-content;
      animation: caretBlink 850ms steps(1) infinite;
    }

    @keyframes caretBlink {
      0%, 48% { border-right-color: rgba(255, 180, 120, 0.9); }
      50%, 100% { border-right-color: transparent; }
    }

    .hero-name {
      position: relative;
      display: inline-block;
    }

    .hero-name .name-shimmer {
      position: relative;
      display: inline-block;
      background: linear-gradient(110deg, #fff 0%, #ffd7a3 35%, #ff8c00 55%, #ffd7a3 75%, #fff 100%);
      background-size: 200% 100%;
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      animation: nameShimmer 5.5s linear infinite;
    }

    @keyframes nameShimmer {
      0% { background-position: 170% 0; }
      100% { background-position: -40% 0; }
    }

    .alias.alias-reveal {
      opacity: 0;
      transform: translateX(14px);
      transition: opacity 420ms ease, transform 420ms cubic-bezier(.2,.9,.2,1);
    }

    .alias.alias-reveal.is-visible {
      opacity: 1;
      transform: translateX(0);
    }

    .hero-rotator {
      color: var(--text-muted);
      margin-top: -16px;
      margin-bottom: 20px;
      min-height: 1.5em;
      font-size: 0.95rem;
    }

    .hero-rotator .rotator-word {
      display: inline-block;
      color: #ffd4a0;
      font-weight: 600;
      transition: transform 220ms ease, opacity 220ms ease;
    }

    .hero-rotator .rotator-word.out {
      opacity: 0;
      transform: translateY(-8px);
    }

    .hero-rotator .rotator-word.in {
      opacity: 1;
      transform: translateY(0);
    }

    .btn.btn-scan {
      position: relative;
      overflow: hidden;
    }

    .btn.btn-scan::after {
      content: "";
      position: absolute;
      top: -40%;
      left: -30%;
      width: 24%;
      height: 180%;
      background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
      transform: rotate(18deg) translateX(-240%);
      transition: transform 560ms cubic-bezier(.2,.8,.2,1);
      pointer-events: none;
    }

    .btn.btn-scan:hover::after {
      transform: rotate(18deg) translateX(560%);
    }

    .nav-links a {
      transition: color 0.2s ease, transform 0.2s ease !important;
    }

    .nav-links a:hover {
      transform: translateY(-1px);
    }

    .nav-links a::after {
      left: 50% !important;
      transform: translateX(-50%);
      transition: width 280ms cubic-bezier(.2,.9,.2,1) !important;
    }

    .skill-pill {
      transition: transform 200ms cubic-bezier(.2,.9,.2,1), border-color 200ms ease, background 200ms ease !important;
    }

    .skill-pill:hover {
      transform: translateY(-1px) scale(1.06) !important;
    }

    .exp-item.reveal-item {
      opacity: 0;
      transform: translateY(20px);
      transition: opacity 520ms ease, transform 520ms cubic-bezier(.2,.9,.2,1);
    }

    .exp-item.reveal-item.in-view {
      opacity: 1;
      transform: translateY(0);
    }

    .exp-item.exp-wave .exp-tech {
      animation: chipWave 520ms ease both;
      animation-delay: calc(var(--idx, 0) * 50ms);
    }

    @keyframes chipWave {
      0% { transform: translateY(0); background: rgba(255, 140, 0, 0.08); }
      40% { transform: translateY(-2px); background: rgba(255, 140, 0, 0.28); }
      100% { transform: translateY(0); background: rgba(255, 140, 0, 0.08); }
    }

    .project-card {
      position: relative;
      transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px)) !important;
      transition: transform 140ms linear, box-shadow 200ms ease, border-color 200ms ease, background 200ms ease !important;
      will-change: transform;
    }

    /* Project card glow border (soft aura, no spinning outline) */
    .project-card::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      pointer-events: none;
      opacity: 0;
      z-index: 2;
      background: transparent;
      box-shadow:
        0 0 0 1px rgba(255, 180, 110, 0.18) inset,
        0 0 0 1px rgba(255, 140, 0, 0.18),
        0 0 26px rgba(255, 140, 0, 0.14),
        0 0 60px rgba(255, 140, 0, 0.10);
      transition: opacity 220ms ease;
      mix-blend-mode: screen;
    }

    .project-card:hover::before {
      opacity: 1;
    }
    .project-card:hover {
      --ty: -4px;
    }

    .project-thumb img {
      filter: saturate(0.74) brightness(0.86);
      transition: transform 0.35s ease, filter 0.35s ease !important;
    }

    .project-card:hover .project-thumb img {
      filter: saturate(1.05) brightness(1);
    }

    .project-tags .tag {
      position: relative;
      overflow: hidden;
    }

    .project-tags .tag::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(100deg, transparent 25%, rgba(255,255,255,0.75) 50%, transparent 75%);
      transform: translateX(-140%);
      opacity: 0;
      pointer-events: none;
    }

    .project-card:hover .project-tags .tag::after {
      animation: tagSpark 580ms ease;
    }

    @keyframes tagSpark {
      0% { opacity: 0; transform: translateX(-140%); }
      15% { opacity: 0.8; }
      100% { opacity: 0; transform: translateX(160%); }
    }

    .scroll-hint {
      margin-top: 14px;
      color: var(--text-muted);
      background: transparent;
      border: 0;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      opacity: 0.85;
      transition: opacity 220ms ease, transform 220ms ease;
    }

    .scroll-hint:hover {
      opacity: 1;
    }

    .scroll-hint .arrow {
      display: inline-block;
      animation: hintBounce 1.5s ease-in-out infinite;
    }

    @keyframes hintBounce {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(4px); }
    }

    .scroll-hint.is-hidden {
      opacity: 0;
      pointer-events: none;
      transform: translateY(-6px);
    }

    /* FX toggle mode: stop all animations and return to clean static style */
    .fx-off * {
      animation: none !important;
      transition: none !important;
    }

    .fx-off .nebula-layer {
      display: none !important;
      animation: none !important;
    }

    .fx-off .ambient-stars {
      opacity: 0 !important;
    }

    .fx-off #scroll-hint {
      display: none !important;
    }

    .fx-off .title-spotlight::before {
      opacity: 0 !important;
    }

    .fx-off .project-card::before {
      opacity: 0 !important;
    }

    .fx-off .name-shimmer {
      background: none !important;
      color: var(--text) !important;
      -webkit-background-clip: initial !important;
      background-clip: initial !important;
    }

    .fx-off .hero-greeting.typewriter {
      border-right-color: transparent !important;
    }

    .fx-off .btn.btn-scan::after {
      display: none !important;
    }

    .fx-off .project-thumb img {
      filter: none !important;
    }

    .fx-off .btn-explosion-layer,
    .fx-off .btn-explosion-particle {
      display: none !important;
    }

    /* Toggle button in the header */
    .nav-right {
      display: flex;
      align-items: center;
      gap: 14px;
    }

    .fx-toggle {
      appearance: none;
      border: 1px solid var(--border);
      background: rgba(26, 26, 34, 0.65);
      color: var(--text);
      padding: 8px 12px;
      border-radius: 12px;
      font-size: 0.82rem;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    }

    .fx-toggle:hover {
      border-color: rgba(255, 140, 0, 0.5);
      background: rgba(255, 140, 0, 0.10);
      transform: translateY(-1px);
    }

    /* --- Postprocessing overlays (chromatic aberration: background only) --- */
    .postfx-chroma {
      /* Approximation: colored edge glow via drop-shadows */
      filter:
        drop-shadow(-0.6px 0 rgba(255, 70, 70, 0.14))
        drop-shadow(0.6px 0 rgba(90, 170, 255, 0.12));
    }

    .fx-off .postfx-chroma {
      filter: none !important;
    }

/* Keep the header pinned even with global content z-index rules. */
.portfolio-page > nav {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2147483647 !important;
  background: rgba(15, 15, 19, 0.51) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
}
