/* ==========================================================================
   Work detail pages (case studies)
   ========================================================================== */

/* Case-study pages are plain white end to end, so the header's default
   --color-menu-bg (a warm off-white) reads as a visible seam against the
   page background. Match it here for every work-N.html page. */
.site-header {
  background: var(--color-bg);
}

.work-hero {
  padding-block: clamp(32px, 6vw, 48px) 0;
}

.work-hero__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: clamp(24px, 4vw, 40px);
}

.work-hero__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding-block: clamp(32px, 6vw, 56px);
  border-bottom: 1px solid var(--color-border);
}

.work-meta__item dt {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.work-meta__item dd {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.work-section {
  padding-block: clamp(40px, 7vw, 72px);
}

.work-section__title {
  font-weight: 800;
  font-size: var(--fs-h2);
  margin-bottom: 20px;
  max-width: 720px;
}

.work-section__text {
  max-width: 720px;
  color: var(--color-muted);
}

.work-section__text p + p {
  margin-top: 16px;
}

.work-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: clamp(32px, 6vw, 48px);
}

.work-gallery__item {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--color-menu-bg);
}

.work-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-gallery__item--wide {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 8;
}

.work-results {
  background: var(--color-menu-bg);
}

.work-results__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.work-results__stat strong {
  display: block;
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 800;
  margin-bottom: 8px;
}

.work-results__stat span {
  color: var(--color-muted);
}

.work-next {
  padding-block: clamp(48px, 8vw, 96px);
}

.work-next__card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: clamp(32px, 5vw, 48px);
  border-radius: var(--radius-lg);
  background: var(--color-footer-bg);
  color: var(--color-white);
  text-decoration: none;
}

.work-next__label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin-bottom: 8px;
}

.work-next__title {
  font-size: var(--fs-h2);
  font-weight: 800;
}

.work-next__arrow {
  font-size: 28px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.work-next__card:hover .work-next__arrow {
  transform: translateX(6px);
}

@media (max-width: 860px) {
  .work-meta {
    grid-template-columns: repeat(2, 1fr);
  }

  .work-gallery {
    grid-template-columns: 1fr;
  }

  .work-gallery__item--wide {
    aspect-ratio: 4 / 3;
  }

  .work-results__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 640px) {
  .work-hero__cover {
    aspect-ratio: 4 / 3;
    border-radius: 16px;
  }
}

/* ==========================================================================
   Exact case-study layout (work-1, work-3) — mirrors the Figma case pages
   ========================================================================== */

.case-hero {
  padding-block: clamp(32px, 6vw, 56px) clamp(24px, 4vw, 40px);
}

.case-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 577px) minmax(0, 696px);
  gap: clamp(24px, 4vw, 96px);
  align-items: start;
}

.case-hero__title {
  font-weight: 800;
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.2;
  margin-bottom: 24px;
}

.case-hero__link {
  display: inline-block;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-bottom: 8px;
}

.case-hero__year {
  color: var(--color-muted);
}

.case-hero__body p {
  margin-bottom: 16px;
}

.case-hero__body ul {
  margin: 0 0 16px;
  padding-left: 20px;
}

.case-hero__body li {
  margin-bottom: 4px;
}

.case-meta {
  display: grid;
  grid-template-columns: minmax(0, 577px) minmax(0, 696px);
  gap: clamp(24px, 4vw, 96px);
  margin-top: 40px;
}

.case-meta__heading {
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.case-tag {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 15px;
  border-radius: 6px;
  background: #f0f0f0;
  color: #010102;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.case-preview {
  margin-top: clamp(40px, 6vw, 64px);
  border-radius: 0;
  overflow: hidden;
  background: #f0f0f0;
}

.case-preview img {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- Accordion sections ---------- */

.case-article {
  max-width: 936px;
  margin-inline: auto;
  padding-block: clamp(56px, 10vw, 96px);
  display: flex;
  flex-direction: column;
}

.case-article--upper {
  padding-bottom: 0;
}

.case-article--lower {
  padding-top: 0;
}

.case-accordion {
  border-top: 2px solid #090012;
}

.case-accordion:last-of-type {
  border-bottom: 2px solid #090012;
}

/* When the accordion list is split across two sibling sections (upper/lower),
   the upper section's last item would draw a bottom border right next to the
   lower section's first item's top border, doubling the divider line with no
   gap between them. Suppress it there — the lower section's top border already
   marks that boundary, and the lower section's own last item still closes the
   list at the very bottom. */
.case-article--upper .case-accordion:last-of-type {
  border-bottom: none;
}

.case-accordion > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 24px;
  cursor: pointer;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.02em;
  color: #010102;
}

.case-accordion > summary::-webkit-details-marker {
  display: none;
}

.case-accordion__chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.case-accordion[open] .case-accordion__chevron {
  transform: rotate(180deg);
}

.case-accordion__body {
  padding-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--color-ink);
  font-size: var(--fs-body);
  line-height: 1.6;
}

.case-accordion__body ol {
  margin: 0;
  padding-left: 20px;
}

.case-accordion__body li {
  margin-bottom: 4px;
}

.case-accordion__body img {
  width: 100%;
  display: block;
  border-radius: 10px;
}

.case-caption {
  margin-top: -4px;
  font-size: 14px;
  font-style: italic;
  color: var(--color-muted);
}

.case-shot {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 7.33px 21.98px rgba(0, 0, 0, 0.25);
}

.case-shot--small {
  max-width: 320px;
}

.case-shot--wide img {
  border-radius: 10px;
}

.case-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.case-two-col img {
  border-radius: 10px;
  box-shadow: 0 7.33px 21.98px rgba(0, 0, 0, 0.25);
}

/* ---------- Hover-swap (logo old/new, homepage old/new, article old/new) ---------- */

.case-hover-swap {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.case-hover-swap img {
  display: block;
  width: 100%;
  border-radius: 0;
}

.case-hover-swap__old {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.case-hover-swap:hover .case-hover-swap__old,
.case-hover-swap:focus-visible .case-hover-swap__old {
  opacity: 1;
}

/* Touch devices have no hover — js/main.js toggles this class on tap so the
   old/new comparison still works there: tap once to reveal "old", tap again
   to go back to "new", indefinitely. Also fires on a plain desktop click, on
   top of (not instead of) the :hover/:focus-visible reveal above. */
.case-hover-swap.is-flipped .case-hover-swap__old {
  opacity: 1;
}

.case-logo-swap {
  width: 100%;
}

/* ---------- Full-width flat asset boxes: secondary logo, business cards, t-shirts ---------- */

.case-full-shot {
  width: 100%;
  aspect-ratio: 936 / 437;
  overflow: hidden;
}

.case-full-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

/* ---------- Mobile UI row: 4 phone mockups, always fits, no scroll ---------- */

.case-mobile-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 2.2vw, 24px);
  padding-top: 8px;
}

.case-mobile-row__item {
  min-width: 0;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.18));
}

/* Flat screenshot mobile shots (opaque rectangles, not cut-out phone PNGs):
   swap the silhouette drop-shadow for a normal box-shadow + rounded corners. */
.case-mobile-row__item--screenshot {
  filter: none;
}

.case-mobile-row__item--screenshot img {
  box-shadow: 0 7.33px 21.98px rgba(0, 0, 0, 0.25);
}

.case-mobile-row__item .case-hover-swap {
  overflow: hidden;
}

.case-mobile-row__item img {
  width: 100%;
  display: block;
}

/* ---------- Research: annotated screenshots, no card frame ---------- */

.case-research {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.case-research__caption {
  font-size: var(--fs-body);
  color: var(--color-muted);
  max-width: 640px;
}

.case-research__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding-top: 56px;
}

.case-research__item {
  position: relative;
  aspect-ratio: 456 / 272;
}

.case-research__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 10px;
  box-shadow: 0 7.33px 21.98px rgba(0, 0, 0, 0.25);
}

.case-research__pin {
  position: absolute;
  top: -56px;
  width: 2px;
  background: #090012;
  left: 19%;
  height: calc(56px + 72%);
}

.case-research__pin--right {
  left: 40%;
  height: calc(56px + 34%);
}

.case-research__pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #090012;
  background: #fff;
  transform: translate(-50%, 50%);
}

/* ---------- Color palette (real brand values, exact Figma mosaic layout) ---------- */

.color-grid {
  display: grid;
  grid-template-columns: 237.66fr 223.03fr 223.03fr 252.28fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 936 / 368.55;
  gap: 0;
  border-radius: 0;
  overflow: hidden;
}

.color-swatch {
  padding: clamp(16px, 2.5vw, 29px) clamp(14px, 2vw, 22px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
}

.color-swatch:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / 3;
}

.color-swatch:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.color-swatch:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.color-swatch:nth-child(4) {
  grid-column: 3;
  grid-row: 1;
}

.color-swatch:nth-child(5) {
  grid-column: 3;
  grid-row: 2;
}

.color-swatch:nth-child(6) {
  grid-column: 4;
  grid-row: 1;
}

.color-swatch:nth-child(7) {
  grid-column: 4;
  grid-row: 2;
}

.color-swatch--black {
  background: #070a11;
  color: #ffffff;
}

.color-swatch__name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.color-swatch--black .color-swatch__name {
  text-transform: uppercase;
  color: #e62c06;
}

.color-swatch__hexrow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
}

.color-swatch__hexlabel {
  opacity: 0.6;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.color-swatch__hexvalue {
  font-family: "SFMono-Regular", Consolas, monospace;
  opacity: 0.85;
}

/* ---------- Typography sample + 3-up color row (Typography accordion, work-2) ---------- */

.case-type-sample {
  display: flex;
  align-items: flex-end;
  gap: clamp(20px, 4vw, 48px);
  padding-block: clamp(8px, 2vw, 16px) clamp(16px, 3vw, 24px);
}

.case-type-sample__aa {
  font-size: clamp(88px, 13vw, 150px);
  line-height: 0.78;
  font-weight: 400;
  color: #d9d9d9;
  flex-shrink: 0;
}

.case-type-sample__info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 4px;
}

.case-type-sample__name {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 600;
  color: var(--color-ink);
}

.case-type-sample__charset {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-ink);
}

.case-subheading {
  font-weight: 700;
  font-size: clamp(18px, 2.2vw, 20px);
  letter-spacing: 0.02em;
}

.case-color-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-radius: 0;
  overflow: hidden;
}

.case-color-row__item {
  min-height: clamp(96px, 12vw, 140px);
  padding: clamp(14px, 2vw, 20px);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.case-color-row__hex {
  font-weight: 400;
  opacity: 0.8;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.case-color-row__item--dark {
  background: #15140b;
}

.case-color-row__item--caramel {
  background: #edb64b;
}

.case-color-row__item--canvas {
  background: #dfdfdf;
  color: #15140b;
}

.case-color-row__item--canvas .case-color-row__hex {
  opacity: 0.65;
}

@media (max-width: 640px) {
  .case-type-sample {
    flex-wrap: wrap;
  }

  .case-color-row {
    grid-template-columns: 1fr;
  }
}

/* Same box formula as .case-article (max-width 936, centered, then padded)
   so the Result paragraph's left edge lines up exactly with the accordion
   list above it — both are independently-centered 936px columns, not
   flush to the outer .container edge. Pages without an accordion (like
   Forklog Consulting) override this in their own stylesheet instead. */
.case-result {
  max-width: 936px;
  margin: 0 auto clamp(40px, 6vw, 64px);
  padding-inline: var(--container-pad);
  font-size: var(--fs-body);
  color: var(--color-ink);
}

/* An accordion section (.case-article) that's directly followed by a poster
   image contributes its own padding-bottom on top of the poster's
   margin-top, doubling up the gap above the image versus below it (where
   only the poster's margin-bottom applies). Zeroing that padding here keeps
   the gap symmetric — driven by the poster's own (equal) margin-block value
   on both sides — and, as a side effect, brings the accordion's closing
   border line right up against the poster instead of leaving it stranded
   in the middle of an oversized gap. */
.case-article:has(+ .case-poster) {
  padding-bottom: 0;
}

.case-poster {
  width: 100%;
  margin-inline: auto;
  max-width: var(--container-width);
  padding-inline: var(--container-pad);
  margin-block: clamp(40px, 6vw, 64px);
}

.case-poster img {
  width: 100%;
  border-radius: 0;
  display: block;
}

.case-note {
  max-width: 936px;
  margin: 24px auto 0;
  padding-inline: var(--container-pad);
  font-size: 13px;
  color: var(--color-muted);
  font-style: italic;
}

/* ---------- Gallery carousel (work-3) ---------- */

.case-carousel {
  position: relative;
  max-width: 1176px;
  margin-inline: auto;
}

.case-carousel__viewport {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  aspect-ratio: 5 / 4;
  background: #111;
}

.case-carousel__track {
  display: flex;
  height: 100%;
  transition: transform 0.4s ease;
}

.case-carousel__slide {
  flex: 0 0 100%;
  height: 100%;
}

.case-carousel__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.case-carousel__arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: var(--color-ink);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.case-carousel__arrow:hover {
  background: #fff;
}

.case-carousel__arrow--prev {
  left: -60px;
}

.case-carousel__arrow--next {
  right: -60px;
}

.case-carousel__dots {
  position: absolute;
  right: 24px;
  bottom: 20px;
  display: flex;
  gap: 8px;
}

.case-carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0;
}

.case-carousel__dot.is-active {
  background: #fff;
}

@media (max-width: 1300px) {
  .case-carousel__arrow--prev {
    left: 12px;
  }

  .case-carousel__arrow--next {
    right: 12px;
  }
}

@media (max-width: 860px) {
  .case-hero__grid,
  .case-meta {
    grid-template-columns: 1fr;
  }

  .case-two-col {
    grid-template-columns: 1fr;
  }

  .case-research__row {
    grid-template-columns: 1fr;
  }

  .color-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    aspect-ratio: auto;
  }

  .color-swatch {
    aspect-ratio: 1 / 1;
  }

  .color-swatch:nth-child(1) {
    grid-column: 1 / -1;
    grid-row: auto;
    aspect-ratio: 2 / 1;
  }

  .color-swatch:nth-child(2),
  .color-swatch:nth-child(4),
  .color-swatch:nth-child(6) {
    grid-column: 1;
  }

  .color-swatch:nth-child(3),
  .color-swatch:nth-child(5),
  .color-swatch:nth-child(7) {
    grid-column: 2;
  }

  .color-swatch:nth-child(2),
  .color-swatch:nth-child(3) {
    grid-row: 2;
  }

  .color-swatch:nth-child(4),
  .color-swatch:nth-child(5) {
    grid-row: 3;
  }

  .color-swatch:nth-child(6),
  .color-swatch:nth-child(7) {
    grid-row: 4;
  }
}

@media (max-width: 640px) {
  .case-accordion > summary {
    font-size: 20px;
  }

  .case-carousel__arrow {
    width: 42px;
    height: 42px;
    font-size: 19px;
  }
}

/* ---------- Gallery wrapper (spacing for work-3's carousel) ---------- */

.case-gallery {
  padding-block: clamp(40px, 6vw, 64px) 0;
}

/* ---------- Other Projects (reuses the home-page work-card visual) ---------- */

.case-other {
  padding-block: clamp(56px, 9vw, 88px) clamp(24px, 4vw, 40px);
}

.case-other__heading {
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.02em;
  margin-bottom: 24px;
}

.case-other__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.case-other__grid .work-card {
  position: relative;
  display: block;
  aspect-ratio: 456 / 257;
  border-radius: 0;
  overflow: hidden;
  text-decoration: none;
  color: var(--color-white);
  background: linear-gradient(135deg, #6a5a7a, #2a2038);
  isolation: isolate;
  transition: border-radius 0.3s ease;
}

.case-other__grid .work-card__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transition: transform 0.4s ease;
}

.case-other__grid .work-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--color-overlay);
}

.case-other__grid .work-card__title {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: clamp(16px, 6%, 24px);
  transform: translateX(-50%);
  width: 88%;
  text-align: center;
  font-weight: 700;
  font-size: clamp(16px, 2vw, 18px);
  line-height: 1.25;
}

.case-other__grid .work-card__badge {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.case-other__grid a.work-card:hover {
  border-radius: 48px;
}

.case-other__grid a.work-card:hover .work-card__cover {
  transform: scale(1.04);
}

.case-other__grid .work-card--soon {
  cursor: default;
  pointer-events: none;
}

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