:root {
  /* ================= BASE LAYERS ================= */
  --bg: #f2f4f7; /* Page background (cool off-white) */

  /* ================= GLASS SURFACES ================= */
  --panel-bg: rgba(255, 255, 255, 0.88); /* Main panel = more solid */
  --item-bg: rgba(255, 255, 255, 0.78); /* Cards/items = lighter */

  /* ================= TEXT ================= */
  --text: #1c1c1e;
  --secondary: #6e6e73;

  /* ================= ACCENT ================= */
  --accent: #007aff;

  /* ================= DOCK GLASS ================= */
  --dock-bg: rgba(245, 247, 250, 0.82); /* Slightly more frosted */

  /* ================= GLASS EFFECT ================= */
  --glass: blur(46px) saturate(185%);

  /* ================= BORDERS ================= */
  --glass-border: rgba(0, 0, 0, 0.08);
  --divider: rgba(0, 0, 0, 0.08);

  /* ================= SHADOWS ================= */
  --shadow-icon: 0 1px 3px rgba(0, 0, 0, 0.05), 0 6px 16px rgba(0, 0, 0, 0.08);

  --shadow-dock:
    0 24px 48px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --glass-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ================= DARK MODE (TRUE iOS STYLE) ================= */
[data-theme="dark"] {
  /* Real iOS blacks */
  --bg: #000000;

  /* Glass layers */
  --panel-bg: rgba(28, 28, 30, 0.85);
  --item-bg: rgba(44, 44, 46, 0.75);

  --text: #f5f5f7;
  --secondary: #a1a1a6;

  --dock-bg: rgba(20, 20, 22, 0.72);

  --glass: blur(52px) saturate(140%);

  --glass-border: rgba(255, 255, 255, 0.08);
  --divider: rgba(255, 255, 255, 0.12);

  --shadow-icon: 0 2px 8px rgba(0, 0, 0, 0.5), 0 14px 34px rgba(0, 0, 0, 0.8);

  --shadow-dock:
    0 30px 70px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /*font-family: 'Inter', sans-serif;*/
  font-family: "Manrope", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================== HIDE DOCK + ISLAND WHEN PANEL IS OPEN ===================== */

.dock-container,
.dynamic-blob {
  transition:
    opacity 0.25s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===================== TOP NAV ===================== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 25px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 90;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ===================== THEME TOGGLE ===================== */
.theme-btn {
  background: var(--item-bg);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.theme-btn ion-icon {
  font-size: 22px;
  position: absolute;
  transition:
    transform 0.5s cubic-bezier(0.6, -0.28, 0.735, 0.045),
    opacity 0.3s;
}

.sun-icon {
  opacity: 0;
  transform: translateY(30px);
}
[data-theme="dark"] .sun-icon {
  opacity: 1;
  transform: translateY(0);
}
[data-theme="dark"] .moon-icon {
  opacity: 0;
  transform: translateY(-30px);
}

/* ===================== HERO ===================== */
.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 30px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  background: var(--item-bg);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34c759;

  box-shadow: 0 0 6px rgba(52, 199, 89, 0.6);

  animation: statusPulse 2.4s ease-in-out infinite;
}
@keyframes statusPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 6px rgba(52, 199, 89, 0.5);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(52, 199, 89, 0.9);
    opacity: 1;
  }
}

h1 {
  font-size: 3.2rem;
  line-height: 1.1;
  letter-spacing: -2px;
  font-weight: 800;
}
h1 .thin {
  font-weight: 300;
  color: var(--secondary);
}
h1 .gradient {
  background: linear-gradient(180deg, var(--text), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

p {
  font-size: 17px;
  color: var(--secondary);
  margin: 20px 0 35px;
  line-height: 1.5;
  max-width: 90%;
}

/* ===============================
   CTA BUTTON BASE
================================ */
.cta-button {
  --btn-bg: var(--text, #000);
  --btn-text: var(--bg, #fff);
  --shimmer-glint: linear-gradient(
    115deg,
    transparent 45%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 55%
  );

  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  position: relative;
  overflow: hidden;

  padding: 18px 32px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;

  /* Standard Light Mode Shadow */
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);

  /* Super smooth "Apple" physics */
  transition:
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.4s ease;
}

/* ===============================
   DARK MODE: THE "CERAMIC" LOOK
================================ */
[data-theme="dark"] .cta-button {
  --btn-bg: #ffffff;
  --btn-text: #000000;

  /* The glint on white needs to be a "cool silver" to look clean */
  --shimmer-glint: linear-gradient(
    115deg,
    transparent 40%,
    rgba(0, 0, 0, 0.04) 47%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.04) 53%,
    transparent 60%
  );

  /* Multi-layered shadow to prevent the white from "bleeding" into the dark background */
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    /* Thin "Rim" light */ 0 12px 24px rgba(0, 0, 0, 0.3),
    /* Main shadow */ 0 4px 10px rgba(0, 0, 0, 0.2),
    /* Soft base */ inset 0 1px 1px rgba(255, 255, 255, 1); /* Sharp top-edge bevel */
}

/* ===============================
   INTERACTION
================================ */
@media (hover: hover) {
  .cta-button:hover {
    transform: translateY(-2px);
    /* In dark mode, white button gets a slight outer glow on hover */
    box-shadow:
      0 0 20px rgba(255, 255, 255, 0.05),
      0 20px 40px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 1);
  }
}

.cta-button:active {
  transform: scale(0.96);
  /* Physical "press" feel */
  background: #f2f2f2;
  transition-duration: 0.2s;
}

/* ===============================
   THE EASY GLINT (ANIMATION)
================================ */
.cta-button::after {
  content: "";
  position: absolute;
  inset: -50% -50%;
  pointer-events: none;
  background: var(--shimmer-glint);

  /* Initial position: Way off to the left */
  transform: translateX(-130%) skewX(-20deg);
  opacity: 0;
}

.cta-button.attention::after {
  /* 5.5s duration makes the movement feel "weighty" and relaxed */
  animation: ctaShimmerPerfect 5.5s cubic-bezier(0.45, 0.03, 0.51, 0.95)
    infinite;
}

/* Hide shimmer when user is interacting */
.cta-button:hover::after,
.cta-button:active::after {
  opacity: 0 !important;
  transition: opacity 0.4s ease;
}

/* The Sweep: 
   Fast start, silky middle, slow finish.
   Rest of the 5.5s is pure "air" (pause).
*/
@keyframes ctaShimmerPerfect {
  0% {
    transform: translateX(-130%) skewX(-20deg);
    opacity: 0;
  }
  10% {
    opacity: 1; /* Fade in as it starts moving */
  }
  /* The sweep finishes around 40% of the total time */
  40% {
    transform: translateX(130%) skewX(-20deg);
    opacity: 1;
  }
  45%,
  100% {
    transform: translateX(130%) skewX(-20deg);
    opacity: 0;
  }
}
/* ===================== DOCK ===================== */
.dock-container {
  position: fixed;
  bottom: 35px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;

  /* CRITICAL FIX 1: Must be higher than dynamic-blob (999) */
  z-index: 1000;

  /* Prevent container from blocking clicks on the sides */
  pointer-events: none;
}

.dock {
  /* CRITICAL FIX 2: Remove border here (the blob handles it) */
  border: none;

  /* Keep background transparent so we see the blob underneath */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;

  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 12px;

  opacity: 0;

  /* Re-enable clicks on the actual dock items */
  pointer-events: auto;

  transform: scale(0.92);
  transition:
    opacity 0.2s ease,
    transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dock-link {
  color: var(--text);
  font-size: 26px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  transition: 0.2s;
}

.dock-link:active {
  background: rgba(120, 120, 120, 0.15);
  transform: scale(0.85);
}

.separator {
  width: 1px;
  height: 20px;
  background: rgba(120, 120, 120, 0.2);
  margin: 0 4px;
}

/* ===================== OVERLAY ===================== */
.blur-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: 0.4s;
  z-index: 150;
}

.blur-overlay.active {
  opacity: 1;
  visibility: visible;
  backdrop-filter: blur(10px);
}

/* ===================== BOTTOM SHEET ===================== */
/*.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;

    height: 70vh;               
    max-height: 70vh;

    background: var(--panel-bg); 
    color: var(--text);
    border-radius: 28px 28px 0 0; 
    z-index: 200; 
    padding: 15px 20px 20px;

    border-top: 0.5px solid rgba(120,120,120,0.2);

    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.3, 0.8, 0.3, 1);
    will-change: transform;

    display: flex;              
    flex-direction: column;     
}*/
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  height: 75vh;
  max-height: 75vh;

  background: var(--panel-bg);
  color: var(--text);
  border-radius: 28px 28px 0 0;
  z-index: 200;
  padding: 15px 20px 5px;

  border-top: 0.5px solid rgba(120, 120, 120, 0.2);

  /* ✅ Use CSS variable for drag */
  --drag-y: 100%;
  transform: translateY(var(--drag-y));
  transition: transform 0.6s cubic-bezier(0.3, 0.8, 0.3, 1);

  display: flex;
  flex-direction: column;
}
.bottom-sheet.active {
  --drag-y: 0px;
}

/*.bottom-sheet.active { 
    transform: translateY(0); 
}*/

/* ===================== SHEET CONTENT ===================== */
.sheet-content {
  display: flex;
  flex-direction: column;
  flex: 1; /* ✅ TAKE REMAINING SPACE */
  min-height: 0;
}

/*.drag-handle { 
   width: 40px; 
    height: 5px; 
    border-radius: 10px; 
    margin: 0 auto 16px; 
     flex-shrink: 0; 
    background: rgba(120,120,120,0.4);  
}*/

.drag-handle {
  width: 40px;
  height: 5px;
  border-radius: 10px;
  margin: 0 auto 16px;
  background: rgba(120, 120, 120, 0.5);
  flex-shrink: 0;

  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.drag-handle.pressed {
  transform: scaleX(1.25) scaleY(0.8);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  margin-bottom: 15px;
  flex-shrink: 0; /* ✅ PREVENT SHRINK */
}

.done-btn {
  background: var(--item-bg);
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

@media (hover: hover) {
  .done-btn:hover {
    background: rgba(120, 120, 120, 0.15);
  }
}

/* ===================== PROJECT LIST ===================== */
.project-grid {
  display: grid;
  gap: 12px;
  flex: 1;
  overflow-y: auto; /* ✅ SCROLL INSIDE PANEL */
  -webkit-overflow-scrolling: touch;
  /* padding-left: 12px; */
  padding: 0 10px 20px;

  scrollbar-gutter: stable;
}

.item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--item-bg);
  padding: 18px;
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
}

.icon-box {
  background: var(--bg);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 20px;
  color: var(--accent);
}

.item-text span {
  font-size: 12px; /* smaller */
  opacity: 0.7; /* softer */
  display: block;
  margin-top: 2px;
}

.item-text h3 {
  font-size: 16px;
  font-weight: 600;
}

/* Make text block flexible so chevron goes to far right */
.item-text {
  flex: 1;
  min-width: 0; /* prevents overflow issues */
}

/* Chevron container */
.item-chevron {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 28px;
  height: 28px;

  margin-left: 8px;
  flex-shrink: 0;

  color: var(--secondary);
  opacity: 0.7;

  transition:
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease;
}

.item-chevron ion-icon {
  font-size: 20px;
}

/* iOS-like press feedback */
.item:active .item-chevron {
  transform: translateX(3px);
  opacity: 1;
}

@media (min-width: 900px) {
  /* Make card relative so we can position chevron */
  .item {
    position: relative;
  }

  /* Reposition chevron to top-right */
  .item-chevron {
    position: absolute;
    top: 14px;
    right: 14px;

    width: 26px;
    height: 26px;

    border-radius: 8px;

    background: rgba(120, 120, 120, 0.08);
    backdrop-filter: blur(6px);

    opacity: 0;
    transform: translateX(-4px);

    transition:
      opacity 0.25s ease,
      transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
      background 0.25s ease;
  }

  .item-chevron ion-icon {
    font-size: 16px;
  }

  /* Show chevron on hover */
  .item:hover .item-chevron {
    opacity: 1;
    transform: translateX(0);
  }

  /* Card hover lift */
  .item {
    transition:
      transform 0.25s ease,
      box-shadow 0.25s ease;
  }

  .item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  }
}

/* ===================== CUSTOM SCROLLBAR (PROJECT LIST) ===================== */

/* Firefox */
.project-grid {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 120, 120, 0.4) transparent;
}

/* Chrome, Edge, Safari */
.project-grid::-webkit-scrollbar {
  width: 6px;
}

.project-grid::-webkit-scrollbar-track {
  background: transparent;
}

.project-grid::-webkit-scrollbar-thumb {
  background-color: rgba(120, 120, 120, 0.35);
  border-radius: 10px;
}

/* Hover effect */
.project-grid::-webkit-scrollbar-thumb:hover {
  background-color: rgba(120, 120, 120, 0.55);
}

/* ===================== PRELOADER ===================== */
.preloader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.6s ease,
    visibility 0.6s ease,
    transform 0.6s ease;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.03);
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Spinner */
/* Dot Pulse Loader */
.dot-pulse {
  display: flex;
  gap: 8px;
}

.dot-pulse span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.2;
  animation: dotPulse 1.4s infinite ease-in-out;
}

.dot-pulse span:nth-child(1) {
  animation-delay: 0s;
}
.dot-pulse span:nth-child(2) {
  animation-delay: 0.2s;
}
.dot-pulse span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%,
  80%,
  100% {
    opacity: 0.2;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Text */
.loader-text {
  font-size: 14px;
  letter-spacing: 0.4px;
  color: var(--secondary);
  font-weight: 600;
}

/* ===================== HERO ENTRANCE ANIMATION ===================== */
.page-loaded .hero-anim {
  opacity: 0;
  transform: translateY(24px);
  animation: heroEnter 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Stagger delays */
.anim-1 {
  animation-delay: 0.1s;
}
.anim-2 {
  animation-delay: 0.25s;
}
.anim-3 {
  animation-delay: 0.4s;
}
.anim-4 {
  animation-delay: 0.55s;
}

@keyframes heroEnter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================== DOCK ENTRANCE ANIMATION ===================== */
/* ===================== iOS MATERIAL BLOB ===================== */
/* ===================== THE ANIMATED BLOB (Dynamic Island) ===================== */
.dynamic-blob {
  position: fixed;
  left: 50%;
  bottom: 35px;
  transform: translateX(-50%) translateY(60px); /* Start hidden below */

  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.06);

  background: var(--dock-bg);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  box-shadow: none;

  z-index: 999;

  /* Physics for the morph */
  transition:
    transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
    width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
    height 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 0.6s ease 0.2s,
    /* Color changes slightly later */ backdrop-filter 0.6s ease 0.2s,
    border-radius 0.6s ease;
}

[data-theme="dark"] .dynamic-blob {
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Phase 1: Blob Floats Up (Page Load) */
.page-loaded .dynamic-blob {
  transform: translateX(-50%) translateY(0);
}

/* Phase 2: Expansion & Material Change */
.dynamic-blob.expand {
  width: 260px; /* Match your Dock width */
  height: 64px; /* Match your Dock height */
  border-radius: 24px;

  /* MORPH: Become the glass background */
  background: var(--dock-bg);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  box-shadow: none;

  /* Add the subtle iOS glass border */
  border: 1px solid rgba(0, 0, 0, 0.1);
}
[data-theme="dark"] .dynamic-blob.expand {
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* ===================== REAL DOCK CONTENT ===================== */
.dock {
  /* The dock container is now invisible/transparent 
       because the blob provides the background */
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  gap: 12px;

  /* Content is hidden until blob expands */
  opacity: 0;
  pointer-events: auto;

  /* Start slightly scaled down */
  transform: scale(0.95);
  transition:
    opacity 0.3s ease,
    transform 0.4s ease;
}

/* Show content once expanded */
.dock-container.show .dock {
  opacity: 1;
  transform: scale(1);
}

/* ===================== DOCK ICONS ===================== */
.dock-link {
  color: var(--text);
  font-size: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: transparent;
  position: relative;

  /* Smooth hover/press */
  transition:
    background 0.2s,
    transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

/* iOS Icon Press State */
.dock-link:active {
  background: rgba(120, 120, 120, 0.15);
  transform: scale(0.9); /* Deep press */
}

/* ===================== ICON ENTRANCE ANIMATION (POP) ===================== */
/* Icons are hidden initially */
.dock-link {
  opacity: 0;
  transform: scale(0.4) translateY(10px);
}

/* ===================== ICON ENTRANCE ===================== */
/* When dock shows, trigger the POP animation */
.dock-container.show .dock-link {
  animation: iconPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* CRITICAL FIX 3: Increased delays slightly so icons don't pop 
   outside the blob while it's still stretching */
.dock-container.show .dock-link:nth-child(1) {
  animation-delay: 0.15s;
}
.dock-container.show .dock-link:nth-child(2) {
  animation-delay: 0.2s;
}
.dock-container.show .dock-link:nth-child(3) {
  animation-delay: 0.25s;
}
.dock-container.show .dock-link:nth-child(4) {
  animation-delay: 0.3s;
}

@keyframes iconPop {
  0% {
    opacity: 0;
    transform: scale(0.4) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.separator {
  width: 1px;
  height: 24px;
  background: var(--secondary);
  opacity: 0.2;
  margin: 0 4px;
}

/* ===================== DISABLE DOCK INTERACTION WHEN BUSY ===================== */

/* When bottom sheet is open OR project page is open, kill dock clicks */
body.no-scroll .dock,
body.project-open .dock {
  pointer-events: none !important;
}

/* Also disable the blob just in case */
body.no-scroll .dynamic-blob,
body.project-open .dynamic-blob {
  pointer-events: none !important;
}

/* ===================== SHEET ITEM ULTRA SMOOTH ENTRANCE ===================== */
/* ===================== SHEET ITEM ULTRA SMOOTH BLUR FADE-IN ===================== */
.sheet-item {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(6px);
}

/* Items animate ONLY when .items-visible is added */
.bottom-sheet.items-visible .sheet-item {
  animation: sheetItemEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Stagger delays (12 items) */
.bottom-sheet.items-visible .sheet-item:nth-child(1) {
  animation-delay: 0s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(2) {
  animation-delay: 0.08s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(3) {
  animation-delay: 0.16s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(4) {
  animation-delay: 0.24s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(5) {
  animation-delay: 0.32s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(6) {
  animation-delay: 0.4s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(7) {
  animation-delay: 0.48s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(8) {
  animation-delay: 0.56s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(9) {
  animation-delay: 0.64s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(10) {
  animation-delay: 0.72s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(11) {
  animation-delay: 0.8s;
}
.bottom-sheet.items-visible .sheet-item:nth-child(12) {
  animation-delay: 0.88s;
}

/* Animation */
@keyframes sheetItemEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0px);
  }
}

/* ===================== DESKTOP PROJECT GRID ===================== */
@media (min-width: 900px) {
  .bottom-sheet {
    max-width: 1200px; /* ✅ wider panel */
    width: 65vw; /* ✅ responsive width */
    left: 50%;
    right: auto;

    /* Keep your drag system working */
    transform: translateX(-50%) translateY(var(--drag-y));
  }

  .bottom-sheet.active {
    transform: translateX(-50%) translateY(0);
  }

  .project-grid {
    grid-template-columns: repeat(3, 1fr); /* ✅ 3 cards per row */
    gap: 16px;
  }

  .item {
    flex-direction: column; /* ✅ Vertical card layout */
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
  }

  .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 22px;
  }

  .item-text h3 {
    font-size: 17px;
  }

  .item-text span {
    font-size: 12px;
  }
  .item {
    transition:
      transform 0.25s ease,
      box-shadow 0.25s ease;
  }

  .item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  }
}

/* ================= PROJECT DETAILS PAGE (iOS PUSH) ================= */

/* Header */
.project-header {
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(120, 120, 120, 0.15);
}

.project-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.project-title {
  font-weight: 600;
  font-size: 17px;
}

/* Content */
.project-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 30px;
}

/* Gallery */
/* Gallery */
.project-gallery {
  display: grid;
  grid-template-columns: 1fr; /* Mobile: 1 per row */
  gap: 12px;
  padding: 16px;
}

/* Desktop layout */
@media (min-width: 900px) {
  .project-gallery {
    grid-template-columns: repeat(3, 1fr); /* 3 images per row */
    gap: 20px;
  }
}

.project-gallery img {
  width: 100%;
  border-radius: 18px;
  display: block;
}

/* Text */
.project-info {
  padding: 8px 20px 40px;
}

.project-info h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.project-info p {
  font-size: 16px;
  color: var(--secondary);
  line-height: 1.6;
}

@media (max-width: 768px) {
  .dock-container {
    bottom: calc(35px + env(safe-area-inset-bottom));
  }

  .hero .container {
    padding-bottom: calc(140px + env(safe-area-inset-bottom));
  }
}

.pull-refresh {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--dock-bg);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
  opacity: 0;
}

.pull-refresh.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.pull-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pull-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 99999;
}

.pull-indicator.visible {
  opacity: 1;
}

/* ===================== ACTION BAR MORPH (iOS STYLE) ===================== */

/* ===================== ACTION BAR MORPH (TRUE iOS STYLE) ===================== */
/* ===================== ACTION BAR (APPLE-LEVEL) ===================== */

.project-actions {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);

  height: 56px;
  width: 56px;
  border-radius: 999px;

  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.72),
    rgba(240, 240, 245, 0.62)
  );

  backdrop-filter: blur(50px) saturate(180%);
  -webkit-backdrop-filter: blur(50px) saturate(180%);

  border: 0.5px solid rgba(255, 255, 255, 0.18);

  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;

  z-index: 100001;

  opacity: 0;
  visibility: hidden;
  overflow: hidden;

  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 0 0.5px rgba(255, 255, 255, 0.6);

  transition:
    width 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.35s ease;
}

/* Highlight */
.project-actions::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;

  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.25) 35%,
    rgba(255, 255, 255, 0.05) 60%,
    transparent
  );

  opacity: 0.45;
}

/* Noise */
.project-actions::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;

  background-image: var(--glass-noise);
  mix-blend-mode: overlay;
  opacity: 0.18;
}

/* Step 1: appear as circle */
.project-actions.bar-visible {
  opacity: 1;
  visibility: visible;
}

/* Step 2: stretch horizontally with subtle overshoot */
.project-actions.bar-expanded {
  width: 296px; /* overshoot width */
}

/* After stretch settles (optional micro-fix) */
.project-actions.bar-expanded.settled {
  width: 280px;
}

/* ================= iOS 17 DARK GLASS ================= */
[data-theme="dark"] .project-actions [data-theme="dark"] .project-back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ================= CLEAN iOS DARK MODE BUTTONS (NO SHADOW) ================= */

[data-theme="dark"] .project-visit-btn {
  background: rgba(255, 255, 255, 0.92); /* Soft off-white, not harsh */
  color: #000000;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .project-back-btn {
  background: rgba(40, 40, 44, 0.95); /* iOS graphite glass */
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ===================== CONTENT REVEAL (MASK FEEL) ===================== */

.project-back-btn,
.project-visit-btn {
  opacity: 0;
  transform: scale(0.94);
  filter: blur(3px);

  transition:
    opacity 0.28s ease,
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.45s ease;
}

/* Content materializes from glass */
.project-actions.bar-expanded .project-back-btn,
.project-actions.bar-expanded .project-visit-btn {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}

/* Subtle stagger */
.project-actions.bar-expanded .project-back-btn {
  transition-delay: 0.08s;
}
.project-actions.bar-expanded .project-visit-btn {
  transition-delay: 0.14s;
}

/* ===================== BUTTON STYLES ===================== */

.project-back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;

  background: rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.35);

  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);

  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.project-visit-btn {
  background: var(--text);
  color: var(--bg);
  padding: 12px 26px;
  border-radius: 22px;
  font-weight: 600;
  text-decoration: none;
  font-size: 15px;

  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* ===================== BACKGROUND DEFOCUS ===================== */

body.project-open .hero,
body.project-open .dock-container,
body.project-open .dynamic-blob {
  transform: scale(0.965);
  filter: blur(6px);

  transition:
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===================== BOTTOM ACTION BAR ===================== */

.project-action-bar {
  transform: translateY(40px) scale(0.96);
  opacity: 0;

  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
}

.project-page.active .project-action-bar {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ===================== GALLERY IMAGE STAGGER ===================== */

.project-gallery img {
  opacity: 0;
  transform: translateY(10px);
}

.project-page.active .project-gallery img {
  animation: imageReveal 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes imageReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== SKELETON LOADER ===== */

.gallery-item {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  overflow: hidden;
  background: #e5e7eb;
}

[data-theme="dark"] .gallery-item {
  background: #1f1f22;
}

/* Skeleton shimmer */
.skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.05) 30%,
    rgba(255, 255, 255, 0.15) 40%,
    rgba(255, 255, 255, 0.05) 50%
  );
  animation: shimmer 1.2s infinite linear;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* Real image */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.02);
  transition:
    opacity 0.5s ease,
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* When loaded */
.gallery-item.loaded img {
  opacity: 1;
  transform: scale(1);
}

.gallery-item.loaded .skeleton {
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* ================= PROJECT PAGE (FINAL iOS DEPTH PUSH) ================= */

/* ================= PROJECT PAGE (NATIVE SLIDE PUSH) ================= */

.project-page {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100000;

  transform: translateX(100%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);

  display: flex;
  flex-direction: column;

  will-change: transform;
  pointer-events: none;
}

.project-page.active {
  transform: translateX(0);
  pointer-events: auto;
}

/* While dragging with finger */
.project-page.dragging {
  transition: none !important;
}

/* Pre-enter state = prepare GPU & avoid first-frame stutter */
.project-page.pre-enter {
  opacity: 0;
  transform: scale(1.04);
  filter: blur(10px);
}
.project-page.dragging {
  transition: none !important;
}

/* Active = settled into place */

/* Remove all depth while swiping back (iOS style) */
.project-page.dragging,
.project-page.dragging * {
  box-shadow: none !important;
}

/* ===================== HARD KILL DOCK INTERACTION WHEN UI IS BUSY ===================== */

/* When bottom sheet OR project page is open → NOTHING under it should be clickable */
body.no-scroll .dock-container,
body.no-scroll .dock,
body.no-scroll .dynamic-blob,
body.project-open .dock-container,
body.project-open .dock,
body.project-open .dynamic-blob {
  pointer-events: none !important;
}

/* Also prevent any ghost taps during transitions */
body.no-scroll .dock-container *,
body.project-open .dock-container * {
  pointer-events: none !important;
  visibility: hidden;
}
