/* ─── Work Page ─── */
/* Loaded after style.css and cv.css on work.html only; reuses their tokens
   and the .cv-back link. */

.work-page .container {
  max-width: 760px;
}

/* ─── Work Header ─── */

.work-page .work-header {
  margin-bottom: 48px;
  padding-bottom: 40px;
}

.work-header h1 {
  font-size: 42px;
  line-height: 1.1;
  margin-bottom: 16px;
}

.work-header p {
  max-width: 560px;
  text-wrap: pretty;
}

.work-header .header-actions {
  margin-top: 20px;
}

/* ─── Sections ─── */

.work-page section {
  margin-bottom: 64px;
}

.work-section-intro {
  max-width: 560px;
  margin-top: -6px;
  margin-bottom: 24px;
  font-size: 14.5px;
  text-wrap: pretty;
}

/* ─── Case Study Cards ─── */

.case-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  list-style: none;
}

.case-card {
  --tint: var(--accent);
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

@media (hover: hover) {
  .case-card:hover {
    border-color: color-mix(in srgb, var(--tint) 45%, var(--border));
    transform: translateY(-3px);
    box-shadow: 0 10px 30px color-mix(in srgb, var(--tint) 12%, transparent);
  }
}

.case-card[data-tint='coral'] { --tint: #D8674B; }
.case-card[data-tint='gold'] { --tint: #B8891A; }
.case-card[data-tint='violet'] { --tint: #7A5AF0; }
.case-card[data-tint='navy'] { --tint: #3F63A8; }
.case-card[data-tint='teal'] { --tint: #2E9C96; }
.case-card[data-tint='amber'] { --tint: #D9822B; }

/* Featured card spans both columns */
.case-grid > .case-wide {
  grid-column: 1 / -1;
}

.case-wide .case-cover {
  aspect-ratio: 21 / 8;
}

/* Cover: shows an <img> when one is provided, otherwise a typographic
   placeholder built from the project name. */
.case-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--tint) 22%, transparent), transparent 60%),
    color-mix(in srgb, var(--tint) 9%, var(--bg));
  border-bottom: 1px solid color-mix(in srgb, var(--tint) 18%, var(--border));
}

.case-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-cover-label {
  position: relative;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tint) 55%, var(--text));
}

.case-cover-title {
  position: relative;
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: color-mix(in srgb, var(--tint) 65%, var(--text));
}

.case-metric {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint) 30%, var(--border));
  border-radius: 100px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.case-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 20px 20px;
}

.case-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.case-body h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--text);
}

.case-year {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.case-role {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.case-aka {
  margin-top: 2px;
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
}

.case-summary {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.65;
  text-wrap: pretty;
}

.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  list-style: none;
}

.case-tags li {
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border-radius: 100px;
}

.case-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.case-link::after {
  content: '↗';
  content: '↗' / '';
  color: var(--text-muted);
  transition: transform 0.25s ease, color 0.25s ease;
}

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

.case-link:hover::after {
  color: var(--accent-text);
  transform: translate(2px, -2px);
}

/* ─── Visual Work ─── */

.visual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  list-style: none;
}

.visual-grid:empty {
  display: none;
}

.visual-item {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.visual-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.visual-item figcaption {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  border-radius: 100px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

@media (hover: hover) {
  .visual-item:hover img {
    transform: scale(1.04);
  }

  .visual-item:hover figcaption {
    opacity: 1;
    transform: none;
  }
}

@media (hover: none) {
  .visual-item figcaption {
    opacity: 1;
    transform: none;
  }
}

.layers-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--text);
  transition: border-color 0.25s ease, background 0.25s ease;
}

.layers-card:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--surface);
}

.layers-card-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--accent-text);
  background: var(--accent-glow);
}

.layers-card-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.layers-card-title {
  font-size: 15px;
  font-weight: 600;
}

.layers-card-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.layers-card-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.25s ease, color 0.25s ease;
}

.layers-card:hover .layers-card-arrow {
  color: var(--accent-text);
  transform: translate(2px, -2px);
}

/* ─── How I Work ─── */

.approach-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  list-style: none;
}

.approach-list h3 {
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.approach-list p {
  font-size: 14px;
  line-height: 1.65;
  text-wrap: pretty;
}

/* ─── Closing CTA ─── */

.work-cta {
  padding: 32px 0 8px;
  text-align: center;
}

.work-cta h2::after {
  content: none;
}

.work-cta p {
  max-width: 440px;
  margin: 0 auto 22px;
}

.work-cta .header-actions {
  justify-content: center;
  margin-top: 0;
}

/* ─── Work Entrance Stagger ─── */

header.fade-in.visible .cv-back { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both; opacity: 0; }

.fade-in.visible .case-grid > li:nth-child(1) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both; opacity: 0; }
.fade-in.visible .case-grid > li:nth-child(2) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both; opacity: 0; }
.fade-in.visible .case-grid > li:nth-child(3) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both; opacity: 0; }
.fade-in.visible .case-grid > li:nth-child(4) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.32s both; opacity: 0; }
.fade-in.visible .case-grid > li:nth-child(5) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.40s both; opacity: 0; }
.fade-in.visible .case-grid > li:nth-child(6) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.48s both; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  header.fade-in .cv-back,
  .fade-in .case-grid > li {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ─── Work Responsive ─── */

@media (max-width: 720px) {
  .case-grid {
    grid-template-columns: 1fr;
  }

  .case-wide .case-cover {
    aspect-ratio: 16 / 10;
  }

  .visual-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .approach-list {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .work-header h1 {
    font-size: 36px;
  }

  .work-page section {
    margin-bottom: 48px;
  }

  .case-cover-title {
    font-size: 34px;
  }

  .visual-grid {
    gap: 8px;
  }
}

/* ─── Print ─── */

@media print {
  .fade-in,
  .fade-in *,
  .fade-in.visible,
  .fade-in.visible * {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .case-card {
    break-inside: avoid;
  }

  .cv-back,
  .work-cta,
  .footer {
    display: none !important;
  }
}
