/* ROBY Ventures: watercolour paper, ink and a few brand colours. */
:root {
  --paper: #F3EADB;       /* the original ROBY beige */
  --paper-deep: #EADFCB;
  --ink: #1F2E4A;          /* navy, from the mark */
  --ink-soft: #4A5468;
  --pen: #5B5148;          /* the brown-grey of the painted pen lines */
  --gold: #B99855;
  --burgundy: #6E1F2F;
  --rule: rgba(91, 81, 72, 0.22);

  --serif: "Cormorant Garamond", "EB Garamond", Garamond, Georgia, serif;
  --mark: "Libre Baskerville", Baskerville, "Baskerville Old Face", Georgia, serif;

  --gutter: clamp(16px, 4vw, 48px);
  --measure: 1280px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}
/* Cold-press watercolour paper over the whole page: everything looks painted onto it. */
/* It stays still while the content scrolls over it. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none;
  will-change: transform;            /* its own GPU layer, so scrolling never repaints the grain */
  background: url("img/paper.svg") repeat;
  background-size: 150px 150px;
  mix-blend-mode: multiply;
  opacity: .38;
}

a { color: inherit; }

/* ---------- Top bar: typed wordmark only ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--gutter);
  background: linear-gradient(var(--paper) 70%, rgba(243, 234, 219, 0));
}
.wordmark {
  font-family: var(--mark);
  font-size: 17px;
  letter-spacing: 0.34em;
  margin-right: -0.34em;            /* letter-spacing adds space after the last letter */
  text-decoration: none;
  color: var(--ink);
  line-height: 1;
}
.toplink {
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--pen);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: border-color .3s, color .3s;
}
.toplink:hover, .toplink:focus-visible { color: var(--burgundy); border-color: var(--gold); }

/* ---------- Hero ---------- */
.hero {
  min-height: min(calc(100svh - 70px), 760px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 24px var(--gutter) 72px;
}
.mark { width: min(300px, 62vw); height: auto; overflow: visible; }
/* The logo sits above the paper texture: solid colour, no grain showing through. */
.mark, .name { position: relative; z-index: 60; }
.name {
  margin: 34px 0 0;
  font-family: var(--mark);
  font-weight: 400;
  font-size: clamp(40px, 7vw, 64px);
  letter-spacing: 0.24em;
  margin-right: -0.24em;
  line-height: 1;
  color: var(--ink);
}
.name span {
  display: block;
  margin-top: 18px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(11px, 1.4vw, 14px);
  letter-spacing: 0.62em;
  margin-right: -0.62em;
  text-transform: uppercase;
  color: var(--burgundy);
}
.tagline {
  margin: 44px 0 0;
  font-style: italic;
  font-size: clamp(22px, 2.6vw, 28px);
  color: var(--ink-soft);
}

/* The mark assembles once: parents first, then the children. */
.mark .p, .mark .k { transform-box: fill-box; }
@media (prefers-reduced-motion: no-preference) {
  .mark .p { animation: rise 1.1s cubic-bezier(.2,.7,.2,1) both; transform-origin: 50% 100%; }
  .mark .p:nth-child(2) { animation-delay: .15s; }
  .mark .k { animation: drop .8s cubic-bezier(.2,.7,.2,1) both; transform-origin: 50% 0; }
  /* children arrive navy, light blue, pink, then burgundy last */
  .mark .k3 { animation-delay: .7s; }  .mark .k2 { animation-delay: .86s; }
  .mark .k4 { animation-delay: 1.02s; } .mark .k1 { animation-delay: 1.18s; }
  .name, .tagline { animation: fade 1.2s ease 1.1s both; }
  .tagline { animation-delay: 1.4s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scaleY(.9); } }
@keyframes drop { from { opacity: 0; transform: translateY(-10px) scaleY(.6); } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* ---------- The painted map ---------- */
.world {
  padding: 40px var(--gutter) 0;
}
.intro { text-align: center; max-width: 640px; margin: 64px auto 28px; }
h2 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.1;
  color: var(--ink);
}
h2 em { color: var(--burgundy); }
.intro p { margin: 14px 0 0; font-size: 21px; color: var(--ink-soft); font-style: italic; }

.atlas {
  position: relative;
  width: min(100%, var(--measure));
  margin: 0 auto;
  aspect-ratio: 650 / 360;
}

/* The flight: a tall scroll track with the map pinned in view while the plane crosses it. */
.flying .flight { height: 360vh; }
.flying .stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  display: flex; align-items: center; justify-content: center;
}
.flying .atlas { width: min(100%, var(--measure), calc((100svh - 150px) * 1.805)); margin-top: 40px; }

.route, .cloud-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; display: none; }
.flying .route, .flying .cloud-layer { display: block; }
.cloud-layer { z-index: 3; will-change: opacity; transition: opacity .6s ease; }
.clouds .puff { transition: opacity .35s linear; }
.trail {
  fill: none; stroke: none;          /* geometry only: the plane leaves clouds, not a line */
}
.plane {
  display: none;
  position: absolute; z-index: 4; left: 0; top: 0;
  will-change: transform, opacity;
  width: 9%; height: auto;
  filter: drop-shadow(0 6px 6px rgba(31, 46, 74, .12)) saturate(1.15);
  transition: opacity .5s ease;
  pointer-events: none;
}
.flying .plane { display: block; }
.map, .wash {
  position: absolute; inset: 0; width: 100%; height: 100%;
  /* dissolve the left and right edges into the paper */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%);
}
.map { opacity: .75; }
.wash { will-change: opacity; }               /* a faint map: the paintings and washes carry the section */

.places { list-style: none; margin: 0; padding: 0; }
/* Each painting sits on its city. --cx/--cy are map coordinates (see tools/build_map.py),
   --w is the painting width in % of the map. */
.place {
  position: absolute;
  left: calc((var(--cx) - 226) / 650 * 100%);
  top: calc((var(--cy) + 40) / 360 * 100%);
  width: calc(var(--w) * 1%);
  /* centre the painting on its city (margins in % follow the map width, like --w) */
  margin-left: calc(var(--w) * -0.5%);
  margin-top: calc(var(--w) * -0.36%);
  text-align: center;
}
.place.label-top { margin-top: calc(var(--w) * -0.36% - 30px); }
/* Layering across all six cities: colour bleeds at the back, paintings above, names on top. */
.place img.bleed { z-index: 0; }
.place img:not(.bleed) { z-index: 1; }
.label { position: relative; z-index: 5; }   /* above the plane too */
.art { position: relative; display: block; }
.place img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; }
.place img:not(.bleed) {
  position: relative;
  /* dissolve every edge of the painting into the map */
  -webkit-mask-image: radial-gradient(ellipse 62% 70% at 50% 56%, #000 76%, rgba(0,0,0,.85) 90%, transparent 100%);
          mask-image: radial-gradient(ellipse 62% 70% at 50% 56%, #000 76%, rgba(0,0,0,.85) 90%, transparent 100%);
  filter: saturate(1.2) contrast(1.06);
}
/* The same painting, blurred and spread wider underneath: its colours bleed out into the map
   like wet paint, so the blend reaches well past the painting's edge. */
.place img.bleed {
  position: absolute; inset: 0;
  transform: scale(2.1, 2.2);       /* img/bleed/*.png is already blurred (tools/build_bleeds.sh) */
  opacity: .6;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 52%, #000 50%, transparent 100%);
          mask-image: radial-gradient(ellipse 50% 50% at 50% 52%, #000 50%, transparent 100%);
}
.label {
  display: block;
  margin: 2px 0;
  font-variant: small-caps;
  text-transform: lowercase;      /* so small-caps renders as caps throughout, like the reference */
  font-size: clamp(15px, 1.6vw, 22px);
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #3F4A3C;
}

/* Reveal: each city is painted in as the plane lands (or, on phones, as it scrolls into view). */
.js .intro, .js .contact { opacity: 0; transition: opacity 1.4s ease; }
.js .intro.in, .js .contact.in { opacity: 1; }
/* Each city is its own GPU layer, so fading it in never re-renders its blurred colour bleed. */
/* .001, not 0: the browser draws each city ahead of time, so its first appearance costs nothing */
.js .place { opacity: .001; transition: opacity 1.1s ease; will-change: opacity; }
.js .place.in { opacity: 1; }

/* Phones and small tablets: map with pins on top, paintings listed underneath. */
@media (max-width: 820px) {
  .world { padding-bottom: 72px; }
  .intro { margin-top: 40px; }
  .atlas { aspect-ratio: auto; }
  .wash, .route, .cloud-layer, .plane { display: none !important; }
  .map { position: relative; display: block; height: auto; aspect-ratio: 650 / 360; }
  .places {
    display: grid; grid-template-columns: 1fr 1fr; gap: 28px 18px;
    margin-top: 24px;
  }
  .place, .place.label-top { position: static; width: auto; margin: 0; }
  .place img.bleed { transform: scale(1.3, 1.5); opacity: .4; }
  .place.label-top { display: flex; flex-direction: column-reverse; }
}
@media (max-width: 480px) {
  .places { grid-template-columns: 1fr; gap: 32px; }
  .art { max-width: 420px; margin: 0 auto; }
}

/* ---------- Contact ---------- */
.contact {
  text-align: center;
  padding: 24px var(--gutter) 112px;
}

.email {
  display: inline-block;
  margin-top: 22px;
  font-size: clamp(22px, 2.6vw, 28px);
  font-style: italic;
  color: var(--burgundy);
  text-decoration: none;
  border-bottom: 1px solid var(--gold);
  padding-bottom: 2px;
  transition: color .3s;
}
.email:hover, .email:focus-visible { color: var(--ink); }

/* ---------- Footer: the four children as a painted rule ---------- */
.foot {
  position: relative;
  padding: 26px var(--gutter) 34px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--pen);
}
.foot::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg,
    #6E1F2F 0 25%, #B9D2E3 25% 50%, #1F2E4A 50% 75%, #D9A3AC 75% 100%);
  opacity: .85;
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
