/*
 * WingFlight branding: welcome screen and app chrome.
 *
 * Colours follow the landing page (www.wingflight.org) and the configurator (cfg.wingflight.org):
 * WingFlight red on dark blue-grey neutrals, heavy headings and uppercase letter-spaced labels.
 */

:root {
    --wf-red: #d40000;
    --wf-red-hover: #a40000;
    --wf-red-bright: #ff4d4d;
    --wf-chrome-bg: hsl(220, 9%, 13%);
    --wf-chrome-bg-raised: hsl(220, 9%, 18%);
    --wf-chrome-bg-sunken: hsl(220, 10%, 9%);
    --wf-chrome-border: hsl(220, 10%, 22%);
    --wf-text: #f4f5f7;
    --wf-text-secondary: #c5cad3;
    --wf-text-muted: #9da5b1;
    --wf-font: 'Helvetica Now Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ---------------------------------------------------------------------------------------------
 * App chrome (shown once a log is open)
 * ------------------------------------------------------------------------------------------- */

.navbar-inverse {
    background-image: none;
    background-color: var(--wf-chrome-bg);
    border-color: var(--wf-chrome-border);
    border-bottom: 2px solid var(--wf-red);
}

/* The toolbar below is fixed at top: 50px, so the bar must stay exactly 50px tall including its border */
.wf-navbar {
    height: 50px;
    min-height: 50px;
    margin: 0;
    border-width: 0 0 2px;
    border-radius: 0;
    box-shadow: none;
    font-family: var(--wf-font);
    z-index: 1030;
}

.wf-navbar-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 48px;
    padding: 0 16px 0 20px;
}

.wf-navbar-logo {
    flex: none;
    height: 26px;
    width: auto;
}

.wf-navbar-divider {
    flex: none;
    width: 1px;
    height: 24px;
    background: var(--wf-chrome-border);
}

.wf-navbar-file {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 600;
    color: var(--wf-text);
}

.wf-navbar-actions {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wf-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--wf-chrome-border);
    border-radius: 6px;
    background: var(--wf-chrome-bg-raised);
    color: var(--wf-text);
    font-size: 13px;
    font-weight: 600;
    text-shadow: none;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.wf-nav-btn:hover,
.wf-nav-btn:focus,
.open > .wf-nav-btn {
    background: hsl(220, 9%, 23%);
    border-color: hsl(220, 10%, 30%);
    color: #fff;
    box-shadow: none;
}

.wf-nav-btn-primary {
    background: var(--wf-red);
    border-color: var(--wf-red);
    color: #fff;
}

.wf-nav-btn-primary:hover,
.wf-nav-btn-primary:focus-within {
    background: var(--wf-red-hover);
    border-color: var(--wf-red-hover);
}

.wf-nav-btn svg,
.wf-nav-icon svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.wf-nav-btn .caret {
    margin-left: 2px;
    opacity: 0.7;
}

.wf-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--wf-text-muted);
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.wf-nav-icon:hover,
.wf-nav-icon:focus {
    background: var(--wf-chrome-bg-raised);
    color: #fff;
    outline: 0;
}

/* Only shown once a log is loaded, not for a video on its own */
.wf-nav-icon.open-flight-analysis-dialog {
    display: none;
}

html.has-log .wf-nav-icon.open-flight-analysis-dialog {
    display: inline-flex;
}

.wf-export-menu .dropdown-menu {
    min-width: 160px;
    width: auto;
    margin-top: 6px;
}

html.has-log .wf-export-menu .btn-video-export {
    display: block;
}

@media (max-width: 900px) {
    .wf-nav-label {
        display: none;
    }

    .wf-navbar-divider:first-of-type,
    .wf-navbar-logo {
        display: none;
    }
}

.btn-primary {
    background-image: none;
    background-color: var(--wf-red);
    border-color: var(--wf-red-hover);
    text-shadow: none;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
    background-color: var(--wf-red-hover);
    border-color: var(--wf-red-hover);
}

.navbar .btn-group > .btn-primary + .btn-primary {
    border-left-color: rgba(0, 0, 0, 0.25);
}

.btn-nobg:hover {
    color: var(--wf-red-bright);
    text-shadow: none;
}

/* ---------------------------------------------------------------------------------------------
 * Welcome screen (shown until a log or video is opened)
 * ------------------------------------------------------------------------------------------- */

html:not(.has-log):not(.has-video) body {
    padding-bottom: 0;
    background: var(--wf-chrome-bg-sunken);
}

.welcome-pane {
    position: relative;
    top: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
    font-family: var(--wf-font);
    color: var(--wf-text-secondary);
    background:
        radial-gradient(circle at 85% -10%, rgba(212, 0, 0, 0.22) 0%, transparent 45%),
        radial-gradient(circle at 0% 110%, rgba(255, 255, 255, 0.06) 0%, transparent 40%),
        linear-gradient(160deg, var(--wf-chrome-bg) 0%, var(--wf-chrome-bg-sunken) 100%);
}

.welcome-pane a {
    color: var(--wf-text);
}

.welcome-pane a:hover,
.welcome-pane a:focus {
    color: var(--wf-red-bright);
    text-decoration: none;
}

/* Top bar */

.wf-topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
}

.wf-topbar-logo {
    height: 40px;
    width: auto;
}

.wf-topbar-links {
    display: flex;
    gap: 32px;
}

.wf-topbar-links a {
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--wf-text-secondary);
    transition: color 0.2s ease;
}

/* Hero */

.wf-hero {
    position: relative;
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px 60px;
}

/* A stylised pair of gyro traces running behind the hero, as a nod to what the tool does */
.wf-trace {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 240px;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.5;
    mask-image: linear-gradient(90deg, transparent 0%, #000 20%, #000 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 20%, #000 80%, transparent 100%);
}

.wf-trace svg {
    width: 100%;
    height: 100%;
}

.wf-trace path {
    fill: none;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    animation: wf-trace-draw 2.4s ease-out forwards;
}

.wf-trace-a {
    stroke: var(--wf-red);
}

.wf-trace path.wf-trace-b {
    stroke: rgba(255, 255, 255, 0.25);
    animation-delay: 0.3s;
}

@keyframes wf-trace-draw {
    to { stroke-dashoffset: 0; }
}

.wf-hero-content {
    position: relative;
    z-index: 1;
    max-width: 760px;
    text-align: center;
}

.wf-eyebrow {
    display: inline-block;
    margin: 0 0 20px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wf-text-secondary);
    animation: wf-fade-down 0.7s ease both;
}

.wf-headline {
    margin: 0 0 18px;
    font-family: var(--wf-font);
    font-size: 4em;
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -2px;
    color: var(--wf-text);
    animation: wf-fade-down 0.7s ease 0.1s both;
}

.wf-accent {
    color: var(--wf-red-bright);
}

.wf-lead {
    max-width: 600px;
    margin: 0 auto 40px;
    font-size: 1.15em;
    line-height: 1.7;
    color: var(--wf-text-muted);
    animation: wf-fade-down 0.7s ease 0.2s both;
}

@keyframes wf-fade-down {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Drop zone */

.wf-dropzone {
    max-width: 560px;
    margin: 0 auto;
    padding: 36px 32px 28px;
    border: 2px dashed rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    background: rgba(20, 22, 26, 0.65);
    backdrop-filter: blur(8px);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    animation: wf-fade-down 0.7s ease 0.3s both;
}

html.is-dragging .wf-dropzone {
    border-color: var(--wf-red-bright);
    background: rgba(212, 0, 0, 0.12);
    transform: scale(1.02);
}

.wf-dropzone-icon {
    width: 44px;
    height: 44px;
    color: var(--wf-red-bright);
    margin-bottom: 12px;
}

.wf-dropzone-title {
    margin: 0;
    font-size: 1.25em;
    font-weight: 700;
    color: var(--wf-text);
}

.wf-dropzone-or {
    margin: 6px 0 14px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--wf-text-muted);
}

.wf-btn-primary {
    padding: 14px 34px;
    border: none;
    border-radius: 8px;
    background: var(--wf-red);
    color: #fff;
    font-size: 0.95em;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 10px 30px rgba(212, 0, 0, 0.3);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.wf-btn-primary:hover,
.wf-btn-primary:focus-within {
    background: var(--wf-red-hover);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(212, 0, 0, 0.4);
}

.wf-dropzone .loading-message {
    padding: 14px 0 0;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--wf-text-secondary);
    overflow-wrap: anywhere;
}

.wf-formats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
}

.wf-formats li {
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--wf-text-muted);
}

/* Cards */

.wf-cards {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

.wf-card {
    display: flex;
    flex-direction: column;
    padding: 24px;
    border: 1px solid var(--wf-chrome-border);
    border-radius: 12px;
    background: rgba(31, 33, 37, 0.8);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

a.wf-card:hover {
    border-color: var(--wf-red);
    transform: translateY(-4px);
}

.wf-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: rgba(212, 0, 0, 0.15);
    color: var(--wf-red-bright);
}

.wf-card-icon svg {
    width: 22px;
    height: 22px;
}

.wf-card h3 {
    margin: 0 0 8px;
    font-family: var(--wf-font);
    font-size: 1.2em;
    font-weight: 800;
    color: var(--wf-text);
}

.wf-card p {
    flex: 1;
    margin: 0 0 14px;
    font-size: 0.95em;
    line-height: 1.6;
    color: var(--wf-text-muted);
}

.wf-card-link {
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--wf-red-bright);
}

.wf-card-hint {
    font-size: 0.85em;
    color: var(--wf-text-muted);
}

.wf-card kbd {
    background: var(--wf-chrome-bg-raised);
    border: 1px solid var(--wf-chrome-border);
    box-shadow: none;
    color: var(--wf-text);
}

/* Footer */

.wf-footer {
    position: relative;
    z-index: 1;
    padding: 18px 24px;
    border-top: 1px solid var(--wf-chrome-border);
    font-size: 0.85em;
    text-align: center;
    color: var(--wf-text-muted);
}

.wf-footer a {
    color: var(--wf-text-secondary);
}

/* Small screens */

@media (max-width: 860px) {
    .wf-cards {
        grid-template-columns: 1fr;
    }

    .wf-headline {
        font-size: 2.8em;
        letter-spacing: -1px;
    }
}

@media (max-width: 600px) {
    .wf-topbar {
        flex-direction: column;
        gap: 14px;
        padding: 16px;
    }

    .wf-topbar-links {
        gap: 20px;
    }

    .wf-dropzone {
        padding: 28px 18px 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wf-trace path,
    .wf-eyebrow,
    .wf-headline,
    .wf-lead,
    .wf-dropzone {
        animation: none;
        stroke-dashoffset: 0;
    }
}

/* ---------------------------------------------------------------------------------------------
 * Right-click menu on the graph and seek bar (js/context_menu.js)
 * ------------------------------------------------------------------------------------------- */

.wf-context-menu {
    position: absolute;
    z-index: 2000;
    min-width: 240px;
    width: auto;
    margin: 0;
    padding: 6px 0;
    border: 1px solid var(--wf-chrome-border);
    border-radius: 8px;
    background: var(--wf-chrome-bg);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    font-family: var(--wf-font);
    font-size: 13px;
}

.wf-context-menu > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 6px 14px;
    color: var(--wf-text);
}

.wf-context-menu > li > a:hover,
.wf-context-menu > li > a:focus {
    background: var(--wf-red);
    background-image: none;
    color: #fff;
}

.wf-context-menu > .disabled > a,
.wf-context-menu > .disabled > a:hover,
.wf-context-menu > .disabled > a:focus {
    background: transparent;
    color: var(--wf-text-muted);
    opacity: 0.6;
}

.wf-context-menu .dropdown-header {
    padding: 4px 14px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--wf-text-muted);
}

.wf-context-menu .divider {
    margin: 5px 0;
    background: var(--wf-chrome-border);
}

.wf-context-menu-shortcut {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--wf-chrome-bg-raised);
    box-shadow: none;
    font-size: 11px;
    color: var(--wf-text-muted);
}

.wf-context-menu > li > a:hover .wf-context-menu-shortcut {
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
}
