/* NASA 1960s Technical Document + Tufte Design */

:root {
    --technical-black: #1a1a1a;
    --technical-blue: #0033cc;
    --technical-red: #cc0000;
    --paper-white: #ffffff;
    --code-bg: #f5f5f5;
    --grid-unit: 8px;
    --font-stack: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-stack);
    line-height: 1.5;
    background-color: var(--paper-white);
    color: var(--technical-black);
    text-rendering: optimizeLegibility;
}

/* Layout - Tufte Style with Technical Precision */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr minmax(auto, 65ch) 1fr;
    gap: 2rem;
}

/* Header spanning full width or contained */
header {
    grid-column: 1 / -1;
    border-bottom: 4px solid var(--technical-black);
    padding: 2rem 0 1rem 0;
    margin-bottom: 3rem;
}

header h1 {
    font-family: var(--font-stack);
    font-weight: 700;
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 0.5rem;
}

header p {
    font-family: "Courier New", Courier, monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.8rem;
    color: #555;
}

/* Navigation - Top Bar */
nav {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #ccc;
    padding-bottom: 1rem;
    margin-bottom: 3rem;
    font-family: var(--font-stack);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center; /* Align items vertically */
}

.nav-links > a {
    text-decoration: none;
    color: var(--technical-black);
    position: relative;
    padding-bottom: 5px; /* Add some space for underline */
}

.nav-links > a:hover,
.nav-links > a.active {
    color: var(--technical-blue);
}

.nav-links > a.active::after {
    content: '';
    position: absolute;
    bottom: -1.2rem;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--technical-blue);
}

/* Dropdown Menu System */
.dropdown-container {
    position: relative;
    display: inline-block;
    height: 100%;
    padding-bottom: 5px;
}

.dropdown-trigger {
    cursor: pointer;
    position: relative;
    padding-bottom: 5px;
}

.dropdown-trigger:hover {
    color: var(--technical-blue);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--paper-white);
    min-width: 220px;
    box-shadow: 4px 4px 0px 0px rgba(0,0,0,0.1); /* Hard shadow for technical feel */
    border: 2px solid var(--technical-black);
    z-index: 1000;
    top: 100%; /* Position right below */
    left: 0;
    margin-top: 5px;
}

/* Invisible bridge to prevent menu from closing when moving mouse across gap */
.dropdown-content::before {
    content: "";
    display: block;
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.dropdown-container:hover .dropdown-content {
    display: block;
}

/* Nested Dropdown Styles */
.dropdown-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-item {
    position: relative;
    border-bottom: 1px solid #eee;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item > a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--technical-black);
    white-space: nowrap;
    font-size: 0.85rem;
}

.dropdown-item > a:hover {
    background-color: #f0f0f0;
    color: var(--technical-blue);
}

/* Submenus */
.dropdown-item .dropdown-menu {
    display: none;
    position: absolute;
    left: 100%;
    top: -2px; /* Align with border */
    border: 2px solid var(--technical-black);
    background-color: var(--paper-white);
    box-shadow: 4px 4px 0px 0px rgba(0,0,0,0.1);
    min-width: 200px;
}

.dropdown-item:hover > .dropdown-menu {
    display: block;
}

/* Arrow for items with children */
.dropdown-item:has(> .dropdown-menu) > a {
    padding-right: 25px;
}

.dropdown-item:has(> .dropdown-menu) > a::after {
    content: "►";
    font-size: 0.6em;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.dropdown-item:hover > a::after {
    color: var(--technical-blue);
}

/* Main Content Area */
main {
    grid-column: 2 / 3; /* Center column for reading */
    position: relative;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--technical-black);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 { font-size: 2.2rem; letter-spacing: -0.02em; }
h2 { 
    font-size: 1.5rem; 
    border-bottom: 2px solid var(--technical-black); 
    padding-bottom: 0.3rem;
    margin-top: 3rem;
}
h3 { font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.05em; }

p {
    margin-bottom: 1.4rem;
    text-align: justify; /* Classic print feel */
    hyphens: auto;
}

a {
    color: var(--technical-blue);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--technical-red);
}

/* Lists */
ul, ol {
    margin-bottom: 1.4rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Code Blocks - Technical Style */
pre {
    background: var(--code-bg);
    border-left: 3px solid var(--technical-black);
    padding: 1rem;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    margin: 2rem 0;
}

code {
    font-family: "Courier New", Courier, monospace;
    background: var(--code-bg);
    padding: 0.1em 0.3em;
    font-size: 0.9em;
}

pre code {
    background: transparent;
    padding: 0;
}

/* Blockquotes */
blockquote {
    border-left: 2px solid var(--technical-blue);
    margin: 2rem 0;
    padding-left: 1.5rem;
    font-style: italic;
    color: #444;
}

/* Images & Figures */
figure {
    margin: 3rem 0;
    width: 100%;
}

/* Full width figures extend into margin */
figure.full-width {
    width: 140%; /* Extend into right margin */
    margin-right: -40%;
}

img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc; /* Technical frame */
}

figcaption {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-family: var(--font-stack);
    color: #555;
    text-align: left;
    border-top: 1px solid #ccc;
    padding-top: 0.5rem;
    display: inline-block;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.9rem;
    font-family: "Courier New", Courier, monospace;
}

th {
    border-bottom: 2px solid var(--technical-black);
    text-align: left;
    padding: 0.5rem;
    text-transform: uppercase;
    font-weight: 700;
}

td {
    border-bottom: 1px solid #eee;
    padding: 0.5rem;
}

/* Sidenotes */
.sidenote-wrapper {
    position: relative;
    display: inline;
    cursor: help;
}

.sidenote-number {
    vertical-align: super;
    font-size: 0.7em;
    color: var(--technical-blue);
    font-weight: bold;
}

.sidenote-content {
    float: right;
    clear: right;
    margin-right: -45%; /* Push into the right margin */
    width: 35%; /* Width of the sidenote */
    margin-top: 0.3rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.3;
    vertical-align: baseline;
    position: relative;
    color: #444;
}

/* Mobile Responsiveness */
@media (max-width: 1100px) {
    .container {
        grid-template-columns: 1fr;
        padding: 0 1.5rem;
    }

    main {
        grid-column: 1 / -1;
    }
    
    .sidenote-content {
        float: none;
        display: block;
        margin: 1rem 0;
        width: 100%;
        border-left: 2px solid var(--technical-blue);
        padding-left: 1rem;
        color: #666;
    }
    
    figure.full-width {
        width: 100%;
        margin-right: 0;
    }
}

/* Utility / Status Classes */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--technical-black);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-right: 0.5rem;
}

.post-meta {
    font-family: "Courier New", Courier, monospace;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 2rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    padding: 0.5rem 0;
}

/* Footer */
footer {
    grid-column: 1 / -1;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 4px solid var(--technical-black);
    text-align: center;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
}

/* Form Elements */
input, button, select, textarea {
    font-family: var(--font-stack);
    border: 1px solid #ccc;
    padding: 0.5rem;
    font-size: 0.9rem;
}

button {
    background: var(--technical-black);
    color: white;
    border: none;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    background: var(--technical-blue);
}
