/*
 * What crosses the barrier (includes/pieces/crossing.php): the browser above, a row of ticket gates,
 * our server below. Cards are timetable paper; the gate is steel posts and enamel paddles that swing
 * open on their hinges; the tickets are card stock.
 */

.crossing__mode { margin: 0 0 14px; padding: 0; border: 0; }
.js .crossing__mode { display: flex; flex-wrap: wrap; gap: 8px; }
.crossing__mode label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border-radius: 8px; background: var(--stone); font: 700 1rem/1.2 var(--board-font); letter-spacing: .04em; cursor: pointer; box-shadow: inset 0 0 0 1px var(--stone-2); }
.crossing__mode input { width: 18px; height: 18px; margin: 0; accent-color: var(--board); }
.crossing__mode label:has(input:checked) { background: var(--board); color: var(--flap-ink); box-shadow: none; }
.crossing__mode label:has(input:focus-visible) { outline: 3px solid var(--signal); outline-offset: 2px; }

.crossing__stage { display: grid; gap: 0; overflow-x: clip; }
.crossing__side { padding: 14px; border-radius: 10px; background: var(--stone); box-shadow: inset 0 0 0 1px var(--stone-2); }
.crossing__h { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font: 700 1.15rem/1.1 var(--board-font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.crossing__h::before { content: ""; width: 14px; height: 14px; border-radius: 3px; background: var(--board); box-shadow: inset 0 -5px 0 var(--signal); }
.crossing__side--srv .crossing__h::before { box-shadow: inset 0 -5px 0 var(--line); }
.crossing__cards { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 700px) { .crossing__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .crossing__side--srv .crossing__cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.crossing__card { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 8px; background: var(--paper); box-shadow: 0 1px 0 rgba(0, 0, 0, .12), inset 4px 0 0 var(--signal); font-size: .98rem; line-height: 1.4; color: var(--ink-2); }
.crossing__card b { font: 700 1.08rem/1.2 var(--board-font); letter-spacing: .02em; color: var(--ink); }
.crossing__card--srv { box-shadow: 0 1px 0 rgba(0, 0, 0, .12), inset 4px 0 0 var(--line); }
.crossing__off, .js .crossing[data-mode="auto"] .crossing__off, .crossing[data-mode="on"] .crossing__off { display: none; }
.crossing[data-mode="auto"] .crossing__off, .crossing[data-mode="off"] .crossing__off { display: block; }
.crossing[data-mode="auto"] .crossing__on, .crossing[data-mode="off"] .crossing__on { display: none; }
.js .crossing[data-mode="auto"] .crossing__on { display: block; }
.js .crossing[data-mode="auto"] .crossing__off { display: none; }
html:not(.js) .crossing__card--dob, html:not(.js) .crossing__card--pay, .crossing[data-mode="off"] .crossing__card--dob, .crossing[data-mode="off"] .crossing__card--pay { box-shadow: 0 1px 0 rgba(0, 0, 0, .12), inset 4px 0 0 var(--line); }

/* The barrier: two steel posts and two enamel paddles, seen a little from above; the paddles swing open on their hinges. */
.crossing__gate { position: relative; height: 104px; margin: 0 auto; width: min(340px, 100%); perspective: 600px; }
.crossing__gate::before { content: ""; position: absolute; left: -40%; right: -40%; top: 50%; height: 2px; background: repeating-linear-gradient(90deg, var(--ink-2) 0 10px, transparent 10px 18px); opacity: .5; }
.crossing__post { position: absolute; top: 22px; left: 0; width: 34px; height: 60px; border-radius: 6px; background: var(--p-steel); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), 0 6px 10px -6px rgba(0, 0, 0, .6); }
.crossing__post::after { content: ""; position: absolute; left: 9px; top: 8px; width: 16px; height: 6px; border-radius: 2px; background: #15171a; box-shadow: inset 0 0 0 1px #000, 0 0 0 1px rgba(255, 255, 255, .5); }
.crossing__post--b { left: auto; right: 0; }
.crossing__paddle { position: absolute; top: 34px; width: calc(50% - 36px); height: 36px; border-radius: 4px 14px 14px 4px; background: linear-gradient(180deg, #e05147, var(--retire) 55%, #9e1f1f); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 6px -3px rgba(0, 0, 0, .6); transform-origin: 0 50%; left: 34px; transition: transform .45s cubic-bezier(.3, .7, .3, 1); }
.crossing__paddle--b { left: auto; right: 34px; transform-origin: 100% 50%; border-radius: 14px 4px 4px 14px; }
.crossing__gate.is-open .crossing__paddle--a { transform: rotateY(-78deg); }
.crossing__gate.is-open .crossing__paddle--b { transform: rotateY(78deg); }

/* The tickets: card stock with a notched edge; they wait above the gate. */
.crossing__ticket { position: absolute; left: 50%; top: -6px; z-index: 2; padding: 5px 10px; border-radius: 4px; background: var(--p-card); color: var(--p-card-ink); font: 700 .9rem/1.2 var(--board-font); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 2px 0 rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(0, 0, 0, .12); transform: translateX(-50%); opacity: 0; }
.crossing__ticket::before, .crossing__ticket::after { content: ""; position: absolute; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--paper); }
.crossing__ticket::before { left: -4px; }
.crossing__ticket::after { right: -4px; }
.crossing__ticket.is-go { animation: crossing-go 2.2s cubic-bezier(.45, 0, .25, 1) forwards; }
.crossing__ticket.is-stop { animation: crossing-stop 1.8s cubic-bezier(.45, 0, .25, 1) forwards; }
@keyframes crossing-go { 0% { opacity: 0; transform: translate(-50%, -14px); } 15% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; transform: translate(-50%, 92px); } 100% { opacity: 0; transform: translate(-50%, 104px); } }
@keyframes crossing-stop { 0% { opacity: 0; transform: translate(-50%, -14px); } 15% { opacity: 1; transform: translate(-50%, 0); } 45% { transform: translate(-50%, 24px); } 55% { transform: translate(-50%, 16px); } 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -10px); } }

.piece .crossing__cf, .piece .crossing__nojs { margin: 14px 0 0; font-size: .98rem; line-height: 1.5; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
	.crossing__paddle { transition: none; }
	.crossing__ticket { display: none; }
}
