/* View header: Timeline and List only. On the Canvas the regions carry their
   own titles, and a second page heading would compete with them. */
.canvas-view-header {
    position: fixed;
    top: 88px;
    left: calc(var(--sidebar-w) + 32px);
    right: 28px;
    z-index: 920;
    display: flex;
    align-items: center;
    gap: 18px;
    pointer-events: none;
}

body[data-view='canvas'] .canvas-view-header {
    display: none;
}

.canvas-view-copy {
    min-width: 0;
    pointer-events: auto;
}

.canvas-view-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
}

.canvas-view-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Segmented control: one primitive for the view switch and the settings panel. */
.seg {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid var(--hairline);
    background: var(--surface);
}

.seg > button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--control-h-sm);
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: -0.005em;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.seg > button:hover {
    color: var(--text);
}

.seg > button.is-active {
    background: var(--surface-solid);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(26, 26, 46, 0.08), 0 0 0 1px var(--hairline);
}

.seg > button[aria-disabled='true'] {
    cursor: default;
    opacity: 0.45;
}

.seg > button[aria-disabled='true']:hover {
    background: transparent;
    color: var(--text-muted);
}

/* Icon button: the other primitive, for fit, zoom, home and theme. */
.icon-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: var(--control-h);
    height: var(--control-h);
    padding: 0;
    border: none;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease;
}

.icon-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.icon-btn svg {
    display: block;
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* A floating chrome island: the shell for the canvas control group. */
.chrome-island {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--hairline);
    background: var(--surface);
    box-shadow: var(--elev-2);
    backdrop-filter: blur(18px) saturate(160%);
}

.chrome-island .icon-btn {
    width: var(--control-h-sm);
    height: var(--control-h-sm);
    border-radius: 999px;
}

.seg > button:focus-visible,
.icon-btn:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Canvas map in the navigator. */
.minimap {
    position: relative;
    width: 100%;
    height: 118px;
    background: var(--surface-solid);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.minimap-content {
    position: absolute;
    inset: 10px;
    transform-origin: 0 0;
}

/* The minimap repeats the map's colours: each plate in its hue. */
.minimap-region {
    position: absolute;
    border-radius: 3px;
    background: var(--hue-wash, var(--region-fill));
    box-shadow: inset 0 2px 0 var(--hue, transparent), inset 0 0 0 1px color-mix(in srgb, var(--hue, var(--text-muted)) 25%, transparent);
}

.minimap-region.is-active-layer {
    box-shadow: inset 0 2px 0 var(--hue, var(--accent)), inset 0 0 0 1.5px var(--hue, var(--accent));
}

.minimap-card {
    position: absolute;
    background: var(--text-muted);
    border-radius: 2px;
    opacity: 0.32;
}

.minimap-canvas-card[data-tone] {
    background: var(--hue);
    opacity: 0.42;
}

.minimap-canvas-card.is-active-layer {
    opacity: 0.85;
}

.minimap-canvas-card.is-dimmed,
.minimap-timeline-item.is-dimmed,
.minimap-list-row.is-dimmed {
    opacity: 0.12;
}

.minimap-rail {
    position: absolute;
    height: 1px !important;
    border-radius: 999px;
    background: var(--hairline);
}

.minimap-timeline-column {
    position: absolute;
    border: 1px solid var(--hairline);
    border-radius: 6px;
    background: var(--region-fill);
}

.minimap-timeline-item {
    position: absolute;
    border-radius: 2px;
    background: var(--text-muted);
    opacity: 0.4;
}

.minimap-list-toolbar,
.minimap-list-row {
    position: absolute;
}

.minimap-list-toolbar {
    border-radius: 4px;
    background: var(--hairline);
}

.minimap-list-row {
    border-radius: 2px;
    background: var(--text-muted);
    opacity: 0.35;
}

.minimap-viewport {
    position: absolute;
    border: 1.5px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 4px;
}

/* Canvas control group, bottom right, where design tools keep it. */
.canvas-controls {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 940;
}

.canvas-dock {
    gap: 1px;
}

.zoom-level {
    min-width: 44px;
    text-align: center;
    font-size: 11.5px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.canvas-dock-divider {
    width: 1px;
    height: 18px;
    margin: 0 4px;
    background: var(--hairline);
}

/* One button cycles Light -> Dark -> Auto; the glyph is the current state. */
.theme-cycle svg {
    display: none;
}

.theme-cycle[data-theme-state='light'] .theme-glyph-light,
.theme-cycle[data-theme-state='dark'] .theme-glyph-dark,
.theme-cycle[data-theme-state='auto'] .theme-glyph-auto {
    display: block;
}

.tool-status {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    transform: translateY(8px);
    min-width: max-content;
    max-width: min(300px, calc(100vw - 40px));
    padding: 7px 12px;
    border-radius: var(--r-md);
    border: 1px solid var(--hairline);
    background: var(--surface-solid);
    box-shadow: var(--elev-2);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    white-space: nowrap;
}

.tool-status.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

@media (max-width: 900px) {
    .canvas-view-header {
        top: 80px;
        left: 16px;
        right: 16px;
    }

    .canvas-controls {
        right: 14px;
        bottom: 14px;
    }
}

@media (max-width: 767px) {
    .canvas-view-copy {
        display: none;
    }

    .minimap {
        height: 150px;
    }

    /* Touch targets grow on phones even though the desktop chrome is compact. */
    .icon-btn,
    .seg > button {
        height: 34px;
    }

    .icon-btn {
        width: 34px;
    }
}

@media (max-width: 360px) {
    .seg > button {
        padding: 0 8px;
        font-size: 11px;
    }
}
