#hfc, #hfc * { box-sizing: border-box; }
#hfc {
  position: relative; margin: 0; padding: 0;
  background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

#hfc { max-width: none; float: none; text-align: left; text-indent: 0; text-transform: none; letter-spacing: normal; word-spacing: normal; font-weight: 400; font-style: normal; }
#hfc :where(.hfc-cards) :where(h2, h3, p, section, span, button), #hfc :where(.hfc-credit) {
  margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; max-width: none; float: none;
  text-align: left; text-indent: 0; text-transform: none; text-decoration: none; text-shadow: none; letter-spacing: normal;
}
#hfc :where(.hfc-cards) :where(h2, h3, p)::before, #hfc :where(.hfc-cards) :where(h2, h3, p)::after { content: none; }

#hfc .hfc-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--paper); }
#hfc .hfc-map { position: absolute; inset: 0; }
#hfc .hfc-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-dim); pointer-events: none;
}
#hfc .hfc-loading.hidden { display: none; }

/* Text cards */
#hfc .hfc-cards { position: relative; margin-top: -100vh; margin-top: -100svh; padding: 0 14px; pointer-events: none; }
#hfc .hfc-card {
  pointer-events: auto; max-width: 400px; margin: 0 auto 82vh; padding: 11px 13px 12px;
  background: var(--paper); border: 1px solid var(--ink); box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
}
#hfc .hfc-card:first-child { margin-top: 0; }
#hfc .hfc-cards::before { content: ''; display: block; height: var(--hfc-lead, 58vh); }
#hfc .hfc-cards::after { content: ''; display: block; height: 62vh; }
#hfc .hfc-card:last-child { margin-bottom: 0; }

#hfc .hfc-num { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--ink-dim); margin: 0 0 6px; }
#hfc .hfc-title { font-family: var(--mono); font-size: 14px; font-weight: 700; line-height: 1.25; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 6px; }
#hfc .hfc-card.intro .hfc-title { font-size: 17px; letter-spacing: 0.04em; }
#hfc .hfc-body { margin: 0; font-size: 15px; line-height: 1.4; }
#hfc .hfc-hint { font-family: var(--mono); font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-dim); margin: 9px 0 0; }
#hfc .hfc-note { font-size: 11.5px; line-height: 1.35; color: var(--ink-dim); margin: 9px 0 0; }
#hfc .hfc-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
#hfc .hfc-hint::after { content: ' ↓'; }

#hfc .hfc-chip { padding: 1px 5px; -webkit-box-decoration-break: clone; box-decoration-break: clone; white-space: normal; }
#hfc .hfc-chip.source { background: color-mix(in srgb, var(--c-source) 62%, var(--paper)); }
#hfc .hfc-chip.direct { background: color-mix(in srgb, var(--c-direct) 42%, var(--paper)); }
#hfc .hfc-chip.neighbours { background: color-mix(in srgb, var(--c-neighbours) 58%, var(--paper)); }
#hfc .hfc-chip.entry { background: color-mix(in srgb, var(--c-entry) 52%, var(--paper)); }
#hfc .hfc-chip.markets { background: color-mix(in srgb, var(--c-markets) 58%, var(--paper)); }
#hfc .hfc-chip.eu { padding: 1px 1px 0; border-bottom: 2.5px solid var(--c-markets); }
#hfc .hfc-chip.mark { border: 1px solid var(--ink); font-family: var(--mono); font-size: 0.82em; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }

#hfc .co { position: relative; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity 0.5s; }
#hfc .co.show { opacity: 1; transition-delay: 1.2s; }
#hfc .co-dot { position: absolute; left: -3.5px; top: -3.5px; width: 7px; height: 7px; border: 1.5px solid var(--ink); background: var(--paper); }
#hfc .co-line { position: absolute; left: 0; top: 0; height: 0; border-top: 1px solid var(--ink); transform-origin: 0 0; }
#hfc .co-text {
  position: absolute; width: max-content; max-width: 108px; font-family: var(--mono); font-size: 10.5px; line-height: 1.25;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink);
  background: var(--paper); padding: 2px 5px; border: 1px solid var(--ink);
}
#hfc .co-plain .co-line, #hfc .co-plain .co-dot { display: none; }
#hfc .co-plain .co-text { background: none; border: 0; padding: 0; max-width: none; font-size: 10px; font-weight: 400; letter-spacing: 0.14em; line-height: 1.2; }
#hfc .co-text small { display: block; font-size: 9.5px; font-weight: 400; letter-spacing: 0.04em; color: var(--ink-dim); text-transform: none; }

@media (min-width: 900px), (min-width: 600px) and (max-height: 500px) {
  #hfc .hfc-cards { padding: 0 0 0 28px; }
  #hfc .hfc-card { max-width: 340px; margin-left: 0; margin-right: 0; padding: 18px 20px 19px; }
  #hfc .hfc-title { font-size: 18px; margin-bottom: 8px; }
  #hfc .hfc-card.intro .hfc-title { font-size: 24px; }
  #hfc .hfc-body { font-size: 17px; line-height: 1.45; }
  #hfc .hfc-hint { margin-top: 12px; }
}

#hfc .hfc-credit {
  position: absolute; left: 12px; bottom: 46px; margin: 0; z-index: 2; pointer-events: none;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink);
  opacity: 1; text-shadow: 0 0 3px var(--paper), 0 0 6px var(--paper);
}
#hfc:not(.hfc-light) .hfc-credit { color: #fff; }
/* Mapbox logo, bottom left: dimmed so it sits back, but still plainly readable */
#hfc .mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-logo { margin: 0 0 6px 0; opacity: 0.5; }
#hfc .mapboxgl-ctrl-attrib, #hfc .mapboxgl-ctrl-attrib.mapboxgl-compact {
  background: transparent; box-shadow: none; color: var(--ink-dim); font-size: 10.5px; margin: 0 6px 6px 0;
  text-shadow: 0 0 3px var(--paper), 0 0 6px var(--paper);
}
#hfc .mapboxgl-ctrl-attrib a, #hfc .mapboxgl-ctrl-attrib .mapbox-improve-map { color: var(--ink-dim); font-weight: 400; }
#hfc .mapboxgl-ctrl-attrib-button { background-color: transparent; filter: invert(1); opacity: 0.5; }
#hfc .mapboxgl-ctrl-attrib-button:focus { box-shadow: none; }

#hfc.hfc-click { height: 100vh; height: 100svh; overflow: hidden; }
#hfc.hfc-click .hfc-stage { position: absolute; inset: 0; height: auto; }
#hfc.hfc-click .hfc-cards {
  position: absolute; left: 0; right: 0; bottom: 84px; margin: 0; padding: 0 14px;
  display: flex; flex-direction: column; align-items: center;
}
#hfc.hfc-click .hfc-cards::before, #hfc.hfc-click .hfc-cards::after { display: none; }
#hfc.hfc-click .hfc-card { display: none; width: 100%; margin: 0; border-bottom: 0; box-shadow: none; }
#hfc.hfc-click .hfc-card.on { display: block; }
#hfc .hfc-nav {
  pointer-events: auto; width: 100%; max-width: 400px; display: flex; align-items: center; gap: 12px;
  padding: 8px 13px 9px; background: var(--paper); border: 1px solid var(--ink); border-top: 1px solid var(--rule);
}
#hfc .hfc-nav-btn {
  appearance: none; background: none; border: 0; padding: 4px 0; margin: 0; cursor: pointer; color: var(--ink);
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
#hfc .hfc-nav-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
#hfc .hfc-nav-arrow { display: inline-block; }
#hfc .hfc-nav-btn.hint .hfc-nav-arrow { animation: hfc-nudge 1.5s ease-in-out infinite; }
@keyframes hfc-nudge { 0%, 55%, 100% { transform: translateX(0); } 25% { transform: translateX(6px); } 40% { transform: translateX(1px); } }
#hfc .hfc-nav-btn.hint { position: relative; }
#hfc .hfc-nav-btn.hint::after {
  content: ''; position: absolute; top: -2px; bottom: -2px; left: -8px; right: -8px; border: 1.5px solid var(--ink);
  pointer-events: none; animation: hfc-pulse 1.5s ease-in-out infinite;
}
@keyframes hfc-pulse { 0%, 100% { opacity: 0.25; transform: scale(1); } 40% { opacity: 1; transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) {
  #hfc .hfc-nav-btn.hint .hfc-nav-arrow { animation: none; }
  #hfc .hfc-nav-btn.hint::after { animation: none; opacity: 0.8; }
}
#hfc .hfc-nav-btn:disabled { color: var(--ink-dim); opacity: 0.45; cursor: default; text-decoration: none; }
#hfc .hfc-nav-btn:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
#hfc .hfc-ticks { flex: 1; display: flex; justify-content: center; gap: 4px; }
#hfc .hfc-ticks span { flex: 0 1 14px; min-width: 5px; height: 2px; background: var(--rule); }
#hfc .hfc-ticks span.on { background: var(--ink); }
@media (min-width: 900px), (min-width: 600px) and (max-height: 500px) {
  /* The cards share one bottom edge and grow upwards, so Back and Next never move between slides */
  #hfc.hfc-click .hfc-cards { left: 28px; right: auto; top: 0; bottom: max(20px, calc(50% - 160px)); width: 340px; padding: 0; justify-content: flex-end; }
  #hfc .hfc-nav { max-width: 340px; padding: 10px 20px 11px; }
}

@media (min-width: 600px) and (max-height: 500px) {
  #hfc .hfc-cards { padding-left: 16px; }
  #hfc .hfc-card { max-width: 300px; padding: 11px 13px 12px; }
  #hfc .hfc-title { font-size: 13px; margin-bottom: 6px; }
  #hfc .hfc-card.intro .hfc-title { font-size: 16px; }
  #hfc .hfc-body { font-size: 14px; line-height: 1.38; }
  #hfc .hfc-hint { margin-top: 8px; }
  #hfc.hfc-click .hfc-cards { left: 16px; width: 300px; }
  #hfc .hfc-nav { max-width: 300px; padding: 8px 13px 9px; }
}

/* Light theme */
#hfc.hfc-light .hfc-card { box-shadow: 4px 4px 0 rgba(27, 26, 23, 0.14); }
#hfc.hfc-light.hfc-click .hfc-card { box-shadow: none; }
#hfc.hfc-light .mapboxgl-ctrl-attrib-button { filter: none; }

#hfc.hfc-pin .hfc-stage { position: absolute; top: 0; left: 0; width: 100%; }
#hfc.hfc-pin[data-pin="on"] .hfc-stage { position: fixed; }
#hfc.hfc-pin[data-pin="end"] .hfc-stage { top: auto; bottom: 0; }
#hfc.hfc-pin .hfc-cards { margin-top: 0; }

/* Back / Next labels never wrap, in any language; the progress ticks shrink to make room */
.hfc .hfc-nav-btn { white-space: nowrap; flex: none; }
.hfc .hfc-ticks { min-width: 0; }

/* Hover label (desktop): the country, or the two ends of a route, under the pointer */
#hfc .hfc-tip {
  position: absolute; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 0.12s;
  transform: translate(14px, 16px); white-space: nowrap;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); background: var(--paper); border: 1px solid var(--ink); padding: 3px 7px;
}
#hfc .hfc-tip.show { opacity: 1; }
#hfc .co-text { max-width: 132px; }

/* Explore step: the map can be dragged and zoomed; + and − buttons sit above the credits */
#hfc .mapboxgl-canvas-container.mapboxgl-interactive { cursor: default; }
#hfc.hfc-exploring .mapboxgl-canvas-container.mapboxgl-interactive { cursor: grab; }
#hfc.hfc-exploring .mapboxgl-canvas-container.mapboxgl-interactive:active { cursor: grabbing; }
#hfc .hfc-zoom { position: absolute; right: 10px; bottom: 44px; z-index: 2; display: none; flex-direction: column; }
#hfc.hfc-exploring .hfc-zoom { display: flex; }
@media not all and (min-width: 900px) { #hfc .hfc-zoom { bottom: auto; top: 12px; } }
#hfc .hfc-zoom-btn {
  appearance: none; width: 30px; height: 30px; margin: 0; padding: 0; cursor: pointer; pointer-events: auto;
  font-family: var(--mono); font-size: 16px; line-height: 1; color: var(--ink);
  background: var(--paper); border: 1px solid var(--ink);
}
#hfc .hfc-zoom-btn + .hfc-zoom-btn { border-top: 0; }
#hfc .hfc-zoom-btn:hover { background: var(--ink); color: var(--paper); }
#hfc.hfc-light .mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-logo { opacity: 0.8; }
