/*
 * Shared building blocks for the case studies under /work/<slug>/.
 * Rules and reasoning: CASE-STUDY-STANDARD.md.
 * Load after case-chapters.css and before the page's own <slug>-story.css,
 * so a story file can still place a component inside its own layout.
 */

:root {
  --portfolio-blue: #3a41e4;
  --portfolio-blue-on-dark: #aab2ff;
  --case-ink: #232323;
  --case-muted: #5f6468;
  --case-line: rgba(35, 35, 35, 0.12);
  --case-dark: #1d2429;
  --case-font: 'Montserrat', Arial, sans-serif;

  /* One type scale for all case studies (decision E4, 22.10.2026). */
  --case-h1-size: clamp(48px, 6vw, 96px);
  --case-h1-leading: 1.02;
  --case-h2-size: clamp(34px, 4.4vw, 64px);
  --case-h2-leading: 1.08;
  --case-heading-weight: 600;
  --case-heading-tracking: -0.04em;
}

/* ---------- Hero ---------- */

/* custom.css gives every <section> 2rem padding below 768 px. Heroes bring
   their own spacing; on photo heroes the padding showed as a black band. */
section.case-hero {
  padding-top: 0;
  padding-bottom: 0;
}

/* ---------- Headings (for Tailwind markup; story files use the tokens) ---------- */

.case-h1 {
  font-family: var(--case-font);
  font-size: var(--case-h1-size);
  font-weight: var(--case-heading-weight);
  line-height: var(--case-h1-leading);
  letter-spacing: var(--case-heading-tracking);
}

.case-h2 {
  font-family: var(--case-font);
  font-size: var(--case-h2-size);
  font-weight: var(--case-heading-weight);
  line-height: var(--case-h2-leading);
  letter-spacing: var(--case-heading-tracking);
  text-wrap: balance;
}

/* ---------- Skip link ---------- */

.case-skip {
  position: fixed;
  z-index: 100;
  top: 16px;
  left: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fff;
  color: var(--case-ink);
  font: 600 14px/1.2 var(--case-font);
  text-decoration: none;
  transform: translateY(-200%);
}

.case-skip:focus {
  transform: none;
}

/* ---------- Focus ---------- */

/* Blue ring with a white halo: visible on white, grey, dark and blue
   surfaces alike. :where() keeps it overridable by components. */
:where(a[href], button, input, select, textarea, summary, video, [tabindex]):focus-visible {
  outline: 3px solid var(--portfolio-blue);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #fff;
}

/* ---------- Chapter label ---------- */

/* "01 / Starting point" – the same words as in the chapter bar. */
.case-eyebrow {
  display: block;
  margin: 0 0 24px;
  color: var(--portfolio-blue);
  font: 700 12px/1.4 var(--case-font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.case-eyebrow--on-dark {
  color: var(--portfolio-blue-on-dark);
}

/* ---------- Key facts: Role · Timeframe · Context · Status ---------- */

.case-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 32px;
  margin: 32px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid rgba(127, 127, 127, 0.4);
  border-top-color: color-mix(in srgb, currentColor 28%, transparent);
  font-family: var(--case-font);
}

@media (min-width: 768px) {
  .case-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .case-facts dd {
    font-size: 15px;
  }
}

.case-facts > div {
  min-width: 0;
}

.case-facts dt {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.72;
}

.case-facts dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.case-facts b,
.case-facts strong {
  font: inherit;
}

/* !important: the global link rule in custom.css removes underlines with a
   much higher specificity; links in facts and credits must stay visible. */
.case-facts a {
  text-decoration: underline !important;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ---------- Reflection in "What remains" ---------- */

/* At least one sentence of self-criticism ("What I would do differently").
   Same look as the reflection blocks on MNEMO and Albturm. */
.case-reflection {
  max-width: 760px;
  margin: 40px 0 0;
  padding-left: 28px;
  border-left: 3px solid var(--portfolio-blue);
  font-family: var(--case-font);
}

.case-reflection__label {
  margin: 0 0 12px;
  color: var(--portfolio-blue);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.case-reflection p:not(.case-reflection__label) {
  margin: 0;
  color: inherit;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.6;
}

.case-reflection--on-dark {
  border-left-color: var(--portfolio-blue-on-dark);
}

.case-reflection--on-dark .case-reflection__label {
  color: var(--portfolio-blue-on-dark);
}

@media (max-width: 767px) {
  .case-reflection {
    padding-left: 20px;
  }

  .case-reflection p:not(.case-reflection__label) {
    font-size: 16px;
  }
}

/* ---------- Credits at the end of "What remains" ---------- */

.case-credits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 20px 32px;
  margin: 40px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid rgba(127, 127, 127, 0.4);
  border-top-color: color-mix(in srgb, currentColor 22%, transparent);
  font-family: var(--case-font);
}

.case-credits dt {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.72;
}

.case-credits dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.case-credits a {
  text-decoration: underline !important;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ---------- Next project ---------- */

/* Order follows the cards on the home page; the last card points to the
   first. */
.case-next {
  padding: 64px 0;
  background: var(--portfolio-blue);
  color: #fff;
  font-family: var(--case-font);
}

.case-next__inner {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  width: min(100%, 1440px);
  margin-inline: auto;
  padding-inline: 16px;
}

.case-next__label {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.case-next__title {
  margin: 0;
  color: #fff;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.case-next__text {
  max-width: 480px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 16px;
  line-height: 1.6;
}

/* !important: the global link rule in custom.css sets display and color on
   every link with a much higher specificity. */
.case-next__link {
  display: inline-block !important;
  flex: none;
  padding: 16px 32px;
  border-radius: 999px;
  background: #fff;
  color: var(--portfolio-blue) !important;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.case-next__link:hover {
  background: #ececec;
}

@media (min-width: 640px) {
  .case-next__inner {
    padding-inline: 24px;
  }
}

@media (min-width: 768px) {
  .case-next {
    padding: 96px 0;
  }

  .case-next__inner {
    flex-direction: row;
    align-items: flex-end;
  }

  .case-next__title {
    font-size: 48px;
  }
}

@media (min-width: 1024px) {
  .case-next__inner {
    padding-inline: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-next__link {
    transition: none;
  }
}
