/* =====================================================
   Caltech Library Exhibit Template Stylesheet
   Author: Twila Smith
   Updated: 2025-10-07
====================================================== */

:root {
  --color-brand-orange: #FF6C0C;
  --color-accent-dark: #9c3110;
  --color-link: #bd3c13;
  --color-link-hover: #9c3110;
  --color-text: #2f3334;
}

/* - - - 
Base
- - - - */

html {
  margin: 0;
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background-color: #fff;
  color: var(--color-text);
}

main {
  width: 85%;          
  max-width: 1105px;    
  margin: 2rem auto;
  padding: 0rem;
  box-sizing: border-box;
}


/* - - - 
FONTS
- - - - */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Merriweather', Georgia, serif;
  color: var(--color-text); 
  margin: 1rem auto;
  font-weight: 700;
  line-height: 1.2;
}

main h2 {
  font-size: 1.75rem;
  margin: 3rem auto;
}


.banner-inner h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.banner-inner h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.banner-inner h3 {
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
  padding: 0 0.5rem;
}

p {
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 1.125rem;
  line-height: 1.75;
  margin-bottom: 1rem;
}

/* - - -
LOGO
- - - - */

#logo {
  width: 100%;
  max-width: 400px;
  fill: transparent;
  overflow: visible;
}

/* SVG logo hover and focus states */
#logo rect {
  fill: transparent;
  stroke: transparent;
  transition: fill 0.2s ease, stroke 0.2s ease;
}

#logo a:hover > rect {
  fill: rgba(244, 93, 44, 0.25);
}

#logo a:focus-visible > rect {
  stroke: rgba(244, 93, 44, 0.25);
  stroke-width: 3px;
}

#logo a {
  outline: none;
}

.logo-caltech {
  fill: var(--color-brand-orange);
  transition: fill 0.2s ease;
}

#logo a:first-of-type:hover > .logo-caltech {
  fill: #000000;
}

.logo-archives {
  fill: black;
}

.logo svg {
  width: 100%;
  height: auto;
  display: block;
}

/* - - - 
HEADER 
- - - - */

header {
  padding: 48px 0px 0px 0px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.nav-container {
  display: flex;
  align-items: center;         
  justify-content: space-between; 
}

.logo {
  margin-left: 15%;      
  padding-bottom: 48px;
  width: auto;           
  max-width: 500px;       
  min-width: 250px;      
}

.banner {
  background-size: cover;
  background-position: center;
  padding: 60px 0; 
}

.banner-inner {
  width: 100%;
  max-width: 933px;
  margin: 0 auto;
  padding: 0 1rem; 
  position: relative;
  z-index: 1;
  text-align: center;
}

.banner-inner h1, .banner-inner h2 {
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* front matter variables */

.banner.has-image {
  background-image: var(--feature-image);
  background-color: #1a1a1a; /* Accessible dark fallback */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.banner.has-color {
  background-color: var(--feature-color);
}

.banner.has-overlay {
  position: relative;
}

.banner.has-overlay::after {
  content: "";
  position: absolute;
  inset: 0; 
  background-color: var(--feature-overlay);
  pointer-events: none;
  z-index: 0;
  /* overlay sits under text, above background */
}

/* - - - 
NAV
- - - - */

/* main nav styling */

nav.main-nav {
  position: relative;
  display: flex;
  justify-content: flex-end;
  margin: 0px 15% 35px 20px;
}

.main-nav.off {
  display: none;
}

.menu-toggle {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  padding: 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-toggle svg {
  display: block;
}

.menu-items {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 150px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  display: none;
  z-index: 10;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(-5px);
}

.menu-items li a {
  display: block;
  padding: 0.5rem 1rem;
  text-decoration: none;
  cursor: pointer;
}

.menu-items li a:hover {
  background: #f0f0f0;
}

.menu-items.show {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
}

/* Global focus styles for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(244, 93, 44, 0.25);
  outline-offset: 2px;
}

/* Ensure focus is visible even with custom button styles */
.menu-toggle:focus-visible {
  outline: 3px solid rgba(244, 93, 44, 0.25);
  outline-offset: 2px;
}

/* Topic menu styling */

#topic-nav {
  text-align: center;       
  background-color: #f1f0f0;
  padding: 1rem;         
}

#topic-nav.off {
  display: none;
}

#topic-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;           
  justify-content: center;  
  gap: 30px;                
}

#topic-nav li {
  display: inline-block;
}

#topic-nav a {
  text-decoration: underline;
  letter-spacing: 1px;          
  padding: 0.25rem 0.5rem; 
  text-underline-offset: 3px;
}

#topic-nav a:hover {
  color: var(--color-accent-dark);           
  text-decoration: underline;
}

/* --- Large Screens (max-width: 992px) --- */
@media (max-width: 992px) {
  .logo {
    max-width: 350px;      
  }

  #logo {
    max-width: 350px;
  }

  p {
    font-size: 1rem;
  }

  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  #topic-nav a {
    font-size: 1rem; 
  }

}

/* --- Medium Screens (max-width: 768px) --- */
@media (max-width: 768px) {
  .logo {
    max-width: 250px;    
  }

  #logo {
    max-width: 250px;
  }

  p {
    font-size: 0.95rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.4rem;
  }
  #topic-nav a {
    font-size: .9rem; 
  }
}

/* --- Small Screens (max-width: 576px) --- */
@media (max-width: 576px) {
  .logo {
    max-width: 250px;    
  }

  #logo {
    max-width: 250px;
  }

  .banner-inner h2 {
    font-size: clamp(1.25rem, 3.5vw, 1.75rem);
    line-height: 1.3;
    margin-left: auto;
    margin-right: auto;
    max-width: 80%; 
    padding: 0 1rem; 
    box-sizing: border-box;
  }

  p {
    font-size: 0.9rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  #topic-nav a {
    font-size: .8rem; 
  }
}

/* --- Extra Small Screens (max-width: 450px) --- */
@media (max-width: 450px) {
 
  .logo {
    max-width: 200px; 
    margin-left: 5%;   
  }

  #logo {
    max-width: 200px;
  }

  nav.main-nav {
    position: relative;
    display: flex;
    justify-content: flex-end;
    margin: 0px 5% 35px 20px;
  }
  
  .banner-inner h1 {
    font-size: 1.75rem;
  }

  .banner-inner h2 {
    font-size: 1.1rem;
  }

  p {
    font-size: 0.85rem;
  }
}

/* - - - 
LINKS
- - - - */

body a {
  color: var(--color-link);
  text-decoration: underline;
  transition: color 0.2s ease;
}

body a:hover {
  color: var(--color-link-hover); 
  text-decoration: underline;
}

/* - - - 
IMAGES
- - - - */

figure img {
  margin: 0 auto;
}

figcaption {
  font-size: 0.9rem;
  color: var(--color-text);
  opacity: 0.8;
  margin-top: 0.5rem;
  font-style: italic;
  text-align: center;
}

img, figure img {
  max-width: 100%;
  height: auto;
}


/* size utilities */
.img-small {
  max-width: 300px;
}

.img-medium {
  max-width: 600px;
}

.img-large {
  max-width: 100%; 
}

/* frame treatment */
.frame {
  border: 1px solid #ddd;
  padding: 4px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


/* alignment utilities */
figure.left,
figure.right {
  max-width: 45%;
}

figure.left {
  float: left;
  margin: 0 1.5rem 1rem 0;
}

figure.right {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

figure.center {
  display: block;
  margin: 1.5rem auto;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  figure.left,
  figure.right {
    float: none;
    max-width: 100%;
    margin: 1.5rem auto;
  }
}

/* - - -
ACCESSIBILITY
- - - - */

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
