/* ============================================
   BB PORTFOLIO — Case Study Styles
   ============================================ */

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

:root {
  --white:   #ffffff;
  --ink:     #150d26;
  --purple:  #2d0a5e;
  --muted:   #7c6d90;
  --rule:    rgba(21, 13, 38, 0.1);
  --pad:     clamp(1.25rem, 5vw, 4rem);
  --max-width: 1100px;
  --radius:  8px;
  --radius-lg: 14px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* Legacy aliases so existing case study markup still works */
  --bg:        #ffffff;
  --text:      #150d26;
  --text-muted:#7c6d90;
  --accent:    #2d0a5e;
  --border:    rgba(21, 13, 38, 0.1);
  --bg-card:   #f8f7fb;
  --bg-elevated:#f0edf7;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--white);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 2.8vw, 2rem); }
h3 { font-size: clamp(1.1rem, 1.8vw, 1.3rem); }

p { color: var(--muted); max-width: 680px; }

.label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--purple);
}

/* ============================================
   Layout
   ============================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--pad);
}

section { padding: clamp(3rem, 6vw, 6rem) 0; }

/* ============================================
   Navigation — matches homepage exactly
   ============================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--rule);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  gap: 2rem;
}

nav > * {
  opacity: 0;
  transform: translateY(-6px);
  animation: navIn 0.5s ease forwards;
}
nav > *:nth-child(1) { animation-delay: 0s; }
nav > *:nth-child(2) { animation-delay: 0.06s; }
nav > *:nth-child(3) { animation-delay: 0.12s; }
nav > *:nth-child(4) { animation-delay: 0.18s; }

@keyframes navIn { to { opacity: 1; transform: translateY(0); } }

.site-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
  flex-shrink: 0;
  text-decoration: none;
}

.site-name .name-first {
  display: block;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink);
}

.site-name .name-last {
  display: block;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.155em;
  text-transform: uppercase;
  color: var(--ink);
}

.nav-divider {
  width: 1px;
  height: 22px;
  background: var(--rule);
  flex-shrink: 0;
}

.ticker {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
}

.ticker-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  line-height: 1;
}

.ticker-track {
  position: relative;
  height: 1em;
  overflow: hidden;
  min-width: 210px;
}

.ticker-word {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(110%);
  line-height: 1;
}

.ticker-word.is-in  { animation: wordIn  0.4s cubic-bezier(0.16,1,0.3,1) forwards; }
.ticker-word.is-out { animation: wordOut 0.3s ease-in forwards; }

@keyframes wordIn  { from{opacity:0;transform:translateY(110%)} to{opacity:1;transform:translateY(0)} }
@keyframes wordOut { from{opacity:1;transform:translateY(0)} to{opacity:0;transform:translateY(-110%)} }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  flex-shrink: 0;
}

.nav-links a {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--purple); }
.nav-links a:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; border-radius: 2px; }

/* ============================================
   Company Context Card
   ============================================ */
.company-context {
  margin-top: 2rem;
  display: flex;
  gap: 2.5rem;
  align-items: baseline;
  padding: 1.5rem 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}

.company-context .label {
  flex-shrink: 0;
  white-space: nowrap;
}

.company-context p:last-child {
  font-size: 0.88rem;
  line-height: 1.65;
  max-width: none;
  color: var(--muted);
}

@media (max-width: 768px) {
  .company-context { flex-direction: column; gap: 0.5rem; }
}

/* ============================================
   Case Study — Hero
   ============================================ */
.case-hero {
  padding-top: 5rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--rule);
}

.case-hero .label { margin-bottom: 0.75rem; }

.case-hero h1 {
  margin-bottom: 1rem;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.case-meta-item .label { margin-bottom: 0.3rem; }
.case-meta-item p { font-size: 0.92rem; color: var(--ink); max-width: none; }

/* ============================================
   Case Study — Content Sections
   ============================================ */
.case-section {
  padding: clamp(3rem, 5vw, 5rem) 0;
}

.case-section + .case-section {
  border-top: 1px solid var(--rule);
}

.case-section .label { margin-bottom: 0.75rem; }

.case-section h2 {
  margin-bottom: 1.25rem;
}

.case-section p + p {
  margin-top: 1.25rem;
}

.case-section ul {
  list-style: none;
  margin-top: 1rem;
}

.case-section ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.case-section ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--purple);
}

/* ============================================
   Image Showcase
   ============================================ */
.image-showcase {
  margin: 3rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
}

.image-showcase img {
  width: 100%;
  object-fit: contain;
}

.image-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.image-showcase-grid .image-showcase { margin: 0; }

.image-caption {
  padding: 1rem 1.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
}

.image-placeholder {
  margin: 3rem 0;
  padding: 4rem 2rem;
  border: 2px dashed var(--rule);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--bg-card);
}

/* ============================================
   Prototype Links
   ============================================ */
.prototype-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.prototype-link {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  color: inherit;
}

.prototype-link:hover {
  border-color: rgba(45, 10, 94, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(45, 10, 94, 0.08);
}

.prototype-link .proto-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--purple);
}

.prototype-link .proto-text .label { margin-bottom: 0.15rem; }
.prototype-link .proto-text span { color: var(--ink); font-weight: 500; font-size: 0.95rem; }
.prototype-link .proto-text p { font-size: 0.8rem; margin-top: 0.25rem; }

/* ============================================
   Outcome / Stats
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
}

.stat-card .stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--purple);
  line-height: 1.1;
  margin-bottom: 0.5rem;
  letter-spacing: -0.04em;
}

.stat-card .stat-label {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: none;
}

/* ============================================
   Callout / Highlight Box
   ============================================ */
.callout {
  background: var(--bg-card);
  border-left: 3px solid var(--purple);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
}

.callout p { color: var(--ink); font-style: italic; max-width: none; }

/* ============================================
   Case Study Navigation (prev/next)
   ============================================ */
.case-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 4rem 0;
  border-top: 1px solid var(--rule);
}

.case-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.25rem 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  max-width: 45%;
  color: inherit;
}

.case-nav a:hover {
  border-color: rgba(45, 10, 94, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(45, 10, 94, 0.08);
}

.case-nav a .label { font-size: 0.65rem; }
.case-nav a span { color: var(--ink); font-weight: 600; font-size: 0.92rem; }

.case-nav .next { margin-left: auto; text-align: right; }

/* ============================================
   Footer
   ============================================ */
footer {
  border-top: 1px solid var(--rule);
  padding: 2rem var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

footer p { font-size: 0.72rem; color: var(--muted); max-width: none; }

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a { font-size: 0.72rem; color: var(--purple); transition: color 0.2s; }
.footer-links a:hover { color: var(--ink); }

/* ============================================
   Tag pills
   ============================================ */
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 100px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
  opacity: 0;
  animation: fadeUp 0.6s ease-out forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 860px) {
  .case-meta { gap: 1.25rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .case-nav { flex-direction: column; }
  .case-nav a { max-width: 100%; }
}

@media (max-width: 560px) {
  .nav-links { display: none; }
  .ticker-track { min-width: 130px; }
  .stats-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}

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