/**
 * Mizar Theme Custom Styles
 * Based on Next.js design system
 */

:root {
    /* Color Palette */
    --bg: #ffffff;
    --fg: #0f172a;           /* slate-900 */
    --muted: #64748b;        /* slate-500 */
    --border: #e2e8f0;       /* slate-200 */
    
    /* Brand Colors */
    --primary: #1e40af;      /* blue-800 */
    --primary-hover: #1d4ed8; /* blue-700 */
    --primary-light: #dbeafe; /* blue-50 */
    --secondary: #7c3aed;    /* violet-600 */
    --secondary-hover: #8b5cf6; /* violet-500 */
    
    /* Semantic Colors */
    --success: #059669;      /* emerald-600 */
    --warning: #d97706;      /* amber-600 */
    --error: #dc2626;        /* red-600 */
    --info: #0284c7;         /* sky-600 */
    
    /* Surface Colors */
    --surface: #f8fafc;      /* slate-50 */
    --surface-elevated: #ffffff;
    --surface-hover: #f1f5f9; /* slate-100 */
    
    /* Link System */
    --link: var(--primary);
    --link-hover: var(--primary-hover);
    
    /* Typography Scale (Fluid) */
    --scale--2: clamp(0.75rem, 0.78rem + 0.1vw, 0.85rem);
    --scale--1: clamp(0.875rem, 0.88rem + 0.2vw, 0.98rem);
    --scale-0:  clamp(1rem, 0.96rem + 0.4vw, 1.125rem);
    --scale-1:  clamp(1.25rem, 1.1rem + 0.8vw, 1.5rem);
    --scale-2:  clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem);
    --scale-3:  clamp(1.875rem, 1.4rem + 2vw, 2.25rem);
    --scale-4:  clamp(2.25rem, 1.6rem + 3vw, 3rem);
    
    /* Spacing & Layout */
    --section-y: clamp(2rem, 3vw + 0.5rem, 4rem);
    --container: 1200px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Base Styles */
body {
    font-family: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--fg);
    line-height: 1.6;
    font-size: var(--scale-0);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.6em;
    font-weight: 600;
    line-height: 1.2;
    color: var(--fg);
    letter-spacing: -0.025em;
}

h1 { font-size: var(--scale-4); line-height: 1.15; }
h2 { font-size: var(--scale-3); line-height: 1.2; margin: 1.2em 0 0.5em; }
h3 { font-size: var(--scale-2); line-height: 1.25; margin: 1.1em 0 0.5em; }
h4 { font-size: var(--scale-1); line-height: 1.3; margin: 1em 0 0.5em; }
h5 { font-size: var(--scale-0); line-height: 1.4; margin: 0.8em 0 0.4em; }
h6 { font-size: var(--scale--1); line-height: 1.4; margin: 0.6em 0 0.3em; }

p, li {
    font-size: var(--scale-0);
    line-height: 1.65;
    color: var(--muted);
    margin-bottom: 1.25rem;
}

/* Links */
a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}

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

/* Navbar */
.navbar {
    background-color: var(--bg) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    padding: 1rem 0;
}

/* Logo Size Control */
.navbar-brand img,
.custom-logo {
    max-height: 60px;        /* Maximum logo height */
    width: auto;             /* Maintain aspect ratio */
    max-width: 200px;        /* Maximum logo width */
    height: auto;            /* Flexible height */
}

/* Responsive Logo Size */
@media (max-width: 768px) {
    .navbar-brand img,
    .custom-logo {
        max-height: 45px;    /* Smaller logo on mobile */
        max-width: 150px;
    }
}

/* Navigation Menu */
.navbar-nav {
    align-items: center;
}

.navbar-nav .nav-item {
    margin: 0 0.25rem;
}

.navbar-nav .nav-link {
    color: var(--fg) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    margin: 0;
    transition: all 0.3s ease;
    border-radius: 6px;
    display: block;
}

.navbar-nav .nav-link:hover {
    color: var(--link-hover) !important;
    background-color: rgba(30, 64, 175, 0.1);
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link:focus {
    color: var(--link-hover) !important;
    font-weight: 600;
    background-color: rgba(30, 64, 175, 0.1);
}

/* Dropdown Menu */
.navbar-nav .dropdown-menu {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    margin-top: 0.5rem;
    padding: 0.5rem 0;
}

.navbar-nav .dropdown-item {
    color: var(--fg);
    padding: 0.5rem 1.5rem;
    transition: all 0.2s ease;
}

.navbar-nav .dropdown-item:hover,
.navbar-nav .dropdown-item:focus {
    background-color: var(--primary-light);
    color: var(--primary);
}

.navbar-nav .dropdown-toggle::after {
    margin-left: 0.5rem;
    vertical-align: 0.15em;
}

/* Mobile Menu */
@media (max-width: 991.98px) {
    .navbar-collapse {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border);
    }
    
    .navbar-nav .nav-item {
        margin: 0.25rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
    }
    
    .navbar-nav .dropdown-menu {
        margin-top: 0;
        margin-left: 1rem;
        border: none;
        box-shadow: none;
        background-color: var(--surface);
    }
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

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

/* Cards */
.card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

/* Footer */
.site-footer {
    background-color: #0f172a !important; /* Dark background */
    color: #ffffff !important; /* White text */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem 0 1.5rem !important;
}

.site-footer h3,
.site-footer h4,
.site-footer h5,
.site-footer h6 {
    color: #ffffff !important;
    margin-bottom: 1rem;
}

.site-footer p {
    color: rgba(255, 255, 255, 0.8) !important;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

.site-footer .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

.site-footer .border-secondary,
.site-footer .border-top {
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Footer Menu */
.footer-menu-wrapper {
    margin: 1.5rem 0;
}

.footer-menu,
.site-footer .nav {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0 !important;
}

.footer-menu li,
.site-footer .nav li {
    margin: 0 !important;
    padding: 0 !important;
    display: inline-block !important;
    list-style: none !important;
}

.footer-menu li:not(:last-child)::after,
.site-footer .nav li:not(:last-child)::after {
    content: ' | ';
    color: rgba(255, 255, 255, 0.4);
    margin: 0 0.75rem;
    font-weight: 300;
    display: inline-block;
    pointer-events: none;
}

.footer-menu a,
.site-footer .nav a,
.site-footer .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.9rem !important;
    transition: color 0.3s ease;
    display: inline-block !important;
    white-space: nowrap;
}

.footer-menu a:hover,
.site-footer .nav a:hover,
.site-footer .nav-link:hover {
    color: #ffffff !important;
    text-decoration: underline !important;
    background-color: transparent !important;
}

/* Responsive Footer Menu */
@media (max-width: 768px) {
    .footer-menu,
    .site-footer .nav {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .footer-menu li::after,
    .site-footer .nav li::after {
        display: none !important;
    }
    
    .footer-menu a,
    .site-footer .nav a,
    .site-footer .nav-link {
        padding: 0.5rem 0 !important;
        display: block !important;
    }
}

/* Entry Content - Allow full HTML styling */
.entry-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.entry-content > *:first-child {
    margin-top: 0;
}

.entry-content > *:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: var(--scale-3); }
    h2 { font-size: var(--scale-2); }
    h3 { font-size: var(--scale-1); }
    
    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* Screen Reader Text */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}