:root {
    --bg-base: #06080a;
    --bg-panel: #0a0d12;
    --grid-line: rgba(255, 255, 255, 0.03);
    --text-main: #c3ccd6;
    --text-bright: #f5f8fa;
    --accent-cyan: #6fd0ea;
    --accent-muted: #2d3748;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.85;
    margin: 0;
    padding: 0;
    /* Faint blueprint/tech grid */
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: center top;
}

/* Container to constrain width and center */
.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 40px;
}

/* Top Header Area */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--accent-muted);
    margin-bottom: 60px;
}

.header-left .classification {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--accent-cyan);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.header-left h1 {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 24px;
    color: var(--text-bright);
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-right {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #93a5b5;
    text-align: right;
    text-transform: uppercase;
}

/* Replicating the Left-Label / Right-Content layout of the UFO site */
.record-entry {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
    margin-bottom: 80px;
    position: relative;
    padding-top: 20px;
}

/* The tech border with a notch */
.record-entry::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--accent-muted);
}

.record-entry::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 1px;
    background: var(--accent-cyan);
}

/* The left side label */
.entry-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #9fb0bf;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.6;
}

.entry-meta strong {
    color: var(--text-bright);
    display: block;
    margin-bottom: 4px;
}

/* The right side content */
.entry-content {
    max-width: 800px;
}

.entry-content p {
    margin-top: 0;
    margin-bottom: 24px;
    text-align: justify;
    font-size: 16px;
    color: #d3dae1;
}

/* Inner thoughts / author notes */
.author-note {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: #93a5b5;
    padding-left: 15px;
    border-left: 2px solid var(--accent-cyan);
    margin: 30px 0;
    line-height: 1.7;
}

/* Math formula blocks */
.math-block {
    font-family: "JetBrains Mono", monospace;
    font-size: 14px;
    color: var(--text-bright);
    background: rgba(255, 255, 255, 0.02);
    padding: 15px 20px;
    border: 1px solid var(--accent-muted);
    text-align: center;
    margin: 30px 0;
    letter-spacing: 1px;
    overflow-x: auto;
}

/* Remove MathJax's default display-equation margins inside the box */
.math-block mjx-container[display="true"] {
    margin: 0 !important;
}


/* Image and Video styling */
figure {
    margin: 40px 0;
    background: var(--bg-panel);
    border: 1px solid var(--accent-muted);
    padding: 10px;
}

img,
video {
    width: 100%;
    height: auto;
    display: block;
    /* Subdued look that matches the telemetry screens */
    opacity: 0.95;
    filter: grayscale(40%) contrast(1.05);
    transition: all 0.3s ease;
}

img:hover,
video:hover {
    opacity: 1;
    filter: grayscale(0%) contrast(1);
}

figcaption {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent-cyan);
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
}

/* Small layout utility for side-by-side images */
.image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.image-grid figure {
    margin: 0;
}

/* ===========================================================
           MEDIA GALLERY -- large preview with thumbnail strip
        =========================================================== */
.media-gallery {
    margin: 40px 0 70px 0;
}

.media-main {
    position: relative;
    width: 100%;
    background: #000;
    border: 1px solid var(--accent-muted);
    overflow: hidden;
    aspect-ratio: 3278 / 1424;
}

.media-main img,
.media-main video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1;
    filter: none;
    display: block;
    background: #000;
}

.media-main-caption {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent-cyan);
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
}

.media-thumbs {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.media-thumbs::-webkit-scrollbar {
    height: 6px;
}

.media-thumbs::-webkit-scrollbar-thumb {
    background: var(--accent-muted);
}

.media-thumb {
    flex: 0 0 auto;
    width: 110px;
    height: 66px;
    border: 1px solid var(--accent-muted);
    cursor: pointer;
    overflow: hidden;
    opacity: 0.55;
    filter: grayscale(60%);
    transition: all 0.25s ease;
    position: relative;
}

.media-thumb img,
.media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-thumb:hover {
    opacity: 0.85;
    filter: grayscale(20%);
}

.media-thumb.active {
    opacity: 1;
    filter: grayscale(0%);
    border-color: var(--accent-cyan);
}

.media-thumb .thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-bright);
    background: rgba(6, 8, 10, 0.25);
    pointer-events: none;
}

/* Muted hyperlinks*/
.entry-content a,
.entry-content a:visited {
    color: var(--accent-cyan);
    text-decoration: none;
    border-bottom: 1px solid rgba(131, 197, 215, 0.45);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.entry-content a:hover,
.entry-content a:focus-visible {
    color: var(--text-bright);
    border-bottom-color: var(--accent-cyan);
}

.entry-content a:focus-visible {
    outline: 1px solid var(--accent-cyan);
    outline-offset: 3px;
}

/* Click-to-expand image and video viewer */
figure img,
.media-main img,
.media-main video {
    cursor: zoom-in;
}

.media-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
}

.media-lightbox.is-open {
    display: flex;
}

.lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 92vw;
    max-height: 92vh;
}

.lightbox-content img {
    display: block;
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border: 1px solid var(--accent-muted);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.6);
}

.lightbox-content video {
    display: block;
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    background: #000;
    border: 1px solid var(--accent-muted);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.6);
}

.lightbox-close {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 1001;
    width: 42px;
    height: 42px;
    border: 1px solid var(--accent-muted);
    background: var(--bg-panel);
    color: var(--text-bright);
    font: 300 30px/1 "JetBrains Mono", monospace;
    cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    outline: none;
}

body.lightbox-open {
    overflow: hidden;
}

.brand {
    position: fixed;
    top: 40px;
    left: 60px;
    z-index: 100;
}

.brand a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-bright);
    letter-spacing: 2px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.brand a:hover,
.brand a:focus-visible {
    color: var(--accent-primary);
}

.brand a:focus-visible {
    outline: 1px solid var(--accent-primary);
    outline-offset: 5px;
}

@media (max-width: 720px) {
    .brand {
        top: 24px;
        left: 24px;
    }
}