/* --- Reset (minimal) --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  padding: 0;
}

/* --- Heading font --- */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("BricolageGrotesque[opsz,wdth,wght].ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

h1,
h2,
h3 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(3.25rem, 9vw, 6.25rem);
  letter-spacing: 0.01em;
}

h2 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

/* --- Page --- */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #fff;
  color: #111;
}

:root {
  --preview-radius: 15px;
  /* Near-black surfaces (hero, prompt blocks, etc.) — tweak one place for “the black” */
  --black: #111;
  --on-black: #f2f2f2;
  --on-black-muted: #9a9a9a;
  --on-black-accent: #8fd4c1;
  /* Wipe end width for case hero line highlights (GSAP animates to this %) */
  --title-line-highlight-end: 118%;
  /* Vertical size of highlight — keep modest so rows don’t paint over text above */
  --title-line-highlight-height: 106%;
  /* Prose links (case studies, etc.) — neutral; swap when you lock a palette */
  --link-prose: #111;
  --link-prose-underline: rgba(17, 17, 17, 0.4);
  --link-prose-hover: #000;
  --link-prose-underline-hover: rgba(17, 17, 17, 0.85);
}

.site-header {
  height: 10dvh;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
}

.site-header__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  font-size: 0.9375rem;
}

.nav-links a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.hero {
  min-height: calc(100dvh - 10dvh);
  background: #000;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 2rem 1.5rem;
}

.hero__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.hero h1 {
  color: #fff;
  /* max-width: 18ch; */
  max-width: 22ch;
  font-size: clamp(2.5rem, 6.5vw, 4.5rem);
  font-weight: 600;
  user-select: none;
  -webkit-user-select: none;
}

.hero h1 .hero-word {
  white-space: nowrap;
}

.hero__subtitle {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.15;
  margin-top: 0.875rem;
  letter-spacing: -0.02em;
}

.selected-work {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) 1.5rem;
}

.selected-work h2 {
  margin-bottom: 2rem;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4rem 2rem;
}

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

.work-item__link {
  display: block;
  color: inherit;
}

.work-item__link:hover .work-item__title {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.work-item__media {
  background: #f0f0f0;
  border-radius: var(--preview-radius);
  overflow: hidden;
  border: 0;
}

.work-item__media--placeholder {
  min-height: 0;
}

.work-item__preview-button {
  display: block;
  width: 100%;
  padding: 0;
  cursor: pointer;
}

.case-preview {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.work-item__media > img {
  width: 100%;
  height: auto;
}

.work-item__title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.15;
  margin-top: 0.875rem;
  letter-spacing: -0.02em;
}

.work-item__note {
  font-size: 0.875rem;
  color: #666;
  margin-top: 0.35rem;
  line-height: 1.4;
}

.work-item__case-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.transition-main {
  min-height: 100dvh;
}

html.is-changing .transition-main {
  transition: opacity 320ms ease, transform 320ms ease;
}

html.is-animating .transition-main {
  opacity: 0;
  transform: translateY(8px);
}

html[data-swup-mode="shared"].is-changing .transition-main {
  transition: opacity 220ms ease-out, transform 220ms ease-out;
}

html[data-swup-mode="shared"].is-animating .transition-main {
  opacity: 0;
  transform: translateY(4px);
}

html[data-swup-mode="shared"] #swup[data-page="case-study"] .case-preview--hero {
  opacity: 0;
}

.case-hero {
  min-height: 0;
  padding: clamp(2rem, 5vw, 4rem) 1.5rem;
  background: #fff;
}

.case-hero__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.work-item--hero {
  display: grid;
  grid-template-columns: minmax(260px, 460px) minmax(320px, 760px);
  grid-template-rows: auto;
  align-items: start;
  max-width: none;
  gap: 0;
}

.case-preview--hero {
  grid-column: 2;
  grid-row: 1;
  margin-top: 0;
  border-radius: var(--preview-radius);
  overflow: hidden;
}

.case-hero__meta {
  grid-column: 1 / span 2;
  grid-row: 1;
  z-index: 2;
  max-width: min(72ch, 70%);
  padding-top: 0;
}

.case-hero__name {
  display: block;
  margin-top: 0;
  margin-bottom: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.case-hero__title {
  font-size: clamp(2rem, 5vw, 4.5rem);
  max-width: 18ch;
  margin-top: 0;
  display: block;
  line-height: 1.15;
}

#swup[data-page="case-study"] .case-hero__title {
  visibility: hidden;
}

/* One highlight strip per measured line; words animate above the backing */
.case-hero__title .title-line {
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: block;
  width: fit-content;
  max-width: 100%;
  white-space: nowrap;
  background-image: linear-gradient(#fff, #fff);
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 0% var(--title-line-highlight-height);
  padding: 0.02em 0.26em 0.02em 0;
  margin-top: 0;
  margin-bottom: 0;
  will-change: transform, opacity, background-size;
}

.case-hero__title .title-word {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 0;
  margin: 0;
  will-change: transform, opacity;
}

.case-content {
  padding: clamp(2rem, 4vw, 2.75rem) 1.5rem 5rem;
}

.case-content:first-of-type {
  padding-top: clamp(3.25rem, 6vw, 5.5rem);
}

.case-content__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Case-study body: subordinate to hero title; global h2 is display-sized */
.case-content h2 {
  font-size: clamp(1.35rem, calc(0.5rem + 2.2vw), 3rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}

.case-content p {
  max-width: 72ch;
  margin-bottom: 1rem;
  font-size: 1.25rem;
  line-height: 1.65;
}

/* Inline links in case-study body: underline by default, stronger on hover */
.case-content .case-content__inner a {
  color: var(--link-prose);
  text-decoration: underline;
  text-decoration-color: var(--link-prose-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.case-content .case-content__inner a:hover {
  color: var(--link-prose-hover);
  text-decoration-color: var(--link-prose-underline-hover);
}

.case-content .case-content__inner a:focus-visible {
  outline: 2px solid var(--link-prose);
  outline-offset: 3px;
}

.case-content .case-prompt a {
  color: var(--on-black-accent);
  text-decoration: underline;
  text-decoration-color: rgba(143, 212, 193, 0.45);
}

.case-content .case-prompt a:hover {
  color: #b8eadc;
  text-decoration-color: rgba(184, 234, 220, 0.85);
}

.case-content .case-prompt a:focus-visible {
  outline-color: var(--on-black-accent);
}

.case-content .case-prompt {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 2rem 1.15rem 2rem;
  max-width: 72ch;
  background: var(--black);
  color: var(--on-black);
  border-radius: var(--preview-radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.case-content .case-prompt__label {
  margin: 0 0 0.65rem;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-black-muted);
}

.case-content .case-prompt__body {
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: clamp(0.8rem, 0.35rem + 1.1vw, 0.95rem);
  line-height: 1.55;
  color: var(--on-black);
  word-break: break-word;
}

.case-content .case-prompt__q {
  color: var(--on-black-muted);
  user-select: none;
}

.case-content .case-prompt__slot {
  font-weight: 600;
  color: var(--on-black-accent);
  white-space: nowrap;
}

.case-content__media {
  margin: 1.25rem 0 1.5rem;
  max-width: 100%;
}

.case-content__media.frame,
.case-content__media--frame {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--black) 10%, transparent);
}

.case-content__media img {
  width: 100%;
  height: auto;
}

.case-content .case-content__media-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  margin: 1.25rem 0 1.5rem;
  width: 100%;
}

.case-content .case-content__media-row .case-content__media {
  margin: 0;
  min-width: 0;
}

@media (min-width: 900px) {
  .case-content .case-content__media-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.case-content .case-content__svg-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.6rem, 1.5vw, 1rem);
  margin: 1.25rem 0 1.5rem;
  width: 100%;
}

.case-content .case-content__svg-row svg {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
}

@media (max-width: 640px) {
  .case-content .case-content__svg-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.case-content__image {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 2.5vw, 1.25rem);
  margin: 1.5rem 0 1.75rem;
  width: 100%;
}

/*
 * Breakout rows inside .case-content (sibling to .case-content__inner).
 * Shared horizontal padding matches .case-content (1.5rem); never uses 100vw (scrollbar-safe).
 *
 * Sizes align with .case-content__inner--width-* / case-note:
 *   --full  viewport edge to edge (negative margin cancels section padding)
 *   --xl    wider than lg (1920 cap)
 *   --lg    matches --width-lg (1680)
 *   --md    matches --width-md / default inner (1200)
 *   --sm    matches --width-sm (840)
 *   --small matches case-note rail (720)
 */
.case-content__bleed {
  padding-inline: max(1.5rem, env(safe-area-inset-left, 0px)) max(1.5rem, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

.case-content__bleed--full {
  width: calc(100% + 3rem);
  margin-inline: -1.5rem;
}

.case-content__bleed--xl {
  width: min(1920px, calc(100vw - 3rem));
  max-width: 100%;
  margin-inline: auto;
}

.case-content__bleed--lg {
  width: min(1680px, calc(100vw - 3rem));
  max-width: 100%;
  margin-inline: auto;
}

.case-content__bleed--md {
  width: min(1200px, calc(100vw - 3rem));
  max-width: 100%;
  margin-inline: auto;
}

.case-content__bleed--sm {
  width: min(840px, calc(100vw - 3rem));
  max-width: 100%;
  margin-inline: auto;
}

.case-content__bleed--small {
  width: min(720px, calc(100vw - 3rem));
  max-width: 100%;
  margin-inline: auto;
}

.case-content__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.case-content__figure img {
  width: 100%;
  height: auto;
  border: 1px solid #e8e8e8;
}

.case-content__figure figcaption {
  font-size: 0.95rem;
  line-height: 1.4;
  color: #666;
}

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

.case-note {
  width: 100%;
  max-width: 720px; /* xs / extra-small rail */
  margin-inline: auto;
  padding: clamp(1.35rem, 3.5vw, 2rem) clamp(1.75rem, 6vw, 3.5rem);
  background: #f4f4f4;
  border-radius: var(--preview-radius);
}

.case-content .case-note h2 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

.case-content .case-note p {
  font-size: 1rem;
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.case-content .case-note p:last-child {
  margin-bottom: 0;
}

/* Readable column widths vs viewport — only desktop */
@media (min-width: 1260px) {
  .case-content__inner--width-sm {
    max-width: min(840px, calc(100vw - 3rem)); /* small rail */
  }

  .case-content__inner--width-md {
    max-width: min(1200px, calc(100vw - 3rem));
  }

  .case-content__inner--width-lg {
    max-width: min(1680px, calc(100vw - 3rem));
  }
}

@media (max-width: 900px) {
  .work-item--hero {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .case-preview--hero {
    grid-column: 1;
    margin-top: 0;
  }

  .case-hero__meta {
    grid-column: 1;
    max-width: none;
    padding-top: 0;
  }

  .case-hero__title {
    max-width: none;
  }
}
