/*
 * Main Stylesheet for gavinduley.org
 * Modern, sleek redesign preserving original color palette
 */

/* CSS Reset and Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Original color palette - modernized */
    --bg-dark: #0a0a0f;
    --bg-header: #FFF6D5;
    --text-primary: #f0f0f0;
    --text-header: #162656;
    --link-color: #7eb8c9;
    --link-visited: #c9b8d9;
    --link-hover: #FFFFC9;
    --link-active: #FFFFC9;
    --nav-bg: #162656;
    --nav-hover: #1e3470;
    --dropdown-bg: #1a1a2e;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --accent-gold: #d4af37;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* Typography */
    --font-main: 'Gill Sans', system-ui, -apple-system, sans-serif;
    --font-heading: 'Gill Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'Consolas', 'Monaco', monospace;

    /* Layout */
    --max-width: 1200px;
    --content-width: 800px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.7;
    min-height: 100vh;
}

/* Navigation - Fixed at top with CSS dropdowns */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, var(--nav-bg) 0%, #0d1a3d 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-item > a {
    display: block;
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.nav-item > a:hover,
.nav-item > a:focus {
    background-color: var(--nav-hover);
    color: var(--link-hover);
}

/* Dropdown Menus */
.has-dropdown > a::after {
    content: ' \25BE';
    font-size: 0.75em;
    margin-left: var(--spacing-xs);
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--dropdown-bg);
    list-style: none;
    padding: var(--spacing-sm) 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-radius: 0 0 4px 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown li a {
    display: block;
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.dropdown li a:hover,
.dropdown li a:focus {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--link-hover);
    padding-left: calc(var(--spacing-lg) + var(--spacing-sm));
}

.rss-link {
    font-size: 0.85em;
    opacity: 0.7;
}

.rss-link a {
    color: var(--accent-gold);
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, var(--bg-header) 0%, #fff0c0 100%);
    padding: var(--spacing-xl) var(--spacing-lg);
    /*text-align: center;*/
}

.header-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--spacing-lg);
    max-width: var(--max-width);
    margin: 0 auto;
    wdith: 100%;
}

.header-image {
    flex-shrink: 0;
    flex-basis: auto;
    display: block;
}

.header-image img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
}

.page-header h1 {
    color: var(--text-header);
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
    flex: 1;
}

/* Page Container - Two Column Layout */
.page-container {
    display: flex;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
    gap: var(--spacing-xl);
}

/* Main Content */
.content {
    flex: 1;
    max-width: var(--content-width);
    min-width: 0;
}

.page-content {
    line-height: 1.8;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
    line-height: 1.3;
}

h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: var(--spacing-sm);
}

h3 {
    font-size: 1.35rem;
    color: var(--link-color);
}

h4 {
    font-size: 1.15rem;
}

p {
    margin-bottom: var(--spacing-md);
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:visited {
    color: var(--link-visited);
}

a:hover,
a:focus {
    color: var(--link-hover);
    text-decoration: underline;
}

a:active {
    color: var(--link-active);
}

/* Lists */
ul, ol {
    margin-left: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

li {
    margin-bottom: var(--spacing-sm);
}

/* Nested lists */
ul ul, ol ol, ul ol, ol ul {
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

/* Blockquotes - for the poetic quotes */
blockquote, .quote {
    border-left: 3px solid var(--accent-gold);
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-md) var(--spacing-lg);
    font-style: italic;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 4px 4px 0;
}

blockquote p:last-child,
.quote p:last-child {
    margin-bottom: 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-lg) 0;
    font-size: 0.95rem;
}

th, td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Code and Preformatted */
code, .mono {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

pre {
    background: rgba(0, 0, 0, 0.3);
    padding: var(--spacing-md);
    border-radius: 4px;
    overflow-x: auto;
    margin: var(--spacing-md) 0;
}

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

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Horizontal Rule */
hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
    margin: var(--spacing-xl) 0;
}

/* Footer */
.site-footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-lg);
    /*padding-left: calc(150px + var(--spacing-xl) + var(--spacing-lg)); */
    text-align: left;
    font-size: 0.9rem;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .site-footer {
        padding-left: var(--spacing-md);
        text-align: center;
    }
}

/* Contact Table */
.contact-info {
    margin: var(--spacing-lg) 0;
}

.contact-info td {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
}

.contact-info td:first-child {
    font-weight: 600;
    color: var(--link-color);
}

/* What's New Table */
.whatsnew-table {
    margin-top: var(--spacing-lg);
}

.whatsnew-table td:first-child {
    width: 120px;
    vertical-align: top;
    white-space: nowrap;
    color: var(--accent-gold);
    font-weight: 500;
}

/* Home page specific */
.home-content .quote-block {
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-lg);
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--accent-gold);
    border-radius: 0 4px 4px 0;
}

/* Page list styling */
.page-list {
    list-style: none;
    margin-left: 0;
}

.page-list li {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.page-list li:last-child {
    border-bottom: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-item > a {
        padding: var(--spacing-md);
        border-bottom: 1px solid var(--border-subtle);
    }

    .dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.2);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .has-dropdown:hover .dropdown,
    .has-dropdown:focus-within .dropdown {
        max-height: 500px;
    }

    .dropdown li a {
        padding-left: calc(var(--spacing-lg) + var(--spacing-md));
    }

    .page-container {
        flex-direction: column;
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .sidebar {
        width: 100%;
        text-align: center;
    }

    .sidebar-image {
        position: static;
    }

    .content {
        padding: 0;
    }

    .whatsnew-table td:first-child {
        display: block;
        width: 100%;
        padding-bottom: 0;
    }

    .whatsnew-table td:last-child {
        display: block;
        padding-top: 0;
    }
}

/* Print styles */
@media print {
    .main-nav {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .page-header {
        background: none;
        border-bottom: 2px solid black;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: rgba(255, 255, 255, 0.5);
    }
}

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--link-hover);
    outline-offset: 2px;
}
