/*
 * Home page parts with moving drawings: the road in "How renting works", the drawings on the driving tips,
 * and the ring of handover places beside "Where we hand over the keys". Night colours are at the end.
 * Every animation stops for visitors whose device asks for less motion (the road car is paused in app.js).
 */

/* ---------- How renting works: a road with four stops ---------- */
.journey { padding-top: clamp(40px, 6vw, 72px); }
.journey-board {
  position: relative; padding: 14px 14px 28px; border-radius: 24px;
  background: var(--g); border: 1px solid var(--g-edge); box-shadow: var(--g-shadow);
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
}
.jr-road { display: block; width: 100%; height: auto; overflow: visible; }
.jr-verge { fill: none; stroke: rgba(255, 255, 255, .8); stroke-width: 46; stroke-linecap: round; }
.jr-tarmac { fill: none; stroke: #33465C; stroke-width: 32; stroke-linecap: round; }
.jr-lane { fill: none; stroke: #DFB589; stroke-width: 2.5; stroke-dasharray: 14 12; }
.jr-stop { color: #10273F; }
.jr-stem { fill: none; stroke: #9DB4C8; stroke-width: 2; stroke-dasharray: 3 4; }
.jr-dot { fill: rgba(255, 255, 255, .95); stroke: rgba(16, 39, 63, .14); stroke-width: 1.5; }
.jr-lit { fill: rgba(223, 181, 137, .38); stroke: #DFB589; stroke-width: 3; }
.jr-pulse { fill: none; stroke: #DFB589; stroke-width: 2; }
.jr-beam { fill: url(#jr-beam); opacity: 0; }
.jr-steps { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; text-align: center; }
.jr-steps li { padding: 0 8px; }
.jr-steps h3 { margin: 0 0 6px; font-family: var(--cond); font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: var(--navy); }
.jr-steps p { margin: 0 auto; max-width: 30ch; color: var(--ink-2); font-size: .97rem; line-height: 1.5; }
.jr-num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-bottom: 8px; border-radius: 50%;
  background: #10273F; color: #DFB589; font-family: var(--cond); font-size: 1rem; font-weight: 700;
}
.jr-mcar { display: none; }

/* On phones the road runs down the left side and the car drives down it */
@media (max-width: 760px) {
  .jr-road { display: none; }
  .journey-board { padding: 22px 18px 22px 16px; }
  .jr-steps { position: relative; grid-template-columns: 1fr; gap: 24px; margin: 0; padding-left: 50px; text-align: left; }
  .jr-steps::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 28px; border-radius: 14px; background: #33465C; box-shadow: 0 0 0 6px rgba(255, 255, 255, .7); }
  .jr-steps::after { content: ""; position: absolute; left: 17px; top: 12px; bottom: 12px; border-left: 2px dashed #DFB589; }
  .jr-steps li { padding: 0; }
  .jr-steps p { margin: 0; }
  .jr-num { width: 26px; height: 26px; margin: 0 8px 0 0; vertical-align: 2px; }
  .jr-steps h3 { display: inline; font-size: 1.4rem; }
  .jr-steps h3 + p { margin-top: 6px; }
  .jr-mcar { display: block; position: absolute; left: 26px; top: 26px; width: 16px; height: 32px; animation: jr-down 13s ease-in-out infinite; }
}
@keyframes jr-down {
  0%, 12% { top: 26px; opacity: 1; }
  24%, 36% { top: calc(26px + 25%); }
  48%, 60% { top: calc(26px + 50%); }
  72%, 92% { top: calc(100% - 60px); opacity: 1; }
  97% { opacity: 0; }
  100% { top: calc(100% - 60px); opacity: 0; }
}

/* ---------- Driving in Montenegro: a drawing on each tip ---------- */
.tips .tip { display: flex; flex-direction: column; padding: 10px 10px 22px; }
.tips .tip h3, .tips .tip p { padding: 0 12px; }
.tip-art {
  display: block; aspect-ratio: 5 / 2; margin-bottom: 14px; border-radius: 14px; overflow: hidden; color: #10273F;
  background: linear-gradient(180deg, rgba(214, 231, 245, .9), rgba(255, 255, 255, .45));
}
.tip:nth-child(even) .tip-art { background: linear-gradient(180deg, rgba(247, 238, 228, .95), rgba(255, 255, 255, .45)); }
.tip-svg { display: block; width: 100%; height: 100%; }
.tip-svg .ta-line { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ta-blue { fill: #2E78B5; }
.ta-glass { fill: #D9E7F2; }
.ta-tyre { fill: #1C2A3A; }
.ta-hub { fill: #E6ECF1; }
.ta-lamp { fill: #FFF6E8; }
.ta-road { fill: #33465C; }
.ta-lane { fill: none; stroke: #DFB589; stroke-width: 2; stroke-dasharray: 10 8; }
.ta-sand { fill: #DFB589; }
.ta-soft { fill: currentColor; opacity: .08; }
.ta-sign { fill: #FFFFFF; stroke: #C8463E; stroke-width: 6; }
.ta-num, .ta-euro { font-family: var(--cond); font-weight: 700; fill: #10273F; }
.ta-num { font-size: 23px; }
.ta-euro { font-size: 17px; }
.tip-svg .ta-paper { fill: #FFFFFF; }
.ta-roof { fill: #2E78B5; }
.ta-post { fill: #10273F; }
.ta-stripes { fill: none; stroke: #C8463E; stroke-width: 9; }
.ta-sea { fill: #A7D0E8; }
.ta-land { fill: #7D9A8A; }
.tip-svg .ta-route { stroke-dasharray: 4 7; opacity: .45; }
.ta-wave { fill: none; stroke: #FFFFFF; stroke-width: 2.2; stroke-linecap: round; opacity: .8; }
.ta-hull { fill: #FFFFFF; stroke: #10273F; stroke-width: 2; stroke-linejoin: round; }
.ta-moonface, .ta-star { fill: #F2E6C9; }
.ta-snowcap, .ta-drift { fill: #FFFFFF; }
.ta-tread { fill: none; stroke: #3B4B5E; stroke-width: 6; stroke-dasharray: 5 4.2; }
.ta-rim { fill: #C9D3DD; }
.ta-spokes { fill: none; stroke: #8496A8; stroke-width: 2.5; stroke-linecap: round; }
.ta-flake { fill: none; stroke: #6F9CC4; stroke-width: 1.8; stroke-linecap: round; }
.ta-wheelrim { fill: none; stroke: currentColor; stroke-width: 10; stroke-linecap: round; opacity: .16; }
.ta-mount { fill: currentColor; opacity: .45; }
.ta-phone { fill: #10273F; }
.ta-screen { fill: #2E78B5; }
.ta-call { fill: #FFFFFF; }
.ta-sig { fill: none; stroke: #2E78B5; stroke-width: 3; stroke-linecap: round; }

@media (prefers-reduced-motion: no-preference) {
  /* lights: day turns to night and back, the beam stays on */
  .ta-sun { animation: ta-day 9s ease-in-out infinite; }
  .ta-moon { animation: ta-night 9s ease-in-out infinite; }
  .ta-beam { animation: ta-beam 3s ease-in-out infinite; }
  /* speed limits: a small car passes through town and out onto the open road */
  .ta-drive { animation: ta-pass 7s linear infinite; }
  /* winter tyres: the wheel turns, snow falls */
  .ta-wheel { transform-box: fill-box; transform-origin: center; animation: ta-spin 3.2s linear infinite; }
  .ta-flake { animation: ta-fall 5s linear infinite; }
  /* tolls: the barrier lifts and drops */
  .ta-arm { transform-box: fill-box; transform-origin: 1px 50%; animation: ta-lift 5s ease-in-out infinite; }
  /* ferry: crosses the bay and bobs on the waves */
  .ta-waves { animation: ta-swell 2.4s linear infinite; }
  .ta-ferry { animation: ta-cross 8s ease-in-out infinite alternate; }
  .ta-bob { transform-box: fill-box; transform-origin: 50% 100%; animation: ta-bob 2.6s ease-in-out infinite alternate; }
  /* hands-free: the call goes out over the speakers */
  .ta-sig { animation: ta-sig 1.8s ease-in-out infinite; }
  .ta-sig.s2 { animation-delay: .25s; }
  .ta-sig.s3 { animation-delay: .5s; }
}
@keyframes ta-day { 0%, 38%, 100% { opacity: 1; } 50%, 88% { opacity: 0; } }
@keyframes ta-night { 0%, 38%, 100% { opacity: 0; } 50%, 88% { opacity: 1; } }
@keyframes ta-beam { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes ta-pass { from { transform: translateX(-70px); } to { transform: translateX(290px); } }
@keyframes ta-spin { to { transform: rotate(360deg); } }
@keyframes ta-fall { 0% { transform: translate(0, -12px); opacity: 0; } 12% { opacity: 1; } 50% { transform: translate(6px, 54px); } 88% { opacity: 1; } 100% { transform: translate(-4px, 112px); opacity: 0; } }
@keyframes ta-lift { 0%, 22% { transform: rotate(0); } 38%, 70% { transform: rotate(-74deg); } 86%, 100% { transform: rotate(0); } }
@keyframes ta-swell { to { transform: translateX(-20px); } }
@keyframes ta-cross { from { transform: translateX(-20px); } to { transform: translateX(24px); } }
@keyframes ta-bob { from { transform: rotate(-2.2deg); } to { transform: rotate(2.2deg); } }
@keyframes ta-sig { 0%, 100% { opacity: .15; } 35% { opacity: 1; } }
.ta-moon { opacity: 0; }

/* ---------- Where we hand over the keys: the places on a ring around a car key ---------- */
.handover { display: grid; grid-template-columns: 430px minmax(0, 1fr); gap: 36px; align-items: center; }
.handover .board .places { grid-template-columns: 1fr; }
.handover .board-head .bh-half + .bh-half { display: none; }
.orbit { position: relative; width: 430px; height: 430px; }
.orbit-ring { position: absolute; margin: 0; padding: 0; list-style: none; border-radius: 50%; }
.orbit-outer { inset: 39px; border: 2px dashed rgba(46, 120, 181, .35); }
.orbit-inner { inset: 98px; border: 2px solid rgba(223, 181, 137, .6); }
.orbit-sat { position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; transform: rotate(var(--a)) translate(174px) rotate(calc(var(--a) * -1)); }
.orbit-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 100%; height: 100%; padding: 8px;
  border-radius: 50%; text-align: center; color: #2E78B5;
  background: rgba(255, 255, 255, .9); border: 1px solid #FFFFFF; box-shadow: 0 16px 30px -14px rgba(16, 39, 63, .45);
}
.orbit-tile b { font-family: var(--cond); font-size: .98rem; font-weight: 700; line-height: 1.05; color: #10273F; }
.orbit-tile small { font-size: .7rem; line-height: 1.1; color: var(--ink-2); }
.orbit-core {
  position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 170px; height: 170px; margin: -85px 0 0 -85px; border-radius: 50%;
  background: var(--g); border: 1px solid var(--g-edge); box-shadow: var(--g-shadow); -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
}
.orbit-key { width: 118px; height: auto; margin-top: 10px; overflow: visible; }
.ok-ring { fill: none; stroke: #DFB589; stroke-width: 5; }
.ok-link { stroke: #9AA9B8; stroke-width: 4; stroke-linecap: round; }
.ok-fob { fill: #10273F; }
.ok-btn { fill: #2E78B5; }
.ok-glyph { fill: none; stroke: #FFFFFF; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ok-led { fill: #DFB589; }
.ok-blade { fill: #C9D3DD; }
@media (prefers-reduced-motion: no-preference) {
  .orbit-outer { animation: orbit-spin 110s linear infinite; }
  .orbit-tile { animation: orbit-spin 110s linear infinite reverse; }
  .ok-swing { transform-box: view-box; transform-origin: 60px 18px; animation: key-swing 4.4s ease-in-out infinite; }
  .ok-led { animation: key-led 3s ease-in-out infinite; }
}
@keyframes orbit-spin { to { transform: rotate(360deg); } }
@keyframes key-swing { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes key-led { 0%, 55%, 100% { opacity: .25; } 65%, 85% { opacity: 1; } }
@media (max-width: 1080px) {
  .handover { grid-template-columns: 1fr; }
  .orbit { display: none; }
  .handover .board .places { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .handover .board-head .bh-half + .bh-half { display: flex; }
}
@media (max-width: 700px) {
  .handover .board .places { grid-template-columns: 1fr; }
  .handover .board-head .bh-half + .bh-half { display: none; }
}
@media (prefers-reduced-motion: reduce) { .jr-mcar { animation: none; } }

/* ---------- Night ---------- */
.is-dark .jr-verge { stroke: rgba(255, 255, 255, .06); }
.is-dark .jr-tarmac { stroke: #0D1620; }
.is-dark .jr-stop { color: #E3EAF1; }
.is-dark .jr-stem { stroke: rgba(255, 255, 255, .25); }
.is-dark .jr-dot { fill: #12243A; stroke: rgba(255, 255, 255, .16); }
.is-dark .jr-beam { opacity: 1; }
.is-dark .jr-num { background: rgba(233, 193, 143, .14); color: var(--amber); }
.is-dark .jr-steps::before { background: #0D1620; box-shadow: 0 0 0 6px rgba(255, 255, 255, .05); }

.is-dark .tip-art, .is-dark .tip:nth-child(even) .tip-art { background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)); color: #C9D6E2; }
.is-dark .ta-glass { fill: #2C4560; }
.is-dark .ta-road { fill: #0D1620; }
.is-dark .ta-soft { opacity: .07; }
.is-dark .tip-svg .ta-paper { fill: #22344A; }
.is-dark .ta-post { fill: #9AA9B8; }
.is-dark .ta-sea { fill: #173552; }
.is-dark .ta-land { fill: #1E3A36; }
.is-dark .ta-wave { stroke: rgba(255, 255, 255, .3); }
.is-dark .ta-hull { fill: #C9D3DD; stroke: #0A1828; }
.is-dark .ta-snowcap, .is-dark .ta-drift { fill: #C9D6E2; }
.is-dark .ta-rim { fill: #8D9DAE; }
.is-dark .ta-tyre { fill: #0A121B; }
.is-dark .ta-phone { fill: #050D16; stroke: rgba(255, 255, 255, .2); stroke-width: 1.5; }
.is-dark .ta-screen { fill: #24639A; }
.is-dark .ta-sig { stroke: #8EC6F2; }
.is-dark .ta-flake { stroke: #A9C8E4; }

.is-dark .orbit-outer { border-color: rgba(142, 198, 242, .3); }
.is-dark .orbit-inner { border-color: rgba(233, 193, 143, .4); }
.is-dark .orbit-tile { background: rgba(14, 28, 44, .94); border-color: rgba(255, 255, 255, .14); color: #8EC6F2; box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .9); }
.is-dark .orbit-tile b { color: #F3F6F9; }
.is-dark .ok-fob { fill: #050D16; stroke: rgba(255, 255, 255, .2); stroke-width: 1.5; }
