/* Maritime-themed custom styles for Niovi Cruising */

/* Typography - Maritime-inspired font stacks */
:root {
    /* Font families */
    --font-serif: "Times New Roman", "Times", "Liberation Serif", "DejaVu Serif", serif;
    --font-sans: "Segoe UI", "Roboto", "Helvetica Neue", "Arial", "Liberation Sans", "DejaVu Sans", sans-serif;
    --font-display: "Georgia", "Times New Roman", "Times", serif;
    --font-mono: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace;
    
    /* Font weights and styles for maritime feel */
    --weight-light: 300;
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-bold: 700;
    
    /* Colors */
    --carmine-red: #960018;
    --sail-red: #dc2626;
    --deep-red: #7f1d1d;
    --light-red: #fecaca;
    --sand: #fef3c7;
    --sunset: #f97316;
    --ocean-blue: #1e40af;
    --cream: #f8f3e7;  /* Favicon background color */
    --warm-cream: #f5f0e5;  /* Slightly darker variant */
}

/* Base Typography */
body {
    font-family: var(--font-sans);
    font-weight: var(--weight-normal);
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* Headings - Use serif for elegance and maritime tradition */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    line-height: 1.3;
    letter-spacing: -0.02em;
}

/* Display headings for hero sections */
.display-1, .display-2, .display-3, .display-4 {
    font-family: var(--font-display);
    font-weight: var(--weight-medium);
    letter-spacing: -0.03em;
}

/* Navigation and brand */
.navbar-brand {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    letter-spacing: -0.01em;
}

.nav-link {
    font-family: var(--font-sans);
    font-weight: var(--weight-medium);
    letter-spacing: 0.02em;
}

/* Buttons - clean sans-serif */
.btn {
    font-family: var(--font-sans);
    font-weight: var(--weight-medium);
    letter-spacing: 0.02em;
    text-transform: none;
}

/* Lead text - serif for elegance */
.lead {
    font-family: var(--font-serif);
    font-weight: var(--weight-normal);
    font-style: italic;
    line-height: 1.7;
    letter-spacing: 0.01em;
}

/* Card titles - serif for elegance */
.card-title {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
}

/* Small text and metadata */
.small, small, .text-muted, .post-meta {
    font-family: var(--font-sans);
    font-weight: var(--weight-normal);
    letter-spacing: 0.02em;
}

/* Code and technical content */
code, pre, .font-monospace {
    font-family: var(--font-mono);
    font-weight: var(--weight-normal);
}

/* Custom color scheme */
.bg-primary {
    background-color: var(--carmine-red) !important;
}

.btn-primary {
    background-color: var(--sail-red);
    border-color: var(--sail-red);
}

.btn-primary:hover {
    background-color: var(--carmine-red);
    border-color: var(--carmine-red);
}

.btn-outline-primary {
    color: var(--sail-red);
    border-color: var(--sail-red);
}

.btn-outline-primary:hover {
    background-color: var(--sail-red);
    border-color: var(--sail-red);
}

.text-primary {
    color: var(--sail-red) !important;
}

/* Map container styling */
#homepage-map, #map-container, #post-map {
    height: 400px;
    width: 100%;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

#map-controls {
    margin-bottom: 20px;
}

/* Fix Leaflet map positioning issues with Bootstrap */
.leaflet-container {
    box-sizing: content-box !important;
}

.leaflet-control-container .leaflet-control {
    box-sizing: content-box !important;
}

.leaflet-popup-content-wrapper {
    box-sizing: content-box !important;
}

.leaflet-popup-content {
    box-sizing: content-box !important;
}

.leaflet-tile {
    box-sizing: content-box !important;
}

/* Fix Bootstrap's img responsive class conflict with Leaflet markers */
.leaflet-container img {
    max-width: none !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
}

/* Fix any positioning issues */
.leaflet-map-pane {
    box-sizing: content-box !important;
}

.leaflet-layer {
    box-sizing: content-box !important;
}

/* Additional fixes for Leaflet + Bootstrap integration */
.leaflet-control-zoom a {
    box-sizing: content-box !important;
}

.leaflet-control-attribution {
    box-sizing: content-box !important;
}

/* Navigation enhancements */
.navbar-brand {
    font-size: 1.5rem;
    /* Typography already defined above */
}

/* Card enhancements with cream accents */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    background-color: rgba(248, 243, 231, 0.6); /* Subtle cream tint */
    backdrop-filter: blur(10px);
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background-color: rgba(248, 243, 231, 0.8); /* Stronger cream on hover */
}

/* Maritime-themed background with cream tones */
body {
    background: linear-gradient(135deg, var(--cream) 0%, #f1f5f9 50%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Typography improvements */
.lead {
    font-size: 1.15rem;
    /* Other properties defined above in typography section */
}

.post-meta {
    font-size: 0.9em;
    color: #888;
    /* Font family defined above in typography section */
}

/* Footer styling */
footer {
    margin-top: auto;
}

/* Map loading animation */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Post content styling */
article h1, article h2, article h3 {
    color: var(--carmine-red);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    /* Font family defined above in typography section */
}

article h1:first-child, article h2:first-child {
    margin-top: 0;
}

/* Article body text - elegant serif for readability */
article p, article li {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.7;
    color: #2d3748;
}

/* Article blockquotes */
article blockquote {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.1rem;
    border-left: 4px solid var(--sail-red);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: var(--carmine-red);
}

/* Link styling */
a {
    color: var(--sail-red);
    text-decoration: none;
}

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

/* Alert styling */
.alert-info {
    background-color: rgba(254, 202, 202, 0.2);
    border-color: var(--light-red);
    color: var(--carmine-red);
}

/* Responsive typography */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    h1, .h1 { font-size: 1.8rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.3rem; }
    
    .lead {
        font-size: 1.1rem;
    }
    
    article p, article li {
        font-size: 1rem;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
}

/* GIF-specific styling */
img[src$=".gif"], img[src*=".gif?"] {
    /* Ensure GIFs don't auto-resize aggressively on slow connections */
    min-height: 200px;
    background: linear-gradient(135deg, var(--cream) 0%, #f1f5f9 100%);
    background-size: 20px 20px;
    background-image: 
        linear-gradient(45deg, rgba(0,0,0,.1) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(0,0,0,.1) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(0,0,0,.1) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(0,0,0,.1) 75%);
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    
    /* Loading state indicator */
    position: relative;
}

/* GIF loading indicator */
img[src$=".gif"]:not([data-loaded="true"])::before {
    content: "🎬 Loading animation...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(248, 243, 231, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    color: var(--carmine-red);
    font-family: var(--font-sans);
}

/* Image captions */
img + em, img + p em {
    display: block;
    text-align: center;
    font-family: var(--font-serif);
    font-style: italic;
    color: #6c757d;
    font-size: 0.9em;
    margin-top: 0.5rem;
    letter-spacing: 0.01em;
}

/* Gallery styles for multiple images */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.image-gallery img {
    margin: 0;
    width: 100%;
    object-fit: cover;
    aspect-ratio: 4/3;
}

/* Lightbox effect for clickable images */
.image-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-container:hover {
    transform: scale(1.02);
}

/* Print styles for sailing logs */
@media print {
    .navbar, .card-footer, footer {
        display: none !important;
    }
    
    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }
    
    body {
        background: white !important;
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}
