/* Paradigms 2026 — Typographic Treatment */

@font-face {
    font-family: 'ABCDiatype';
    src: url('../font/ABCDiatype-Medium-Trial.woff2') format('woff2'),
         url('../font/ABCDiatype-Medium-Trial.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        repeating-conic-gradient(#e0e0e0 0% 25%, #fff 0% 50%) 0 0 / 20px 20px;
}

/* --- Canvas layer --- */
#glcanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: block;
}

/* --- Text overlay layer --- */
#text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;

    font-family: 'ABCDiatype', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 500;
    color: transparent;
    caret-color: #fff;

    outline: none;
    cursor: text;
    padding: 2rem;

    -webkit-user-select: text;
    user-select: text;
}

#text-overlay::selection {
    background: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
}

#text-overlay *::selection {
    background: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
}

/* --- lil-gui: dark glass theme + positioning --- */
.paradigms-gui {
    z-index: 2;
    position: fixed !important;
    top: 12px !important;
    right: 12px !important;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    --background-color: rgba(0, 0, 0, 0.55);
    --widget-color: rgba(255, 255, 255, 0.08);
    --focus-color: rgba(255, 255, 255, 0.15);
    --hover-color: rgba(255, 255, 255, 0.12);
    --number-color: rgba(255, 255, 255, 0.7);
    --string-color: rgba(255, 255, 255, 0.7);
    --font-family: 'ABCDiatype', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-size: 11px;
    --text-color: rgba(255, 255, 255, 0.85);
    --title-background-color: rgba(0, 0, 0, 0.3);
    --title-text-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.paradigms-gui .children {
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.paradigms-gui input,
.paradigms-gui select {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
}

.paradigms-gui .slider {
    background: rgba(255, 255, 255, 0.06);
}

.paradigms-gui.is-hidden {
    display: none;
}

/* --- Timeline bar (QuickTime-style) --- */
.timeline-bar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 640px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 10px 16px 8px;
    font-family: 'ABCDiatype', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 500;
    color: #fff;
    font-size: 11px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    min-height: 66px;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Auto-hide when idle */
.timeline-bar.is-idle {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
    pointer-events: none;
}

/* Hide cursor when idle */
body.cursor-hidden {
    cursor: none;
}

/* --- Scrub area (padded hit target) --- */
.timeline-scrub {
    position: relative;
    padding: 6px 0;
    cursor: pointer;
    margin-bottom: 10px;
    min-height: 10px;
}

/* --- Track (thin bar, expands on hover) --- */
.timeline-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    transition: height 0.15s ease;
}

.timeline-scrub:hover .timeline-track {
    height: 3px;
}

.timeline-track-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.35);
    border-radius: inherit;
    pointer-events: none;
}

/* --- Playhead (circle) --- */
.timeline-playhead {
    position: absolute;
    top: 50%;
    left: 0;
    width: 13px;
    height: 13px;
    background: #fff;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease;
    opacity: 0;
}

.timeline-scrub:hover .timeline-playhead,
.timeline-bar.is-playing .timeline-playhead,
.timeline-bar.is-scrubbing .timeline-playhead {
    opacity: 1;
}

.timeline-scrub:hover .timeline-playhead {
    transform: translate(-50%, -50%) scale(1.1);
}

/* --- Controls row --- */
.timeline-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-spacer {
    flex: 1;
}

/* --- Play button (borderless) --- */
.timeline-play {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.1s;
}

.timeline-play:hover {
    color: #fff;
}

/* --- Animation toggles --- */
.timeline-toggles {
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    padding: 0;
    cursor: pointer;
    transition: all 0.15s;
}

.timeline-toggle-pro{
    margin-right: 6px;
}

.timeline-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
}

.timeline-toggle.is-active {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
}

.timeline-toggle.is-active:hover {
    background: #fff;
}

.timeline-toggle svg {
    display: block;
    shape-rendering: geometricPrecision;
}

/* Force controls-row content onto its own compositing layer
   so backdrop-filter blur doesn't soften icons and text */
.timeline-controls-row {
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Vertical slider popup --- */
.timeline-vslider {
    position: fixed;
    transform: translate(-50%, -100%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.timeline-vslider-track {
    width: 4px;
    height: 100px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.timeline-vslider-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.7);
    border-radius: inherit;
    transition: none;
}

.timeline-vslider-label {
    font-family: 'ABCDiatype', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}

/* --- Time display --- */
.timeline-time {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    opacity: 0.5;
    font-size: 11px;
}

.timeline-total {
    cursor: pointer;
    border-radius: 3px;
    padding: 1px 3px;
    margin: -1px -3px;
    transition: background 0.15s;
}

.timeline-total:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- Inline duration edit --- */
.timeline-duration-edit {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    padding: 1px 4px;
    width: 48px;
    font-size: 11px;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
    outline: none;
}

/* --- Preset toggle strip — goo blob group --- */
.timeline-preset-group {
    position: relative;
    isolation: isolate;
}

/* Goo-filtered background: full-alpha circles for shape detection,
   #goo-light replaces the visual with a subtle tint + white border */
.timeline-preset-blob-bg {
    position: absolute;
    inset: -12px;
    padding: 12px;
    display: flex;
    align-items: center;
    filter: url(#goo-light);
    pointer-events: none;
    overflow: visible;
    opacity: 0.4;
    padding-left: 7px;
    padding-right: 7px;
}

.timeline-preset-blob-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #000;
    flex: 1 0 0%;
}

/* Content layer — buttons sit on top, unfiltered */
.timeline-preset-strip {
    position: relative;
    display: flex;
    align-items: center;
    background: none;
    border: none;
    height: 26px;
    z-index: 1;
}

.timeline-preset-indicator {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 20px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.timeline-preset-btn {
    position: relative;
    z-index: 1;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    padding: 4px 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s;
}

.timeline-preset-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

.timeline-preset-btn.is-active {
    color: rgba(255, 255, 255, 0.95);
}

/* --- Color pickers --- */
.timeline-colors {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}

.timeline-color {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    background: none;
    transition: border-color 0.15s;
}

.timeline-color:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.timeline-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.timeline-color::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.timeline-color::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}

/* --- Color wrap (checkerboard behind swatch for alpha preview) --- */
.timeline-color-wrap {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: repeating-conic-gradient(#999 0% 25%, #666 0% 50%) 0 0 / 6px 6px;
    cursor: pointer;
    overflow: hidden;
}

.timeline-color-wrap .timeline-color {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 50%;
    pointer-events: none;
}

/* --- Keyframe SVG arc layer --- */
.timeline-kf-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.timeline-kf-svg path {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.8;
}

/* --- Keyframe dots --- */
.timeline-kf-dot {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--kf-color);
    transform: translate(-50%, -50%);
    z-index: 2;
    cursor: grab;
    pointer-events: auto;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

/* Large invisible hit area via pseudo-element */
.timeline-kf-dot::before {
    content: '';
    position: absolute;
    top: -14px;
    left: -14px;
    right: -14px;
    bottom: -14px;
    border-radius: 50%;
}

.timeline-kf-dot:hover {
    transform: translate(-50%, -50%) scale(1.3);
    box-shadow: 0 0 8px var(--kf-color);
}

.timeline-kf-dot.is-selected {
    transform: translate(-50%, -50%) scale(1.4);
    box-shadow: 0 0 12px var(--kf-color), 0 0 4px var(--kf-color);
}

/* --- Keyframe picker popup --- */
.timeline-kf-picker {
    position: fixed;
    z-index: 20;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 180px;
    max-height: 320px;
    overflow-y: auto;
    font-family: 'ABCDiatype', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.timeline-kf-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.timeline-kf-picker-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.timeline-kf-picker-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.timeline-kf-picker-val {
    margin-left: auto;
    opacity: 0.4;
    font-variant-numeric: tabular-nums;
}

/* --- Easing picker popup --- */
.timeline-easing-picker {
    position: fixed;
    z-index: 20;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 130px;
    font-family: 'ABCDiatype', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.timeline-easing-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.timeline-easing-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.timeline-easing-item.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.timeline-easing-preview {
    flex-shrink: 0;
    opacity: 0.6;
}

.timeline-easing-item.is-active .timeline-easing-preview {
    opacity: 1;
}

/* --- Action buttons — blobby group architecture --- */
.timeline-actions {
    position: absolute;
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
}

.timeline-actions-left {
    right: auto;
    left: -80px;
}

.timeline-actions-left .timeline-blob-bg,
.timeline-actions-left .timeline-blob-content {
    direction: rtl;
}

/* Blob group wrapper — isolate goo filter */
.timeline-blob-group {
    isolation: isolate;
}

/* Background blob layer — grid mirrors the content layout.
   Negative inset + matching padding gives the goo blur room to extend
   while keeping circle grid cells aligned with button grid cells.
   Explicit 32px columns prevent 50px circles from inflating the grid —
   circles overflow their cells and the goo blur merges the overlap. */
.timeline-blob-bg {
    position: absolute;
    inset: -16px;
    padding: 16px;
    display: grid;
    grid-template-rows: repeat(2, 32px);
    grid-template-columns: repeat(2, 32px);
    grid-auto-flow: column;
    row-gap: 6px;
    column-gap: 4px;
    filter: url(#goo);
    pointer-events: none;
    overflow: visible;
    opacity: 0.6;
    
}

.timeline-blob-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    place-self: center;
    border: 20px solid rgba(0, 0, 0, 0.55);
}

/* Content layer — 2-row grid, column-first fill.
   Same explicit column sizing as blob-bg so cells align. */
.timeline-blob-content {
    position: relative;
    display: grid;
    grid-template-rows: repeat(2, 32px);
    grid-template-columns: repeat(2, 32px);
    grid-auto-flow: column;
    row-gap: 6px;
    column-gap: 4px;
    z-index: 1;
}

/* Col 2 offset — nudge down for organic asymmetry.
   Right group: item 3 (font) is alone in col 2. */
.timeline-actions:not(.timeline-actions-left) .timeline-blob-content .timeline-action:nth-child(3) {
    transform: translateY(8px);
}
.timeline-actions:not(.timeline-actions-left) .timeline-blob-circle:nth-child(3) {
    transform: translateY(8px);
}

.timeline-actions:not(.timeline-actions-right) .timeline-blob-content .timeline-action:nth-child(3) {
    transform: translateY(8px);
}
.timeline-actions:not(.timeline-actions-right) .timeline-blob-circle:nth-child(3) {
    transform: translateY(8px);
}


.timeline-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    background: radial-gradient(rgba(255,255,255,0.15), transparent);
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
    transition: all 0.15s;
}

.timeline-action:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
}

.timeline-action svg {
    display: block;
    shape-rendering: geometricPrecision;
}

/* Record button — recording state (matches toggle .is-active style) */
.timeline-action.is-recording {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    animation: recording-pulse 1.2s ease-in-out infinite;
}

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3); }
    50% { box-shadow: 0 0 12px 4px rgba(255, 255, 255, 0.15); }
}

/* Font generation button — generating state (matches toggle .is-active) */
.timeline-action-font.is-generating {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    animation: font-pulse 1.5s ease-in-out infinite;
}

@keyframes font-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- Resolution label on record button --- */
.timeline-rec-label {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translate(-50%, 100%);
    font-size: 8px;
    font-family: 'ABCDiatype', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    pointer-events: none;
    line-height: 1;
    opacity: 0;
}

/* --- Resolution picker popup --- */
.timeline-res-picker {
    position: fixed;
    z-index: 20;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 80px;
    font-family: 'ABCDiatype', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.timeline-res-picker-item {
    padding: 5px 14px;
    cursor: pointer;
    text-align: center;
    transition: background 0.1s;
    white-space: nowrap;
}

.timeline-res-picker-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.timeline-res-picker-item.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}
