/* ==========================================================================
   PROJECT PAGE (projects/*.html, proyectos/*.html)
   Loaded after styles.css. Reuses its tokens (--black, --white, --orange,
   --text, --muted, --border), nav, footer, cursor, .reveal, .hero-orb and
   .project-row (used for the "next project" link). Only page-specific
   layout lives here. Class prefix: .case-
   ========================================================================== */

/* PAGE TOKENS */
.case-page {
  /* var(--muted) (#888) fails AA for small text on --white, labels use this.
     Same value as in the projects section of styles.css */
  --text-soft: #6b6b6b;
  --case-gutter: 40px;
  --case-max: 1280px;
}

.case a:focus-visible,
.case-page nav a:focus-visible,
.case-page footer a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Shared small uppercase label (same look as .section-label / info table) */
.case-kicker {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

/* Skip link: hidden until it gets keyboard focus */
.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: 100px;
  background: var(--black);
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* HERO */
.case-hero {
  position: relative;
  padding: 140px var(--case-gutter) 56px;
}

/* the home orb, moved to the right so it never sits behind the title */
.case-hero .hero-orb {
  top: -140px;
  left: auto;
  right: -160px;
  width: 520px;
  height: 520px;
  opacity: 0.7;
}

.case-hero__inner {
  position: relative;
  z-index: 1;
  max-width: var(--case-max);
}

.case-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 48px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

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

.case-back .line {
  width: 32px;
  height: 1px;
  background: currentColor;
}

/* Project number, same face as the home row index */
.case-index {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.case-index span {
  color: var(--text-soft);
}

.case-title {
  margin: 14px 0 20px;
  font-family: 'DM Serif Display', serif;
  font-size: clamp(48px, 9vw, 136px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--black);
  opacity: 0;
  animation: fadeUp 0.9s 0.1s forwards;
}

.case-tagline {
  max-width: 620px;
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.5;
  color: #444;
  opacity: 0;
  animation: fadeUp 0.9s 0.25s forwards;
}

/* Metadata: four columns with hairlines, like the info table */
.case-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr);
  gap: 24px;
  margin-top: 56px;
  opacity: 0;
  animation: fadeUp 0.9s 0.4s forwards;
}

.case-meta > div {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.case-meta dt {
  margin-bottom: 8px;
}

.case-meta dd {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* Stack pills */
.case-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.case-stack li {
  font-size: 11px;
  font-weight: 500;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: #444;
}

/* COVER IMAGE */
.case-cover {
  margin: 0 var(--case-gutter);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #e8e4de;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

/* dark backdrop for projects whose screenshots have a dark UI */
.case-cover--dark {
  background: linear-gradient(135deg, #1a2240 0%, #0b1026 100%);
}

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

/* CONTENT SECTIONS
   Two columns: numbered label on the left (sticky), text on the right */
.case-body {
  padding: 40px var(--case-gutter) 0;
}

.case-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 40px;
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

.case-body > .case-section:first-child {
  border-top: none;
}

.case-section__label {
  align-self: start;
  position: sticky;
  top: 96px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.1;
}

.case-section__label .case-num {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-soft);
}

.case-section__content {
  max-width: 680px;
}

.case-section__content p {
  font-size: 15px;
  line-height: 1.75;
  color: #333;
}

.case-section__content p + p {
  margin-top: 16px;
}

/* opening paragraph of the overview, bigger and in the display face */
.case-section__content .case-lead {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.4;
  color: var(--text);
}

/* Highlights: short statements in two columns, hairline on top and an
   orange dot (the accent of the home) as the bullet */
.case-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 40px;
  list-style: none;
}

.case-highlights li {
  position: relative;
  padding: 16px 0 0 18px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.6;
  color: #333;
}

.case-highlights li::before {
  content: '';
  position: absolute;
  top: 25px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

/* Challenges: numbered, title in the display face and body below */
.case-challenges {
  list-style: none;
  counter-reset: challenge;
}

.case-challenge {
  counter-increment: challenge;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 12px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
}

.case-challenge:first-child {
  padding-top: 0;
  border-top: none;
}

.case-challenge::before {
  content: counter(challenge, decimal-leading-zero);
  grid-row: span 2;
  padding-top: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}

.case-challenge h3 {
  margin-bottom: 10px;
  font-family: 'DM Serif Display', serif;
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 400;
  line-height: 1.25;
}

/* Results: short statements in the display face */
.case-results {
  list-style: none;
  counter-reset: result;
}

.case-results li {
  counter-increment: result;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  font-family: 'DM Serif Display', serif;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.3;
}

.case-results li:first-child {
  border-top: none;
  padding-top: 0;
}

.case-results li::before {
  content: counter(result, decimal-leading-zero);
  padding-top: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-soft);
}

/* GALLERY (full width, label on top) */
.case-section--full {
  grid-template-columns: minmax(0, 1fr);
}

.case-section--full .case-section__label {
  position: static;
}

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

/* with an odd number of images the first one spans the full row */
.case-gallery__item--wide {
  grid-column: 1 / -1;
}

.case-gallery__media {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #e8e4de;
}

.case-gallery__media--dark {
  background: linear-gradient(135deg, #1a2240 0%, #0b1026 100%);
}

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


/* CONTACT CTA */
.case-cta {
  margin: 40px var(--case-gutter) 0;
  padding: 72px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.case-cta h2 {
  max-width: 760px;
  margin: 0 auto 28px;
  font-family: 'DM Serif Display', serif;
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 400;
  line-height: 1.05;
}

/* same pill button as the home hero "Get in Touch" */
.case-cta__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 22px;
  border: 1px solid var(--text);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition:
    background 0.2s,
    color 0.2s;
}

.case-cta__link:hover {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}

/* NEXT PROJECT (reuses .project-row from styles.css) */
/* every case section sets its own padding, overriding the global
   `section { padding: 100px 40px }` from the home layout */
.case-next {
  padding: 0 var(--case-gutter) 40px;
}

.case-next .case-kicker {
  margin-bottom: 16px;
}

.case-next .project-row {
  border-top: 1px solid var(--border);
}

/* Navegacion entre casos: anterior y lista de todos los proyectos */
.case-pager {
  padding: 0 var(--case-gutter) 64px;
}
.case-pager__prev {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.case-pager .case-kicker {
  margin-bottom: 12px;
}
.case-pager__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  list-style: none;
}
.case-pager__list a {
  color: var(--text-soft);
  text-decoration: none;
}
.case-pager__list a[aria-current='page'] {
  color: var(--text);
  font-weight: 500;
}
.case-pager__prev:hover,
.case-pager__prev:focus-visible,
.case-pager__list a:hover,
.case-pager__list a:focus-visible {
  color: var(--orange);
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .case-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .case-meta__stack {
    grid-column: 1 / -1;
  }

  .case-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 44px 0;
  }

  .case-section__label {
    position: static;
  }

}

@media (max-width: 768px) {
  .case-page {
    --case-gutter: 20px;
  }

  .case-hero {
    padding-top: 110px;
  }

  /* pushed into the corner so it does not sit behind the title */
  .case-hero .hero-orb {
    width: 280px;
    height: 280px;
    top: -150px;
    right: -170px;
  }

  .case-back {
    margin-bottom: 32px;
  }

  .case-cover {
    border-radius: 8px;
  }

  .case-cta {
    padding: 56px 0;
  }
}

@media (max-width: 600px) {
  .case-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 40px;
  }

  .case-highlights,
  .case-gallery {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-title,
  .case-tagline,
  .case-meta {
    animation: none;
    opacity: 1;
  }
}

/* Links de demo y repo en los metadatos del proyecto */
.case-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-right: 12px;
  white-space: nowrap;
}

.case-link:hover,
.case-link:focus-visible {
  color: var(--orange);
}
