/* ==========================================================================
   Work: case pages, work index, and work gallery cards
   Uses design tokens from main.css only - no raw hex outside main.css tokens.
   ========================================================================== */

/* --- Work index hero --- */
.work-hero {
  padding: 140px 0 48px;
}
.work-hero h1 {
  font-size: var(--fs-display);
  line-height: 1.05;
  margin: 12px 0 20px;
  color: var(--text-primary);
}
.work-hero-lead {
  max-width: 640px;
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
}

/* --- Work grid --- */
.work-grid-section {
  padding: 32px 0 96px;
}
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}
.work-grid .work-card:first-child {
  grid-column: 1 / -1;
}
@media (max-width: 768px) {
  .work-grid { grid-template-columns: 1fr; }
}

/* Homepage variant: three equal columns, no featured span */
.work-grid--home {
  grid-template-columns: repeat(3, 1fr);
}
.work-grid--home .work-card:first-child {
  grid-column: auto;
}
@media (max-width: 1000px) {
  .work-grid--home { grid-template-columns: 1fr; }
}

/* --- Work card --- */
.work-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s ease, box-shadow 0.4s ease;
}
.work-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-light);
  box-shadow: 0 24px 60px -24px var(--shadow);
}
.work-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
.work-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-elevated);
}
.work-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.work-card:hover .work-card-media img {
  transform: scale(1.04);
}
.work-card-placeholder {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 35%, rgba(62, 174, 44, 0.55) 0 3px, transparent 4px),
    radial-gradient(circle at 50% 60%, rgba(0, 155, 133, 0.55) 0 3px, transparent 4px),
    radial-gradient(circle at 75% 30%, rgba(0, 108, 193, 0.55) 0 3px, transparent 4px),
    radial-gradient(circle at 62% 78%, rgba(0, 155, 133, 0.4) 0 2px, transparent 3px),
    radial-gradient(circle at 38% 80%, rgba(0, 108, 193, 0.4) 0 2px, transparent 3px),
    linear-gradient(rgba(127, 127, 127, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 127, 127, 0.07) 1px, transparent 1px),
    radial-gradient(120% 90% at 15% 10%, rgba(62, 174, 44, 0.14), transparent 55%),
    radial-gradient(110% 90% at 85% 90%, rgba(0, 108, 193, 0.14), transparent 55%);
  background-size:
    auto, auto, auto, auto, auto,
    32px 32px, 32px 32px,
    auto, auto;
  background-color: var(--surface-elevated);
}
.work-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 26px 26px;
  flex: 1;
}
.work-card-kind {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--gradient-full);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
}
.work-card-title {
  font-size: 1.35rem;
  margin: 0;
  color: var(--text-primary);
}
.work-card-summary {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}
.work-card-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}
.work-card-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.work-card-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.work-card-cta {
  margin-top: 6px;
  font-weight: 600;
  color: var(--text-primary);
  transition: transform 0.3s ease;
  width: fit-content;
}
.work-card:hover .work-card-cta {
  transform: translateX(4px);
}

/* --- Case hero --- */
.case-hero {
  padding: 140px 0 36px;
}
.case-back {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 28px;
  transition: color 0.3s ease;
}
.case-back:hover { color: var(--text-primary); }
.case-kind {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--gradient-full);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
  margin-bottom: 14px;
}
.case-title {
  font-size: var(--fs-display);
  line-height: 1.04;
  margin: 0 0 18px;
  color: var(--text-primary);
}
.case-summary {
  max-width: 680px;
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 28px;
}
.case-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.case-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stack-chip {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* --- Case hero media --- */
.case-hero-media {
  padding: 12px 0 24px;
}
.case-hero-frame {
  margin: 0;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  box-shadow: 0 40px 100px -40px var(--shadow);
}
.case-hero-frame img {
  display: block;
  width: 100%;
  height: auto;
}

/* --- Case metrics / facts band --- */
.case-metrics {
  padding: 36px 0;
}
.case-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 768px) {
  .case-metrics-grid { grid-template-columns: 1fr; }
}
.case-metric {
  padding: 28px 26px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.case-metric .counting-number .num,
.case-fact-value {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  background: var(--gradient-full);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 8px;
}
.case-metric-label {
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.95rem;
}

/* --- Case prose --- */
.case-body {
  padding: 32px 0 24px;
}
.case-prose {
  max-width: 720px;
}
.case-prose h2 {
  font-size: 1.6rem;
  margin: 48px 0 16px;
  color: var(--text-primary);
}
.case-prose h2:first-child { margin-top: 0; }
.case-prose p {
  font-size: 1.06rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin: 0 0 20px;
}
.case-prose strong { color: var(--text-primary); }
.case-prose ul, .case-prose ol {
  color: var(--text-secondary);
  line-height: 1.75;
  padding-left: 22px;
  margin: 0 0 20px;
}

/* --- Case gallery --- */
.case-gallery {
  padding: 24px 0;
}
.case-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
@media (max-width: 768px) {
  .case-gallery-grid { grid-template-columns: 1fr; }
}
.case-gallery-item {
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
}
.case-gallery-item img {
  display: block;
  width: 100%;
  height: auto;
}
.case-gallery-item figcaption {
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* --- Case contact band --- */
.case-contact {
  padding: 48px 0;
}
.case-contact-card {
  text-align: center;
  padding: 56px 32px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    radial-gradient(90% 120% at 50% 0%, rgba(0, 155, 133, 0.10), transparent 60%),
    var(--surface);
}
.case-contact-card h2 {
  margin: 0 0 10px;
  font-size: 1.8rem;
  color: var(--text-primary);
}
.case-contact-card p {
  margin: 0 0 24px;
  color: var(--text-secondary);
}

/* --- Case pagination --- */
.case-pagination {
  padding: 12px 0 80px;
}
.case-pagination-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.case-pagination-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 26px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.case-pagination-link:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
}
.case-pagination-next { text-align: right; align-items: flex-end; }
.case-pagination-dir {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.case-pagination-title {
  font-weight: 600;
  color: var(--text-primary);
}
@media (max-width: 600px) {
  .case-pagination-grid { grid-template-columns: 1fr; }
  .case-pagination-next { text-align: left; align-items: flex-start; }
}

/* --- Instrument imagery system: motifs on all design surfaces --- */
.instrument-media--motif {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(50% 45% at 28% 18%, rgba(62, 174, 44, 0.10), transparent 65%),
    radial-gradient(50% 45% at 76% 86%, rgba(0, 108, 193, 0.10), transparent 65%),
    var(--surface-elevated);
}
.instrument-media--motif .motif {
  width: 100%;
  height: 100%;
  max-height: 100%;
}

/* Screenshots live only in case galleries, inside a neutral frame */
.gallery-frame {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.gallery-frame-bar {
  display: flex;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
}
.gallery-frame-bar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
}
.gallery-frame img {
  display: block;
  width: 100%;
}

/* --- Instrument imagery system: schematic motifs --- */
.case-hero-frame--motif {
  background:
    radial-gradient(45% 40% at 28% 18%, rgba(62, 174, 44, 0.12), transparent 65%),
    radial-gradient(45% 40% at 76% 86%, rgba(0, 108, 193, 0.11), transparent 65%),
    var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.case-hero-frame--motif .motif {
  width: 100%;
  max-width: 820px;
  height: auto;
  display: block;
}
.work-card-motif {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background:
    radial-gradient(50% 45% at 30% 20%, rgba(62, 174, 44, 0.10), transparent 65%),
    radial-gradient(50% 45% at 75% 85%, rgba(0, 108, 193, 0.10), transparent 65%);
}
.work-card-motif .motif {
  width: 100%;
  height: 100%;
}
[data-theme="light"] .motif text {
  fill: #3d4a44;
}

/* Light theme: faint grid strokes darken so motifs hold on white */
[data-theme="light"] .motif [stroke="#8a9a90"] {
  stroke: #5a6a62;
}
[data-theme="light"] .instrument-media--motif {
  background:
    radial-gradient(50% 45% at 28% 18%, rgba(62, 174, 44, 0.07), transparent 65%),
    radial-gradient(50% 45% at 76% 86%, rgba(0, 108, 193, 0.07), transparent 65%),
    var(--surface-elevated);
}
