/* --- Global & Variables --- */
:root {
  --background: #080808;
  --surface: #121212;
  --surface-soft: #171717;
  --text: #f4f1ea;
  --muted-text: rgba(244, 241, 234, 0.68);
  --faint-text: rgba(244, 241, 234, 0.44);
  --line: rgba(244, 241, 234, 0.18);
  --fire: #ff6a00;
  --max-width: 1440px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text);
  font-family: "Space Grotesk", Arial, sans-serif;
}

/* --- Layout Shell --- */
.case-study {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 5rem);
}

/* --- Navigation --- */
.case-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
}

.case-nav a {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 200ms ease;
}

.case-nav .brand-link {
  color: var(--fire);
}

.case-nav a:hover {
  color: var(--fire);
}

/* --- Hero Section --- */
.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: clamp(2.5rem, 8vw, 9rem);
  align-items: end;
  min-height: 640px;
  padding: clamp(4rem, 9vw, 9rem) 0 clamp(4rem, 8vw, 7rem);
  border-bottom: 1px solid var(--line);
}

.project-hero h1 {
  margin: 0;
  font-size: clamp(4.5rem, 10vw, 10.5rem);
  font-weight: 500;
  line-height: 0.78;
  letter-spacing: -0.095em;
  text-transform: uppercase;
}

.project-hero h1 span {
  display: block;
}

.project-intro {
  max-width: 490px;
  margin: 2rem 0;
  color: var(--muted-text);
  font-size: clamp(1rem, 1.6vw, 1.22rem);
  line-height: 1.65;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.project-tags span {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  color: var(--muted-text);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- Swipeable Gallery Logic --- */
.phone-gallery-wrapper {
  margin-top: 3rem;
  position: relative;
}

.phone-gallery {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory; /* The magic for snapping */
  padding-bottom: 2rem;
  scrollbar-width: none; /* Hides scrollbar on Firefox */
}

.phone-gallery::-webkit-scrollbar {
  display: none; /* Hides scrollbar on Chrome/Safari */
}

.phone-gallery .feature-card {
  flex: 0 0 300px; /* Adjust width to fit your phone assets */
  scroll-snap-align: center;
  background: var(--surface);
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.phone-gallery img {
  width: 100%;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.feature-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feature-label span {
  color: var(--fire);
  font-weight: bold;
}

.gallery-hint {
  text-align: center;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--faint-text);
  margin-top: 1rem;
}

/* --- Content Sections --- */
.project-summary, .feature-section, .tech-section {
  display: grid;
  grid-template-columns: minmax(180px, 0.34fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 8vw, 9rem);
  padding: clamp(4rem, 9vw, 9rem) 0;
  border-bottom: 1px solid var(--line);
}

.eyebrow, .summary-label p {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint-text);
  margin: 0;
}

.summary-content h2, .section-heading h2 {
  margin: 0 0 2rem;
  font-size: clamp(2.5rem, 5vw, 5.75rem);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.summary-content p, .feature-copy p {
  color: var(--muted-text);
  font-family: Inter, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.8;
}

/* --- Feature Grid --- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.feature-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--surface-soft);
  cursor: zoom-in;
}

/* --- Lightbox UI --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 8, 8, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: 220ms ease;
}

.lightbox-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 80vh;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

/* --- Typewriter & Animations --- */
.tw-line {
  display: inline-block;
  border-right: 2px solid transparent;
}

.tw-line.is-typing {
  border-right-color: var(--fire);
  animation: tw-blink 0.9s step-end infinite;
}

@keyframes tw-blink {
  50% { border-color: transparent; }
}

/* --- Responsive Fixes --- */
@media (max-width: 780px) {
  .project-hero, .project-summary, .feature-section, .tech-section {
    display: block;
    padding: 3rem 0;
  }
  
  .project-hero h1 {
    font-size: 4rem;
  }
}
