/* Syntheticist – case studies */
.case {
  /* Boundary of an interactive control: 40% white is 3.7:1 on the dark surfaces (WCAG 1.4.11). */
  --border-control: rgba(255, 255, 255, 0.4);
}

.case-main {
  padding: calc(var(--header-h) + 4rem) 0 6rem;
}

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

.case a:focus-visible,
.case button:focus-visible,
.case input:focus-visible + .chip-face {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---- Header ---- */
.case-back {
  display: block;
  width: fit-content;
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

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

.case-eyebrow {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0;
}

.case-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  max-width: 18ch;
  margin: 0.75rem 0 1.5rem;
}

.case-summary {
  font-size: clamp(1.125rem, 1.8vw, 1.375rem);
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 54ch;
  margin: 0 0 2.5rem;
}

.case-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  margin: 0 0 2rem;
}

.case-facts dt {
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.case-facts dd {
  margin: 0.25rem 0 0;
  font-weight: 500;
}

.case-facts a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.stack-list li {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--bg-elevated);
}

/* ---- Media ---- */
.case-cover {
  margin-top: 3.5rem;
  margin-bottom: 0;
}

.case-cover img,
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-elevated);
}

.shot,
.reel {
  margin: 2.5rem 0;
}

.shot figcaption,
.reel figcaption {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 60ch;
  margin-top: 0.875rem;
}

.reel-canvas {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-elevated);
}

.reel-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.reel-control {
  position: absolute;
  right: 0.875rem;
  bottom: 0.875rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid var(--border-control);
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.reel-control:hover {
  border-color: var(--text);
}

/* ---- Body ---- */
/* Prose sits in a reading column; media and components break out to the container width. */
.case-body {
  display: grid;
  grid-template-columns: [full-start] 1fr [prose-start] min(720px, 100%) [prose-end] 1fr [full-end];
  margin-top: 4.5rem;
  font-size: 1.125rem;
  line-height: 1.75;
}

.case-body > * {
  grid-column: prose;
}

.case-body > .shot,
.case-body > .reel,
.case-body > .gallery,
.case-body > .metric-row,
.case-body > .demo {
  grid-column: full;
}

.case-body > p,
.case-body > ul,
.case-body > ol {
  margin: 0 0 1.5rem;
}

.case-body > h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 3.5rem 0 1rem;
}

.case-body > h2:first-child {
  margin-top: 0;
}

.case-body > h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2.5rem 0 0.75rem;
}

.case-body > ul,
.case-body > ol {
  padding-left: 1.5rem;
}

.case-body > ul > li + li,
.case-body > ol > li + li {
  margin-top: 0.5rem;
}

.case-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.case-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
  padding: 0.125em 0.375em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* ---- Metrics ---- */
.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
  margin: 2.5rem 0;
}

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

.metric p {
  margin: 0;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--accent);
}

.metric .metric-label {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 0.875rem;
}

.metric .metric-note {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

/* ---- Callout ---- */
.callout {
  margin: 2.5rem 0;
  padding: 1.5rem 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
}

.callout-title {
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.callout-body p {
  margin: 0 0 1rem;
}

.callout-body p:last-child {
  margin-bottom: 0;
}

/* ---- Gallery ---- */
.gallery {
  margin: 2.5rem 0;
}

.gallery-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

@media (min-width: 64rem) {
  .gallery-grid {
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  }
}

.gallery .shot {
  margin: 0;
}

/* ---- Demo ---- */
.demo {
  margin: 3rem 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.6;
}

.demo button {
  font: inherit;
  color: inherit;
  background: none;
  cursor: pointer;
}

.demo-header,
.demo-note {
  padding: 1.25rem 1.5rem;
  background: #161616;
}

.demo-header {
  border-bottom: 1px solid var(--border);
}

.demo-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0.375rem 0 0;
}

.demo-origin {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.demo-stage {
  padding: 1.5rem;
}

.demo-fallback {
  color: var(--text-muted);
  margin: 0;
}

.demo-note {
  font-size: 0.9375rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin: 0;
}

.demo-pill {
  font-size: 0.875rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--border-control);
  border-radius: 9999px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.demo-pill:hover {
  border-color: var(--text);
}

.demo-list {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Locale switch */
.locale-demo,
.filter-demo {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.locale-demo-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.locale-demo-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.demo .locale-demo-switch {
  color: var(--accent);
  border-color: var(--accent);
}

.demo .locale-demo-switch:hover {
  background: var(--accent);
  color: var(--bg);
}

.locale-demo-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.locale-demo-tab {
  font-size: 0.875rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--border-control);
  border-radius: 8px;
}

.demo .locale-demo-tab {
  color: var(--text-muted);
}

.demo .locale-demo-tab[aria-current='true'] {
  color: var(--text);
  border-color: var(--text);
  background: #1c1c1c;
}

.locale-demo-panel {
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.locale-demo-heading {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.locale-demo-body {
  margin: 0;
}

/* Departure picker */
.filter-demo fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

.filter-demo legend {
  padding: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.filter-demo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.chip-face {
  display: inline-block;
  cursor: pointer;
}

.chip input:checked + .chip-face {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.filter-demo-summary {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0;
}

.departure {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  text-align: left;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  background: var(--bg);
  transition: border-color 0.2s, background 0.2s;
}

@media (min-width: 34rem) {
  .departure {
    grid-template-columns: 6.5rem minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 1rem;
  }
}

.departure:hover:not(.is-unavailable) {
  border-color: var(--text);
}

.departure[aria-pressed='true'] {
  border-color: var(--accent);
  background: rgba(234, 179, 8, 0.1);
}

.demo .departure.is-unavailable {
  cursor: not-allowed;
  background: #161616;
}

.departure.is-unavailable .departure-date,
.departure.is-unavailable .departure-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.departure-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem;
}

.departure-name {
  font-weight: 500;
}

.departure-status {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Shared element transition */
.transition-demo-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.pattern-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  height: 100%;
  text-align: left;
  padding: 1.25rem;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  background: var(--bg);
  transition: border-color 0.2s;
}

.pattern-card:hover {
  border-color: var(--text);
}

.pattern-category {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

.pattern-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.2;
}

.pattern-detail {
  padding: 1.5rem;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  background: var(--bg);
}

.pattern-detail-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0.25rem 0 1rem;
}

.pattern-detail dl {
  margin: 0 0 1.5rem;
}

.pattern-detail dt {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.pattern-detail dd {
  margin: 0.125rem 0 0.875rem;
  max-width: 62ch;
}

/* ---- End of page ---- */
.case-end {
  margin-top: 5rem;
}

.case-next-link {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: border-color 0.25s, background 0.25s;
}

.case-next-link:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: #161616;
}

.case-next-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.case-next-summary {
  color: var(--text-muted);
  max-width: 56ch;
}

.case-cta {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.case-cta p {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

.case-title,
.case-body h2,
.case-body h3,
.demo-title,
.case-next-title {
  text-wrap: balance;
}

.case p,
.case li,
.case figcaption,
.case dd {
  text-wrap: pretty;
}

/*
  Short blocks in narrow boxes: even the lines out so the last one never
  dangles. work.js leaves these alone; its word binding fights balance.
*/
.case .metric-note,
.case figcaption,
.case .locale-demo-body,
.case .case-next-summary {
  text-wrap: balance;
}

@media (max-width: 600px) {
  .nav-link:not(:last-child) {
    display: none;
  }

  .case-body {
    font-size: 1rem;
    line-height: 1.7;
  }

  .case-summary {
    font-size: 1.0625rem;
  }

  .callout {
    padding: 1.25rem;
  }

  .demo-header,
  .demo-note {
    padding: 1rem 1.25rem;
  }

  .demo-stage {
    padding: 1rem;
  }

  .locale-demo-panel,
  .pattern-detail {
    padding: 1rem;
  }

  .case-next-link {
    padding: 1.5rem;
  }

  .case-next-summary {
    font-size: 0.9375rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
