:root {
  color-scheme: light;
  --bg: #f7f1e8;
  --surface: #efe6d8;
  --border: #ddd0bc;
  --text: #231a14;
  --text-muted: #6b5d50;
  --accent: #c4532d;
  --accent-ink: #8f3519;
  --maxw: 1440px;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Type scale — perfect fourth (1.333) off a 1rem base */
  --text-xs: 0.5625rem;
  --text-sm: 0.75rem;
  --text-base: 1rem;
  --text-md: 1.333rem;
  --text-lg: 1.7769rem;
  --text-xl: 2.3686rem;
  --text-2xl: 3.1573rem;
  --text-3xl: 4.2087rem;
}

html {
  font-size: 17px;
}

/* Below 720px switch to a tighter minor-third ratio (1.2) off the same
   1rem base so headings compress without shrinking body text. */
@media (max-width: 720px) {
  :root {
    --text-xs: 0.6944rem;
    --text-sm: 0.8333rem;
    --text-base: 1rem;
    --text-md: 1.2rem;
    --text-lg: 1.44rem;
    --text-xl: 1.728rem;
    --text-2xl: 2.0736rem;
    --text-3xl: 2.4883rem;
  }
}

/* Paper scheme applies in both light and dark system settings. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #f7f1e8;
    --surface: #efe6d8;
    --border: #ddd0bc;
    --text: #231a14;
    --text-muted: #6b5d50;
    --accent: #c4532d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--text-base)/1.7 var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

article {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  letter-spacing: -0.015em;
}

h1 {
  font-weight: 800;
  color: var(--text);
}

h2, h3 {
  font-weight: 600;
}

h4 {
  font-weight: 600;
  font-size: var(--text-md);
  line-height: 1.3;
}

main {
  padding: 128px 60px 192px;
}

@media (max-width: 720px) {
  main {
    padding: 64px 20px 80px;
  }

  /* main already provides the side gutter on small screens — drop .wrap's
     and .text-wrap's own padding so every section lines up on the same
     margin and runs full width. */
  .wrap,
  .text-wrap {
    width: 100%;
    margin: 0 auto;
    padding: 0;
  }
}

.wrap {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
}

/* Keyboard focus, switched to light on the dark footer. */
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.page-footer :focus-visible { outline-color: var(--bg); }

.back-link {
  display: inline-block;
  margin: 0 0 32px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.back-link:hover {
  background: var(--accent);
  color: var(--bg);
}

.text-wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

h1 {
  font-size: var(--text-3xl);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0 0 64px;
}

/* Must follow the unconditional h1 rule to win the cascade. */
@media (max-width: 720px) {
  h1 {
    font-size: 2.25rem;
    margin: 0 0 40px;
  }
}

h2 {
  font-size: var(--text-xl);
  line-height: 1.15;
  margin: 56px 0 36px;
}

h3 {
  font-size: var(--text-lg);
  line-height: 1.2;
  margin: 32px 0 16px;
  color: var(--text);
}

p {
  margin: 0 0 16px;
  max-width: 760px;
}

a { color: var(--accent-ink); }

ul { margin: 0 0 1em; padding-left: 1.25em; }

li { margin: 0 0 0.75em; }

li h4 { margin-top: 0; }

img {
  width: 100%;
}

.overview {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 24px;
  align-items: start;
  margin: 0 0 8px;
}

@media (max-width: 720px) {
  .overview {
    grid-template-columns: 1fr;
    gap: 48px;
  }
}

.meta {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 720px) {
  .meta {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
  }
}

.meta li {
  margin: 0;
  width: 100%;
  padding: 12px 0;
}

@media (max-width: 719px) {
  .meta li { width: calc(50% - 8px); }
}

.meta .label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-ink);
  margin-bottom: 2px;
}

.meta strong { font-weight: 500; }

.intro {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
  max-width: 50ch;
}

.context, .solution-section {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.context__text > :first-child {
  margin-top: 0;
}

/* Lists of goals / challenges / outcomes / feedback read as open
   editorial columns rather than tiled cards: no fill, rules or radius. */
.goals ul,
.challenges ul,
.outcomes ul,
.feedback-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
}

.goal,
.challenge,
.outcome,
.feedback-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 28px 0;
}

.goal__icon,
.challenge__icon,
.outcome__icon,
.feedback-item__icon {
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.goal span {
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: 1.45;
}

@media (min-width: 640px) {
  .challenges ul {
    grid-template-columns: 1fr 1fr;
    column-gap: 48px;
  }
}

.challenge h3 {
  font-size: var(--text-md);
  line-height: 1.3;
  margin: 0 0 0.5rem;
}

.challenge p {
  margin: 0;
  color: var(--text-muted);
}

@media (min-width: 960px) {
  .outcomes ul {
    grid-template-columns: repeat(4, 1fr);
    column-gap: 32px;
  }
}

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

.feedback-item p {
  margin: 0;
}

/* Reasons inside a solution block: unnumbered, each led by its bold
   lead-in on a line of its own. */
.reasons {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.reasons li {
  margin: 0 0 16px;
}

.reasons strong {
  display: block;
  font-weight: 600;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  background: var(--surface);
}

/* A pull quote in the magazine sense: oversized italic display serif with
   a hanging terracotta quote mark. */
.customer-quote {
  position: relative;
  margin: 64px 0 0;
  padding: 0 0 0 56px;
}

.customer-quote::before {
  content: "\201C";
  position: absolute;
  left: 0;
  top: -0.2em;
  font-family: var(--font-display);
  font-size: 5rem;
  line-height: 1;
  color: var(--accent);
}

.customer-quote p {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-xl);
  line-height: 1.25;
  color: var(--text);
  margin: 0 0 16px;
  max-width: 28ch;
}

.customer-quote cite {
  display: block;
  font-style: normal;
  font-weight: 600;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.context__media {
  margin: 24px 0;
  border-radius: 4px;
  overflow: hidden;
}

.context__media img,
.context__media video {
  display: block;
  width: 100%;
  height: auto;
}

/* Two-column skills table that sits in a split layout's media slot. */
.skills-table {
  padding:1rem;
}

.skills-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
  line-height: 1.5;
}

.skills-table th {
  text-align: left;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 16px 12px 0;
  border-bottom: 1px solid var(--border);
}

.skills-table td {
  vertical-align: top;
  padding: 16px 16px 16px 0;
  border-bottom: 1px solid var(--border);
}

.skills-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

.lottie {
  width: 100%;
  min-height: 200px; /* fallback until JS sets the real aspect-ratio */
}

.context__media .lottie svg {
  display: block;
}

/* Stand-in for media that hasn't been supplied yet — swap each one for an
   <img>, <video> or .lottie element. */
.media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.media .media-placeholder {
  aspect-ratio: 16 / 9;
  border-radius: 4px;
}

/* Hero animation sits on the same surface panel the placeholder used. */
.media .lottie {
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

@media (min-width: 960px) {
  .context__body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 64px;
    align-items: start;
  }
  .context__body > .context__media {
    margin: 0;
  }
}

@media (min-width: 961px) {
  .solution-section {
    gap: 96px;
  }
}

/* Split image / text layouts for the solution sections.
   *-2-1 = image two-thirds, text one-third; *-1-1 = 50/50.
   image-right-* flips the visual order so the figure sits on the right.

   The heading sits outside .text-wrap (a sibling before the figure) so
   that on small screens the DOM order gives title -> media -> content.
   From 721px up they're arranged as a grid via named areas. */

.image-left-2-1 h3,
.image-right-2-1 h3,
.image-left-1-1 h3,
.image-right-1-1 h3 {
  margin-top: 0;
}

@media (min-width: 721px) {
  .image-left-2-1 .text-wrap,
  .image-right-2-1 .text-wrap,
  .image-left-1-1 .text-wrap,
  .image-right-1-1 .text-wrap {
    padding: 0;
    margin: 0;
    max-width: none;
  }

  .image-left-2-1,
  .image-right-2-1,
  .image-left-1-1,
  .image-right-1-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: min-content 1fr;
    gap: 0 64px;
    align-items: start;
  }

  .image-left-2-1,
  .image-left-1-1 {
    grid-template-areas:
      "media title"
      "media text";
  }

  .image-right-2-1,
  .image-right-1-1 {
    grid-template-areas:
      "title media"
      "text media";
  }

  .image-left-2-1 .context__media,
  .image-right-2-1 .context__media,
  .image-left-1-1 .context__media,
  .image-right-1-1 .context__media {
    grid-area: media;
    margin: 0;
  }

  .image-left-2-1 h3,
  .image-right-2-1 h3,
  .image-left-1-1 h3,
  .image-right-1-1 h3 {
    grid-area: title;
  }

  .image-left-2-1 .text-wrap,
  .image-right-2-1 .text-wrap,
  .image-left-1-1 .text-wrap,
  .image-right-1-1 .text-wrap {
    grid-area: text;
  }
}

@media (min-width: 961px) {
  .image-left-2-1 {
    grid-template-columns: 2fr 1fr;
    column-gap: 40px;
  }
  .image-left-2-1 p:last-child {
    margin-bottom: 0;
  }

  .image-right-2-1 {
    grid-template-columns: 1fr 2fr;
  }
}

/* Stacked layout: title, then media at the full width of the .wrap,
   then text in a readable column. Same order at every screen size. */
.stacked h3 {
  margin-top: 0;
}

.stacked .stacked__media {
  width: 100%;
  margin: 24px 0 32px;
}

.stacked .text-wrap {
  margin: 0;
}

.media {
  position: relative;
  margin: 0 auto;
  background: var(--surface);
  border: 1px dashed var(--border); 
  border-radius: 4px;
  overflow: hidden;
}

.media video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Scroll drives this video's playhead, so it has no native controls — this
   gives keyboard and screen-reader users a real, focusable way to play it
   without needing to scroll at all. */
.media__toggle {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(35, 26, 20, 0.65);
  color: #fff;
  cursor: pointer;
}

.media__toggle:hover {
  background: rgba(35, 26, 20, 0.85);
}

.media__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.media__toggle-icon--play {
  margin-left: 2px; /* optically centre the play triangle */
}

/* Looping diagrams carry the same toggle, to pause them. */
.motion-figure {
  position: relative;
}

/* Chrome's SVG UA stylesheet doesn't apply display:none for [hidden]. */
.media__toggle-icon[hidden] {
  display: none;
}

/* Full-bleed ink close to the page — sits outside <main> so it isn't
   constrained by main's side padding. */
.page-footer {
  background: var(--text);
  padding: clamp(3rem, 6vw, 4.5rem) 0;
  margin-top: clamp(3rem, 8vw, 6rem);
}

.page-footer .wrap {
  padding: 0 60px;
}

@media (max-width: 720px) {
  .page-footer .wrap {
    padding: 0 20px;
  }
}

.page-footer__eyebrow {
  color: #b39c86;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 12px;
}

.page-footer h2 {
  color: var(--bg);
  max-width: 16ch;
  margin: 0 0 32px;
}

.page-footer__cta {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-md);
  padding: 16px 32px;
  border-radius: 999px;
  background: var(--bg);
  margin: 0 0 48px;
  transition: background 0.15s, color 0.15s;
}

.page-footer__cta:hover {
  background: var(--accent);
  color: var(--bg);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(247, 241, 232, 0.15);
}

.footer-link {
  color: #cdbca9;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--bg);
}
