/* ==========================================================================
   A Little More Polish — Rimoka campaign study by Ekpe Cobham
   Structure: two columns (text left, image column right), after the
   reference case study. Visual language: Rimoka — white, black, pale pink,
   a geometric sans set in tracked capitals, an italic serif for headlines.
   The page is always white. Edit colours, type and spacing in the tokens below.
   ========================================================================== */

/* Self-hosted typefaces (SIL Open Font License, licences in the fonts folder) */
@font-face {
  font-family: "Jost";
  src: url("../fonts/jost.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --ink: #000000;
  --muted: #737373;
  --rule: #e6e6e6;
  --pink: #fff1f1;        /* Rimoka's pale pink */
  --grey: #f7f7f7;        /* Rimoka's light section grey */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.25, 1);

  --sans: "Jost", "Futura", "Century Gothic", "Helvetica Neue", Arial, sans-serif;
  --serif: "Playfair Display", "Didot", "Bodoni 72", Georgia, serif;

  --margin: clamp(1rem, 1.4vw, 1.5rem);
  --header-h: 3.5rem;
  --stack-gap: 6px;
  --col: min(40vw, calc((100svh - var(--header-h) - 1.5rem) * 0.8));

  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: inherit; }

html {
  scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--header-h) + var(--stack-gap));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
html.is-locked { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Covers the phone status-bar area above the sticky header */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--paper);
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: 1rem;
  z-index: 40;
  padding: 0.7rem 1.2rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-300%);
}
.skip-link:focus { transform: none; }

/* ---------- Layout: text column + image column ---------- */

.layout { padding-inline: var(--margin); }

@media (min-width: 56em) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max(22rem, var(--col));
    column-gap: clamp(2rem, 6vw, 8rem);
  }
}

/* ---------- Type ---------- */

.label,
.meta dt {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.6875rem;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-subtitle {
  max-width: 24rem;
  font-size: 1.125rem;
  line-height: 1.45;
}

.section-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.875rem, 2.5vw, 2.5rem);
  line-height: 1.05;
  margin-bottom: 1.25rem;
}

.prose { max-width: 27rem; }
.prose p { font-size: 0.875rem; line-height: 1.65; }
.prose p + p { margin-top: 0.85rem; }
.page-subtitle + .prose { margin-top: 1.75rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.875rem;
  margin-top: 1.75rem;
  padding: 0 1.9rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: linear-gradient(var(--paper), var(--paper)) 0 0 / 0% 100% no-repeat var(--ink);
  color: var(--paper);
  font: 500 0.75rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-size 0.5s var(--ease-in-out), color 0.3s ease;
}
.button:hover { background-size: 100% 100%; color: var(--ink); }

/* Links that draw and retract their underline */
.text-link {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  transition: background-size 0.45s var(--ease-in-out);
}
.text-link:hover { background-size: 0% 1px; background-position: 100% 100%; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--paper);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  min-height: var(--header-h);
  padding-block: 0.6rem;
}

.site-header__credit {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  justify-self: start;
}

.site-nav { position: relative; display: flex; gap: clamp(0.25rem, 2vw, 3rem); }
.site-nav a {
  position: relative;
  z-index: 1;
  transition: color 0.3s ease;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="true"] { color: var(--paper); text-decoration: none; }
.site-nav__pill {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--ink);
  opacity: 0;
  transition: transform 0.5s var(--ease-in-out), width 0.5s var(--ease-in-out), opacity 0.25s ease;
}
.site-nav__pill.is-ready { opacity: 1; }

@media (max-width: 23.75em) {
  :root { --header-h: 5.25rem; }
}

@media (max-width: 30em) {
  .site-header__credit { padding: 0.3rem 0.7rem; letter-spacing: 0.1em; }
  .site-nav { gap: 0; margin-right: -0.5rem; }
  .site-nav a { padding: 0.3rem 0.5rem; letter-spacing: 0.1em; }
}

@media (min-width: 56em) {
  .site-header__inner { display: grid; align-items: center; padding-block: 0; }
  .site-nav { justify-content: center; }
}

/* ---------- Chapters ---------- */

.chapter + .chapter { margin-top: var(--stack-gap); }

.chapter__text { padding-block: 2.75rem 2.25rem; }
.chapter--intro .chapter__text { padding-top: 1.5rem; }

.chapter__images {
  display: grid;
  gap: var(--stack-gap);
  align-content: start;
}

@media (min-width: 56em) {
  .chapter__text { padding-block: 0; }
  .chapter--intro .chapter__text { padding-top: 0; }

  .chapter__sticky {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + var(--header-h) + 0.25rem);
    max-width: 27rem;
    padding-top: 0.75rem;
  }

  .chapter--intro .chapter__sticky {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
    min-height: calc(100svh - var(--header-h) - 2rem);
    padding-bottom: 1rem;
  }
}

/* On short screens the text simply scrolls with the page */
@media (min-width: 56em) and (max-height: 46em) {
  .chapter__sticky { position: static; }
  .chapter--intro .chapter__sticky { min-height: 0; }
}

/* ---------- Introduction details ---------- */

.intro__bottom { margin-top: 2.75rem; }
@media (min-width: 56em) { .intro__bottom { margin-top: 0; } }

.meta {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  column-gap: clamp(1.5rem, 3vw, 3rem);
  row-gap: 1rem;
}
.meta dd { margin-top: 0.35rem; font-size: 0.8125rem; line-height: 1.45; }

.independence {
  margin-top: 1.25rem;
  max-width: 24rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
}

.index { display: none; }
@media (min-width: 56em) {
  .index {
    display: grid;
    grid-template-columns: repeat(9, 2rem);
    gap: 3px;
    margin-top: 2rem;
  }
  .index a { display: block; aspect-ratio: 4 / 5; overflow: hidden; }
  .index img { width: 100%; height: 100%; object-fit: cover; }
  .index a { transition: translate 0.3s var(--ease-out); }
  .index a:hover { translate: 0 -3px; }
  .index a[aria-current="true"] { outline: 1px solid var(--ink); outline-offset: 1px; }
}

/* ---------- Brand reading ---------- */

.reading { margin-top: 1.5rem; max-width: 27rem; }
.reading li {
  padding-block: 0.65rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
}
.reading li:last-child { border-bottom: 1px solid var(--rule); }

/* ---------- Process ---------- */

.steps {
  counter-reset: step;
  display: grid;
  gap: 0.9rem;
  margin-top: 2rem;
  max-width: 27rem;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2rem 1fr;
  column-gap: 0.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1;
}
.steps__title {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}
.steps p {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Closing ---------- */

.closing-line {
  margin-top: 2rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(2rem, 3.1vw, 3rem);
  line-height: 1.05;
}
.closing-line span { display: block; }

/* ---------- Images ---------- */

.shot { position: relative; }

.shot__open {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--ph, var(--grey));
  overflow: hidden;
  cursor: zoom-in;
}
.shot__open img { width: 100%; height: 100%; object-fit: cover; }
html.has-chip .shot__open { cursor: none; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .shot__open img { transition: transform 1.2s var(--ease-out); }
  .shot__open:hover img { transform: scale(1.03); }
}
.shot__open:focus-visible { outline-offset: -4px; outline-color: var(--paper); box-shadow: inset 0 0 0 4px var(--ink); }

/* A smaller image floating in white space or on a pale panel */
.shot--panel {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  background: var(--panel, transparent);
}
.shot--white { --panel: var(--paper); }
.shot--pink { --panel: var(--pink); }
.shot--grey { --panel: var(--grey); }
.shot--panel .shot__open { width: 62%; translate: 0 var(--py, 0px); }
.shot--panel .shot__open:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; box-shadow: none; }
@media (min-width: 56em) { .shot--panel .shot__open { width: 52%; } }

/* ---------- Motion ----------
   The opening screen animates once on load. Everything below it is marked
   by the script and revealed as it scrolls into view. All of it switches off
   for visitors who prefer reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .chapter--intro .chapter__sticky { animation: rise 0.9s var(--ease-out) both; }
  .chapter--intro .shot:first-child .shot__open { animation: wipe 1.2s var(--ease-in-out) both; }
  .chapter--intro .shot:first-child img { animation: settle 1.8s var(--ease-out) both; }

  [data-reveal].pre:not(.is-in) { opacity: 0; }
  [data-reveal].pre.is-in { animation: rise 0.9s var(--ease-out) var(--d, 0s) backwards; }
  .section-title.pre.is-in,
  .closing-line span.pre.is-in { animation-name: mask-rise; animation-duration: 1s; }

  .shot.pre:not(.is-in) .shot__open { clip-path: inset(100% 0 0 0); }
  .shot.pre.is-in .shot__open { animation: wipe 1.1s var(--ease-in-out) backwards; }
  .shot.pre.is-in img { animation: settle 1.6s var(--ease-out) backwards; }

  .shot--panel.pre:not(.is-in) .shot__open { clip-path: none; opacity: 0; transform: translateY(2rem); }
  .shot--panel.pre.is-in .shot__open { animation: rise 1s var(--ease-out) 0.1s backwards; }
  .shot--panel.pre.is-in img { animation: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: none; }
}
@keyframes mask-rise {
  from { clip-path: inset(0 0 100% 0); transform: translateY(0.6em); }
  to { clip-path: inset(0 0 0 0); transform: none; }
}
@keyframes wipe {
  from { clip-path: inset(100% 0 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes settle {
  from { transform: scale(1.08); }
  to { transform: scale(1); }
}

/* Pointer label over images, on devices with a mouse */
.cursor-chip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 25;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 500 0.625rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  scale: 0.6;
  transition: opacity 0.2s ease, scale 0.3s var(--ease-out);
}
.cursor-chip.is-visible { opacity: 1; scale: 1; }

/* ---------- Closing reel: all 18 images in quick cuts ---------- */

.reel {
  --frame: 0.22s;
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--grey);
}
.reel__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}
.reel__frame:last-child { opacity: 1; }

.reel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
}
.reel__toggle {
  min-height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 0.625rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.reel__toggle:hover { background: var(--ink); color: var(--paper); }
.reel:not(.is-playing) + .reel__bar .reel__toggle { visibility: hidden; }

@media (prefers-reduced-motion: no-preference) {
  .reel.is-playing .reel__frame {
    animation: cut calc(var(--frame) * 18) steps(1, end) infinite;
    animation-delay: calc(var(--frame) * var(--i));
  }
  .reel.is-playing .reel__frame:last-child { opacity: 0; }
  .reel.is-paused .reel__frame { animation-play-state: paused; }
}
@media (prefers-reduced-motion: reduce) {
  .reel__bar .reel__toggle { display: none; }
}
@keyframes cut {
  0% { opacity: 1; }
  5.5556% { opacity: 0; }
  100% { opacity: 0; }
}

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  margin-top: clamp(4rem, 10vw, 8rem);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: var(--margin);
  border-top: 1px solid var(--rule);
}
.site-footer__inner {
  display: grid;
  align-content: end;
  gap: 0.75rem;
  min-height: clamp(10rem, 24vh, 15rem);
  padding-block: 2rem 1.5rem;
  font-size: 0.75rem;
  line-height: 1.5;
}
.site-footer__credit,
.site-footer__top {
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.site-footer__note { color: var(--muted); max-width: 30rem; }
.site-footer__top { justify-self: start; }

@media (min-width: 56em) {
  .site-footer__inner {
    grid-template-columns: minmax(0, 1fr) max(22rem, var(--col));
    column-gap: clamp(2rem, 6vw, 8rem);
    align-items: end;
  }
  .site-footer__credit { grid-column: 1; grid-row: 1; }
  .site-footer__note { grid-column: 1; grid-row: 2; }
  .site-footer__top { grid-column: 2; grid-row: 2; justify-self: end; }
}

/* ---------- Full-screen viewer ---------- */

.viewer {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}
.viewer[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.viewer::backdrop { background: var(--paper); }

.viewer__frame {
  --px: clamp(0.75rem, 3vw, 2rem);
  --pt: calc(env(safe-area-inset-top, 0px) + var(--px));
  position: relative;
  min-height: 0;
  touch-action: pan-y pinch-zoom;
}
.viewer__img {
  position: absolute;
  top: var(--pt);
  left: var(--px);
  width: calc(100% - 2 * var(--px));
  height: calc(100% - var(--pt));
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
@media (prefers-reduced-motion: no-preference) {
  .viewer__img { transition: opacity 0.25s ease; }
}
.viewer__img.is-loading { opacity: 0; }

.viewer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1rem clamp(0.75rem, 3vw, 2rem) calc(env(safe-area-inset-bottom, 0px) + 1rem);
}
.viewer__caption { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.75rem; }
.viewer__title {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.viewer__finish, .viewer__count { font-size: 0.8125rem; color: var(--muted); }

.viewer__controls { display: flex; gap: 0.5rem; }
.viewer__btn {
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 500 0.6875rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.viewer__btn:hover { background: var(--grey); }
.viewer__btn--solid { background: var(--ink); color: var(--paper); }
.viewer__btn--solid:hover { background: var(--ink); opacity: 0.85; }

@media (max-width: 30em) {
  .viewer__controls { width: 100%; }
  .viewer__btn { flex: 1; padding: 0 0.5rem; }
}
