/* web/style.css — the HUD: an instrument over the picture. One dark world (space); the ink, dim and accent tokens
   follow the viewer's local hour (device.js paletteFor). Layout: the canvas fills the screen; the dials and the lens
   are rings about the planet (rings.js, one canvas), picture tiles fill the corners, one line of time and tags
   lies at the bottom, the menu is a sheet. */
/* IBM Plex, the weights the page uses, served from fonts/ beside it (no request to a font host: on weichseltree.com
   that would hand every visitor's address to it). SIL Open Font License, fonts/OFL.txt */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
:root {
  --bg: #04060b;
  --ink: #eef2f6;
  --dim: #a7b1bd;
  --accent: #8fc1ff;
  --glass: rgba(12, 18, 28, 0.58);
  --line: rgba(255, 255, 255, 0.14);
  --good: #7ed6a3;
  --warn: #ffb86b;
  --font-ui: "IBM Plex Sans", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-num: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); overflow: hidden; -webkit-text-size-adjust: 100%; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; background: var(--bg); transform-origin: 50% 185%; }   /* the lens swings about the nosepiece's axis, below the screen */
.rings { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.hud { position: fixed; left: 0; right: 0; pointer-events: none; padding-left: max(16px, var(--marble-left, env(safe-area-inset-left, 0px))); padding-right: max(16px, var(--marble-right, env(safe-area-inset-right, 0px))); }
.hud > * { pointer-events: auto; }
.card { background: var(--glass); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.chip { border: 1px solid var(--line); background: rgba(255,255,255,0.05); color: var(--dim); border-radius: 999px; padding: 7px 9px; font: 500 12px/1 var(--font-ui); cursor: pointer; white-space: nowrap; flex: none; }
.chip.on { color: var(--ink); border-color: var(--accent); background: rgba(143,193,255,0.14); }
.chip.accent { color: var(--accent); border-color: rgba(143,193,255,0.45); }
/* the corners: tiles, each a picture of what it switches (hud.js ART); while a tile is on, its picture plays */
.corner { display: flex; align-items: flex-start; gap: 8px; right: auto; padding: 0; }
.corner.tl { top: calc(10px + var(--marble-top, env(safe-area-inset-top, 0px))); left: max(10px, var(--marble-left, env(safe-area-inset-left, 0px))); }
.corner.tr { top: calc(10px + var(--marble-top, env(safe-area-inset-top, 0px))); left: auto; right: max(10px, var(--marble-right, env(safe-area-inset-right, 0px))); }
.corner.bl { bottom: calc(52px + var(--marble-bottom, env(safe-area-inset-bottom, 0px))); left: max(10px, var(--marble-left, env(safe-area-inset-left, 0px))); }
.corner.br { bottom: calc(52px + var(--marble-bottom, env(safe-area-inset-bottom, 0px))); left: auto; right: max(10px, var(--marble-right, env(safe-area-inset-right, 0px))); }
.tile { width: 46px; padding: 0; border: none; background: none; color: var(--dim); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; opacity: 0.72; }
.tile .pic { width: 46px; height: 46px; box-sizing: border-box; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: grid; place-items: center; }
.tile .word { font: 500 9.5px/1 var(--font-ui); letter-spacing: 0.03em; color: var(--dim); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); white-space: nowrap; }
.tile svg { width: 34px; height: 34px; overflow: hidden; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* the parts of the pictures. A length in a transform is a unit of the svg's 48 box whatever size the tile is drawn at;
   an origin is a point of that box (view-box), or the part's own middle where it says fill-box */
.tile svg * { transform-box: view-box; }
.tile .solid { fill: currentColor; stroke: none; }
.tile .full { fill: currentColor; }
.tile .limb { fill: currentColor; fill-opacity: 0.14; }
.tile .disc { fill: currentColor; fill-opacity: 0.28; }
/* what the camera follows: the event's still picture; the frame is not there while the tile is off */
.tile.impact { --aim: 24px, 24px; } .tile.vent { --aim: 24px, 19px; } .tile.province { --aim: 24px, 33.5px; }
.tile .aim { stroke: var(--accent); opacity: 0; transform: translate(var(--aim)); }
.tile .meteor, .tile .burst, .tile .flash { transform-origin: 24px 24px; }
.tile .flash { fill: currentColor; stroke: none; opacity: 0; }
.tile .late { opacity: 0; }
.tile .puff { fill: currentColor; stroke: none; transform-box: fill-box; transform-origin: center; }
.tile .pa { --rise: 0px, 6.5px; --gone: 2.5px, -3px; } .tile .pb { --rise: -5px, 11.7px; --gone: -2.5px, 2.2px; }
.tile .flood { fill: currentColor; stroke: none; opacity: 0.92; }
.tile .flood * { transform-box: fill-box; } .tile .f1 { transform-origin: center; } .tile .f2 { transform-origin: 0% 50%; } .tile .f3 { transform-origin: 100% 50%; }
/* what the picture draws: the air a glow about the disc, the clouds streaks across it; neither while off */
.tile .halo { stroke: var(--accent); stroke-width: 4.5; opacity: 0; }
.tile .halo :nth-child(2) { stroke-width: 3; opacity: 0.45; } .tile .halo :nth-child(3) { stroke-width: 2.5; opacity: 0.18; }
.tile .drift { stroke-width: 3; opacity: 0.22; }
/* the acts */
.tile .swirl, .tile .year { transform-origin: 24px 24px; }
.tile .globe { transform-origin: 37.1px 14.8px; }
.tile .orbit { stroke-width: 1.5; opacity: 0.4; }
.tile .rays { stroke-width: 1.8; }
.tile .bar { stroke-width: 3; }
.tile.on { color: var(--ink); opacity: 1; }
.tile.on .pic { border-color: var(--accent); }
.tile.on .word { color: var(--ink); }
.tile.jump, .tile.menu, .tile.weather, .tile.season { color: var(--ink); opacity: 0.9; }
/* a follow tile that is on plays what the camera will do, one 3 s loop for all three: the event (8–30 %), the frame
   closing in on it from the full view (30–54 %), the hold, and all of it fading to the empty limb the loop began with */
.tile.on .aim { opacity: 1; animation: aim 3s cubic-bezier(.4, 0, .2, 1) infinite; }
.tile.on .meteor { animation: meteor 3s ease-in infinite; }
.tile.on .burst { animation: burst 3s ease-out infinite; }
.tile.on .flash { animation: flash 3s ease-out infinite; }
.tile.on .late { animation: late 3s infinite; }
.tile.on .puff { animation: puff 3s ease-out infinite backwards; }
.tile.on .pb { animation-delay: 0.39s; }
.tile.on .flood { animation: flood 3s linear infinite; }
.tile.on .f1 { animation: spread1 3s ease-out infinite; }
.tile.on .f2 { animation: spread2 3s ease-out infinite; }
.tile.on .f3 { animation: spread3 3s ease-out infinite; }
.tile.on .halo { opacity: 1; animation: halo 1.6s ease-in-out infinite alternate; }
.tile.on .drift { opacity: 1; animation: drift 6s linear infinite; }
.tile.go .swirl, .tile.go .globe { animation: turn 0.9s cubic-bezier(.3, 0, .2, 1); }
.tile.go .year { animation: unturn 0.9s cubic-bezier(.3, 0, .2, 1); }
@keyframes aim { 0%, 30% { opacity: 0; transform: translate(24px, 24px) scale(1.75); stroke-width: 1.2; } 38% { opacity: 1; } 54%, 86% { opacity: 1; transform: translate(var(--aim)) scale(1); stroke-width: 2; } 100% { opacity: 0; transform: translate(var(--aim)) scale(1); stroke-width: 2; } }
@keyframes meteor { 0%, 7% { opacity: 0; transform: translate(20px, -23.4px); } 9% { opacity: 1; } 24% { opacity: 1; transform: translate(-5.9px, 6.8px); } 25%, 100% { opacity: 0; transform: translate(-5.9px, 6.8px); } }
@keyframes flash { 0%, 23% { opacity: 0; transform: scale(0.3); } 26% { opacity: 1; transform: scale(1); } 46%, 100% { opacity: 0; transform: scale(2.4); } }
@keyframes burst { 0%, 24% { opacity: 0; transform: scale(0.3); } 30% { opacity: 1; transform: scale(1.2); } 38%, 86% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }
@keyframes late { from, to { opacity: 1; } }
@keyframes puff {
  0%, 8% { opacity: 0; transform: translate(var(--rise)) scale(0.4); } 12%, 26% { opacity: 1; } 34% { opacity: 0; transform: translate(var(--gone)) scale(1.3); }
  34.01% { opacity: 0; transform: translate(var(--rise)) scale(0.4); } 38%, 52% { opacity: 1; } 60% { opacity: 0; transform: translate(var(--gone)) scale(1.3); }
  60.01% { opacity: 0; transform: translate(var(--rise)) scale(0.4); } 64%, 78% { opacity: 1; } 86%, 100% { opacity: 0; transform: translate(var(--gone)) scale(1.3); }
}
@keyframes flood { 0%, 8% { opacity: 0; } 14%, 86% { opacity: 0.92; } 100% { opacity: 0; } }
@keyframes spread1 { 0%, 8% { transform: scale(0.1); } 42%, 100% { transform: scale(1); } }
@keyframes spread2 { 0%, 18% { transform: scale(0); } 48%, 100% { transform: scale(1); } }
@keyframes spread3 { 0%, 26% { transform: scale(0); } 56%, 100% { transform: scale(1); } }
@keyframes halo { from { opacity: 1; } to { opacity: 0.55; } }
@keyframes drift { to { transform: translateX(36px); } }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes unturn { to { transform: rotate(-360deg); } }
/* the line at the bottom: the time in numbers, the picture's state in tags */
.line { bottom: calc(8px + var(--marble-bottom, env(safe-area-inset-bottom, 0px))); display: grid; grid-template-columns: max-content; justify-content: center; justify-items: start; align-items: end; gap: 2px 14px; font: 500 12px/1.5 var(--font-num); font-size: min(12px, calc((100vw - 24px) / 30.7)); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); pointer-events: none; }
.line > * { pointer-events: none; }
/* the time has always the same number of figures (hud.js pads them) and stands in the middle, on the bottom row; the
   tags stand above it at its width and wrap upward (narrow screens), or to its right in what is left of the screen
   (wide ones): nothing that changes moves the time — the tags take no part in the column's width (width 0, then
   stretched to it). The type shrinks on a screen narrower than the time (~30 em). Each stands on its own dark
   ground: the planet behind them may be bright */
.line .time, .line .tags { background: rgba(4, 6, 11, 0.55); border-radius: 8px; padding: 0 8px; }
.line .time { color: var(--ink); white-space: pre; }
.line .tags { color: var(--accent); text-align: left; order: -1; box-sizing: border-box; width: 0; min-width: 100%; max-width: none; }
.line .tags:empty { display: none; }
.tile .word { display: none; }   /* (icons, no words: the tiles' pictures carry them; their titles stay) */
.line .time, .line .tags { display: none; }   /* (the line drawn as icons and figures, hud.js drawLine; its words its accessible name) */
.lineCv { display: block; width: min(96vw, 760px); height: 38px; grid-column: 1 / -1; justify-self: center; }
.timeline { position: fixed; left: 10px; width: calc(100vw - 20px); bottom: calc(126px + env(safe-area-inset-bottom, 0px)); height: 84px; border-radius: 10px; z-index: 5; touch-action: none; cursor: ew-resize; }
body.bare .timeline { display: none; }
.sheet { position: fixed; inset: 0; background: rgba(2, 4, 8, 0.72); display: none; z-index: 20; }
.sheet.open { display: block; }
.sheet.first { z-index: 40; }   /* (the settings at a first open: over the opening, while the planet is made behind it) */
.sheet .panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86%; overflow: auto; background: #0b111b; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 14px max(16px, var(--marble-right, env(safe-area-inset-right, 0px))) calc(20px + var(--marble-bottom, env(safe-area-inset-bottom, 0px))) max(16px, var(--marble-left, env(safe-area-inset-left, 0px))); }
.panel h2 { font: 600 13px/1.2 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin: 18px 0 8px; }
.panelBody h2:first-child { margin-top: 4px; }
.panel .close { position: absolute; right: 12px; top: 10px; width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.form { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr); gap: 8px 12px; align-items: center; font: 400 13px/1.45 var(--font-ui); }
.form .k { color: var(--dim); }
.form .k.off, .form .v.off { opacity: 0.45; }
.form .v { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--ink); }
.form select, .form input[type=number] { font: 400 13px/1.3 var(--font-num); color: var(--ink); background: rgba(255,255,255,0.05); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; max-width: 100%; }
.form input[type=number] { width: 9em; }
.form input:disabled, .form select:disabled { cursor: not-allowed; }
.kv { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, 2fr); gap: 4px 12px; font: 400 13px/1.45 var(--font-ui); }
.kv .k { color: var(--dim); min-width: 0; }
.kv .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.kv .v.good { color: var(--good); } .kv .v.warn { color: var(--warn); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.chart { min-width: 0; }
.chart .title { font: 500 12px/1.3 var(--font-ui); color: var(--dim); margin-bottom: 4px; display: flex; justify-content: space-between; }
.chart .title b { color: var(--ink); font-family: var(--font-num); font-weight: 500; }
.chart canvas { width: 100%; height: 64px; display: block; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row label { font: 400 12.5px/1.3 var(--font-ui); color: var(--dim); }
.row input[type=range] { flex: 1; min-width: 100px; accent-color: var(--accent); }
.list { font: 400 12.5px/1.5 var(--font-ui); color: var(--dim); }
.list li { margin: 2px 0; }
.list code { font-family: var(--font-num); color: var(--ink); }
.status { font: 400 12px/1.4 var(--font-ui); color: var(--dim); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--marble-bottom, env(safe-area-inset-bottom, 0px))); background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font: 400 12.5px/1.4 var(--font-ui); color: var(--ink); max-width: min(92vw, 520px); z-index: 15; opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.toast.show { opacity: 1; }
.opening { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 30; color: var(--dim); font: 400 14px/1.5 var(--font-ui); text-align: center; padding: 24px; transition: opacity 0.6s; }
.opening.gone { opacity: 0; pointer-events: none; }
.opening .big { font: 500 22px/1.2 var(--font-num); color: var(--ink); margin-bottom: 8px; }
@media (prefers-reduced-motion: reduce) { .opening, .toast { transition: none; } }
/* a wide screen (a desktop's full screen): larger tiles, the menu a panel at the right edge — the rings and the
   planet's disc stay clear, and the menu's numbers can be read beside them */
@media (min-width: 1000px) and (min-aspect-ratio: 4/3) {
  .tile { width: 58px; }
  .tile .pic { width: 58px; height: 58px; border-radius: 14px; }
  .tile .word { font-size: 10.5px; }
  .tile svg { width: 42px; height: 42px; }
  .corner { gap: 10px; }
  /* (--marble-*: the lens page's chrome when framed, marble-adapter.js; unset, 0) */
  .corner.tl, .corner.tr { top: calc(16px + var(--marble-top, 0px)); } .corner.tl, .corner.bl { left: calc(16px + var(--marble-left, 0px)); } .corner.tr, .corner.br { right: calc(16px + var(--marble-right, 0px)); }
  .corner.bl, .corner.br { bottom: calc(40px + var(--marble-bottom, env(safe-area-inset-bottom, 0px))); }
  .timeline { left: 160px; width: calc(100vw - 320px); bottom: calc(52px + env(safe-area-inset-bottom, 0px)); height: 92px; }
  .line { font-size: 13px; grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1fr); justify-content: stretch; }
  .line .time { grid-column: 2; }
  .line .tags { grid-column: 3; order: 0; width: auto; min-width: 0; max-width: 100%; white-space: normal; }
  .sheet { background: rgba(2, 4, 8, 0.3); }
  .sheet .panel { left: auto; top: 0; width: min(520px, 42vw); max-height: none; border-top: none; border-left: 1px solid var(--line); border-radius: 22px 0 0 22px; padding-top: calc(14px + var(--marble-top, env(safe-area-inset-top, 0px))); padding-left: 16px; }
  .panel .close { top: calc(10px + var(--marble-top, env(safe-area-inset-top, 0px))); }
}
/* the picture alone (H on a keyboard) */
body.bare .hud, body.bare .toast { display: none; }
/* as a marble on weichseltree.com (marble-adapter.js): the page draws the lens and the age as its own bands */
body.marble .rings { display: none; }
body.marble .timeline { display: none; }   /* (the lens page draws the age itself, marble-adapter.js) */
@media (prefers-reduced-motion: reduce) { #view { transform: none !important; filter: none !important; } .tile * { animation: none !important; } }

/* in a headset (xr.js) the page's instrument is not drawn: the arm carries the dials. What a screen beside the headset
   still shows is the way out */
body.xr .rings, body.xr .hud, body.xr .toast { visibility: hidden; }
body.xr #vr { visibility: visible; opacity: 1; color: var(--accent); }
