:root {
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  --border: #27272a;
  --radius: 12px;
  --radius-lg: 20px;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max: 1480px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

body.lightbox-open {
  overflow: hidden;
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.nebula {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(99, 102, 241, 0.18), transparent 55%),
    radial-gradient(700px 420px at 85% 20%, rgba(168, 85, 247, 0.12), transparent 50%),
    radial-gradient(600px 400px at 50% 100%, rgba(79, 70, 229, 0.1), transparent 55%);
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-header {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.15rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  text-decoration: none;
  color: var(--text-primary);
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.94rem;
  transition: color 0.2s ease;
}

.nav a.is-active,
.nav a:hover {
  color: var(--text-primary);
}

.nav-cta {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 2rem 1.25rem;
  animation: rise 0.7s ease both;
}

.hero-compact {
  padding-bottom: 0.5rem;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

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

.cases-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 2rem 5rem;
}

.cases-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-kicker {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  letter-spacing: -0.03em;
}

.search input {
  width: min(100vw - 4rem, 300px);
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font: inherit;
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tag-filter,
.tag {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(17, 17, 17, 0.9);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.tag-filter:hover,
.tag:hover {
  border-color: rgba(99, 102, 241, 0.55);
  color: var(--text-primary);
}

.tag-filter.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.case-card .tag {
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.cases-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

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

@media (min-width: 1020px) {
  .cases-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1320px) {
  .cases-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.case-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.9rem;
  align-items: start;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(17, 17, 17, 0.95), rgba(10, 10, 10, 0.8));
  backdrop-filter: blur(8px);
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  animation: rise 0.55s ease both;
}

.case-card.is-hidden,
.case-card[hidden] {
  display: none !important;
}

.case-card:hover {
  border-color: rgba(99, 102, 241, 0.55);
  transform: translateY(-3px);
  box-shadow: 0 0 32px rgba(99, 102, 241, 0.15);
}

.case-card-logo {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: transparent;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.case-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.case-card-fallback {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--accent);
}

.case-card-body h2 {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  line-height: 1.3;
  font-weight: 600;
  font-family: var(--font-display);
}

.case-card-body p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.case-card-arrow {
  color: var(--accent);
  font-size: 1.1rem;
  opacity: 0.75;
  margin-top: 0.2rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.case-card:hover .case-card-arrow {
  transform: translateX(4px);
  opacity: 1;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.case-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
  animation: rise 0.55s ease both;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  color: var(--accent);
}

.case-hero {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 640px) {
  .case-hero {
    grid-template-columns: 120px 1fr;
    align-items: start;
  }
}

.case-hero-logo {
  width: 120px;
  height: 120px;
  border-radius: 18px;
  background: transparent;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.case-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.case-kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-weight: 600;
}

.case-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.5vw, 2.5rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.case-hero .tag-list {
  margin-top: 0.85rem;
}

.case-client {
  margin: 0.85rem 0 0;
  color: var(--text-secondary);
}

.case-block {
  margin: 1.75rem 0;
}

.case-block h2,
.story-h {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.case-block p,
.case-story p {
  margin: 0 0 1rem;
  color: #d4d4d8;
}

.task-block {
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.08);
}

.task-block p {
  margin: 0;
  color: #e4e4e7;
  font-weight: 500;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
}

.metric {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.metric-value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.metric-label {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.gallery-item {
  position: relative;
  margin: 0;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0f0f12;
  cursor: zoom-in;
  display: block;
  width: 132px;
  height: 132px;
  flex: 0 0 132px;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

@media (min-width: 640px) {
  .gallery-item {
    width: 148px;
    height: 148px;
    flex-basis: 148px;
  }
}

.gallery-item:hover {
  border-color: rgba(99, 102, 241, 0.65);
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.2);
}

.gallery-item::after {
  content: "⤢";
  position: absolute;
  right: 0.4rem;
  bottom: 0.35rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.4rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.75rem;
  display: grid;
  place-items: center;
  opacity: 0.75;
  pointer-events: none;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 0.45rem;
  background: #111;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: grid;
  place-items: center;
  padding: 2rem;
  animation: fade-in 0.18s ease;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-dialog {
  position: relative;
  max-width: min(1100px, 94vw);
  max-height: 88vh;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 16px;
  background: #0a0a0a;
  box-shadow: 0 0 80px rgba(99, 102, 241, 0.28);
  overflow: hidden;
}

.lightbox img {
  display: block;
  max-width: min(1100px, 94vw);
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.92);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  border-color: var(--accent);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 3.5rem 2rem;
  background: rgba(10, 10, 10, 0.65);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.footer-kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  letter-spacing: -0.03em;
}

.footer-lead {
  margin: 0.75rem 0 0;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 1.25rem;
}

.footer-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-note {
  margin: 2rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
