/* ─── Shared case study styles ─────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:           #02131c;
  --bg2:          #031824;
  --cyan:         #00f0e0;
  --purple:       #0080ff;
  --pink:         #00c8f0;
  --cyan-dim:     rgba(0, 240, 224, 0.15);
  --purple-dim:   rgba(0, 128, 255, 0.15);
  --pink-dim:     rgba(0, 200, 240, 0.15);
  --glass:        rgba(0, 200, 255, 0.04);
  --glass-hover:  rgba(0, 200, 255, 0.07);
  --border:       rgba(0, 200, 255, 0.10);
  --border-glow:  rgba(0, 240, 224, 0.25);
  --text:         #d0f4ff;
  --text-dim:     rgba(180, 230, 255, 0.45);
  --hero-name:    #ffffff;
  --grid-line:    rgba(0,245,255,0.012);
  --bg-rgb:       2, 19, 28;
}

[data-theme="light"] {
  --bg:           #eaf4fb;
  --bg2:          #dfecf5;
  --cyan:         #006b80;
  --purple:       #004bb0;
  --pink:         #006580;
  --cyan-dim:     rgba(0, 107, 128, 0.12);
  --purple-dim:   rgba(0, 75, 176, 0.12);
  --pink-dim:     rgba(0, 101, 128, 0.12);
  --glass:        rgba(0, 60, 100, 0.04);
  --glass-hover:  rgba(0, 60, 100, 0.08);
  --border:       rgba(0, 60, 100, 0.15);
  --border-glow:  rgba(0, 107, 128, 0.45);
  --text:         #031520;
  --text-dim:     rgba(3, 21, 32, 0.7);
  --hero-name:    #031520;
  --grid-line:    rgba(0,100,150,0.028);
  --bg-rgb:       234, 244, 251;
}

html { scroll-behavior: smooth; -ms-overflow-style: none; scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; display: none; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
  transition: background 0.4s ease, color 0.4s ease;
}

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: 0;
}

.grid-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,128,255,0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 90%, rgba(0,240,224,0.08), transparent);
}

/* ─── Header ─────────────────────────────────────── */
.cs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 120px;
  padding: 26px 88px 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 100;
  background: linear-gradient(
    to bottom,
    rgba(var(--bg-rgb), 0.95) 0%,
    rgba(var(--bg-rgb), 0.85) 30%,
    rgba(var(--bg-rgb), 0.55) 60%,
    rgba(var(--bg-rgb), 0.22) 82%,
    rgba(var(--bg-rgb), 0) 100%
  );
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 50%, rgba(0,0,0,0) 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 50%, rgba(0,0,0,0) 100%);
  transition: background 0.4s ease;
}

.cs-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 100px;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-decoration: none;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

.cs-back:hover {
  color: var(--cyan);
  border-color: var(--border-glow);
  background: var(--glass-hover);
  transform: translateX(-4px);
}

.cs-site {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ─── Theme toggle (top-right desktop / bottom-right mobile) ─── */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.3s ease;
  padding: 0;
  z-index: 200;
}

.theme-toggle:hover {
  color: var(--cyan);
  border-color: var(--border-glow);
  background: var(--glass-hover);
  transform: rotate(18deg);
}

.theme-toggle.squish {
  animation: theme-squish 0.42s cubic-bezier(0.2, 0.8, 0.2, 1.2);
}

@keyframes theme-squish {
  0%   { transform: scale(1) rotate(0deg); }
  30%  { transform: scale(0.78, 0.68); }
  55%  { transform: scale(1.1, 1.12); }
  80%  { transform: scale(0.96, 0.98); }
  100% { transform: scale(1) rotate(0deg); }
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ─── Hero ───────────────────────────────────────── */
.cs-wrapper { position: relative; z-index: 1; }

.cs-hero {
  padding: 180px 80px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.cs-index {
  font-family: 'Space Mono', monospace;
  font-size: 16px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.cs-index::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--cyan);
}

.cs-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(52px, 7.5vw, 104px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--hero-name);
  margin-bottom: 28px;
}

.cs-subtitle {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 680px;
  margin-bottom: 32px;
}

.cs-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cs-divider {
  width: 75%;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  margin: 40px 0 0;
  border-radius: 2px;
}

.tag {
  padding: 7px 16px;
  border-radius: 100px;
  font-size: 12px;
  font-family: 'Space Mono', monospace;
  letter-spacing: 1px;
  font-weight: 600;
}
.tag-cyan { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,245,255,0.2); }
.tag-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(0,128,255,0.2); }
.tag-pink { background: var(--pink-dim); color: var(--pink); border: 1px solid rgba(0,200,240,0.2); }

[data-theme="light"] .tag-cyan {
  background: rgba(0, 107, 128, 0.16);
  color: #004e5e;
  border: 1px solid rgba(0, 107, 128, 0.45);
}
[data-theme="light"] .tag-purple {
  background: rgba(0, 75, 176, 0.15);
  color: #002e7a;
  border: 1px solid rgba(0, 75, 176, 0.45);
}
[data-theme="light"] .tag-pink {
  background: rgba(168, 20, 98, 0.14);
  color: #7a0d45;
  border: 1px solid rgba(168, 20, 98, 0.45);
}

/* ─── Glass card ─────────────────────────────────── */
.glass-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ─── Hero image ─────────────────────────────────── */
.cs-cover {
  max-width: 1200px;
  margin: 0 auto 80px;
  padding: 0 80px;
}

/* Phone mockup for embedded prototypes */
.cs-phone {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  padding: 24px 0;
}

.cs-phone-body {
  position: relative;
  width: 320px;
  aspect-ratio: 9/19.5;
  background: #0a0a14;
  border-radius: 42px;
  border: 3px solid rgba(255,255,255,0.14);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 30, 60, 0.18), inset 0 0 0 1px rgba(255,255,255,0.05);
}

.cs-phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 24px;
  background: #0a0a14;
  border-radius: 0 0 18px 18px;
  z-index: 10;
}

.cs-phone-body iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 390px;
  height: 844px;
  transform: scale(0.821);
  transform-origin: top left;
  border: none;
  display: block;
}

/* Side-by-side laptop + phone for showcasing responsive sites */
.cs-devices {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px 0;
  flex-wrap: wrap;
  margin: 0 auto;
}

/* Tasteful hover-lift to invite exploration */
.cs-devices .cs-laptop-wrap,
.cs-devices .cs-phone-body {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.5s ease;
  transform-origin: center center;
}

.cs-devices .cs-laptop-wrap:hover,
.cs-devices .cs-phone-body:hover {
  transform: translateY(-8px) scale(1.06);
  z-index: 2;
}

.cs-devices .cs-laptop-wrap:hover .cs-laptop-screen {
  box-shadow: 0 50px 90px rgba(0, 60, 90, 0.28);
}

.cs-devices .cs-phone-body:hover {
  box-shadow: 0 50px 90px rgba(0, 60, 90, 0.28);
}

.cs-laptop-wrap {
  position: relative;
  width: 520px;
  max-width: 100%;
}

.cs-laptop-screen {
  background: #0a0a14;
  border-radius: 12px 12px 0 0;
  border: 3px solid rgba(255,255,255,0.14);
  border-bottom: none;
  overflow: hidden;
  aspect-ratio: 16/10;
  position: relative;
  box-shadow: 0 30px 60px rgba(0, 30, 60, 0.18);
}

.cs-laptop-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 14px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 2;
}

/* Render iframe at full desktop size then scale to fit — avoids tablet view */
.cs-laptop-screen iframe {
  position: absolute;
  top: 14px;
  left: 0;
  width: 1440px;
  height: 900px;
  border: none;
  display: block;
  transform: scale(0.361);
  transform-origin: top left;
}

.cs-laptop-base {
  background: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.05) 100%);
  height: 14px;
  border-radius: 0 0 6px 6px;
  border: 3px solid rgba(255,255,255,0.14);
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cs-laptop-notch {
  width: 70px;
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 0 0 6px 6px;
}

.cs-laptop-stand {
  height: 5px;
  background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,0.08) 50%, transparent 70%);
  margin: 0 auto;
  width: 70%;
  border-radius: 0 0 4px 4px;
}

.cs-devices .cs-phone-body {
  width: 180px;
}

.cs-devices .cs-phone-body iframe {
  width: 390px;
  height: 844px;
  transform: scale(0.462);
  transform-origin: top left;
  position: absolute;
  top: 0;
  left: 0;
}

@media (max-width: 900px) {
  .cs-devices { gap: 20px; }
  .cs-laptop-wrap { width: 92%; max-width: 420px; }
  .cs-laptop-screen iframe { transform: scale(0.264); }
  .cs-devices .cs-phone-body { width: 150px; }
  .cs-devices .cs-phone-body iframe { transform: scale(0.385); }
}

.cs-cover-inner {
  aspect-ratio: 16/9;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0,240,224,0.05), rgba(0,128,255,0.07));
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.cs-cover-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,245,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,255,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}

.cs-cover-label {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-dim);
  z-index: 1;
}

/* ─── Sections ───────────────────────────────────── */
.cs-section {
  padding: 60px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.cs-section-tag {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cs-section-tag::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--cyan);
}

.cs-section-title {
  font-size: clamp(36px, 4.5vw, 60px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 28px;
  line-height: 1.15;
}

.cs-section-body {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-dim);
  max-width: 760px;
}

.cs-section-body p { margin-bottom: 16px; }
.cs-section-body p:last-child { margin-bottom: 0; }
.cs-section-body strong { color: var(--text); font-weight: 500; }

/* ─── Stats grid ─────────────────────────────────── */
.cs-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 48px 0 0;
}

.cs-stat {
  padding: 28px;
  border-radius: 16px;
}

.cs-stat-num {
  font-family: 'Space Mono', monospace;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

.cs-stat-label {
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ─── Image block ────────────────────────────────── */
.cs-image {
  aspect-ratio: 16/9;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(0,240,224,0.03), rgba(0,128,255,0.05));
  border: 1px solid var(--border);
  margin-top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.cs-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,245,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,255,0.03) 1px, transparent 1px);
  background-size: 28px 28px;
}

.cs-image-label {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  z-index: 1;
}

/* ─── Next project ───────────────────────────────── */
.cs-next {
  max-width: 1200px;
  margin: 60px auto 0;
  padding: 48px 80px 120px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
}

.cs-next-label {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.cs-next-link {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--hero-name);
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.cs-next-link:hover {
  color: var(--cyan);
  gap: 22px;
}

/* ─── Footer ─────────────────────────────────────── */
.cs-footer {
  padding: 32px 80px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.cs-footer span { color: var(--cyan); }

/* ─── Fade-in ────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Mobile ─────────────────────────────────────── */
@media (max-width: 900px) {
  .cs-header { height: 96px; padding: 14px 16px 0; }
  .cs-site { display: none; }
  .cs-back { padding: 8px 14px; font-size: 10px; letter-spacing: 1.5px; }
  .cs-hero { padding: 120px 24px 40px; }
  .cs-cover, .cs-section { padding-left: 24px; padding-right: 24px; }
  .cs-section { padding: 40px 24px; }
  .cs-next { padding: 40px 24px 80px; flex-direction: column; gap: 16px; align-items: flex-start; }
  .cs-stats { grid-template-columns: 1fr; }
  .cs-footer { padding: 24px; flex-direction: column; gap: 12px; text-align: center; }
  .theme-toggle {
    top: auto;
    bottom: 18px;
    right: 18px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .theme-toggle svg { width: 15px; height: 15px; }
}
