@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;1,400&family=Playfair+Display:ital,wght@0,400;0,600;1,400;1,600&display=swap');

:root {
  --font-body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
  --paper: #ffffff;
  --ink: #1A1A1A;
  --divider: #E8E4DC;
  --brand: #8D8CB6; /* the desk purple, so the white pages match the homepage */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--paper);
}

/* A page of its own: white, full width, with the site's own bar on top. */
/* The same container as every other page: this width, 56px of air at the sides. */
.cs-page {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 0 56px;
  min-height: 100vh;
  animation: cs-fade-in 0.4s ease;
}

@keyframes cs-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 20px 0;
}

.site-nav {
  grid-row: 1;
  grid-column: 1;
  justify-self: start;
  align-items: center;
  display: flex;
  gap: 22px;
}

.site-nav__tab {
  color: var(--brand);
  text-decoration: none;
  font-size: 1.2rem;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.site-nav__tab:hover { opacity: 1; }

.topbar__home {
  grid-row: 1;
  grid-column: 2;
  justify-self: center;
  line-height: 0;
}

.topbar__logo {
  display: block;
  height: 72px; /* same as every other page */
  width: auto;
  -webkit-user-drag: none;
}

.social {
  grid-row: 1;
  grid-column: 3;
  justify-self: end;
  align-items: center;
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social a {
  display: block;
  color: var(--brand);
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.social a:hover {
  opacity: 1;
  transform: translateY(-2px);
}

/* Solid marks, each fitted inside the same square so they line up optically. */
.social svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}

/* The burger only exists on a phone; the media query below switches it on. */
.nav-toggle {
  display: none;
  grid-row: 1;
  grid-column: 3;
  justify-self: end;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  margin: 5px auto;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

/* Open, the three lines fold into a cross. */
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 640px) {
  .topbar { padding: 16px 0; }
  .topbar__logo { height: 52px; }

  .nav-toggle { display: block; }

  /* The tabs and the icons leave the bar's top row and wait underneath it. */
  .site-nav,
  .social {
    grid-column: 1 / -1;
    justify-self: center;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease, visibility 0.3s;
  }

  .site-nav {
    grid-row: 2;
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .social {
    grid-row: 3;
    gap: 26px;
    /* the panel clips what sticks out, so leave room for the hover lift */
    padding: 6px 0;
  }

  .site-nav__tab { font-size: 1.25rem; }
  .social svg { width: 24px; height: 24px; }

  /* Open, the bar becomes a panel in the deeper purple, so the menu turns white.
     It reaches past the page's own side padding, edge to edge. */
  body.nav-open .topbar {
    background: #575690;
    border-radius: 0 0 28px 28px; /* softens the panel where it meets the page */
    margin: 0 -24px;
    padding: 16px 24px;
  }

  body.nav-open .site-nav__tab,
  body.nav-open .social a,
  body.nav-open .nav-toggle {
    color: var(--paper);
  }

  body.nav-open .site-nav,
  body.nav-open .social {
    max-height: 200px;
    opacity: 1;
    visibility: visible;
    margin-top: 44px;
  }

  body.nav-open .social {
    margin-top: 38px; /* 44 less the padding above */
    margin-bottom: 38px;
  }
}


/* A pill, like the filters on the work page, with an arrow leading back. */
.back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px; /* puts it at the same height as the button on the other pages */
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 9px 20px;
  color: var(--brand);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.back svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.back:hover {
  background: var(--brand);
  color: var(--paper);
}

/* Back to top: appears once you've scrolled a screenful or so. */
.to-top {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 20;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(26, 26, 26, 0.07);
  backdrop-filter: blur(4px);
  color: var(--brand);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, visibility 0.25s;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  background: rgba(26, 26, 26, 0.12);
}

.to-top svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 640px) {
  .to-top { right: 20px; bottom: 20px; width: 60px; height: 60px; }
}

.cs-header {
  padding: 8px 0 0;
}

.cs-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}

.cs-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.cs-meta__left,
.cs-meta__right {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}

.cs-meta__right {
  text-align: right;
}

.cs-tag-row {
  margin-top: 80px;
  text-align: center;
}

.cs-tag {
  display: inline-block;
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 6px 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  cursor: default;
  user-select: none;
}

.cs-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  margin: 15px 0 60px;
  line-height: 1.1;
  text-align: center;
}

.cs-title em {
  font-style: italic;
  font-weight: 400;
}

.cs-hook {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink);
  border-left: 3px solid var(--accent, #FF5436);
  padding-left: 20px;
  margin: 0 0 40px;
}

.cs-placeholder {
  padding: 0 0 80px;
}

.cs-slot {
  border: 1px dashed var(--divider);
  border-radius: 12px;
  padding: 60px 24px;
  text-align: center;
  color: #a39d8f;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.cs-hero {
  margin: 0;
  padding: 0 0 100px;
}

.cs-hero img {
  width: 100%;
  display: block;
  border-radius: 30px;
}

/*
  What the company is sits beside the scope; the challenge and what I did follow
  underneath, stacked in the same column as the intro.
*/
.cs-body {
  display: grid;
  grid-template-columns: 1fr 0.5fr;
  column-gap: 80px;
  row-gap: 64px;
  align-items: start;
  padding: 0 0 100px;
}

.cs-intro p {
  font-size: 1.3rem;
  line-height: 1.75;
  margin: 0;
}

.cs-columns {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 40px;
}

.cs-col p {
  font-size: 1.2rem;
  line-height: 1.75;
  margin: 0;
}

/* A case study with no client scope: one column, held to a readable measure. */
.cs-body--solo {
  grid-template-columns: 1fr;
}

.cs-body--solo .cs-body__main {
  max-width: 720px;
}

/* Same treatment as "The Challenge" and "What I Did". */
.cs-scope__title {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 16px;
}

.cs-scope__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 1.05rem;
  color: var(--ink);
}

.cs-scope__list li {
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 8px 18px;
}

@media (max-width: 720px) {
  .cs-body,
  .cs-columns {
    grid-template-columns: 1fr;
    row-gap: 40px;
  }
}

.cs-block {
  padding: 48px 0;
  border-bottom: 1px solid var(--divider);
}

.cs-block:first-child {
  padding-top: 0;
}

.cs-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.cs-block__label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 16px;
}

.cs-block__heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 16px;
}

.cs-block p {
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--ink);
  margin: 0;
}

.cs-gallery {
  padding: 0 0 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.cs-gallery img,
.cs-gallery__video {
  width: 100%;
  display: block;
  border-radius: 12px;
}

/* Artwork gallery: pieces sit two-up at close to their native size, so they
   stay crisp instead of being stretched across the full column width. */
.cs-gallery--art {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  align-items: start;
}

.cs-gallery--art img {
  width: 100%;
  height: auto;
}

/* A piece given the full row, capped so it never scales past its own pixels. */
.cs-gallery--art .cs-art-wide {
  grid-column: 1 / -1;
  max-width: 820px;
  margin: 0 auto;
}

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

.cs-gallery__caption {
  font-size: 1.2rem; /* same as the Challenge and What I Did text */
  line-height: 1.75;
  color: var(--ink);
  margin: 40px 0;
  text-align: center;
}

@media (min-width: 641px) {
  .cs-gallery__caption {
    max-width: 620px;
    margin: 40px auto;
  }
}

@media (max-width: 640px) {
  .cs-page { padding: 0 24px; }
}

.cs-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 32px 0 48px;
  margin-top: auto;
}

/* Same pill as "Back to work". */
.cs-nav a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 9px 20px;
  color: var(--brand);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.cs-nav a:hover {
  background: var(--brand);
  color: var(--paper);
}

.cs-nav__next {
  margin-left: auto;
}

@media (max-width: 640px) {
  .cs-nav { padding: 24px 0; }
}
