/* Cittopia home page: the paper world (loaded after paper-theme.css).
   Cut-paper city in depth layers, clouds, postcards, the green band, the portal notes and the SDG deck. */

:root {
  --leaf-1: #DCEBDF; --leaf-2: #A9D3BF; --sun: #FFC222; --sky-dot: #6BBCE6; --lime: #C4D756; --clay: #9C6C44;
}

/* ------------------------------------------------------------------ hero */
body.paper .hero,
body.paper #hero {
  background: linear-gradient(180deg, #F9F4EA 0%, #F3EEDF 46%, #E6F0E6 100%) !important;
  isolation: isolate;
  min-height: calc(100dvh - 64px);
  padding-top: clamp(1.25rem, 2.8vh, 2.5rem) !important;
  padding-bottom: 2.5rem;
  align-items: flex-start;
  overflow-x: clip;
  overflow-y: visible;
}
body.paper #hero-canvas { display: none !important; }   /* the old globe; the paper world replaces it */

.paper-world { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.paper-world canvas.dots { position: absolute; inset: 0; width: 100%; height: 100%; }
.paper-sun {
  position: absolute; width: clamp(110px, 12vw, 190px); aspect-ratio: 1; border-radius: 50%;
  right: 12%; top: 16%; background: var(--sun);
  box-shadow: 0 0 0 14px rgba(255,194,34,.16), 0 0 0 30px rgba(255,194,34,.08), 6px 10px 0 -2px rgba(150,110,20,.18);
}
.paper-layer { position: absolute; left: -4%; right: -4%; bottom: 0; will-change: transform; }
.paper-layer svg { display: block; width: 100%; height: 100%; }
.paper-layer.l1 { height: 66%; filter: drop-shadow(0 -2px 0 rgba(255,255,255,.7)) drop-shadow(0 6px 8px rgba(60,70,50,.10)); }
.paper-layer.l2 { height: 56%; filter: drop-shadow(0 -2px 0 rgba(255,255,255,.55)) drop-shadow(0 8px 10px rgba(30,60,45,.16)); }
.paper-layer.l3 { height: 34%; filter: drop-shadow(0 -2px 0 rgba(255,255,255,.35)) drop-shadow(0 10px 14px rgba(20,45,35,.24)); }
.paper-layer.l4 { height: 17%; filter: drop-shadow(0 -3px 0 rgba(255,255,255,.18)) drop-shadow(0 -8px 16px rgba(10,30,20,.28)); }
.paper-cloud {
  position: absolute; height: auto; will-change: transform;
  filter: drop-shadow(0 6px 0 rgba(160,150,125,.18)) drop-shadow(0 12px 18px rgba(80,70,50,.10));
  animation: cloud-drift linear infinite;
}
@keyframes cloud-drift { from { transform: translateX(-30vw); } to { transform: translateX(130vw); } }
.paper-tram { animation: tram 26s linear infinite; }
@keyframes tram { from { transform: translateX(-12%); } to { transform: translateX(112%); } }

/* hero copy sits on the sky, in front of everything */
body.paper .hero-container { z-index: 3; transform: translateZ(0); /* own layer: otherwise Chrome can paint the paper layers over the text */ }
body.paper .hero-copy h1 { -webkit-text-fill-color: initial; background: none; color: var(--ink); }
body.paper .hero-pillars .pillar-text {
  color: var(--ink) !important; -webkit-text-fill-color: var(--ink) !important; background: none !important;
  text-shadow: 0 2px 0 rgba(255,255,255,.75);
}
body.paper .hero-pillars .pillar-dot { box-shadow: 0 3px 0 rgba(0,0,0,.18), inset 0 -3px 0 rgba(0,0,0,.12); }
body.paper .hero-copy p { color: #3E4C45 !important; }

/* the search becomes a strip of paper pinned to the sky */
body.paper .hero-search-form {
  background: #FFFDF8 !important; border: 1.5px solid var(--ink) !important; border-radius: 18px !important;
  box-shadow: 0 6px 0 -1px var(--paper-2), 0 6px 0 0 var(--ink), 0 22px 30px -18px rgba(40,30,10,.35) !important;
  transform: rotate(-.4deg);
}
body.paper .hero-search-btn { background: var(--leaf-4) !important; border-radius: 12px !important; box-shadow: 0 4px 0 #0E211A !important; }
body.paper .hero-search-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0E211A !important; }

/* featured cities become postcards stuck on the paper ground */
body.paper .featured-cities { position: relative; z-index: 3; }
body.paper .city-card {
  border: 9px solid #FFFDF8 !important; border-bottom-width: 30px !important; border-radius: 6px !important;
  box-shadow: 0 2px 0 var(--paper-edge), 0 18px 28px -14px rgba(30,25,10,.45) !important;
}
body.paper .featured-cities .city-card:nth-child(1) { transform: rotate(-3deg); }
body.paper .featured-cities .city-card:nth-child(2) { transform: rotate(1.5deg) translateY(-8px); }
body.paper .featured-cities .city-card:nth-child(3) { transform: rotate(-1deg); }
body.paper .featured-cities .city-card:hover { transform: rotate(0) translateY(-10px) scale(1.03); }
body.paper .city-card::after { /* a strip of tape */
  content: ""; position: absolute; top: -14px; left: 50%; width: 74px; height: 22px; transform: translateX(-50%) rotate(-4deg);
  background: rgba(255,240,200,.75); box-shadow: 0 1px 2px rgba(0,0,0,.08); z-index: 3;
}

/* ------------------------------------------------------------------ sections */
body.paper section:not(.hero):not(#traction) { background-color: transparent; }
body.paper #how-it-works, body.paper #for-cities, body.paper #latest-insights { background: var(--paper) !important; }

/* torn paper edge at the top of each tinted section */
body.paper #traction { position: relative; }
body.paper #traction::after {
  content: ""; position: absolute; left: 0; right: 0; top: -22px; height: 24px; pointer-events: none;
  -webkit-mask: var(--tear) no-repeat center / 100% 100%; mask: var(--tear) no-repeat center / 100% 100%;
  filter: drop-shadow(0 -2px 1px rgba(80,60,30,.10));
}
body.paper #traction::after { background: var(--leaf-4); }

/* cards: home tilts them like loose sheets (base paper look is in paper-theme.css) */
body.paper .row > div:nth-child(odd) > .card, body.paper .row > div:nth-child(odd) > .step-card { transform: rotate(-.6deg); }
body.paper .row > div:nth-child(even) > .card, body.paper .row > div:nth-child(even) > .step-card { transform: rotate(.5deg); }
body.paper .card:hover, body.paper .step-card:hover {
  transform: rotate(0) translateY(-6px) !important;
  box-shadow: 0 1px 0 #fff inset, 8px 10px 0 -1px var(--paper-2), 8px 10px 0 0 var(--paper-edge), 0 30px 36px -24px rgba(40,30,10,.45) !important;
}
body.paper .step-number-bg { color: rgba(44,165,141,.14) !important; }
body.paper .step-icon-wrapper { border-radius: 50% !important; box-shadow: 0 4px 0 rgba(27,58,47,.18) !important; }

/* the green traction band: dark paper with its own constellation */
body.paper #traction { background: var(--leaf-4) !important; overflow-x: clip; }
body.paper #traction > canvas.dots { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
body.paper #traction > .container { position: relative; z-index: 1; transform: translateZ(0); /* own layer, above the dot canvas */ }

@media (max-width: 760px) {
  .paper-sun { right: 6%; top: 10%; width: 84px; }
  .paper-layer.l1 { height: 34%; } .paper-layer.l2 { height: 28%; } .paper-layer.l3 { height: 22%; } .paper-layer.l4 { height: 11%; }
  body.paper .featured-cities .city-card { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .paper-cloud, .paper-tram { animation: none !important; }
}

/* ================================================================== traction band */
/* stats: each number sits on a paper disc ringed by dots that draw in */
body.paper #traction .display-3 { position: relative; display: inline-block; z-index: 0; font-variant-numeric: tabular-nums; }
body.paper #traction .display-3::before {
  content: ""; position: absolute; left: 50%; top: 47%; width: 112px; height: 112px; z-index: -1;
  transform: translate(-50%, -50%) scale(.6); opacity: 0; border-radius: 50%;
  background: radial-gradient(circle, #24493C 0 60%, transparent 61%),
              repeating-conic-gradient(from 0deg, rgba(255,194,34,.9) 0 2deg, transparent 2deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 0 64%, transparent 64.5% 66%, #000 66.5% 70%, transparent 70.5%);
          mask: radial-gradient(circle, #000 0 64%, transparent 64.5% 66%, #000 66.5% 70%, transparent 70.5%);
  transition: transform 900ms cubic-bezier(.2,.8,.2,1), opacity 600ms;
}
body.paper #traction.in .display-3::before { transform: translate(-50%, -50%) scale(1) rotate(30deg); opacity: 1; }

/* the engine boxes: solid sheets of dark paper, equal height, no dots showing through */
body.paper #traction .row.g-3 > [class*="col-"] { display: flex; }
body.paper #traction .row.g-3 .p-3.rounded-3 {
  flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 22px 22px 20px !important;
  background: #24493C !important; border: 1px solid #3A6656 !important; border-radius: 14px !important;
  box-shadow: 5px 6px 0 -1px #163128, 5px 6px 0 0 #0F241C, 0 24px 30px -22px rgba(0,0,0,.6);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms;
  position: relative;
}
body.paper #traction .row.g-3 > [class*="col-"]:nth-child(odd)  .p-3.rounded-3 { transform: rotate(-.6deg); }
body.paper #traction .row.g-3 > [class*="col-"]:nth-child(even) .p-3.rounded-3 { transform: rotate(.5deg); }
body.paper #traction .row.g-3 .p-3.rounded-3:hover { transform: translateY(-6px) rotate(0); box-shadow: 8px 10px 0 -1px #163128, 8px 10px 0 0 #0F241C, 0 30px 34px -22px rgba(0,0,0,.65); }
body.paper #traction .row.g-3 .p-3.rounded-3 > div:first-child {   /* "Engine 1" becomes a paper tag */
  align-self: flex-start; background: #FFC222; color: #1B3A2F; opacity: 1 !important; border-radius: 6px;
  padding: 3px 8px 2px; margin-bottom: 8px; box-shadow: 0 2px 0 #B98600;
}
body.paper #traction .btn { box-shadow: 0 5px 0 #0F241C !important; border: 1.5px solid #0F241C !important; }

/* staged entrance for the band */
body.paper #traction .row.g-3 > [class*="col-"] { opacity: 0; transform: translateY(26px); transition: opacity 600ms, transform 700ms cubic-bezier(.2,.8,.2,1); }
body.paper #traction.in .row.g-3 > [class*="col-"] { opacity: 1; transform: none; }
body.paper #traction.in .row.g-3 > [class*="col-"]:nth-child(2) { transition-delay: 120ms; }
body.paper #traction.in .row.g-3 > [class*="col-"]:nth-child(3) { transition-delay: 240ms; }
body.paper #traction.in .row.g-3 > [class*="col-"]:nth-child(4) { transition-delay: 360ms; }

/* ================================================================== open-data portals */
/* the portals are paper notes pinned with coloured dots, swaying a little */
body.paper #open-data .container > div:last-child { gap: 1.3rem 0.9rem !important; padding-top: 10px; }
body.paper #open-data .container > div:last-child > a {
  position: relative; transform-origin: 50% 0; padding-top: 1.1rem !important;
  background: #FFFDF8 !important; border: 1px solid var(--paper-edge) !important; border-radius: 6px 6px 12px 12px !important;
  box-shadow: 3px 4px 0 -1px var(--paper-2), 3px 4px 0 0 var(--paper-edge), 0 14px 18px -14px rgba(40,30,10,.45) !important;
  animation: sway 5.5s ease-in-out infinite; transition: box-shadow 200ms;
}
body.paper #open-data .container > div:last-child > a::before {   /* the pin: a dot */
  content: ""; position: absolute; left: 50%; top: -6px; width: 13px; height: 13px; border-radius: 50%; transform: translateX(-50%);
  background: var(--pin, #2CA58D); box-shadow: 1px 3px 0 rgba(0,0,0,.18), inset -2px -2px 0 rgba(0,0,0,.15);
}
body.paper #open-data .container > div:last-child > a:nth-child(5n+1) { --pin: #9C6C44; }
body.paper #open-data .container > div:last-child > a:nth-child(5n+2) { --pin: #6BBCE6; animation-delay: -1.4s; animation-duration: 6.2s; }
body.paper #open-data .container > div:last-child > a:nth-child(5n+3) { --pin: #C4D756; animation-delay: -2.8s; animation-duration: 4.9s; }
body.paper #open-data .container > div:last-child > a:nth-child(5n+4) { --pin: #2CA58D; animation-delay: -0.7s; animation-duration: 5.9s; }
body.paper #open-data .container > div:last-child > a:nth-child(5n+5) { --pin: #FFC222; animation-delay: -2.1s; animation-duration: 5.2s; }
body.paper #open-data .container > div:last-child > a:hover { animation-play-state: paused; box-shadow: 5px 7px 0 -1px var(--paper-2), 5px 7px 0 0 var(--paper-edge), 0 20px 22px -14px rgba(40,30,10,.5) !important; }
@keyframes sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }

/* ================================================================== UN SDGs */
body.paper #sdg { overflow: hidden; }
body.paper .sdg-paper-layer {
  background: #FFFDF8 !important; border: 1px solid var(--paper-edge) !important; border-radius: 10px !important; padding: 14px 14px 34px !important;
  box-shadow: 0 1px 0 #fff inset, 3px 4px 0 -1px var(--paper-2), 3px 4px 0 0 var(--paper-edge), 0 18px 26px -20px rgba(40,30,10,.45) !important;
  transition: transform 700ms cubic-bezier(.2,.9,.25,1.15), box-shadow 400ms !important;
}
body.paper .sdg-paper-layer img { border-radius: 4px; }
body.paper .sdg-paper-layer.active {
  transform: translate(-34px, -26px) rotate(-5deg) scale(1.08) !important;
  box-shadow: 0 1px 0 #fff inset, 6px 8px 0 -1px var(--paper-2), 6px 8px 0 0 var(--paper-edge), 0 34px 40px -22px rgba(40,30,10,.55) !important;
  border-color: var(--sdg-c, var(--paper-edge)) !important;
}
body.paper .sdg-paper-layer.active::after {   /* tape on the card in front */
  content: ""; position: absolute; top: -12px; left: 50%; width: 80px; height: 22px; transform: translateX(-50%) rotate(3deg);
  background: rgba(255,240,200,.8); box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
body.paper .sdg-paper-layer.flip-out { animation: flip-out 650ms cubic-bezier(.4,0,.2,1); }
@keyframes flip-out { 0% { transform: translate(-34px,-26px) rotate(-5deg) scale(1.08); } 45% { transform: translate(-150px,-60px) rotate(-22deg) scale(1.02); } 100% { transform: none; } }

body.paper .sdg-text-panel {
  background: #FFFDF8 !important; border: 1px solid var(--paper-edge) !important; border-radius: 16px !important; position: relative;
  box-shadow: 0 1px 0 #fff inset, 6px 7px 0 -1px var(--paper-2), 6px 7px 0 0 var(--paper-edge), 0 30px 40px -30px rgba(40,30,10,.45) !important;
  border-top: 6px solid var(--sdg-c, #3F7E44) !important; transition: border-color 500ms;
}
body.paper .sdg-text-content.active h3, body.paper .sdg-text-content.active li { animation: rise 600ms cubic-bezier(.2,.8,.2,1) both; }
body.paper .sdg-text-content.active li:nth-child(1) { animation-delay: 120ms; }
body.paper .sdg-text-content.active li:nth-child(2) { animation-delay: 240ms; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* the goal discs: paper coins with a ring that shows the autoplay progress */
body.paper .sdg-nav { gap: 1.25rem !important; position: relative; }
body.paper .sdg-nav-btn { position: relative; border: 0 !important; box-shadow: 0 5px 0 rgba(0,0,0,.22), inset 0 -4px 0 rgba(0,0,0,.14) !important; }
body.paper .sdg-nav-btn::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  background: conic-gradient(var(--ring, #1B3A2F) calc(var(--p, 0) * 1turn), rgba(27,58,47,.12) 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
          mask: radial-gradient(closest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
  opacity: 0; transition: opacity 300ms;
}
body.paper .sdg-nav-btn.active::after { opacity: 1; }
body.paper .sdg-nav-btn.active { transform: translateY(-8px) scale(1.12) !important; box-shadow: 0 10px 0 rgba(0,0,0,.18), inset 0 -4px 0 rgba(0,0,0,.14) !important; }
.sdg-burst { position: absolute; width: 10px; height: 10px; border-radius: 50%; pointer-events: none; z-index: 30; box-shadow: 1px 2px 0 rgba(0,0,0,.15); }

@media (prefers-reduced-motion: reduce) {
  body.paper #open-data .container > div:last-child > a, body.paper .sdg-paper-layer.flip-out { animation: none; }
}

/* ================================================================== the Stories cast (Google Flow papercraft cut-outs) */
.paper-cast { position: absolute; inset: 0; will-change: transform; }
.paper-figure { position: absolute; bottom: 6%; height: clamp(170px, 23vh, 250px); width: auto;
  filter: drop-shadow(4px 8px 0 rgba(20,40,30,.18)) drop-shadow(0 18px 18px rgba(20,40,30,.22)); }
.paper-figure.ola     { left: 7%;  animation: figure-breathe 6s ease-in-out infinite; transform-origin: 50% 100%; }
.paper-figure.officer { right: 8%; animation: figure-breathe 7s ease-in-out -2s infinite; transform-origin: 50% 100%; }
@keyframes figure-breathe { 0%, 100% { transform: rotate(-.6deg); } 50% { transform: rotate(.6deg) translateY(-2px); } }
.paper-figure.tram { bottom: 1.2%; height: clamp(64px, 9vh, 96px); left: 0; z-index: 2;
  filter: drop-shadow(3px 6px 0 rgba(10,30,20,.25)); animation: tram-roll 34s linear infinite; }
@keyframes tram-roll { from { transform: translateX(-30vw); } to { transform: translateX(120vw); } }
@media (max-width: 760px) {
  .paper-figure.ola, .paper-figure.officer { display: none; }   /* the phone hero is too narrow for the cast */
  .paper-figure.tram { height: 52px; }
}
@media (prefers-reduced-motion: reduce) { .paper-figure { animation: none !important; } .paper-figure.tram { left: 8%; } }
