@import url('../tokens.css');
@import url('../type.css');

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

:root {
  --oat-mid: var(--bg-tint);
  --radius: 0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.7;
  min-height: 100vh;
}

.site-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 2rem;
}

.site-wrap--wide {
  max-width: 1100px;
}

.case-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--rule);
}

.case-back {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 2rem;
  transition: color 0.2s;
}

.case-back:hover { color: var(--clay); }

.case-back--top {
  display: block;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 2rem 0;
}

.site-wrap--wide .case-header {
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.site-wrap--wide .case-section,
.site-wrap--wide .proto-player {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.case-tag {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 1rem;
}

.case-lead-visual {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 2rem;
  padding: 0 2rem;
}

.case-lead-visual img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
}

.case-intro {
  margin-top: 1.5rem;
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.8;
  max-width: 560px;
}

.case-meta {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  line-height: 1.6;
}

.case-section {
  padding: 4rem 0;
  border-bottom: 1px solid var(--rule);
}

.case-section:last-of-type { border-bottom: none; }

.case-section h2 {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  font-weight: 600;
  text-transform: none;
  margin-bottom: 1.5rem;
}

.case-section p,
.case-section li {
  color: var(--ink-soft);
  margin-bottom: 1em;
  line-height: 1.8;
}

.case-section ul {
  padding-left: 1.25rem;
  margin-bottom: 1em;
}

.case-section strong {
  font-weight: 500;
  color: var(--ink);
}

.case-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  margin-top: 1.5rem;
}

.case-stat {
  background: var(--oat-mid);
  padding: 1.5rem;
}

.case-stat-value {
  font-family: var(--sans);
  font-size: 2rem;
  color: var(--clay);
  line-height: 1.1;
}

.case-stat-label {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.04em;
}

.case-stats--three {
  grid-template-columns: repeat(3, 1fr);
}

.case-results-list {
  margin-top: 1.5rem;
}

.proto-player {
  padding: 3rem 0 4rem;
  border-bottom: 1px solid var(--rule);
}

.proto-device {
  max-width: 280px;
  margin: 0 auto;
  background: #1a1a1a;
  border-radius: 36px;
  padding: 12px;
  box-shadow: 0 24px 48px rgba(28, 27, 24, 0.12);
}

.proto-screen-wrap {
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  aspect-ratio: 9 / 19.5;
  position: relative;
}

.proto-screen {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: opacity 0.2s ease;
}

.proto-screen.fade { opacity: 0; }

.proto-step-label {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
  margin-top: 1.25rem;
}

.proto-step-count {
  font-size: 0.7rem;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-align: center;
  margin-top: 0.35rem;
}

.proto-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.75rem;
}

.proto-nav button {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.proto-nav button:hover:not(:disabled) {
  border-color: var(--clay);
  color: var(--clay);
}

.proto-nav button:disabled {
  opacity: 0.35;
  cursor: default;
}

.proto-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.proto-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: var(--rule);
  padding: 0;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.proto-dot.active {
  background: var(--clay);
  transform: scale(1.15);
}

.proto-end-note {
  text-align: center;
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: 1rem;
  min-height: 1.2em;
}

.flow-steps {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--rule);
}

.flow-step {
  background: var(--oat-mid);
  padding: 1.5rem 1.75rem;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
}

.flow-step:hover,
.flow-step.active {
  background: var(--rule);
}

.flow-step-num {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  font-weight: 600;
}

.flow-step-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 0.35rem;
}

.flow-step-desc {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
  line-height: 1.65;
  display: none;
}

.flow-step.active .flow-step-desc { display: block; }

/* ── Spruce flow animation (React embed) ── */
.spruce-flow-embed {
  margin-top: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

#spruce-flow-root {
  width: 100%;
}

.spruce-flow-app {
  padding: 1.5rem 1rem 1.75rem;
}

.spruce-flow-stage {
  width: 100%;
  overflow: visible;
  margin-bottom: 1.5rem;
}

.spruce-flow-steps {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

.spruce-flow-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.spruce-flow-btn {
  padding: 0.75rem 1.5rem;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--sans);
  border: none;
  border-radius: 8px;
  transition: background 0.2s ease-out, opacity 0.2s;
}

.spruce-flow-btn:not(:disabled):hover {
  filter: brightness(0.95);
}

@keyframes spruceFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 900px) {
  .site-wrap--wide {
    max-width: 720px;
  }

  .spruce-flow-stage {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .spruce-flow-steps {
    min-width: 640px;
  }
}

.severity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--rule);
  margin-top: 1rem;
}

.severity-item {
  background: var(--oat-mid);
  padding: 1.25rem;
}

.severity-item h3 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.severity-item p {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}

.mock-diff {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-size: 0.82rem;
  margin-top: 1rem;
}

.mock-diff-path {
  color: var(--ink-muted);
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  filter: blur(3px);
  user-select: none;
}

.mock-diff-change {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-tint);
  border-radius: 8px;
}

.mock-diff-change del {
  color: var(--ink-muted);
  text-decoration: line-through;
}

.mock-diff-change ins {
  color: var(--clay);
  text-decoration: none;
  font-weight: 500;
}

.mock-pill {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-top: 0.75rem;
  margin-right: 0.35rem;
}

.mock-pill.severe { background: #f0ddd4; color: #8b4513; }
.mock-pill.draft { background: var(--oat-mid); color: var(--ink-muted); }

.mock-task {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.85rem;
}

.mock-task:last-child { border-bottom: none; }

.nda-note {
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-style: italic;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--oat-mid);
  border-left: 2px solid var(--clay);
}

.handoff-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.handoff-chip {
  font-size: 0.72rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
}

.case-footer {
  padding: 3rem 0;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

@media (max-width: 600px) {
  .case-stats,
  .severity-grid {
    grid-template-columns: 1fr;
  }

  .proto-device { max-width: 240px; }
}
