Files
f1-circuits/examples/site.css
T
jschoubben db9f386c7a Add a library page: seasons, race weekends and sessions as Plex shows them
The operator wants to browse the posters the way a Plex or Emby Formula 1
library shows them. The page reads the whole library from the one Kometa
file (rounds, race names in the race posters' addresses, sessions in the
episodes'), waits through a fresh server's minutes-long first answer
instead of failing, and loads each picture only when it is on screen, two
at a time, dropping the queue when the reader leaves a level: every
poster is a render of about 10 s that pulls map tiles. Each level has its
own address and back/forward work; a picture the server has none for is
a plain card with its name.

The session order per weekend format moves into site.js, so the posters
page and the library read the same list.

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
2026-11-27 10:33:19 +01:00

356 lines
12 KiB
CSS

/* Shared styles for the F1 Circuits API examples: one file, light and dark. */
:root {
color-scheme: light dark;
--bg: #f4f4f7;
--card: #ffffff;
--text: #15151e;
--muted: #5d5d6c;
--line: #dcdce4;
--accent: #e10600;
--accent-text: #ffffff;
--code-bg: #f0f0f4;
--ok: #1a7f37;
--warn: #9a6700;
--error: #c62828;
--tile: #ffffff;
--json-key: #0b5cad;
--json-string: #1a7f37;
--json-number: #a3480b;
--json-literal: #8250df;
--radius: 10px;
--mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #111116;
--card: #1b1b23;
--text: #e9e9ef;
--muted: #a3a3b3;
--line: #2e2e3a;
--accent: #ff3b30;
--code-bg: #24242e;
--ok: #4ac26b;
--warn: #d29922;
--error: #ff6b6b;
--tile: #1b1b23;
--json-key: #79b8ff;
--json-string: #85e89d;
--json-number: #ffab70;
--json-literal: #d2a8ff;
}
}
* { box-sizing: border-box; }
body {
margin: 0;
background: var(--bg);
color: var(--text);
font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
/* ---- header and navigation ---- */
header.site {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem 1.25rem;
padding: 0.75rem 1.5rem;
background: var(--card);
border-bottom: 3px solid var(--accent);
}
header.site .brand {
font-weight: 800;
color: var(--text);
text-decoration: none;
letter-spacing: 0.02em;
}
header.site .brand span { color: var(--accent); }
header.site nav { display: flex; flex-wrap: wrap; gap: 0.25rem; flex: 1; }
header.site nav a {
color: var(--muted);
text-decoration: none;
padding: 0.3rem 0.6rem;
border-radius: 6px;
}
header.site nav a:hover { color: var(--text); background: var(--code-bg); }
header.site nav a[aria-current="page"] { color: var(--accent-text); background: var(--accent); }
.api-switch { font-size: 0.85rem; color: var(--muted); }
.api-switch summary { cursor: pointer; }
.api-switch summary code { color: var(--text); }
.api-switch form { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.api-switch input { width: 18rem; }
main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
h1 { margin: 0.25rem 0 0.5rem; font-size: 1.9rem; }
h2 { margin: 2rem 0 0.5rem; font-size: 1.35rem; }
h3 { margin: 1.25rem 0 0.4rem; font-size: 1.1rem; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 60rem; }
footer.pager {
max-width: 1200px;
margin: 2rem auto 0;
padding: 1rem 1.5rem 2.5rem;
display: grid;
grid-template-columns: 1fr auto 1fr;
gap: 1rem;
border-top: 1px solid var(--line);
}
footer.pager a { text-decoration: none; font-weight: 600; }
footer.pager [rel="next"] { justify-self: end; }
footer.pager .home { justify-self: center; }
/* ---- cards, calls and results ---- */
.card {
background: var(--card);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 1rem 1.1rem;
margin: 1rem 0;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.grid-2 > .card { margin: 0; }
/* The request bar: the exact URL a call sends, with Copy and Open. */
.request {
display: flex;
align-items: center;
gap: 0.5rem;
background: var(--code-bg);
border: 1px solid var(--line);
border-radius: 8px;
padding: 0.4rem 0.5rem;
min-height: 2.4rem;
}
.request .verb {
font: 700 0.75rem var(--mono);
color: var(--accent-text);
background: var(--ok);
border-radius: 4px;
padding: 0.15rem 0.4rem;
}
.request .url {
flex: 1;
overflow-x: auto;
white-space: nowrap;
font-size: 0.85rem;
scrollbar-width: thin;
}
.request .label { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.request:empty { display: none; }
/* In a narrow card: the buttons on the first row, the whole URL wrapped below them. */
.request.compact { flex-wrap: wrap; }
.request.compact .url { order: 9; flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; font-size: 0.75rem; }
.request button, .request a.open { font-size: 0.8rem; padding: 0.2rem 0.55rem; }
.request a.open {
border: 1px solid var(--line);
border-radius: 6px;
text-decoration: none;
color: var(--text);
background: var(--card);
}
.status { font-size: 0.85rem; margin: 0.4rem 0 0.6rem; color: var(--muted); min-height: 1.3em; }
.status.ok::before { content: "● "; color: var(--ok); }
.status.pending::before { content: "◌ "; color: var(--warn); }
.status.error { color: var(--error); }
.status.error::before { content: "✕ "; }
.status.idle::before { content: "○ "; }
.result:empty { display: none; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 0 0 0.6rem; }
.hint.error { color: var(--error); }
pre.code {
margin: 0;
background: var(--code-bg);
border: 1px solid var(--line);
border-radius: 8px;
padding: 0.75rem;
overflow: auto;
max-height: 32rem;
font-size: 0.82rem;
line-height: 1.45;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
pre.code.tall { max-height: 70vh; }
.j-key { color: var(--json-key); }
.j-str { color: var(--json-string); }
.j-num { color: var(--json-number); }
.j-lit { color: var(--json-literal); }
.notice {
border-left: 4px solid var(--warn);
background: var(--code-bg);
padding: 0.6rem 0.8rem;
border-radius: 0 8px 8px 0;
margin: 0.6rem 0;
}
.notice.error { border-left-color: var(--error); }
.notice.info { border-left-color: var(--json-key); }
/* ---- forms ---- */
.controls { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: end; margin: 0.5rem 0 0.75rem; }
.controls label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; color: var(--muted); }
.controls label.inline { flex-direction: row; align-items: center; gap: 0.35rem; color: var(--text); font-size: 0.9rem; }
.controls fieldset { border: none; padding: 0; margin: 0; display: flex; gap: 0.75rem; align-items: center; }
.controls legend { font-size: 0.8rem; color: var(--muted); padding: 0; margin-bottom: 0.2rem; }
select, input, button {
font: inherit;
font-size: 0.92rem;
color: var(--text);
background: var(--card);
border: 1px solid var(--line);
border-radius: 6px;
padding: 0.35rem 0.5rem;
}
input[type="number"] { width: 6.5rem; }
input.wide { min-width: 16rem; }
select { max-width: 30rem; }
button { cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: 0.55; cursor: progress; }
/* ---- lists of choices (circuit browser) ---- */
.choices { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; }
.choices button { font-size: 0.88rem; }
.choices button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.choices button small { color: inherit; opacity: 0.7; }
/* ---- images ---- */
.track-tile {
background: var(--tile);
border: 1px solid var(--line);
border-radius: 8px;
display: grid;
place-items: center;
padding: 0.75rem;
min-height: 9rem;
}
.track-tile img { width: 100%; max-width: 480px; max-height: 320px; object-fit: contain; }
@media (prefers-color-scheme: dark) {
/* The service's track images are a black line on a transparent ground. */
.track-tile img { filter: invert(1); }
}
.layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.layout-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.layout-card h3 { margin: 0; }
.layout-card p { margin: 0; font-size: 0.88rem; color: var(--muted); }
.layout-card .links { font-size: 0.85rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.layout-card .track-tile { min-height: 7rem; }
.layout-card .track-tile img { max-height: 160px; }
.layout-card code.small { font-size: 0.72rem; word-break: break-all; }
.poster { display: block; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.poster.portrait { max-height: 640px; }
.preview { margin-top: 0.75rem; }
/* ---- tables ---- */
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td code { white-space: nowrap; }
table.kv th { width: 12rem; }
/* ---- map ---- */
#map { height: 560px; border-radius: var(--radius); border: 1px solid var(--line); }
.leaflet-container { font: inherit; }
/* ---- index ---- */
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.pages a.page {
display: block;
background: var(--card);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 1rem;
color: var(--text);
text-decoration: none;
}
.pages a.page:hover { border-color: var(--accent); }
.pages a.page h3 { margin: 0 0 0.3rem; color: var(--accent); }
.pages a.page p { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.92rem; }
.pages a.page ul { margin: 0; padding-left: 1.1rem; font-size: 0.78rem; }
.pages a.page li code { background: none; padding: 0; overflow-wrap: anywhere; }
/* ---- library ---- */
.status.warn::before { content: "! "; color: var(--warn); }
.status.warn { color: var(--warn); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 1.3rem; margin: 1.5rem 0 0.25rem; }
.crumbs a { text-decoration: none; font-weight: 600; }
.crumbs [aria-current="page"] { font-weight: 700; }
.crumbs .sep { color: var(--muted); }
.level-head { display: flex; gap: 1.25rem; align-items: flex-start; margin: 0.75rem 0 1rem; }
.level-head .tile { width: 180px; flex: none; }
.level-head h2 { margin-top: 0.25rem; }
.level-head p { margin: 0.3rem 0; color: var(--muted); }
.tiles { display: grid; gap: 1.25rem 1rem; }
.tiles.posters { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tiles.thumbs { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.tile-link { color: var(--text); text-decoration: none; display: flex; flex-direction: column; gap: 0.3rem; }
a.tile-link:hover .tile-frame { outline: 3px solid var(--accent); }
.tile-frame {
position: relative;
background: var(--code-bg);
border: 1px solid var(--line);
border-radius: 8px;
overflow: hidden;
display: grid;
place-items: center;
}
.tile-frame.poster { aspect-ratio: 2 / 3; }
.tile-frame.thumb { aspect-ratio: 16 / 9; }
.tile-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-frame .tile-note { font-size: 0.8rem; color: var(--muted); text-align: center; padding: 0.5rem; }
.tile-frame.plain { background: var(--card); padding: 0.75rem; text-align: center; }
.tile-frame.plain strong { display: block; font-size: 1rem; margin-bottom: 0.4rem; }
.tile-frame.plain span { font-size: 0.8rem; color: var(--muted); }
.tile-title { font-weight: 650; line-height: 1.3; }
.tile-sub { font-size: 0.82rem; color: var(--muted); }
.tile .request.compact { padding: 0.25rem 0.35rem; min-height: 0; gap: 0.3rem; }
.tile .request.compact .url { font-size: 0.66rem; }
.tile .request .verb { font-size: 0.62rem; }
.tile .request button, .tile .request a.open { font-size: 0.7rem; padding: 0.1rem 0.4rem; }
.tile .status { font-size: 0.72rem; margin: 0; }
.spinner {
width: 2.2rem; height: 2.2rem; border-radius: 50%;
border: 4px solid var(--line); border-top-color: var(--accent);
animation: spin 1s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } }
.waiting { display: flex; gap: 1rem; align-items: center; }
.waiting p { margin: 0.2rem 0; }