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

/* Spacing System */
:root {
    --primary-color: #00005C;    /* Deeper, more readable navy */
    --secondary-color: #990000;  /* Richer red */
    --bg-color: #000026;         /* Much darker blue */
    --text-color: #333333;       /* Softer black for better readability */
    --link-color: #003399;       /* More visible blue for links */
    --link-visited: #660066;     /* Purple for visited links */
    --border-color: #CCCCCC;     /* Lighter border color */
    --content-bg: #FFFFFF;
    --heading-color: #800000;    /* Dark red for headings */
    --nav-bg: #000099;           /* Lighter blue for nav */
    --nav-active: #990000;       /* Active nav item */
    --quote-bg: #F5F5F5;         /* Light grey for blockquotes */

    /* Spacing Scale */
    --space-xs: 0.25rem;   /*  4px */
    --space-sm: 0.5rem;    /*  8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 3rem;     /* 48px */
    --space-3xl: 4rem;     /* 64px */

    /* Container widths */
    --container-width: min(960px, 90vw);  /* More responsive approach */
    --container-padding: var(--space-lg);

    /* Breakpoints */
    --bp-mobile: 480px;      /* Small phones */
    --bp-tablet: 768px;      /* Tablets */
    --bp-desktop: 1024px;    /* Small laptops */
    --bp-wide: 1200px;       /* Large screens */

    /* Typography */
    --heading-font: 'Crimson Pro', Georgia, serif;
    --body-font: 'Noto Serif', Georgia, serif;

    /* Font metrics to prevent layout shift */
    --font-sans-fallback: Arial;
    --font-serif-fallback: Georgia;
    
    /* Size-adjust and ascent-override help match fallback fonts */
    --font-crimson-size-adjust: 1.05;
    --font-noto-size-adjust: 1.025;
}

body {
    font-family: var(--body-font), var(--font-serif-fallback);
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.05) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.05) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    color: var(--text-color);
    line-height: 1.8;            /* Increased line height for readability */
    font-size: 18px;
    min-height: 100vh;
    /* Add this to ensure consistent spacing before font loads */
    font-synthesis: none;
    font-display: swap;
}

/* Updated Container */
.content-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: var(--space-xl) var(--space-2xl);
    background-color: var(--content-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    /* Add this for smoother loading */
    will-change: transform;
    backface-visibility: hidden;
}

/* Updated Navigation */
.nav-container {
    background-color: #000066;
    background-image: 
        linear-gradient(to right,
            #000099 0%,
            #000066 20%,
            #000040 35%,
            #000033 50%,
            #000040 65%,
            #000066 80%,
            #000099 100%
        ),
        linear-gradient(45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.05) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.05) 75%);
    background-size: 100% 100%, 16px 16px, 16px 16px, 16px 16px, 16px 16px;
    background-position: 0 0, 0 0, 0 8px, 8px -8px, -8px 0px;
    padding: var(--space-md) 0;
    border-bottom: 3px solid var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Add subtle shine effect */
.nav-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.1) 50%,
        rgba(255,255,255,0) 100%
    );
}

.nav-menu {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--space-2xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-image {
    height: 48px;
    width: auto;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1));
}

.logo-image:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.15));
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: #FFFFFF;
    background: rgba(153, 0, 0, 0.15);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.9em;
    letter-spacing: 0.5px;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background: var(--nav-active);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-links a.active {
    background: var(--nav-active);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Add subtle line decoration */
.nav-container::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

/* Updated Typography */
h1 {
    color: var(--heading-color);
    font-size: 1.6em;
    margin: var(--space-xl) 0;
    text-align: center;
    line-height: 1.4;
    border-bottom: 2px solid var(--heading-color);
    padding-bottom: var(--space-sm);
    font-family: var(--heading-font), var(--font-serif-fallback);
    font-weight: 600;
    /* Add this to prevent layout shift on heading font load */
    font-display: swap;
}

h2 {
    color: var(--heading-color);
    font-size: 1.6em;
    margin-top: var(--space-2xl);
    border-bottom: 1px solid var(--border-color);
    font-family: var(--heading-font), var(--font-serif-fallback);
    font-weight: 600;
    /* Add this to prevent layout shift on heading font load */
    font-display: swap;
}

/* Content Improvements */
p {
    margin-bottom: var(--space-lg);
    text-align: left;
    letter-spacing: 0.2px;
    /* Add this to optimize text rendering */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* Lists */
ul, ol {
    margin: 0 0 var(--space-lg) var(--space-xl);
    line-height: 1.8;
}

li {
    margin-bottom: var(--space-xs);
    position: relative;
}

ul li::marker {
    color: var(--secondary-color);
}

ol li::marker {
    color: var(--secondary-color);
    font-weight: 600;
}

li > ul, 
li > ol {
    margin-top: var(--space-xs);
    margin-bottom: 0;
}

/* Quotes */
blockquote {
    background-color: var(--quote-bg);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--secondary-color);
    padding: var(--space-xl) var(--space-2xl);
    margin: var(--space-2xl) 0;
    font-size: 1.1em;
    line-height: 1.8;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    font-family: var(--body-font), var(--font-serif-fallback);
    font-style: italic;
}

blockquote::before {
    content: '"';
    position: absolute;
    top: var(--space-sm);
    left: var(--space-md);
    font-size: 3em;
    color: var(--secondary-color);
    opacity: 0.1;
    font-family: 'Crimson Pro', serif;
    line-height: 1;
}

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

blockquote cite {
    display: block;
    margin-top: var(--space-md);
    color: var(--secondary-color);
    font-style: italic;
    font-size: 0.9em;
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

a:hover {
    border-bottom-color: var(--link-color);
}

/* Mobile Menu Button */
.mobile-menu-button {
    display: none;
    background: transparent;
    border: none;
    padding:  16px 8px;
    cursor: pointer;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    content: '';
    display: block;
    background: #FFB3B3;
    height: 2px;
    width: 24px;
    transition: all 0.3s;
}

.hamburger::before {
    transform: translateY(-8px);
}

.hamburger::after {
    transform: translateY(6px);
}

/* Tablet and Mobile Styles */
@media (max-width: 1024px) {
    .nav-menu {
        padding: 0 var(--space-lg);
    }

    .brand-tagline {
        font-size: 0.75em;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    :root {
        /* Adjust spacing for mobile */
        --mobile-header-height: 44px;
        --mobile-menu-padding: var(--space-xl);
    }

    /* Reduce padding on mobile */
    .content-container {
        padding: var(--space-md) var(--space-lg);
    }

    /* Optimize font loading on mobile */
    body {
        text-rendering: optimizeSpeed;
        -webkit-font-smoothing: subpixel-antialiased;
    }

    /* Reduce motion on mobile */
    @media (prefers-reduced-motion: no-preference) {
        .content-container {
            transition: none;
        }
    }

    .logo-image {
        height: 36px;
    }

    .brand-text {
        font-size: 1.2em;
    }

    .brand-tagline {
        display: none;
    }

    .mobile-menu-button {
        display: block;
        z-index: 100;
        padding: 16px 8px;
        margin-left: var(--space-sm);
    }

    .nav-menu {
        padding: 0 var(--container-padding);
        height: var(--mobile-header-height);
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 80%;
        max-width: 300px;
        background-color: #000066;
        background-image: 
            linear-gradient(135deg,
                #000099 0%,
                #000066 30%,
                #000040 60%,
                #000033 100%
            ),
            linear-gradient(45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%),
            linear-gradient(-45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%),
            linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.05) 75%),
            linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.05) 75%);
        background-size: 100% 100%, 16px 16px, 16px 16px, 16px 16px, 16px 16px;
        background-position: 0 0, 0 0, 0 8px, 8px -8px, -8px 0px;
        flex-direction: column;
        padding: calc(var(--mobile-header-height) + var(--space-lg))
                var(--mobile-menu-padding)
                var(--space-xl);
        transition: right 0.3s ease;
        z-index: 90;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
    }

    .mobile-menu-open .nav-links {
        right: 0;
    }

    .nav-links a {
        display: block;
        padding: var(--space-md) var(--space-lg);
        border: none;
        border-radius: 6px;
        margin: var(--space-xs) 0;
        font-size: 1.1em;
        font-weight: 500;
    }

    /* Active state in mobile */
    .nav-links a.active {
        background: var(--nav-active);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    /* Improve tap targets */
    .nav-links li {
        width: 100%;
    }

    /* Hamburger Animation */
    .mobile-menu-open .hamburger {
        background: transparent;
    }

    .mobile-menu-open .hamburger::before {
        transform: translateY(0) rotate(45deg);
    }

    .mobile-menu-open .hamburger::after {
        transform: translateY(-2px) rotate(-45deg);
    }

    /* Overlay */
    body.mobile-menu-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 80;
    }

    body.mobile-menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    ul, ol {
        margin-left: var(--space-lg);
    }

    blockquote {
        padding: var(--space-lg);
        margin: var(--space-xl) 0;
    }

    blockquote::before {
        font-size: 2.5em;
    }
} 

/* Small Mobile Styles */
@media (max-width: 480px) {
    :root {
        --mobile-header-height: 40px;
        --container-padding: var(--space-sm);
    }

    .logo-image {
        height: 32px;
    }

    .brand-text {
        font-size: 1.1em;
    }

    .nav-links {
        width: 100%;
        max-width: none;
    }

    .content-container {
        padding: var(--space-md);
    }
}

/* Print Styles */
@media print {
    .nav-container,
    .footer-nav,
    .share-buttons,
    .mobile-menu-button {
        display: none;
    }

    body {
        background: none;
        color: black;
    }

    .content-container {
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
    }

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

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.9em;
    }
}

/* Footer Styles */
.site-footer {
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
}

.footer-content {
    text-align: center;
    color: var(--text-color);
}

.footer-nav {
    margin-bottom: 1em;
}

.footer-nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.3em 0.6em;
    transition: color 0.3s ease;
}

.footer-nav a:hover {
    color: var(--secondary-color);
}

.separator {
    color: var(--border-color);
    margin: 0 0.2em;
}

.footer-info {
    color: #666;
    line-height: 1;
}

.footer-info a {
    color: var(--link-color);
    text-decoration: none;
}

.footer-info a:hover {
    text-decoration: underline;
}

.footer-info p {
  text-align: center;
}

/* Mobile Footer */
@media (max-width: 768px) {
    .site-footer {
        margin-top: 2em;
        padding: 1.5em 1em;
    }

    .footer-nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5em;
    }

    .separator {
        display: none;
    }
} 

/* Form styles */
.contact-form {
    max-width: 600px;
    margin: 2em auto;
    position: relative;
}

.form-group {
    margin-bottom: 1.5em;
}

.form-group label {
    display: block;
    margin-bottom: 0.5em;
    color: var(--text-color);
    font-weight: 600;
}

input, textarea {
    width: 100%;
    padding: 0.8em;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 0, 92, 0.1);
}

textarea {
    height: 150px;
    resize: vertical;
}

button {
    background: var(--primary-color);
    color: white;
    padding: 0.8em 2em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s ease;
}

button:hover {
    background: var(--secondary-color);
}

button:disabled {
    background: #999;
    cursor: not-allowed;
}

/* Form feedback */
.form-success,
.form-error {
    padding: 1em;
    margin: 1em 0;
    border-radius: 4px;
    text-align: center;
}

.form-success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
}

.form-error {
    background: #ffebee;
    color: #b71c1c;
    border: 1px solid #ffcdd2;
} 

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 2em;
    font-size: 0.9em;
}

.breadcrumbs ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
    content: "›";
    margin: 0 0.5em;
    color: var(--border-color);
}

.breadcrumbs a {
    color: var(--link-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Share Buttons */
.share-buttons {
    margin-top: 3em;
    padding-top: 2em;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.share-buttons h3 {
    font-size: 1.1em;
    margin-bottom: 1em;
}

.share-buttons button {
    margin: 0.5em;
    padding: 0.5em 1em;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.share-buttons button:hover {
    background: var(--secondary-color);
} 

/* Brand name styling */
.brand-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-text {
    color: #FFB3B3;
    font-family: var(--heading-font), var(--font-serif-fallback);
    font-size: 1.4em;
    font-weight: 600;
    line-height: 1.1;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    /* Reserve space for text */
    min-height: 1.1em;
    font-display: swap;
}

.brand-tagline {
    color: rgba(255, 179, 179, 0.8);
    font-size: 0.8em;
    font-weight: 400;
    white-space: nowrap;
    /* Reserve space for tagline */
    min-height: 1.2em;
} 

/* 404 Page */
.error-404 {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.error-404 h1 {
  font-size: 2.5em;
  color: var(--secondary-color);
  margin-bottom: var(--space-xl);
}

.error-404 .suggestions {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-xl);
  background: var(--quote-bg);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.error-404 .suggestions h2 {
  color: var(--heading-color);
  margin-bottom: var(--space-lg);
}

.error-404 .suggestions ul {
  list-style: none;
  padding: 0;
  margin: var(--space-lg) 0;
}

.error-404 .suggestions li {
  margin: var(--space-sm) 0;
}

.error-404 .suggestions a {
  color: var(--link-color);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.error-404 .suggestions a:hover {
  background: var(--secondary-color);
  color: white;
} 

/* Add at the start of your CSS file, after Reset CSS */
main {
    content-visibility: auto;
    contain-intrinsic-size: 1000px;  /* Adjust based on your average content height */

    font-display: swap;

    content-visibility: auto;
    contain-intrinsic-size: 0 500px;

    min-height: 100px;
}
