/*! Orbit · (c) 2026 Antichaos — antichaosdata.com. All rights reserved. Proprietary. */
:root { --fg: #151b26; --accent: #4f7cf0; }

html, body {
    margin: 0; padding: 0; height: 100%; width: 100%;
    overflow: hidden;
    background: transparent;             /* blend with the dashboard by default */
    font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    color: var(--fg);
}
.hidden { display: none !important; }

/* The rotation strip: caption + dots on the left, play/pause on the right. */
.orbit {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    /* Symmetric side padding reserves room for the (right-pinned) toggle, so the
       caption stays centred in the tile instead of being shoved left and clipped.
       46 = the button's 6px offset + 40px box, so a right-aligned caption ends beside it. */
    padding: 8px 46px; box-sizing: border-box;
}
.orbit-inner {
    display: flex; flex-direction: column; align-items: inherit; gap: 5px; min-width: 0; max-width: 100%;
}
.caption { display: flex; align-items: baseline; gap: 8px; min-width: 0; max-width: 100%; }
.caption .now {
    font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    opacity: .5; white-space: nowrap;
    min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis;   /* gives way with an ellipsis, never spills */
}
.current {
    font-weight: 800; letter-spacing: -.01em; line-height: 1.1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: opacity .2s ease;
}

/* Tall / narrow zone (set by applyDensity): stack the strip into a centred column so a
   portrait zone uses its height. The caption stacks label-over-value, the value is allowed
   to wrap, the dots wrap across rows, and the control drops below instead of pinned right. */
.tall .orbit { flex-direction: column; gap: 12px; padding: 14px 12px; }
.tall .orbit-inner { gap: 10px; }
.tall .caption { flex-direction: column; align-items: center; gap: 2px; }
.tall .current { white-space: normal; text-align: center; overflow: visible; overflow-wrap: anywhere; line-height: 1.15; }
.tall .dots { flex-wrap: wrap; justify-content: center; }
/* relative (not static) so it stays in normal flow BUT remains the positioning context for the
   absolutely-positioned .toggle button inside it (static would let the button escape to .orbit). */
.tall .toggle-wrap { position: relative; right: auto; top: auto; transform: none; margin-top: 2px; }

/* Narrow strip (set by fitStrip when the one-line caption does not fit, measured): the symmetric
   44px padding left the caption a few pixels, so it spilled past the play button and the Paused
   badge sat on the ring. Here the strip hugs the left, keeps only the button's width free on the
   right, stacks label over value and clips each line with an ellipsis. `short` (that stack is
   taller than the zone) drops the label; anything still too tall is clipped at the bottom (dots). */
.narrow .orbit { padding: 4px 50px 4px 10px; }
.narrow .orbit-inner { align-items: flex-start; gap: 3px; max-height: 100%; overflow: hidden; }
.narrow .orbit-inner > * { flex-shrink: 0; }   /* overflow (measurable, clipped) rather than squashed lines */
.narrow .caption { flex-direction: column; align-items: flex-start; gap: 1px; }
.narrow .current { max-width: 100%; }
.narrow.short .caption .now { display: none; }
/* No badge text in a narrow strip, nor in any zone under 210px wide (body.slim): the play button
   (always visible while paused, dimmed on hold) already shows the state. Kept when the button is
   hidden - then it is the only sign. */
.narrow .orbit:not(.no-toggle) .paused-badge,
.slim .orbit:not(.no-toggle) .paused-badge { display: none; }

/* Stacked (body.stack, set by fitStrip for a slim zone whose row would not fit, or that shows only
   the button): the tall layout in tighter clothes - caption centred above a centred button. A
   small object may clip its right edge (Tableau Desktop seems to keep a minimum web-view width),
   so the button is not pinned there. Falls back to narrow when the stack is taller than the zone. */
.stack .orbit { flex-direction: column; gap: 4px; padding: 4px 8px; }
.stack .orbit > * { flex-shrink: 0; }            /* a 40px button stays 40px (measured, never squashed) */
.stack .orbit-inner { align-items: center; gap: 4px; }
.stack .orbit-inner.void { display: none; }      /* nothing visible in it: the button alone, dead centre */
.stack .caption { flex-direction: column; align-items: center; gap: 1px; }
.stack .current { max-width: 100%; }
.stack .dots { flex-wrap: wrap; justify-content: center; }
.stack .toggle-wrap { position: relative; right: auto; top: auto; transform: none; }

/* progress dots */
.dots { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; max-width: 100%; overflow: hidden; }
.dot {
    flex: 0 0 auto;
    width: 7px; height: 7px; border-radius: 50%;
    background: color-mix(in srgb, var(--fg) 22%, transparent);
    transition: background .2s ease, width .2s ease, height .2s ease;
}
/* Grow the active dot's actual box (crisp circle) rather than transform:scale() — scaling a
   7px raster flattens the anti-aliased edges and reads as a hexagon/pill, not a circle. */
.dot.on { background: var(--accent); width: 9px; height: 9px; }
/* Clickable dots (config_dotclick): a button per step. The box is a 15px hit area around the
   same 7px dot (drawn with background-clip), so the strip looks the same as display-only dots. */
.dots-click .dots { gap: 0; }
button.dot {
    width: 15px; height: 15px; padding: 4px; margin: 0; border: 0; cursor: pointer;
    background-clip: content-box; font: inherit;
}
button.dot.on { padding: 3px; width: 15px; height: 15px; background-clip: content-box; }
button.dot:hover { background-color: color-mix(in srgb, var(--accent) 60%, transparent); }
button.dot:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
/* No progress dots (config_showdots off): a step per value makes no sense with many values. The
   caption keeps the strip; {n}/{total} in the label can still say where the rotation is. */
#running.no-dots .dots { display: none; }

/* play / pause — sits inside an optional countdown ring; revealed on hover */
.toggle-wrap { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; }
.toggle {
    position: absolute; inset: 3px;
    width: 34px; height: 34px; border-radius: 50%;
    border: 0; cursor: pointer;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-size: 14px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;                                   /* hidden until the tile is hovered */
    transition: opacity .15s ease, background .15s ease, transform .15s ease;
}
/* No play/pause button (config_showtoggle off): a circle countdown keeps its ring; without one
   the right-hand space the button reserved is given back. */
#running.no-toggle .toggle { display: none; }
#running.no-toggle:not(.cd-circle) .toggle-wrap { display: none; }
#running.no-toggle:not(.cd-circle) { padding-left: 12px; padding-right: 12px; }
#running:hover .toggle,
#running.is-paused .toggle { opacity: 1; }        /* also show while paused, so resume is findable */
/* On hold (config_holdparam, 1.2): the button is disabled - the parameter, not the viewer, decides. */
#running.is-held .toggle { opacity: .45; cursor: not-allowed; }
#running.is-held .toggle:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.toggle:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* Filling-circle countdown (style 'circle') — a ring around the toggle. */
.ring { position: absolute; inset: 0; width: 40px; height: 40px; transform: rotate(-90deg); display: none; }
#running.cd-circle .ring { display: block; }
.ring-track { fill: none; stroke: color-mix(in srgb, var(--fg) 12%, transparent); stroke-width: 2.5; }
.ring-fill {
    fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round;
    stroke-dasharray: 100; stroke-dashoffset: 100;   /* JS animates 100 → 0 over the interval */
}
@keyframes orbit-ring { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

.paused-badge {
    align-self: flex-start; box-sizing: border-box;
    max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 10px; font-weight: 700; letter-spacing: .04em;
    color: #92400e; background: #fef3c7; border-radius: 999px; padding: 1px 8px;
}
.paused-badge[hidden] { display: none; }
.hold-badge { color: #1e3a8a; background: #dbeafe; }

/* Line countdown (style 'line'): a thin bar along the bottom edge that fills over the
   interval, restarting on every step (driven from JS). Freezes when paused. */
.countdown {
    position: fixed; left: 0; right: 0; bottom: 0; height: 3px;
    background: color-mix(in srgb, var(--fg) 8%, transparent);
    z-index: 3; overflow: hidden;
    display: none;
}
#running.cd-line .countdown { display: block; }
.countdown > i {
    display: block; height: 100%; width: 0;
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 65%, #fff), var(--accent));
    border-radius: 0 3px 3px 0;
}
@keyframes orbit-countdown { from { width: 0; } to { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .countdown { display: none; } }

/* ---- setup / empty states (house style) ---- */
.state {
    position: fixed; inset: 0; z-index: 5;
    display: flex; align-items: center; justify-content: center; padding: 18px; box-sizing: border-box;
    background: var(--ac-bg, #fbfcfe);
}
.state.hidden { display: none !important; }
.setup-card {
    width: 100%; max-width: 340px;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px;
    padding: 26px 24px 22px;
    background: var(--ac-surface, #fff);
    border: 1px solid var(--ac-line, #e7ecf3);
    border-radius: var(--ac-radius, 16px);
    box-shadow: var(--ac-shadow, 0 4px 14px rgba(20, 28, 42, .08), 0 14px 34px rgba(20, 28, 42, .08));
}
.setup-icon {
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center; border-radius: 18px;
    background: color-mix(in srgb, #4f7cf0 12%, transparent); color: #4f7cf0;
}
.setup-card h2 { margin: 2px 0 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; color: var(--ac-ink, #151b26); }
.setup-card p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ac-ink-soft, #5d6878); }
.setup-btn {
    margin-top: 6px; padding: 10px 22px; border: 0; border-radius: 999px; cursor: pointer;
    background: #4f7cf0; color: #fff; font: 700 13px "Inter", sans-serif;
    box-shadow: 0 2px 10px color-mix(in srgb, #4f7cf0 30%, transparent);
    transition: filter .15s ease, transform .15s ease;
}
.setup-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* Small zone: hide the icon/title/copy/brand (unreadable at this size) and keep only the
   Configure button, so it stays inside the visible area instead of scrolling off. */
.compact .state { padding: 6px; }
.compact .setup-card {
    max-width: none; width: auto; gap: 0;
    padding: 0; border: 0; background: none; box-shadow: none;
}
.compact .setup-icon,
.compact .setup-card h2,
.compact .setup-card p,
.compact .setup-brand { display: none; }
.compact .setup-btn { margin-top: 0; padding: 8px 18px; }

.credit {
    position: fixed; bottom: 6px; right: 10px; z-index: 1;
    font-size: 10px; color: color-mix(in srgb, var(--fg) 45%, transparent);
    display: flex; align-items: center; gap: 6px;
}
.credit img { height: 16px; opacity: .7; }
/* On a thin strip the logo is noise — only show it in the setup states. */
#running ~ .credit { display: none; }

/* Drawn for an image/PDF export (environment.isExporting): no motion, no hover states. */
html.is-exporting *, html.is-exporting *::before, html.is-exporting *::after { transition: none !important; animation: none !important; }
html.is-exporting .toggle-wrap, html.is-exporting .countdown { display: none !important; }
