:root {
    --bg: #1e1e1e;
    --ctrl-bg: #2d2d2d;
    --ctrl-border: #3e3e3e;
    --text: #e6e6e6;
    --text-dim: #888;
    --accent: #4ea6f5;
    --accent-hover: #6db8ff;
    --success: #00c800;
    --radius: 4px;
}

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

html, body {
    height: 100%;
}

body {
    background:
        radial-gradient(ellipse 60% 50% at 50% 0%, rgba(78,166,245,0.08), transparent 70%),
        radial-gradient(ellipse 80% 60% at 50% 100%, rgba(78,166,245,0.04), transparent 70%),
        var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 13px;
    min-height: 100vh;
    display: flex;
    padding: 32px 16px;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 1400px;
    width: 100%;
    margin: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.logo-mark {
    width: 160px;
    height: 160px;
    display: block;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
}

h1 {
    font-size: 36px;
    font-weight: 300;
    letter-spacing: -0.5px;
    color: var(--text);
}

.tagline {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.6;
    max-width: 360px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--ctrl-bg);
    border: 1px solid var(--ctrl-border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    margin-top: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(78, 166, 245, 0.6);
    animation: pulse 2s ease-in-out infinite;
}

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

/* Screenshots */
.shots {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 24px;
}

@media (min-width: 780px) {
    .shots { grid-template-columns: 1fr 1fr; }
}

.shots figure {
    background: var(--ctrl-bg);
    border: 1px solid var(--ctrl-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.shots figure:hover {
    transform: translateY(-2px);
    border-color: #555;
}

.shots img {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
}

.shots figcaption {
    padding: 10px 14px;
    font-size: 11px;
    color: var(--text-dim);
    text-align: left;
    border-top: 1px solid var(--ctrl-border);
    line-height: 1.5;
}

footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--ctrl-border);
    width: 100%;
    font-size: 11px;
    color: var(--text-dim);
}

footer a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.15s;
}

footer a:hover {
    color: var(--accent);
}

@media (max-width: 480px) {
    h1 { font-size: 28px; }
    .tagline { font-size: 13px; }
}

/* ==========================================================
   Interactive App Sandbox demo — inline replica of the app
   ========================================================== */

.demo {
    position: relative;
    width: 100%;
    margin-top: 32px;
    /* Room below the stage for the manager's box-shadow, which would
       otherwise be cut off by the overflow: hidden clip. */
    padding-bottom: 64px;
    display: flex;
    justify-content: center;
    /* Always clip — the stage has a fixed design width and is scaled down
       with `zoom` (set inline by demo.js) whenever the viewport is narrower
       than that design width. */
    overflow: hidden;
}

.demo-stage {
    position: relative;
    width: 1200px;
    display: grid;
    grid-template-columns: minmax(0, 1200px);
    justify-content: center;
    gap: 18px;
}

/* When the display window becomes visible, the stage widens to a 1400px
   design canvas with two equal columns. */
.demo-stage:has(.demo-display.visible) {
    width: 1400px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* Fake OS window chrome */
.demo-window {
    width: 100%;
    min-width: 0;
    background: var(--bg);
    border: 1px solid #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    text-align: left;
}

.demo-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 30px;
    padding: 0 0 0 10px;
    background: linear-gradient(#2b2b2b, #232323);
    border-bottom: 1px solid #000;
    color: #d4d4d4;
    font-size: 12px;
    user-select: none;
}

.demo-title {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
}

.demo-title-icon {
    width: 16px;
    height: 16px;
}

.demo-title-glyph { font-size: 13px; }

.demo-title-btns {
    display: flex;
    height: 100%;
}

.demo-title-btn {
    width: 42px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #c8c8c8;
    cursor: default;
}

.demo-title-btn:hover { background: #3a3a3a; }
.demo-title-btn.close:hover { background: #c42b1c; color: #fff; }

/* Window body */
.demo-body {
    padding: 8px 12px 12px;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', sans-serif;
    font-size: 13px;
}

.demo-section { margin-bottom: 12px; }
.demo-section:last-child { margin-bottom: 0; }

.demo-section h2 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--ctrl-border);
    text-align: left;
}

.demo-section h2.collapsible { cursor: default; }
.demo-section .collapse-arrow {
    display: inline-block;
    font-size: 10px;
    transform: rotate(-90deg);
    margin-right: 2px;
}

/* Section header row: title on left, action button on right */
.demo-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--ctrl-border);
}
.demo-section-header h2 {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.demo-btn {
    background: var(--ctrl-bg);
    color: var(--text);
    border: 1px solid var(--ctrl-border);
    border-radius: var(--radius);
    padding: 2px 14px;
    font-size: 12px;
    font-family: inherit;
    height: 26px;
    white-space: nowrap;
    cursor: default;
}

.demo-btn-primary {
    background: #2a5a8a;
    border-color: #3a7aba;
}

/* VM table */
.demo-table-wrap {
    border: 1px solid var(--ctrl-border);
    border-radius: var(--radius);
    overflow-x: auto;
}

table.demo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: var(--text);
    min-width: 1100px;
}

table.demo-table th {
    background: #252525;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 11px;
    text-align: left;
    padding: 4px 6px;
    border-bottom: 1px solid var(--ctrl-border);
    white-space: nowrap;
}

table.demo-table td {
    padding: 4px 6px;
    border-bottom: 1px solid #2a2a2a;
    white-space: nowrap;
}

table.demo-table tr:hover td { background: #252525; }

table.demo-table th.icon-col,
table.demo-table td.icon-col {
    width: 28px;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
}

/* Snap cell placeholder dropdown */
.snap-cell { white-space: nowrap; }
.snap-wrap { position: relative; display: inline-block; }
.snap-select {
    background: var(--ctrl-bg);
    color: var(--text);
    border: 1px solid var(--ctrl-border);
    border-radius: var(--radius);
    padding: 1px 4px;
    font-size: 11px;
    font-family: 'Consolas', 'Courier New', monospace;
    height: 22px;
    opacity: 0.6;
    max-width: 140px;
}

/* Icon buttons */
.demo-table .icon-btn {
    background: none;
    border: none;
    font-size: 14px;
    padding: 0;
    width: 100%;
    height: auto;
    line-height: 1;
    cursor: default;
    font-family: inherit;
}

.demo-table .icon-btn.inactive,
.demo-table .icon-btn:disabled { opacity: 1; }

.demo-table .icon-btn.start { color: var(--success); }
.demo-table .icon-btn.start.inactive { color: #505050; }
.demo-table .icon-btn.shutdown { color: #dcc800; }
.demo-table .icon-btn.shutdown.inactive { color: #505050; }
.demo-table .icon-btn.stop { color: #dc3232; }
.demo-table .icon-btn.stop.inactive { color: #505050; }
.demo-table .icon-btn.connect-idd { color: var(--accent); }
.demo-table .icon-btn.connect-idd.inactive { color: #505050; }
.demo-table .icon-btn.delete { color: #c83c3c; }
.demo-table .icon-btn.edit { color: var(--text-dim); }
.demo-table .icon-btn.ssh { color: var(--accent); font-family: monospace; font-weight: bold; }
.demo-table .icon-btn.ssh.hidden { display: none; }

/* Agent dot */
.demo-table .agent-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c80000;
    vertical-align: middle;
}
.demo-table .agent-dot.online { background: var(--success); }
.demo-table .agent-dot.disabled { background: var(--text-dim); }

/* Status text */
.demo-table .status-running { color: var(--success); font-weight: 600; }
.demo-table .status-shutting-down { color: #dcc800; font-weight: 600; }
.demo-table .status-stopped { color: var(--text-dim); }

/* Log panel */
.demo-log {
    background: var(--ctrl-bg);
    border: 1px solid var(--ctrl-border);
    border-radius: var(--radius);
    padding: 6px 8px;
    height: 120px;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #ccc;
    text-align: left;
}

.demo-log .log-line {
    white-space: pre-wrap;
    word-break: break-all;
    animation: logLineIn 0.25s ease-out;
}

@keyframes logLineIn {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* IDD display window — the screenshot includes its own titlebar.
   Starts as display:none so it takes no layout space until mounted. */
.demo-display {
    display: none;
    width: 100%;
    min-width: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.45s ease, transform 0.45s ease;
    pointer-events: none;
}

.demo-display.mounted { display: block; }

.demo-display.mounted.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Explicit fade-out override — stays in the grid (still .visible) while
   opacity ramps back to 0, so the manager doesn't snap until after the fade. */
.demo-display.mounted.visible.fading {
    opacity: 0;
    transform: translateY(14px);
}

.demo-display img {
    display: block;
    width: 100%;
    height: auto;
    background: #000;
}

/* Animated cursor overlay */
.demo-cursor {
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    pointer-events: none;
    z-index: 20;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
    transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.demo-cursor::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 6px;
    width: 4px;
    height: 4px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.4);
    pointer-events: none;
}

.demo-cursor.clicking::after {
    animation: cursorRipple 0.45s ease-out;
}

@keyframes cursorRipple {
    0%   { opacity: 0.9; transform: scale(0.4); border-width: 3px; }
    100% { opacity: 0;   transform: scale(4);   border-width: 1px; }
}

@media (prefers-reduced-motion: reduce) {
    .demo-cursor { display: none; }
    .demo-display { transition: none; }
    .demo-log .log-line { animation: none; }
}
