/* ================================================================
   MY ADVENTURES — postcard wall (redesign v4)
   Each card is the writing side of a postcard, drawn entirely in
   CSS/SVG in the Bridge palette: cream paper with a watercolour wash
   and deckled edge, a centre rule, ruled lines, a perforated stamp
   with a postmark, and the trip photo taped on the left.

   Every size inside a card is in container units (cqw = 1% of the
   card's width), so a card scales as one piece at any width.
   Class names are unchanged: js/adventure-story.js still drives the
   flip → expand on .pc / .pc-flip / .pc-open / .pc-back-photo.
   ================================================================ */
:root {
  /* One wash for the card back, the flying photo and the story hero */
  --photo-wash:
    linear-gradient(to top, rgba(62, 40, 40, 0.56), rgba(62, 40, 40, 0) 52%),
    linear-gradient(to bottom, rgba(233, 166, 139, 0.14), rgba(233, 166, 139, 0));
}
.adventures {
  position: relative;
  padding: clamp(56px, 7vw, 96px) 0 clamp(72px, 9vw, 120px);
}
.adv-heading {
  max-width: 1394px;
  margin: 0 auto clamp(36px, 4.5vw, 64px);
  padding: 0 clamp(24px, 6.39vw, 92px);
}
.pc-row {
  max-width: 1394px;
  margin: 0 auto;
  padding: 0 clamp(24px, 6.39vw, 92px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(40px, 7vw, 101px) clamp(24px, 8vw, 120px);
}
@media (max-width: 720px) {
  .pc-row { grid-template-columns: 1fr; }
}

/* ---- Card shell ---- */
.pc {
  position: relative;
  width: 100%;
  aspect-ratio: 537 / 356;
  margin: 0;
  isolation: isolate;
  perspective: 1600px;
  container-type: inline-size;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.6s var(--ease-spring);
}
.pc:nth-child(4n+1) { --tilt: -1.4deg; }
.pc:nth-child(4n+2) { --tilt: 1.1deg; }
.pc:nth-child(4n+3) { --tilt: 0.9deg; }
.pc:nth-child(4n+4) { --tilt: -1deg; }
.pc:hover { transform: rotate(0deg) translateY(-6px); }
/* Straight while flipped/open, so the photo flight lines up with it */
.pc.is-flipped { transform: rotate(0deg); }
.pc.is-flipped:hover { transform: rotate(0deg) translateY(-6px); }

.pc-flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
}
.pc-face {
  position: absolute;
  inset: 0;
  /* Flatten each face into its own plane so the front's layers can't
     escape into .pc-flip's 3D context and paint over the back. */
  transform: translateZ(0);
  transform-style: flat;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  isolation: isolate;
}
.pc-face--back { transform: rotateY(180deg); }
.pc.is-flipped .pc-flip { transform: translateZ(12px) rotateY(180deg); }

/* ---- Paper ---- */
.pc-paper {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 0.6cqw;
  background-color: #FFFCF6;
  background-image:
    /* a wash of the stamp's colour bleeding in from the corner */
    radial-gradient(60% 70% at 100% 0%, var(--wash, rgba(233,166,139,0.16)), transparent 70%),
    radial-gradient(45% 55% at 0% 100%, rgba(169,179,154,0.07), transparent 70%),
    /* paper fibre */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.48 0 0 0 0 0.36 0 0 0 0 0.3 0 0 0 0.10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  /* deckled edge + a two-layer, mauve-tinted shadow */
  filter: url(#wc-edge-fine)
          drop-shadow(0 1px 1px rgba(94,65,64,0.10))
          drop-shadow(0 14px 22px rgba(94,65,64,0.18));
}
/* Deeper shadow on hover — its own layer, so only opacity animates */
.pc::before {
  content: '';
  position: absolute;
  inset: 4% 3% 0;
  z-index: -1;
  border-radius: 1cqw;
  box-shadow: 0 30px 44px -18px rgba(94,65,64,0.42);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.pc:hover::before { opacity: 1; }

.pc-heading {
  position: absolute;
  top: 4.6cqw;
  left: 52.5cqw;
  z-index: 1;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2.5cqw;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  color: rgba(122, 88, 86, 0.62);
}
.pc-rule {
  position: absolute;
  left: 52.5cqw;
  top: 10.5cqw;
  bottom: 6cqw;
  width: 1px;
  z-index: 1;
  background: linear-gradient(to bottom, rgba(122,88,86,0.42), rgba(122,88,86,0.22));
}

/* ---- Stamp: perforated edge via a radial mask on the paper border ---- */
.pc-stamp {
  position: absolute;
  top: 5.4cqw;
  right: 5.4cqw;
  width: 15cqw;            /* 10 × the 1.5cqw perforation pitch */
  height: 18cqw;           /* 12 × the pitch */
  padding: 0.9cqw;
  z-index: 2;
  background: #FFFDF9;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle at center, #0000 0.5cqw, #000 0.54cqw) -0.75cqw -0.75cqw / 1.5cqw 1.5cqw;
          mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle at center, #0000 0.5cqw, #000 0.54cqw) -0.75cqw -0.75cqw / 1.5cqw 1.5cqw;
  transform: rotate(2deg);
  transition: transform 0.6s var(--ease-spring);
}
.pc:hover .pc-stamp { transform: rotate(-1deg) scale(1.03); }
.pc-stamp-art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(to bottom, var(--st-sky-1), var(--st-sky-2));
  box-shadow: inset 0 0 0 0.35cqw #FFFDF9, inset 0 0 0 0.5cqw rgba(94,65,64,0.12);
}
.pc-stamp-art svg { display: block; width: 100%; height: 100%; }
.s-sun  { fill: var(--st-sun); }
.s-far  { fill: var(--st-far); }
.s-near { fill: var(--st-near); }

/* Stamp palettes — the data keys stay blue/terracotta/green/pink */
.pc-stamp--blue       { --st-sky-1: #D7E3DE; --st-sky-2: #F3E3CC; --st-sun: #F3D9A8; --st-far: #8EA59D; --st-near: #597373; }
.pc-stamp--terracotta { --st-sky-1: #EBA88D; --st-sky-2: #F6D3C1; --st-sun: #F7E3B8; --st-far: #C98872; --st-near: #7A5856; }
.pc-stamp--green      { --st-sky-1: #DCE1CF; --st-sky-2: #F1EAD8; --st-sun: #F3DCA9; --st-far: #A9B39A; --st-near: #6F7F62; }
.pc-stamp--pink       { --st-sky-1: #EFC9C3; --st-sky-2: #F8E4D6; --st-sun: #F6DDB2; --st-far: #C99A97; --st-near: #8F6664; }
.pc:has(.pc-stamp--blue)       { --wash: rgba(89, 115, 115, 0.13); }
.pc:has(.pc-stamp--terracotta) { --wash: rgba(233, 166, 139, 0.20); }
.pc:has(.pc-stamp--green)      { --wash: rgba(169, 179, 154, 0.22); }
.pc:has(.pc-stamp--pink)       { --wash: rgba(201, 154, 151, 0.20); }

/* ---- Postmark, struck across the stamp's corner ---- */
.pc-postmark {
  position: absolute;
  top: 11cqw;
  right: 12.5cqw;
  width: 25cqw;
  height: auto;
  z-index: 3;
  color: rgba(94, 65, 64, 0.5);
  font-family: var(--font-body);
  font-weight: 600;
  transform: rotate(-9deg);
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* ---- Photo, taped down left of the rule ---- */
.pc-photo {
  position: absolute;
  left: 12.5cqw;
  top: 10cqw;
  width: 34cqw;
  height: 46cqw;
  z-index: 2;
  padding: 1.1cqw;
  background: #FFFDF9;
  box-shadow:
    0 0.2cqw 0.4cqw rgba(94,65,64,0.12),
    0 1.6cqw 2.8cqw -1.2cqw rgba(94,65,64,0.40);
  transform: rotate(-2.2deg);
  transition: transform 0.6s var(--ease-spring);
}
.pc:hover .pc-photo { transform: rotate(-0.6deg) translateY(-0.4cqw); }
.pc-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.92) contrast(0.98);
}
.pc-tape {
  position: absolute;
  top: -1.8cqw;
  left: 50%;
  width: 13cqw;
  height: 3.8cqw;
  transform: translateX(-50%) rotate(-5deg);
  background: rgba(233, 166, 139, 0.55);
  box-shadow: 0 0.2cqw 0.5cqw rgba(94,65,64,0.10);
  /* torn tape ends */
  -webkit-mask: linear-gradient(90deg, transparent 0, #000 0.6cqw, #000 calc(100% - 0.6cqw), transparent 100%);
          mask: linear-gradient(90deg, transparent 0, #000 0.6cqw, #000 calc(100% - 0.6cqw), transparent 100%);
}

/* ---- Place name, running up the left edge ---- */
.pc-name {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12cqw;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.pc-name span {
  display: block;
  transform: rotate(-90deg);
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 7.4cqw;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--mauve-deep);
}

/* ---- Ruled lines + note ---- */
.pc-lines {
  --lh: 6.6cqw;
  position: absolute;
  left: 57cqw;
  right: 6cqw;
  top: 30cqw;
  height: calc(var(--lh) * 4);
  z-index: 1;
  background: repeating-linear-gradient(to bottom,
    transparent 0 calc(var(--lh) - 1px),
    rgba(122, 88, 86, 0.30) calc(var(--lh) - 1px) var(--lh));
}
.pc-note {
  display: block;
  padding: 0 0.6cqw;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 4.1cqw;
  line-height: var(--lh);
  letter-spacing: 0;
  color: var(--ink);
  transform: translateY(-0.6cqw);   /* sit the baseline on the rule */
}

/* ---- Live postcard (has a story) ----------------------------------
   A transparent button sits above both faces so the hit area stays
   put while the card turns. Hover/focus previews the reverse;
   js/adventure-story.js drives flip → expand on click. */
.pc--live { cursor: pointer; }
.pc-open {
  position: absolute;
  inset: -6px;
  z-index: 10;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
}
.pc-open:focus-visible {
  outline: 2px solid var(--mauve);
  outline-offset: 4px;
}
.pc--live:active .pc-flip { transform: translateZ(12px) rotateY(180deg) scale(0.985); }

/* ---- Picture side (revealed by the flip) ---- */
.pc-back-photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 0.6cqw;
  background: var(--mauve-deep);
  border: 1.4cqw solid #FFFCF6;
  box-shadow:
    0 1px 2px rgba(94,65,64,0.12),
    0 26px 40px -22px rgba(94,65,64,0.55);
}
.pc-back-photo > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pc-back-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--photo-wash);
  pointer-events: none;
}
.pc-back-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 15%;
  z-index: 2;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 7.6cqw;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #FFFCF6;
}
.pc-back-cue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7.5%;
  z-index: 2;
  text-align: center;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: max(10px, 2.1cqw);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 252, 246, 0.82);
}
.pc-back-cue::after {
  content: ' \2192';
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.pc.is-flipped .pc-back-cue::after { transform: translateX(4px); }

/* ================================================================
   ADVENTURE STORY — full-page expansion
   Same structure and geometry as before (every size inside
   .story-col is a fraction of --w, the 836px design column); type and
   colour now follow the site: Adelphe for the writing, Synonym for
   labels, and the paper / mauve / bay palette.
   ================================================================ */
.story {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  pointer-events: none;
}
.story.is-open {
  visibility: visible;
  pointer-events: auto;
}
.story-morph {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(70% 40% at 85% 0%, rgba(233, 166, 139, 0.16), transparent 70%),
    radial-gradient(60% 40% at 0% 100%, rgba(169, 179, 154, 0.16), transparent 70%),
    var(--paper);
  transform-origin: 0 0;
  will-change: transform;
  box-shadow: 0 40px 90px -50px rgba(94, 65, 64, 0.55);
}
.story-scroll {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  will-change: transform, opacity;
}
body.story-locked { overflow: hidden; }

.story-fly {
  position: fixed;
  z-index: 3;
  overflow: hidden;
  background: var(--mauve-deep);
  transform-origin: 0 0;
  will-change: transform, clip-path;
  backface-visibility: hidden;
  pointer-events: none;
}
.story-fly img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Same wash as the card back and the story hero, so the photo's tone
   doesn't jump at either end of the flight. */
.story-fly::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--photo-wash);
  pointer-events: none;
}
/* The flying place name — text only, above the photo clone */
.story-fly.story-fly-title {
  z-index: 4;
  margin: 0;
  overflow: visible;
  background: none;
  box-shadow: none;
  white-space: nowrap;
  will-change: transform;
}
.story-fly.story-fly-title::after { content: none; }
.story-hero-photo.is-handing-off > img,
.story-hero-photo.is-handing-off::after,
.story-hero-photo.is-handing-off .story-hero-title { opacity: 0; }

/* Back button */
.story-close {
  position: absolute;
  left: clamp(18px, 3.2vw, 46px);
  top: clamp(16px, 2.2vw, 32px);
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px 10px 14px;
  background: rgba(255, 252, 248, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(122, 88, 86, 0.16);
  border-radius: 999px;
  box-shadow: var(--lift-1);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--mauve-deep);
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.32s ease 0.34s,
    border-color 0.2s ease,
    box-shadow 0.3s ease,
    transform 0.4s var(--ease-spring);
}
.story.is-open .story-close { opacity: 1; }
.story-close svg { width: 16px; height: 16px; flex: none; transition: transform 0.4s var(--ease-spring); }
.story-close:hover {
  border-color: rgba(122, 88, 86, 0.32);
  box-shadow: var(--lift-2);
}
.story-close:hover svg { transform: translateX(-3px); }
.story-close:focus-visible {
  outline: 2px solid var(--mauve);
  outline-offset: 3px;
}
.story-close:active { transform: scale(0.97); }

/* ---- Design column: 836 of the 1440 frame ---- */
.story-col {
  --w: min(836px, calc(100vw - 2 * clamp(20px, 5.5vw, 92px)));
  width: var(--w);
  margin: 0 auto;
  padding-top: max(64px, calc(var(--w) * 0.0981));
  padding-bottom: calc(var(--w) * 0.7416);
  color: var(--ink);
}

/* ---- Hero: photo in a caption frame ---- */
.story-hero {
  margin: 0;
  width: 100%;
  aspect-ratio: 836 / 688;
  display: flex;
  flex-direction: column;
  padding: calc(var(--w) * 0.012);
  background: var(--paper-hi);
  border-radius: calc(var(--w) * 0.03);
  box-shadow: var(--lift-3);
}
.story-hero-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 836 / 627;
  border-radius: calc(var(--w) * 0.02);
  overflow: hidden;
  flex: none;
}
.story-hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.story-hero-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--photo-wash);
  pointer-events: none;
}
.story-hero-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--w) * 0.03828);
  z-index: 1;
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: calc(var(--w) * 0.1);
  letter-spacing: -0.03em;
  line-height: 1;
  color: #FFFCF6;
}
.story-hero-cap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 calc(var(--w) * 0.03);
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: max(14px, calc(var(--w) * 0.024));
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--mauve);
}

/* ---- Body copy ---- */
.story-copy {
  margin-top: calc(var(--w) * 0.11244);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: max(18px, calc(var(--w) * 0.0275));
  letter-spacing: -0.005em;
  line-height: 1.6;
  color: var(--ink);
}
.story-copy p { margin: 0; }
.story-copy p + p { margin-top: 1.2em; }
.story-copy:not(.story-copy--closing) p:first-child::first-letter {
  float: left;
  font-size: 3.4em;
  line-height: 0.82;
  padding: 0.06em 0.1em 0 0;
  color: var(--mauve);
}
.story-copy--closing {
  margin-top: calc(var(--w) * 0.17703);
  margin-left: calc(var(--w) * 0.02033);
  width: 100%;
  padding-left: calc(var(--w) * 0.04);
  border-left: 2px solid rgba(233, 166, 139, 0.8);
  font-style: italic;
  color: var(--ink-soft);
}

/* ---- Map block ---- */
.story-map {
  position: relative;
  margin-top: calc(var(--w) * 0.02093);
  margin-left: calc(var(--w) * 0.02632);
  width: calc(var(--w) * 0.93541);
  aspect-ratio: 782 / 766;
}
.story-map-disc {
  position: absolute;
  left: 5.627%;
  top: 3.655%;
  width: 94.373%;
  height: 96.345%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 30%, rgba(240, 214, 167, 0.75), rgba(240, 214, 167, 0) 45%),
    radial-gradient(circle at 40% 80%, rgba(169, 179, 154, 0.16), rgba(169, 179, 154, 0) 55%),
    #F4E9DA;
  border-radius: 49% 51% 47% 53% / 52% 47% 53% 48%;
  z-index: 1;
}
.story-map-svg {
  position: absolute;
  left: 12.276%;
  top: 5.614%;
  width: 65.729%;
  height: 86.423%;
  display: block;
  z-index: 2;
}
.story-map-dot {
  position: absolute;
  left: 67.008%;
  top: 31.462%;
  width: 3.964%;
  height: 4.047%;
  border-radius: 50%;
  background: var(--mauve);
  box-shadow: 0 0 0 calc(var(--w) * 0.008) rgba(255, 252, 246, 0.9);
  z-index: 3;
}
.story-map-dot::after {
  /* a slow ping, like a pin on a live map */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--mauve);
  animation: map-ping 2.6s var(--ease-out) infinite;
}
@keyframes map-ping {
  from { transform: scale(1); opacity: 0.7; }
  to   { transform: scale(3); opacity: 0; }
}
.story-map-city {
  position: absolute;
  left: 71.867%;
  top: 28.59%;
  z-index: 3;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: calc(var(--w) * 0.07177);
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--mauve);
}

/* Fact card */
.story-facts {
  position: absolute;
  left: 0;
  top: 0;
  width: 27.11%;
  height: 35.509%;
  box-sizing: border-box;
  background: var(--paper-hi);
  border: calc(var(--w) * 0.00957) solid #FFFDF9;
  border-radius: calc(var(--w) * 0.024);
  box-shadow: var(--lift-2);
  z-index: 4;
}
.story-flag {
  position: absolute;
  left: 16.327%;
  top: 7.813%;
  width: 69.898%;
  height: 35.938%;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--w) * 0.004);
  box-shadow: 0 2px 6px rgba(94, 65, 64, 0.18);
}
.story-fact {
  position: absolute;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  line-height: 1.25;
  color: var(--ink);
}
.story-fact b {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: max(13px, calc(var(--w) * 0.028));
  letter-spacing: -0.01em;
}
.story-fact span {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: max(8.5px, calc(var(--w) * 0.0145));
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bay);
}
.story-fact .is-muted { color: var(--bay); }
.story-fact--1 { left: 51.531%; top: 48.438%; }
.story-fact--2 { left: 51.276%; top: 72.656%; }

@media (prefers-reduced-motion: reduce) {
  .pc, .pc-photo, .pc-stamp { transition: none; }
  .pc-flip { transition: none; }
  .story-close { transition: opacity 0.01s; }
  .pc-back-cue::after { transition: none; }
  .story-map-dot::after { animation: none; opacity: 0; }
}
