/*
 * Feedus layered page (spec 11.7), drawn by public/player/feedus-composition.js.
 * Layers are placed in pixels of the page's own size; the page is scaled to
 * its area with --fp-scale.
 */
.fcp {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    transform-origin: 0 0;
    transform: scale(var(--fp-scale, 1));
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.fcp-bg,
.fcp-dim {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.fcp-layer {
    position: absolute;
    box-sizing: border-box;
    overflow: hidden;
}

.fcp-media {
    display: block;
    width: 100%;
    height: 100%;
}

.fcp-text {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.fcp-text-inner {
    position: relative;
    white-space: pre-wrap;
    overflow-wrap: normal;
    word-break: normal;
}

/* Word entrance: each word moves on its own (transforms need an inline block). */
.fcp-word {
    display: inline-block;
}

/* Typewriter entrance: the untyped rest keeps its place invisibly; the caret takes no width. */
.fcp-type-rest {
    visibility: hidden;
}

.fcp-caret {
    border-right: 0.07em solid currentColor;
    margin-right: -0.07em;
    animation: fcp-caret-blink 1s steps(1) infinite;
}

@keyframes fcp-caret-blink {
    50% { border-right-color: transparent; }
}

/* Data layers (clock, countdown, weather): the content is scaled to fill the box. */
.fcp-data {
    box-sizing: border-box;
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.fcp-fit {
    display: inline-block;
    white-space: nowrap;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.fcp-cd { display: flex; align-items: flex-start; gap: 0.3em; }
.fcp-cd-unit { display: flex; flex-direction: column; align-items: center; }
.fcp-cd-num { line-height: 1; }
.fcp-cd-sep { line-height: 1; opacity: 0.8; }
/* Tiles: slightly rounded plates behind the numbers. */
.fcp-cd-tiles,
.fcp-cd-flip { gap: 0.22em; }
.fcp-cd-tile {
    position: relative;
    padding: 0.1em 0.14em;
    border-radius: 0.1em;
}
/* Flip tiles: a lighter top half, a darker bottom half and a thin gap across the middle. */
.fcp-cd-flip .fcp-cd-tile {
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03) 49.5%, rgba(0, 0, 0, 0.18) 50.5%, rgba(0, 0, 0, 0.3));
    box-shadow: 0 0.04em 0.1em rgba(0, 0, 0, 0.55), inset 0 0 0 0.01em rgba(255, 255, 255, 0.08);
}
.fcp-cd-flip .fcp-cd-tile::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 0.025em;
    margin-top: -0.0125em;
    background: rgba(0, 0, 0, 0.7);
    box-shadow: 0 0.01em 0 rgba(255, 255, 255, 0.12);
}
/* Rings: each unit in its own circle of segments, the number in the middle. */
.fcp-cd-rings { gap: 0.25em; }
.fcp-cd-ring {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1em;
    height: 2.1em;
}
.fcp-cd-ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.fcp-cd-ring .fcp-cd-num { position: relative; font-size: 0.78em; }

.fcp-cd-label {
    margin-top: 0.3em;
    font-size: 0.24em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.85;
}

.fcp-wx { display: flex; flex-direction: column; align-items: center; gap: 0.3em; }
.fcp-wx.is-row { flex-direction: row; gap: 0.6em; }
.fcp-wx-now { display: flex; align-items: center; gap: 0.12em; }
.fcp-wx-now-temp { line-height: 1; }
.fcp-wx-rows { display: flex; flex-direction: column; align-items: center; gap: 30px; }
.fcp-wx-rows:empty { display: none; }
.fcp-wx-row { display: flex; gap: 0.25em; }
.fcp-wx-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1em;
    min-width: 2.6em;
    font-size: 0.32em;
}
.fcp-wx-min { opacity: 0.65; font-weight: 400; }
.fcp-wx-missing { font-size: 0.4em; font-weight: 400; }

.fcp-wx-ico {
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
}
.fcp-wx-now-icon { width: 1.3em; height: 1.3em; }
.fcp-wx-icon { width: 1.9em; height: 1.9em; }

/* Weather source line: below the forecast, aligned and spaced by the layer settings. */
.fcp-source {
    box-sizing: border-box;
    align-self: stretch;
    flex: none;
    line-height: 1.25;
    text-align: center;
    font-weight: 400;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fcp-qr-svg,
.fcp-embed-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}
.fcp-embed-frame { background: #000; }

/* Editor only: a layer that has nothing to show yet. */
.fcp-placeholder {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0.5em;
    text-align: center;
    color: #fff;
    font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    font-weight: 600;
    background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 20px, rgba(255, 255, 255, 0.16) 20px 40px);
    outline: 3px dashed rgba(255, 255, 255, 0.5);
    outline-offset: -3px;
}

/* Holder of a text layer's effect filter (spec 11.7 "Tekstitehosteet"). */
.fcp-fx-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Adjustable shadow of a data layer, resolved at each text's own size. */
.fcp-fit, .fcp-source { text-shadow: var(--fcp-shadow, none); }

/* RSS headlines (spec 11.7): one at a time, all in one grid cell so the box fits the longest. */
.fcp-rss .fcp-fit {
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
    font-variant-numeric: normal;
}
.fcp-rss-stack { display: grid; }
.fcp-rss-item {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    /* The old headline fades out first, then the new one fades in. */
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.fcp-rss-item.is-on {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease 0.4s, visibility 0s linear 0.4s;
}
.fcp-rss-title { line-height: 1.15; }
/* Several headlines at once: a thin line between them, in the text colour. */
.fcp-rss-entry + .fcp-rss-entry { margin-top: 0.4em; }
.fcp-rss-entry + .fcp-rss-entry::before {
    content: '';
    display: block;
    height: 0.04em;
    min-height: 1px;
    margin-bottom: 0.4em;
    background: currentColor;
    opacity: 0.35;
}
.fcp-rss-date { font-size: 0.5em; font-weight: 400; opacity: 0.85; margin-bottom: 0.25em; }
.fcp-rss-desc { font-size: 0.58em; font-weight: 400; line-height: 1.3; margin-top: 0.35em; }
.fcp-rss-source { font-size: 0.42em; font-weight: 400; opacity: 0.75; margin-top: 0.7em; }
.fcp-rss-missing { font-size: 0.5em; font-weight: 400; opacity: 0.8; }

/* Scrolling text (spec 11.7): one line moving from right to left. */
.fcp-ticker-wrap { justify-content: flex-start; }
.fcp-ticker-move { display: flex; flex: none; will-change: transform; }
.fcp-ticker-track {
    display: flex;
    flex: none;
    white-space: nowrap;
    line-height: 1.2;
    will-change: transform;
    text-shadow: var(--fcp-shadow, none);
}
.fcp-ticker-unit { display: flex; flex: none; }
.fcp-ticker-sep { padding: 0 0.6em; opacity: 0.85; }
.fcp-ticker-sep.is-empty { padding: 0 0.75em; }

/* Table layer (spec 11.7): rows of a published CSV file, a page at a time. */
.fcp-table .fcp-fit { display: block; white-space: normal; }
.fcp-grid {
    width: 100%;
    border-collapse: collapse;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    text-shadow: var(--fcp-shadow, none);
}
.fcp-grid th, .fcp-grid td { padding: 0.24em 0.6em; text-align: left; vertical-align: middle; }
.fcp-grid th { font-weight: 700; }
.fcp-grid.has-lines th, .fcp-grid.has-lines td { border-bottom: max(1px, 0.05em) solid var(--fcp-table-line); }
.fcp-grid .is-num { text-align: right; white-space: nowrap; }
.fcp-grid.has-lines tr.is-off td { border-bottom: 0; }
.fcp-grid tbody { transition: opacity 0.3s; }

/* Departures layer (spec 11.7 "Lähdöt"): the next buses or trains of a stop. */
.fcp-departures .fcp-fit { display: block; white-space: normal; }
.fcp-dep-title { font-weight: 700; font-size: 1.25em; line-height: 1.2; margin-bottom: 0.3em; white-space: nowrap; }
.fcp-dep-grid td, .fcp-dep-grid th { white-space: nowrap; }
.fcp-dep-grid .fcp-dep-to { width: 100%; }
.fcp-dep-grid .fcp-dep-platform { text-align: center; }
.fcp-dep-badge {
    display: inline-block;
    min-width: 2.4em;
    padding: 0.06em 0.35em;
    border-radius: 0.25em;
    color: #ffffff;
    font-weight: 700;
    text-align: center;
    text-shadow: none;
}
.fcp-dep-old { font-size: 0.7em; opacity: 0.7; margin-right: 0.4em; }
.fcp-dep-grid tr.is-cancelled .fcp-dep-to,
.fcp-dep-grid tr.is-cancelled .fcp-dep-line { text-decoration: line-through; opacity: 0.6; }
.fcp-dep-none { opacity: 0.75; font-weight: 400; }
.fcp-dep-stale { font-size: 0.55em; font-weight: 700; margin-top: 0.45em; white-space: nowrap; }
.fcp-dep-source { font-size: 0.5em; font-weight: 400; opacity: 0.7; margin-top: 0.5em; white-space: nowrap; }
