/* Amble · research landing page — editorial feature (R8)
   Built like a newspaper scroll feature: a display headline set into the painting,
   text cards that scroll over a still image, a slim top bar with progress and the button,
   a narrow article column, and a full-bleed closing. */

:root {
  --pine: #0F3D24;
  --moss: #2F6E3E;
  --ink: #22402E;
  --muted: #4A5E50;
  --sky: #F9F8F4;          /* off-white; both paintings' skies were recoloured to match */
  --persimmon: #E8552B;
  --rule: rgba(15, 61, 36, .14);

  --sans: "Figtree", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;

  --gutter: clamp(20px, 5vw, 72px);
  --inset: clamp(24px, 8.9vw, 128px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --fade: clamp(120px, 16vw, 220px);   /* the long walk's soft bottom edge, kept below the fold while it holds still */
  --paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .06 0 0 0 0 .2 0 0 0 0 .12 0 0 0 1.6 -.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain: .32;      /* strength of the print grain on the paintings */
}

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

html { -webkit-text-size-adjust: 100%; background: var(--sky); }

body {
  margin: 0;
  background: var(--sky);
  color: var(--pine);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Light paper grain over the whole site. It scrolls with the page, like paper, rather than staying fixed to the screen.
   It sits under the pinned long walk (z-index 26), which carries its own copy that drifts with the painting. */
body { position: relative; }
body::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  opacity: .16;
  background: var(--paper) 0 0 / 220px 220px;
}

img { display: block; max-width: none; }
p, h1, figure { margin: 0; }

/* ---------- Shared ---------- */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--pine);
  text-decoration: none;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.035em;
  line-height: 1;
}
.logo-small { font-size: 20px; gap: 6px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 26px;
  border-radius: 999px;
  background: var(--pine);
  color: var(--sky);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .35s var(--ease), background-color .35s var(--ease);
}
.button:hover { background: #164d2f; transform: translateY(-2px); }
.button:focus-visible { outline: 3px solid var(--persimmon); outline-offset: 3px; }
.button-small { padding: 10px 18px; font-size: 14px; }

/* Kicker: a quiet serif italic line above the headline */
.kicker {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(17px, 1.6vw, 22px);
  color: var(--moss);
}

/* ---------- Top bar ---------- */

.topbar {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto 0;
  height: 60px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* equal side columns keep the title on the page's centre line */
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
  background: rgba(249, 248, 244, .9);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--rule);
}
.topbar-title {
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .logo { justify-self: start; }
.topbar .button { justify-self: end; transition: opacity .4s var(--ease), visibility 0s .4s, transform .35s var(--ease), background-color .35s var(--ease); }
.topbar.cta-elsewhere .button { opacity: 0; visibility: hidden; pointer-events: none; }
.topbar:not(.cta-elsewhere) .button { transition: opacity .4s var(--ease), visibility 0s, transform .35s var(--ease), background-color .35s var(--ease); }
.progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--moss);
  transform-origin: 0 50%;
  transform: scaleX(var(--read, 0));
}
.js .topbar { transform: translateY(-101%); visibility: hidden; }
.js .topbar.shown { transform: none; visibility: visible; }
.motion .topbar { transition: transform .6s var(--ease), visibility 0s .6s; }
.motion .topbar.shown { transition: transform .6s var(--ease), visibility 0s; }

/* ---------- Scrollytelling ---------- */

.scrolly { position: relative; }

.scrolly-media {
  position: sticky;
  top: 0;
  height: calc(100vh + var(--fade));
  height: calc(100svh + var(--fade));
  min-height: calc(560px + var(--fade));
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - var(--fade)), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - var(--fade)), transparent);
}
.scrolly-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 32%;
}
/* With JS the painting is placed precisely: walkers in view, hills under the headline */
.js .scrolly-media img {
  position: absolute;
  left: 0;
  top: 0;
  object-fit: fill;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14%);
  mask-image: linear-gradient(180deg, transparent 0, #000 14%);
}

/* Print grain on the paintings. Drawn at screen resolution (a 512px tile shown at 256px, so 2× on retina),
   so it stays crisp however far the painting itself is scaled up, and reads as tooth and pigment rather than blur.
   Overlay blend: it textures the hills and the path but barely touches the off-white sky.
   The sky-coloured backgrounds give the blend something to sit on where the paintings fade out. */
.scrolly-media,
.closing-media { background: var(--sky); isolation: isolate; }
.scrolly-media::after,
.closing-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: url("images/grain.png") 0 0 / 256px 256px;
  mix-blend-mode: overlay;
  opacity: var(--grain);
}
/* The pinned painting sits above the site's paper grain, so it carries its own copy of that paper as well */
.scrolly-media { z-index: 26; }
.scrolly-media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .16;
  background: var(--paper) 0 0 / 220px 220px;
}
/* The long walk drifts while pinned: the grain is sized and moved with it (main.js), so it reads as printed on the painting */
.js .scrolly-media::before,
.js .scrolly-media::after {
  inset: auto;
  left: 0;
  top: 0;
  width: var(--img-w, 100%);
  height: var(--img-h, 100%);
  transform: var(--img-t, none);
  will-change: transform;
}

.scrolly-steps {
  position: relative;
  z-index: 27;   /* above the pinned painting */
  margin-top: calc(-100vh - var(--fade));
  margin-top: calc(-100svh - var(--fade));
}

/* Cover: masthead + headline set into the dip of the hills */
.cover {
  position: relative;
  height: 84vh;
  height: 84svh;       /* shorter than the view, so the first card follows the headline closely */
  min-height: 520px;
}
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: clamp(20px, 4.2svh, 38px) var(--gutter) 0;
}
.masthead-credit { font-size: 15px; color: var(--moss); text-align: right; }

.cover-text {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: clamp(96px, 14.5svh, 160px);
  text-align: center;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.headline em, .closing-text em { font-style: italic; }
.headline {
  margin-top: clamp(24px, 3.8svh, 38px);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 300;
  font-size: min(5vw, 6.8svh, 74px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--pine);
  text-wrap: balance;
}

/* Steps: cards that scroll over the still painting */
.step {
  min-height: 92vh;
  min-height: 92svh;
  display: flex;
  align-items: center;
  padding: 0 var(--inset);
}
.step:last-child { min-height: calc(112vh + var(--fade)); min-height: calc(112svh + var(--fade)); }
.card {
  max-width: 430px;
  padding: 30px 34px 32px;
  /* Frosted glass: the painting shows through, softened */
  border-radius: 10px;
  background: linear-gradient(150deg, rgba(255, 255, 255, .58), rgba(249, 248, 244, .34));
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid rgba(15, 61, 36, .07);   /* faint thin outline, no shadow */
}
.card p {
  font-family: var(--serif);
  font-size: clamp(19px, 1.55vw, 22px);
  line-height: 1.48;
  color: var(--ink);
}
.card .button { margin-top: 24px; }

/* ---------- Article ---------- */

.article {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(40px, 5vw, 80px) 24px clamp(48px, 5vw, 72px);
  font-family: var(--serif);
  font-size: clamp(19px, 1.4vw, 21px);
  line-height: 1.65;
  color: var(--ink);
}
.article p + p { margin-top: 1.1em; }
.lede {
  font-size: clamp(22px, 1.75vw, 25px);
  line-height: 1.48;
  color: var(--pine);
}
.lede::first-letter {
  float: left;
  font-size: 3.4em;      /* a two-line drop cap */
  line-height: .8;
  font-weight: 500;
  padding: .07em .08em 0 0;
  color: var(--moss);
}
.article .lede + p { margin-top: 1.4em; }

/* ---------- Closing ---------- */
/* The words sit in open page; the landscape's sky (recoloured to the page) rises up to meet them */

.closing { position: relative; }
.closing-text {
  position: relative;
  z-index: 2;
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(24px, 3vw, 48px) 24px 0;
  text-align: center;
}
.closing-text p {
  font-family: var(--serif);
  font-size: clamp(26px, 2.5vw, 38px);
  line-height: 1.22;
  letter-spacing: -0.012em;
  color: var(--pine);
  text-wrap: balance;
}
.closing-text .button { margin-top: 28px; }
.closing-text .closing-meta {
  margin-top: 14px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: .01em;
  color: var(--muted);
}
.closing-media {
  position: relative;
  margin-top: clamp(-150px, -9vw, -40px);   /* tuck the empty sky up under the button */
}
.closing-media img {
  width: 100%;
  height: auto;
  aspect-ratio: 2752 / 1536;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12%);
  mask-image: linear-gradient(180deg, transparent 0, #000 12%);
}

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

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  padding: 26px var(--gutter) 30px;
  font-size: 14px;
  color: #2F4A38;
  border-top: 1px solid var(--rule);
}
.footer a:not(.logo) {
  color: var(--pine);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(15, 61, 36, .35);
}
.footer a:not(.logo):hover { text-decoration-color: var(--pine); }

/* ---------- Motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.motion .masthead { animation: fade 1s var(--ease) both; }
.motion .kicker { animation: rise 1s var(--ease) .15s both; }
.motion .headline { animation: rise 1.2s var(--ease) .3s both; }
/* The logo draws itself, then the dot lands at the end of the line */
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.motion .masthead .logo-line { stroke-dasharray: 1; animation: draw 1.5s cubic-bezier(.65,0,.35,1) .2s both; }
.motion .masthead .logo-dot { animation: fade .35s ease-out 1.65s both; }
.motion .scrolly-media { opacity: 0; transition: opacity 1.2s var(--ease); }
.motion .scrolly-media.ready { opacity: 1; }

.motion .card,
.motion .reveal,
.motion .article > * { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.motion .card.in,
.motion .reveal.in,
.motion .article > .in { opacity: 1; transform: none; }

/* ---------- Phones ---------- */

@media (max-width: 600px) {
  :root { --inset: 20px; }
  .masthead { align-items: center; gap: 16px; }
  .masthead-credit {
    max-width: 15em;          /* wraps onto two lines in the top-right corner */
    text-align: right;
    font-size: 12.5px;
    line-height: 1.4;
    text-wrap: balance;
  }
  .cover-text { top: clamp(132px, 19svh, 168px); left: 20px; right: 20px; }
  .kicker { font-size: 17px; }
  .headline { font-size: min(36px, 9.4vw); }

  .topbar { height: 54px; gap: 12px; grid-template-columns: 1fr auto; }
  .topbar-title { display: none; }

  .card { padding: 24px 24px 26px; }
  .card p { font-size: 19px; }

  .lede { font-size: 22px; }

  .closing-text { padding-top: 24px; }
  .closing-text p { font-size: 26px; }
  .closing-media { margin-top: 8px; }
  .closing-media img { aspect-ratio: 4 / 5; object-position: 47% 50%; }
}
