/* ──────────────────────────────────────────────────────────────────────────
   case.css — shared CSS for the 5 case pages (almaz, bellissimo, d8,
   funsun, president). Phase 2 of CSS extraction. See AGENTS.md.

   Load order: base.css → case.css → page-local <style>.

   Contents:
     1. Case topnav extras (topnav-back)
     2. Layout + sidebars (case-version with section nav)
     3. Case-meta (left sidebar metadata)
     4. Marquee (ticker)
     5. Case nav (right sidebar section index)
     6. Header / cover / tag / title
     7. Case-section + case-img base rules
     8. Next-cases footer (next-card cards, blue-footer)
     9. Motion accessibility
    10. Mobile media (900px, 700px for next-cases, 375px)

   NOT in this file (stays page-local in <style>):
     - .hl-* highlight components (too divergent across cases)
     - .case-section ul/li/li::before (varies; 4 of 5 cases)
     - Page-specific patterns (.case-img-pair, .hl-tag-callout,
       .hl-compare-*, .spoiler-*, .topnav-crumb)
   ────────────────────────────────────────────────────────────────────────── */

/* ── 1. CASE TOPNAV EXTRAS ── */
.topnav-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  line-height: 1.5;
  font-family: var(--sans);
  transition: background 150ms var(--ease-out);
}
.topnav-back:hover { background: var(--hover-bg); }
.topnav-back img { width: 24px; height: 24px; flex-shrink: 0; image-rendering: pixelated; }

/* ── 2. LAYOUT ── */
.layout {
  display: grid;
  grid-template-columns: var(--grid-cols);
  align-items: start;
  padding: 64px 0 0;
  max-width: var(--grid-max);
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  overflow-x: clip;
  background: none;
}

/* ── SIDEBAR LEFT (case version — no reveal animation) ── */
.sidebar-l {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 32px clamp(16px, 2.5vw, 32px) 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: border-color 150ms var(--ease-out), background 150ms var(--ease-out);
  margin-top: auto;
}
.back-link:hover { border-color: var(--hover-outline); background: var(--hover-bg); color: var(--text); }

/* ── 3. CASE META (sidebar-l metadata) ── */
.case-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.case-meta + .case-meta { margin-top: 16px; }
.case-meta-label { font-size: 14px; color: var(--muted); }
.case-meta-value { font-size: 14px; color: var(--text-secondary); font-family: var(--sans); line-height: 1.4; }
.sidebar-l .case-meta { display: none; }

/* ── MAIN ── */
.main {
  padding: 0;
  font-family: var(--sans);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ── 4. MARQUEE ── */
.marquee-wrap { padding: 16px 0; overflow: hidden; }
.marquee-track { display: flex; gap: 28px; width: max-content; animation: ticker 22s linear infinite; }
.marquee-wrap.reverse .marquee-track { animation-direction: reverse; }
.marquee-item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 14px; color: var(--text); }
.marquee-item img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ── SIDEBAR RIGHT (case version — section nav, centered) ── */
.sidebar-r {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  padding: 32px 16px 16px clamp(16px, 2.5vw, 32px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ── 5. CASE NAV (section index in sidebar-r) ── */
.case-nav { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.case-nav-item {
  position: relative;
  display: block;
  text-decoration: none;
  height: 14px;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
}
.case-nav-item::before {
  content: '';
  position: absolute;
  top: 50%; left: 0;
  transform: translateY(-50%);
  height: 2px;
  width: 16px;
  background: var(--border);
  border-radius: 1px;
  transition: opacity 160ms var(--ease-out), background 160ms var(--ease-out);
}
.case-nav-item.active::before { background: var(--text); }
.case-nav-item:hover::before  { background: var(--text); }
.case-nav-text {
  display: block;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  line-height: 14px;
  opacity: 0;
  transition: opacity 160ms var(--ease-out), color 160ms var(--ease-out);
}
.case-nav:hover .case-nav-item::before { opacity: 0; }
.case-nav:hover .case-nav-text { opacity: 1; }
.case-nav:hover .case-nav-item:hover .case-nav-text { color: var(--text); }
.case-nav:hover .case-nav-item.active .case-nav-text { color: var(--text); }

/* ── 6. HEADER / COVER / TAG / TITLE ── */
.case-header {
  border-bottom: 1px solid var(--border);
}
.case-header-meta {
  padding: 48px 24px 24px;
}
.case-tag {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.2;
  color: var(--muted);
  margin-bottom: 6px;
}
.case-title {
  font-family: var(--sans);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.1;
  word-spacing: normal;
}
.case-header > .responsive-picture {
  display: block;
  border-top: 1px solid var(--border);
  overflow: hidden;
}
.case-cover {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.case-mobile-meta {
  display: none;
}

/* ── 7. CASE SECTIONS + IMAGES ── */
:root {
  --case-image-bg: #292929;
}
html[data-theme="light"] {
  --case-image-bg: #f1f1f1;
}
.case-section {
  scroll-margin-top: 80px;
  padding: 32px 24px;
  border-bottom: 1px solid var(--border);
}
.case-section:has(> .case-img:last-child),
.case-section:has(> .responsive-picture:last-child > .case-img) {
  padding-bottom: 0;
  border-bottom: none;
}
.case-section > .case-img:last-child,
.case-section > .responsive-picture:last-child .case-img {
  margin-bottom: 0;
}
.case-section h4 {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.25;
  word-spacing: normal;
  margin-bottom: 16px;
  color: var(--text);
}
.case-section p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 24px;
  font-family: var(--sans);
  margin-bottom: 12px;
}
.case-section p:last-child { margin-bottom: 0; }
.case-img {
  width: 100%;
  display: block;
  background: var(--case-image-bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 24px -24px;
  width: calc(100% + 48px);
}

/* ── 8. NEXT-CASES FOOTER ── */
.blue-footer {
  background: transparent;
  box-shadow: none;
  position: relative;
  isolation: isolate;
}
.next-cases-h {
  font-family: var(--sans);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
  word-spacing: normal;
  color: var(--text);
  padding: 96px 24px 24px;
}
.next-cases {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.next-cases > *:first-child {
  box-shadow: 1px 0 0 0 var(--border);
  position: relative;
  z-index: 1;
}
.next-card {
  overflow: hidden;
  position: relative;
  background: var(--bg);
  display: block;
  text-decoration: none;
  color: inherit;
  transition: background 150ms var(--ease-out);
}
.next-card::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 150ms var(--ease-out);
  pointer-events: none;
  z-index: 10;
}
.next-card:hover { background: var(--hover-bg); }
.next-card:hover::after { box-shadow: inset 0 0 0 1px var(--hover-outline); }
.next-card-meta {
  padding: 48px 24px 24px;
}
.next-card-tag {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.2;
  color: var(--muted);
  margin-bottom: 6px;
}
.next-card-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: flex-start;
  gap: 0;
}
.next-card-title {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 400;
  word-spacing: normal;
  line-height: 1.0;
}
.next-card-desc {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 21px;
  width: 100%;
  max-width: none;
  padding: 4px 0 0 16px;
  box-sizing: border-box;
}
.next-card--summary .next-card-meta {
  padding: 40px 24px 24px;
}
.next-card--summary .next-card-tag {
  margin-bottom: 8px;
}
.next-card--summary .next-card-title {
  font-size: 20px;
  font-weight: 400;
  line-height: 24px;
  text-wrap: pretty;
}
.next-card-stats {
  display: flex;
  align-items: flex-start;
  gap: 48px;
  margin-top: 24px;
}
.next-card-stat {
  width: max-content;
  max-width: calc((100% - 48px) / 2);
  flex: 0 1 auto;
}
.next-card-stat-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
}
.next-card-stat-desc {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 20px;
  text-wrap: pretty;
}
.next-card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0;
  display: block;
  border-top: 1px solid var(--border);
  object-fit: cover;
  object-position: center;
}
.blue-footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px 24px;
}
.blue-footer-copy {
  font-size: 14px;
  font-family: var(--sans);
  color: var(--text-faint);
}
.blue-footer-top {
  font-size: 14px;
  font-family: var(--sans);
  color: var(--text-faint);
  text-decoration: none;
}
.blue-footer-top:hover { color: var(--text); }
.footer-links {
  display: inline-flex;
  gap: 24px;
  font-size: 13px;
  font-family: var(--sans);
}
.footer-links a {
  color: var(--text-faint);
  text-decoration: none;
  transition: color 150ms var(--ease-out);
}
.footer-links a:hover { color: var(--text); }

@media (hover: none), (pointer: coarse) {
  .topnav-back:hover,
  .back-link:hover,
  .topnav-back:hover,
  .back-link:hover {
    background: transparent;
  }

  .next-card:hover {
    background: var(--bg);
  }

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

  .case-nav-item:hover::before {
    background: var(--border);
  }

  .case-nav:hover .case-nav-item::before {
    opacity: 1;
  }

  .case-nav:hover .case-nav-text {
    opacity: 0;
  }

  .next-card:hover::after {
    box-shadow: inset 0 0 0 1px transparent;
  }

  .blue-footer-top:hover {
    color: var(--text-faint);
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
  .nda-lock-inputs.is-error input { animation: none; }
  .next-card--locked .next-card-img { transition: none; }
  .nda-lock { transition: opacity 120ms var(--ease-out); }
}

/* ── 10. RESPONSIVE ── */
/* ≤ 1200px — next-case headers follow homepage project-card behavior */
@media (max-width: 1200px) {
  .next-card-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .next-card-title { font-size: 24px; }
  .next-card--summary .next-card-title { font-size: 20px; }
  .next-card-meta { padding: 32px 16px 24px; }
  .next-card-desc {
    max-width: 100%;
    font-size: 14px;
    padding-left: 0;
  }
}

/* ≤ 700px — next-cases stack */
@media (max-width: 700px) {
  .next-cases { grid-template-columns: 1fr; }
  .next-cases > *:first-child { box-shadow: 0 1px 0 0 var(--border); }
}

/* ≤ 900px — single-column layout; case metadata sidebar is hidden on mobile */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; background: none; }
  .sidebar-r { display: none; }
  .sidebar-l { display: none; }
  .main {
    box-shadow: none;
    border-left: none;
    border-right: none;
  }
  .topnav-links { gap: 8px; }
  .topnav-links a { height: 40px; padding: 0 8px; }
  .burger-btn { display: none; }
  .crumb-text { display: none; }
  a.nav-cases { display: none; }
  a.nav-cv { display: inline-flex; }
  .case-title { font-size: 24px; }
  .case-mobile-meta {
    display: none;
  }
  .case-section { padding: 24px 16px; }
  .next-cases-h {
    padding: 64px 16px 16px;
    font-size: 20px;
  }
  .next-card-meta { padding: 32px 16px 16px; }
  .next-card--summary .next-card-meta { padding: 32px 16px 16px; }
  .next-card-row { grid-template-columns: 1fr; gap: 8px; }
  .next-card--summary .next-card-title { font-size: 18px; }
  .next-card-stats {
    flex-direction: column;
    gap: 16px;
  }
  .next-card-stat { max-width: 100%; }
  .next-card-desc {
    max-width: 100%;
    font-size: 14px;
    padding-left: 0;
  }
  .case-section > .case-img,
  .case-section > .responsive-picture .case-img {
    margin: 24px -16px;
    width: calc(100% + 32px);
  }
  .case-header-meta { padding: 32px 16px 16px; }
  .blue-footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 16px;
  }
  .blue-footer-copy { white-space: nowrap; }
}

/* ≤ 375px — smallest phones */
@media (max-width: 375px) {
  .topnav { padding: 0 12px; }
  .case-title { font-size: 20px; }
  .next-card-title { font-size: 20px; }
  .next-card--summary .next-card-title { font-size: 18px; }
}
