/* ===== Footer styles (site-wide) ===== */
/* Global footer layout based on the projects page design */

.site-footer {
    color: rgba(0,0,0,0.85); /* muted serif tone at ~85% */
    font-family: var(--font-editor-regular);
    margin-top: 50px; /* ensure space above footer */
    margin-bottom: 2px; /* no spacing after footer */
}

.site-footer .footer-inner {
    /* Default: Match the projects layout - allow footer rules to reach to the page gutters */
    width: calc(100% + 5rem);
    max-width: none;
    margin-left: -2.5rem;
    margin-right: -2.5rem;
    padding: 12px 2.5rem; /* reduced vertical padding while preserving inner gutter */
    box-sizing: border-box;
}

/* Bookmarks page has a different layout - container doesn't extend to gutters,
   so footer should match the normal width without negative margins */
body:has(.bookmarks-container) .site-footer .footer-inner {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding: 12px 2.5rem;
    box-sizing: border-box;
}

.site-footer .footer-text {
    margin: 0;
    display: flex;
    gap: 0; /* remove flex gap so the pseudo-element controls exact separator spacing */
    align-items: center;
    justify-content: flex-start; /* left-align across the site */
    color: rgba(0,0,0,0.85);
    font-size: 0.95rem;
    font-family: var(--font-editor-regular);
    font-weight: 400;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.site-footer .footer-links {
    display: contents;
}

/* Add separator before footer-links on desktop */
.site-footer .footer-text .footer-links::before {
    content: '·';
    color: #999;
    display: inline-block;
    margin: 0 1.25rem;
    font-weight: 400;
    font-size: inherit;
    line-height: 1;
    vertical-align: middle;
}

/* Prevent duplicate separator on first link inside footer-links */
.site-footer .footer-text .footer-links .footer-item:first-child::before {
    display: none;
}

/* Mobile: Adjust footer text size */
@media (max-width: 768px) {
    .site-footer {
        margin-top: 40px;
    }
    
    .site-footer .footer-inner {
        padding: 12px 0.25rem;
        /* Make footer full width by compensating for body padding (0.25rem) */
        width: calc(100% + 0.5rem);
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
    
    body:has(.bookmarks-container) .site-footer .footer-inner {
        width: calc(100% + 0.5rem);
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
    
    /* Match footer width to page content containers */
    body:has(.contact-container) .site-footer .footer-inner,
    body:has(.colophon-container) .site-footer .footer-inner {
        max-width: none;
        width: calc(100% + 0.5rem);
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
    
    body:has(.now-content) .site-footer .footer-inner {
        max-width: none;
        width: calc(100% + 0.5rem);
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
    
    .site-footer .footer-text {
        font-size: 0.85rem;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 0.6rem;
        text-align: center;
    }
    
    /* Hide all desktop dot separators on mobile */
    .site-footer .footer-text .footer-item + .footer-item::before,
    .site-footer .footer-text .footer-links::before {
        display: none !important;
    }
    
    /* Line 1: Copyright (order 1) left aligned, Dark mode toggle (order 2) right aligned */
    .site-footer .footer-text .footer-item:first-child {
        order: 1;
    }
    
    .site-footer .footer-text .dark-mode-toggle {
        order: 2;
    }
    
    /* Line 2: Links container - forces new line */
    .site-footer .footer-links {
        display: flex;
        flex-direction: row;
        flex-basis: 100%;
        order: 3;
        justify-content: center;
        align-items: center;
        gap: 0;
        margin-top: 0.3rem;
    }
    
    /* Reset any inherited order on links */
    .site-footer .footer-links a.footer-item {
        order: unset;
    }
    
    /* Add pipe separators between links */
    .site-footer .footer-links a.footer-item:not(:last-child)::after {
        content: '|';
        color: #999;
        margin: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .site-footer {
        margin-top: 30px;
    }
    
    .site-footer .footer-text {
        font-size: 0.8rem;
        gap: 0;
        row-gap: 0.5rem;
    }

    /* Reduce pipe margins on small screens */
    .site-footer .footer-links a.footer-item:not(:last-child)::after {
        margin: 0 0.35rem;
    }
    
    .site-footer .footer-inner {
        padding: 10px 0.25rem;
        /* Reset to normal width since body padding is 0 at this breakpoint */
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Reset overrides for specific pages */
    body:has(.contact-container) .site-footer .footer-inner,
    body:has(.colophon-container) .site-footer .footer-inner,
    body:has(.now-content) .site-footer .footer-inner,
    body:has(.bookmarks-container) .site-footer .footer-inner {
        max-width: none;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* Use pseudo-element to render a middle dot between items so HTML remains clean */
.site-footer .footer-text .footer-item {
    display: inline-flex; /* use inline-flex so items and pseudo-element align consistently */
    align-items: center;
}

.site-footer .footer-text .footer-item + .footer-item::before {
    content: '·';
    color: #999;
    display: inline-block;
    margin: 0 1.25rem; /* symmetric spacing so the dot is centered between items */
    font-weight: 400;
    font-size: inherit; /* match surrounding text size */
    line-height: 1; /* prevent vertical misalignment */
    vertical-align: middle;
}

/* Slightly increase the gap between the year and the name inside the © text */
.site-footer .footer-text .footer-item .footer-year {
    margin-right: 0.4rem; /* small extra space between '2025' and 'Sai' */
}

.site-footer .footer-text a {
    /* Make links match the © text exactly */
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    text-decoration: none;
    opacity: 0.95;
}

.site-footer .footer-text a:hover {
    opacity: 1;
}

.site-footer .footer-rule {
    border: none;
    height: 1px;
    background-color: rgba(0,0,0,0.55); /* ~55% opacity */
    margin: 0;
}

.site-footer .footer-rule.top {
    margin-bottom: 3px; /* reduced gap between top rule and text */
}

.site-footer .footer-rule.bottom {
    margin-top: 3px; /* reduced gap between text and bottom rule */
}

/* Dark mode toggle button styles */
.dark-mode-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--font-editor-regular);
    font-size: inherit;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem; /* tight spacing between [Light] and Dark */
    opacity: 0.95;
}

.dark-mode-toggle:hover {
    opacity: 1;
}

/* Inactive mode word can be slightly muted */
.dark-mode-toggle .mode-dark {
    color: #8b8680;
}

/* When dark mode is active, light word becomes muted */
[data-theme="dark"] .dark-mode-toggle .mode-light {
    color: #8b8680;
}

[data-theme="dark"] .dark-mode-toggle .mode-dark {
    color: inherit; /* no muting when active */
}
