/* ------------------------------------------------------------------------
   Fixed chrome geometry

   The title bar's height anchors everything pinned below it: the navigation
   strip, the mobile menu panel, and the body's top padding. Holding it in one
   custom property is what keeps the mobile menu welded to the bar -- the bar
   grows to 80px between 576px and 768px, and the menu used to stay pinned at
   a hard-coded 70px, so it opened 10px underneath the bar.
   ------------------------------------------------------------------------ */
:root {
    --title-header-h: 70px;   /* title bar */
    --navbar-strip-h: 54px;   /* desktop navigation strip */
    --title-header-bg: #424951;
    --navbar-bg: #343a40;
}

@media (max-width: 767.98px) {
    :root { --title-header-h: 80px; }
}

@media (max-width: 575.98px) {
    :root { --title-header-h: 70px; }
}

h1 {
  display: block;
  margin: .67em 0;
  color: #343a40;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-feature-settings: "liga";
  font-size: 25px;
  text-align:left !important;
  text-transform: uppercase;
  font-weight: 700;
}

h2 {
  display: block;
  color: #343a40;
  margin: .75em 0;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-feature-settings: "liga";
  font-size: 20px;
  text-align:left !important;
  text-transform: uppercase;
  font-weight: 700;
} 

h3 {
  display: block;
  color: #343a40;
  margin: .10em 0;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-feature-settings: "liga";
  font-size: 18px;
  text-align:left !important;
  text-transform: uppercase;
  font-weight: 700;
}

h4 {
  display: block;
  color: #343a40;
  margin: 0 0;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-feature-settings: "liga";
  font-size: 14px;
  text-align:left !important;
  text-transform: uppercase;
  font-weight: 700;
}

h1.noupper {
  display: block;
  margin: .67em 0;
  color: #343a40;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-feature-settings: "liga";
  font-size: 25px;
  text-align:left !important;
  text-transform:  none !important;
  font-weight: 700;
}

h2.noupper {
  display: block;
  color: #343a40;
  margin: .75em 0;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-feature-settings: "liga";
  font-size: 20px;
  text-transform:  none !important;
  text-align:left !important;
  font-weight: 700;
} 

h3.noupper {
  display: block;
  color: #343a40;
  margin: .10em 0;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-feature-settings: "liga";
  font-size: 18px;
  text-transform:  none !important;
  text-align:left !important;
  font-weight: 700;
}

h4.noupper {
  display: block;
  color: #343a40;
  margin: 0 0;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-feature-settings: "liga";
  font-size: 14px;
  text-transform:  none !important;
  text-align:left !important;
  font-weight: 700;
}

a {
	color: #0056b3;
}

a:hover {
	color: #006FE6;
	text-decoration: none;
}

/*
a img {
	border: solid 2px transparent;	
}

a:hover img {
	color: darkslateblue;
	background-color: #e3e4fa;
	text-decoration: none;
border: solid 2px #e3e4fa;
}
*/

a.icon {
	color: #4C535D !important;
	background-color: transparent !important;
}

a.icon:hover, a.icon:active {
	/*color: #636D79 !important;*/
	opacity: 0.7;
	background-color: transparent !important;
}

papertitle {
	/*font-family: 'Lato', Verdana, Helvetica, sans-serif;*/
	font-size: 16px;
	line-height: 1px;
	color: #343a40;
	font-family: "Open Sans", Helvetica, Arial, sans-serif;
	font-feature-settings: "liga";
	font-weight: 800
}

b{
	color: #343a40 !important;
}

/* year expansion/minimization icons */
i.minimize {
    color: inherit;
    display: inline-block;
}

i.expand {
    color: inherit;
    display: inline-block;
	transform: rotate(90deg)!important;
}

@media (hover: hover) and (pointer: fine) {
	i.minimize:hover {
		color: inherit;
		text-decoration: none;
		background-color: transparent;
		transform: translateY(3px) !important;
	}

	i.expand:hover {
		color: inherit;
		text-decoration: none;
		background-color: transparent;
		transform: rotate(90deg) translateY(3px) !important;
	}
}

/* Body and HTML for sticky footer */
html {
    height: 100%;
    overflow-y: scroll; /* Force scrollbar to always show */
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Remove any gaps around navbar */
#topheader {
    margin: 0;
    padding: 0;
}

.navbar {
    margin-bottom: 0 !important;
    border: 0 !important;
}

.navbar-dark {
    border-bottom: none !important;
}

/* Desktop styles - restore original navbar appearance */
@media (min-width: 992px) {
    /* Position navbar collapse inside topheader for desktop */
    #topheader {
        display: block;
        background-color: #343a40;
    }
    
    #navbarSupportedContent {
        display: flex !important;
        flex-basis: auto;
    }
    
    /* Hide mobile hamburger on desktop */
    .mobile-menu-toggle {
        display: none !important;
    }
    
    /* Show desktop hamburger (though it should be hidden by default with navbar-expand-lg) */
    .desktop-menu-toggle {
        display: block;
    }
}

/* Mobile menu scrolling fix */
@media (max-width: 991px) {
    /* Hide the navbar bar on mobile (save space) but keep it in DOM */
    #topheader {
        height: 0;
        overflow: visible; /* Important: allows child to escape with fixed positioning */
        visibility: hidden; /* Hide it but keep in DOM */
    }
    
    /* The panel hangs off the bottom edge of the title bar and is always laid
       out; only transform and opacity change, so it unfolds from behind the
       bar instead of appearing instantly. Bootstrap's collapse animates
       height on a static element and cannot animate this one, so navbar.js
       drives the .menu-open class instead. */
    #navbarSupportedContent {
        display: flex !important;
        position: fixed !important;
        top: var(--title-header-h);
        left: 0;
        right: 0;
        width: 100% !important;
        max-height: calc(100vh - var(--title-header-h));
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        z-index: 1029; /* behind the title bar (1030), above page content */
        padding: 0.5rem 1rem 1rem;
        flex-direction: column;
        background-color: var(--navbar-bg);
        border-radius: 0 0 0.75rem 0.75rem;
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);

        /* closed */
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-0.5rem);
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.16s ease,
                    visibility 0.2s;
    }

    #navbarSupportedContent.menu-open {
        visibility: visible !important; /* beats #topheader's visibility: hidden */
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
    
    /* Mobile hamburger menu in title bar - LEFT SIDE */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        width: 44px;  /* comfortable touch target */
        height: 44px;
        padding: 0;
        border: 0;
        border-radius: 0.5rem;
        background: rgba(255, 255, 255, 0.08);
        color: white;
        z-index: 10;
        transition: background-color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:focus {
        background: rgba(255, 255, 255, 0.16);
        outline: none;
        box-shadow: none;
    }

    .mobile-menu-toggle:focus-visible {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
    }

    /* Three bars that fold into an X. aria-expanded is the single source of
       truth for the state, so the icon can never disagree with the panel. */
    .mobile-menu-toggle .menu-bars {
        position: relative;
        display: block;
        width: 22px;
        height: 16px;
    }

    .mobile-menu-toggle .menu-bars > span {
        position: absolute;
        left: 0;
        width: 100%;
        height: 2px;
        border-radius: 2px;
        background-color: white;
        transition: top 0.2s ease, transform 0.2s ease, opacity 0.15s ease;
    }

    .mobile-menu-toggle .menu-bars > span:nth-child(1) { top: 0; }
    .mobile-menu-toggle .menu-bars > span:nth-child(2) { top: 7px; }
    .mobile-menu-toggle .menu-bars > span:nth-child(3) { top: 14px; }

    .mobile-menu-toggle[aria-expanded="true"] .menu-bars > span:nth-child(1) {
        top: 7px;
        transform: rotate(45deg);
    }

    .mobile-menu-toggle[aria-expanded="true"] .menu-bars > span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle[aria-expanded="true"] .menu-bars > span:nth-child(3) {
        top: 7px;
        transform: rotate(-45deg);
    }
    
    /* Hide desktop menu toggle */
    .desktop-menu-toggle {
        display: none;
    }
    
    /* Mobile menu items should be stacked vertically */
    #navbarSupportedContent .navbar-nav {
        flex-direction: column;
        width: 100%;
    }
    
    /* Prevent body scroll when mobile menu is open */
    body.mobile-menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    /* Adjust body padding since navbar is hidden */
    body {
        padding-top: var(--title-header-h) !important; /* Only title header */
    }
}

/* Desktop: hide mobile menu toggle */
@media (min-width: 992px) {
    .mobile-menu-toggle {
        display: none;
    }
    
    .desktop-menu-toggle {
        display: none; /* Hide on desktop too since menu is always visible */
    }
}

/* Remove padding from container after navbar */
.container {
    padding-top: 0;
}

.container > .row:first-child {
    margin-top: 0;
}

/* Main content wrapper - grows to fill available space */
.container {
    flex: 1 0 auto;
    margin-bottom: 1.5rem; /* Same as mt-4 spacing used at top */
}

/* Footer styles - fixed at bottom */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    flex-shrink: 0;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    background-color: #424951;
    border-top: 1px solid #2c3138;
    z-index: 1010;
}

.footer .container-fluid {
    margin-bottom: 0;
}

.footer span {
    margin: 0;
    padding: 0;
    line-height: 1;
    color: #fff;
}

.footer-icons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.footer-icon {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.footer-icon:hover {
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
}

/* Mobile footer adjustments */
@media (max-width: 767px) {
    /* Hide copyright info on mobile, keep login/logout */
    .footer-desktop-info {
        display: none;
    }
    
    /* Remove the leading "|" separator on mobile since copyright is hidden */
    .footer-auth-info {
        margin-left: 0 !important;
    }
    
    .footer-auth-info::before {
        content: none !important;
    }
    
    /* Adjust "Logged in as" text on mobile - keep it simple */
    .footer-auth-info {
        font-size: 0.85rem;
    }
    
    /* Reduce margins on mobile */
    .footer .text-muted {
        margin-left: 0.5rem !important;
    }
    
    .footer-icons {
        margin-right: 0.5rem !important;
        gap: 0.5rem;
    }
    
    /* Slightly smaller icon size on mobile */
    .footer-icon {
        font-size: 1.1rem;
    }
}

/* Add padding to body to prevent content from going under fixed footer */
body {
    padding-bottom: 40px; /* Thin footer height */
}

/* Fixed header styles */
.title-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--title-header-h);
    background-color: var(--title-header-bg);
    z-index: 1030;
}

#topheader {
    position: fixed;
    top: var(--title-header-h);
    left: 0;
    right: 0;
    z-index: 1020;
}

/* Add padding to body to prevent content from going under fixed header */
body {
    padding-top: calc(var(--title-header-h) + var(--navbar-strip-h));
}

/* On mobile, only need padding for title header (navbar bar is hidden) */
@media (max-width: 991px) {
    body {
        padding-top: var(--title-header-h); /* Only title header height */
    }
}
