/* ═══════════════════════════════════════════════════════
   Case Study — Mobile Overrides (≤ 768px)
   Shared across all case-study-*.html pages.
   Design reference: TimeXi ClikSell.dc.html (mobile 430px)
   ═══════════════════════════════════════════════════════ */

@keyframes cs-heroEntrance {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cs-fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Mobile drawer (hidden on desktop) ── */
#cs-drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #07070e;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16,1,0.3,1);
  flex-direction: column;
  padding: 80px 20px 40px;
}
#cs-drawer.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}
#cs-drawer a.cs-drawer-link {
  display: block;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -2px;
  color: #fff;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  line-height: 1;
  text-decoration: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s, transform 0.4s;
}
#cs-drawer a.cs-drawer-link:last-child { border-bottom: none; }
#cs-drawer.open a.cs-drawer-link {
  opacity: 1;
  transform: translateY(0);
}
#cs-drawer.open a.cs-drawer-link:nth-child(1) { transition-delay: 0.08s; }
#cs-drawer.open a.cs-drawer-link:nth-child(2) { transition-delay: 0.15s; }
#cs-drawer.open a.cs-drawer-link:nth-child(3) { transition-delay: 0.22s; }
#cs-drawer.open a.cs-drawer-link:nth-child(4) { transition-delay: 0.29s; }
#cs-drawer .cs-drawer-footer {
  padding-top: 28px;
}
#cs-drawer .cs-drawer-footer a {
  text-decoration: none;
}

/* ── Next Project card (hidden on desktop by default, shown below) ── */
.cs-next-project { display: none; }

@media (max-width: 768px) {

  /* ── Global: full dark background ── */
  body {
    background: #07070e !important;
    color: #fff !important;
  }

  /* ── Nav adjustments ── */
  #main-nav {
    padding: 14px 0 !important;
    top: 0 !important;
    height: 60px !important;
    background: rgba(7,7,14,0.95) !important;
  }
  .nav-desktop-links { display: none !important; }
  .nav-hamburger { display: flex !important; }
  .nav-cta { font-size: 13px !important; padding: 8px 16px !important; border-radius: 6px !important; }
  #nav-mobile-menu { display: none !important; }

  /* Show drawer */
  #cs-drawer { display: flex; }

  /* ── Dark panels: remove border-radius, full-bleed ── */
  .dark-panel { border-radius: 0 !important; }
  .dark-panel-wrap {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* ══ HERO ══ */
  .cs-hero-panel {
    border-radius: 0 !important;
    background: #07070e !important;
  }
  .cs-hero-inner {
    padding: 0 !important;
  }

  /* Hero grid: stack */
  .cs-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  /* Hero image: full-bleed with gradient overlay */
  .cs-hero-grid > div:last-child {
    order: -1;
    border-radius: 0 !important;
    border: none !important;
    height: 420px;
    position: relative;
    overflow: hidden;
  }
  .cs-hero-grid > div:last-child img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
  }
  .cs-hero-grid > div:last-child::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
      rgba(7,7,14,0.6) 0%,
      transparent 30%,
      transparent 45%,
      rgba(7,7,14,0.85) 72%,
      #07070e 100%);
    pointer-events: none;
  }

  /* Hero text content */
  .cs-hero-grid > div:first-child {
    padding: 0 20px 40px;
    margin-top: -80px;
    position: relative;
    z-index: 2;
  }

  /* Breadcrumb */
  .cs-hero-grid > div:first-child > p:first-child {
    margin-bottom: 20px !important;
  }
  .cs-hero-grid > div:first-child > p:first-child a,
  .cs-hero-grid > div:first-child > p:first-child span {
    font-size: 12px !important;
  }

  /* Hero tags */
  .cs-hero-grid > div:first-child > div:first-of-type {
    margin-bottom: 20px !important;
  }
  .cs-hero-grid > div:first-child > div:first-of-type span:first-child {
    padding: 5px 11px !important;
    background: rgba(167,139,250,0.2) !important;
    border: 1px solid rgba(167,139,250,0.35) !important;
    border-radius: 20px !important;
    font-size: 11px !important;
    color: #a78bfa !important;
  }

  /* Hero heading */
  .cs-hero-grid > div:first-child h1 {
    font-size: clamp(32px, 9vw, 40px) !important;
    letter-spacing: -1.5px !important;
    margin-bottom: 16px !important;
  }

  /* Hero description */
  .cs-hero-grid > div:first-child > p:nth-of-type(1) {
    font-size: 15px !important;
    line-height: 1.75 !important;
    color: rgba(255,255,255,0.55) !important;
  }

  /* ── Hero stats: horizontal card ── */
  .cs-hero-stats {
    display: flex !important;
    gap: 0 !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    margin-bottom: 16px !important;
  }
  .cs-hero-stats > div {
    flex: 1 !important;
    padding: 18px 16px !important;
    background: #0d0d18 !important;
    text-align: center !important;
  }
  .cs-hero-stats > div:not(:last-child) {
    border-right: 1px solid rgba(255,255,255,0.08) !important;
  }
  .cs-hero-stats > div p:first-child {
    font-size: 28px !important;
    color: #a78bfa !important;
    letter-spacing: -1.5px !important;
  }
  .cs-hero-stats > div p:last-child {
    font-size: 10px !important;
    letter-spacing: 1.8px !important;
    color: rgba(255,255,255,0.32) !important;
    margin-top: 5px !important;
  }

  /* Hero tech tags */
  .cs-hero-grid > div:first-child > div:last-child span {
    padding: 6px 12px !important;
    background: rgba(167,139,250,0.08) !important;
    border: 1px solid rgba(167,139,250,0.18) !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #a78bfa !important;
  }

  /* Hero wrap top padding */
  .dark-panel-wrap:first-of-type {
    padding-top: 0 !important;
  }

  /* ══ ABOUT SECTION ══ */
  .cs-about-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
    padding: 52px 20px !important;
    width: 100% !important;
    border-top: 1px solid rgba(255,255,255,0.06);
  }

  /* About section label */
  .cs-about-grid > div:first-child p:first-child {
    color: rgba(255,255,255,0.35) !important;
  }
  .cs-about-grid > div:first-child p:first-child span {
    background: #a78bfa !important;
  }

  /* About text */
  .cs-about-grid > div:first-child p {
    color: rgba(255,255,255,0.65) !important;
  }
  .cs-about-grid > div:first-child p:last-child {
    color: rgba(255,255,255,0.48) !important;
  }

  /* Goals card */
  .cs-about-grid > div:last-child {
    background: #0e0e1a !important;
    border: 1px solid rgba(255,255,255,0.07) !important;
    border-radius: 14px !important;
    padding: 24px 20px !important;
  }
  .cs-about-grid > div:last-child p:first-child {
    color: rgba(255,255,255,0.35) !important;
  }
  .cs-about-grid > div:last-child p {
    color: rgba(255,255,255,0.5) !important;
  }
  .cs-about-grid > div:last-child iconify-icon {
    color: #a78bfa !important;
  }
  .cs-about-grid > div:last-child span {
    background: rgba(167,139,250,0.1) !important;
  }

  /* ══ THE NEED PANEL ══ */
  .dark-panel-wrap:nth-of-type(2) .dark-panel {
    background: linear-gradient(135deg, rgba(167,139,250,0.08) 0%, rgba(167,139,250,0.03) 100%) !important;
    border: 1px solid rgba(167,139,250,0.14) !important;
    border-radius: 16px !important;
    padding: 24px 20px !important;
    margin: 0 20px !important;
  }
  .dark-panel-wrap:nth-of-type(2) {
    padding: 0 !important;
    margin-bottom: 0 !important;
  }
  .dark-panel-wrap:nth-of-type(2) .dark-panel p:first-child {
    color: rgba(167,139,250,0.6) !important;
  }
  .dark-panel-wrap:nth-of-type(2) .dark-panel p:last-child {
    font-style: italic;
    color: rgba(255,255,255,0.7) !important;
  }

  /* ══ CHALLENGES ══ */
  .cs-challenges-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Challenges section heading */
  .cs-challenges-grid ~ h2,
  section:has(.cs-challenges-grid) h2 {
    color: #fff !important;
  }
  section:has(.cs-challenges-grid) > div > p:first-child {
    color: rgba(255,255,255,0.35) !important;
  }
  section:has(.cs-challenges-grid) > div > p:first-child span {
    background: #a78bfa !important;
  }

  /* Challenge cards: dark with left accent bar */
  .cs-bento-card,
  .cs-challenges-grid > div {
    background: #0e0e1a !important;
    border: 1px solid rgba(255,255,255,0.07) !important;
    border-radius: 14px !important;
    padding: 20px 20px 20px 24px !important;
    min-height: auto !important;
    position: relative !important;
    overflow: hidden !important;
    grid-column: span 1 !important;
  }
  .cs-bento-card::before,
  .cs-challenges-grid > div::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #a78bfa;
    border-radius: 1px;
  }
  .cs-bento-card h3,
  .cs-challenges-grid > div h3 {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #fff !important;
    text-transform: none !important;
    letter-spacing: -0.3px !important;
    margin-bottom: 6px !important;
  }
  .cs-bento-card h3 br { display: none; }
  .cs-bento-card p,
  .cs-challenges-grid > div p {
    font-size: 13px !important;
    color: rgba(255,255,255,0.45) !important;
    line-height: 1.65 !important;
  }
  .cs-bento-card iconify-icon,
  .cs-challenges-grid > div iconify-icon {
    display: none !important;
  }
  .cs-bento-wide {
    grid-column: span 1 !important;
    flex-direction: column !important;
  }

  /* Counter for challenge cards */
  .cs-challenges-grid {
    counter-reset: challenge;
  }
  .cs-bento-card,
  .cs-challenges-grid > div {
    counter-increment: challenge;
  }
  .cs-bento-card > div:first-child::before,
  .cs-challenges-grid > div > div:first-child::before,
  .cs-bento-card::after,
  .cs-challenges-grid > div::after {
    content: counter(challenge, decimal-leading-zero);
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    color: rgba(167,139,250,0.4);
    margin-bottom: 8px;
  }
  /* Only show the ::after pseudo counter */
  .cs-bento-card > div:first-child::before,
  .cs-challenges-grid > div > div:first-child::before {
    display: none;
  }

  /* ══ SOLUTION (dark panel) ══ */
  .cs-solution-layout {
    grid-template-columns: 1fr !important;
    gap: 40px !important;
  }
  .cs-solution-sticky {
    position: static !important;
    height: auto !important;
  }
  .cs-solution-sticky p:first-child span {
    background: #a78bfa !important;
  }
  .cs-solution-sticky p:first-child {
    color: #a78bfa !important;
  }
  .cs-solution-sticky h2 {
    font-size: 30px !important;
    letter-spacing: -1.2px !important;
  }
  .cs-solution-sticky > p:last-child {
    font-size: 14px !important;
    color: rgba(255,255,255,0.4) !important;
  }

  .cs-solution-items {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .cs-solution-items > div {
    background: #131320 !important;
    border: 1px solid rgba(167,139,250,0.1) !important;
    border-radius: 12px !important;
    padding: 18px 16px !important;
  }
  .cs-solution-items > div span {
    background: rgba(167,139,250,0.1) !important;
    border-radius: 9px !important;
    width: 36px !important;
    height: 36px !important;
  }
  .cs-solution-items > div span iconify-icon {
    color: #a78bfa !important;
    font-size: 16px !important;
  }
  .cs-solution-items > div h4 {
    font-size: 14px !important;
  }
  .cs-solution-items > div p {
    font-size: 13px !important;
    color: rgba(255,255,255,0.4) !important;
  }

  /* Solution group labels */
  .cs-solution-layout > div:last-child > div > div:first-child h3 {
    font-size: 18px !important;
    font-weight: 800 !important;
  }
  .cs-solution-layout > div:last-child > div > div:first-child span {
    font-size: 12px !important;
    color: rgba(255,255,255,0.3) !important;
  }

  /* ══ TECH / PLATFORM SCOPE ══ */
  .cs-tech-layout {
    grid-template-columns: 1fr !important;
    gap: 40px !important;
    padding: 52px 20px !important;
    width: 100% !important;
  }
  .cs-tech-sticky {
    position: static !important;
    height: auto !important;
    order: -1 !important;
  }
  .cs-tech-sticky p:first-child span {
    background: #a78bfa !important;
  }
  .cs-tech-sticky p:first-child {
    color: #a78bfa !important;
  }
  .cs-tech-sticky h2 {
    font-size: 30px !important;
    letter-spacing: -1.2px !important;
    color: #fff !important;
  }
  .cs-tech-sticky > p:last-child {
    font-size: 14px !important;
    color: rgba(255,255,255,0.4) !important;
  }

  .cs-tech-items {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .cs-tech-items > div {
    background: #131320 !important;
    border: 1px solid rgba(167,139,250,0.1) !important;
    border-radius: 12px !important;
    padding: 18px 16px !important;
  }
  .cs-tech-items > div h4 {
    font-size: 14px !important;
    color: #fff !important;
  }
  .cs-tech-items > div p {
    font-size: 13px !important;
    color: rgba(255,255,255,0.4) !important;
  }

  /* Tech section group labels */
  .cs-tech-layout > div:first-child > div > div:first-child h3 {
    color: #fff !important;
  }
  .cs-tech-layout > div:first-child > div > div:first-child span {
    color: rgba(255,255,255,0.3) !important;
  }
  .cs-tech-layout > div:first-child > div > div:first-child {
    border-bottom: 1px solid rgba(255,255,255,0.07) !important;
  }

  /* ══ RESULTS / OUTCOME ══ */
  section:has(.cs-results-grid) > div > p:first-child {
    color: rgba(255,255,255,0.35) !important;
  }
  section:has(.cs-results-grid) > div > p:first-child span {
    background: #a78bfa !important;
  }
  section:has(.cs-results-grid) h2 {
    color: #fff !important;
    font-size: 30px !important;
    letter-spacing: -1.2px !important;
  }

  .cs-results-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
  .cs-result-card {
    flex-direction: column !important;
    gap: 8px !important;
    background: #0e0e1a !important;
    border: 1px solid rgba(167,139,250,0.1) !important;
    border-radius: 14px !important;
    padding: 20px 16px !important;
  }
  .cs-result-card p:first-child {
    font-size: 22px !important;
    color: #a78bfa !important;
    letter-spacing: -0.8px !important;
    min-width: auto !important;
  }
  .cs-result-card p:last-child {
    font-size: 12px !important;
    color: rgba(255,255,255,0.42) !important;
    line-height: 1.6 !important;
  }

  /* ══ CTA SECTION ══ */
  .cs-cta-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 28px !important;
    padding: 52px 20px 64px !important;
    background: #090910 !important;
    border-top: 1px solid rgba(255,255,255,0.05) !important;
  }
  .cs-cta-card > div:first-child p:first-child span {
    background: #a78bfa !important;
  }
  .cs-cta-card > div:first-child p:first-child {
    color: rgba(255,255,255,0.35) !important;
  }
  .cs-cta-card h2 {
    font-size: 36px !important;
    letter-spacing: -1.5px !important;
  }
  .cs-cta-card p {
    font-size: 15px !important;
  }
  .cs-cta-btns {
    width: 100% !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
  }
  .cs-cta-btns .cta-primary {
    background: #a78bfa !important;
    color: #000 !important;
    border-radius: 8px !important;
    padding: 14px 22px !important;
    font-size: 14px !important;
    box-shadow: none !important;
  }
  .cs-cta-btns .cta-primary:hover {
    background: #b49dfc !important;
  }
  .cs-cta-btns .cta-secondary {
    border: 1px solid rgba(255,255,255,0.14) !important;
    border-radius: 8px !important;
    padding: 14px 22px !important;
    font-size: 14px !important;
    color: rgba(255,255,255,0.7) !important;
  }

  /* ══ NEXT PROJECT (mobile only) ══ */
  .cs-next-project {
    display: block !important;
    padding: 0 20px 52px;
  }
  .cs-next-project .cs-np-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    margin-bottom: 12px;
  }
  .cs-next-project a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0e0e1a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 20px 18px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s;
  }
  .cs-next-project a:hover {
    border-color: rgba(167,139,250,0.3);
  }
  .cs-next-project .cs-np-meta {
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    margin-bottom: 4px;
  }
  .cs-next-project .cs-np-title {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
  }
  .cs-next-project .cs-np-icon {
    width: 40px;
    height: 40px;
    background: rgba(167,139,250,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    color: #a78bfa;
    font-size: 18px;
  }

  /* ══ FOOTER ══ */
  footer {
    background: #050509 !important;
    padding: 36px 20px 28px !important;
  }
  footer .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 28px !important;
    margin-bottom: 28px !important;
  }
  footer .footer-grid > div:first-child {
    grid-column: 1 / -1;
  }
  footer .footer-grid > div:first-child img {
    height: 17px !important;
    opacity: 0.55;
  }
  footer .footer-grid > div:first-child p {
    font-size: 13px !important;
    color: rgba(255,255,255,0.25) !important;
    max-width: 220px !important;
  }
  footer .footer-grid > div:first-child .social-icon {
    display: none !important;
  }
  footer .footer-grid > div:not(:first-child) p:first-child {
    font-size: 10px !important;
    letter-spacing: 2.5px !important;
  }
  footer .footer-link {
    font-size: 13px !important;
  }
  footer .footer-bottom {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  footer .footer-bottom p {
    font-size: 12px !important;
    color: rgba(255,255,255,0.16) !important;
  }

  /* ── Section spacing adjustments ── */
  section:has(.cs-about-grid) {
    padding: 0 !important;
  }
  section:has(.cs-challenges-grid) {
    padding: 0 20px 64px !important;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 52px !important;
  }
  section:has(.cs-challenges-grid) > div {
    width: 100% !important;
  }
  section:has(.cs-challenges-grid) h2 {
    font-size: 30px !important;
    letter-spacing: -1.2px !important;
    color: #fff !important;
    margin-bottom: 32px !important;
  }

  /* Solution dark panel */
  .dark-panel-wrap:has(.cs-solution-layout) .dark-panel {
    padding: 52px 20px 64px !important;
    background: #090910 !important;
    border-top: 1px solid rgba(255,255,255,0.05) !important;
  }

  /* Results section */
  section:has(.cs-results-grid) {
    padding: 52px 20px 64px !important;
    border-top: 1px solid rgba(255,255,255,0.05);
  }
  section:has(.cs-results-grid) > div {
    width: 100% !important;
  }
  section:has(.cs-results-grid) h2 {
    margin-bottom: 32px !important;
  }

  /* CTA wrap */
  .dark-panel-wrap:has(.cs-cta-card) {
    padding: 0 !important;
    margin-bottom: 0 !important;
  }
}

/* ── 480px tweaks ── */
@media (max-width: 480px) {
  .cs-results-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  footer .footer-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}
