/* ==========================================================
   CMST 386, shared stylesheet for all project pages
   Author: Gilbert Anderson
   ========================================================== */

/* ---- Base ---- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.6;
  color: #1f2937;
  background-color: #f5f3ef;
  /* Sticky footer: the body fills the viewport and main absorbs the
     leftover height, so the footer sits at the bottom of the screen
     even when a page's content is shorter than the viewport. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Accessible skip link: hidden until it receives keyboard focus */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background-color: #1f2937;
  color: #ffffff;
  padding: 0.5rem 1rem;
  z-index: 100;
}

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

/* ---- Header and navigation ---- */
header {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem 1.5rem 0;
}

.site-name {
  margin: 0 0 0.75rem;
  font-size: 1.4rem;
  font-weight: bold;
  letter-spacing: 0.03em;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav li {
  position: relative;
}

nav a {
  display: block;
  padding: 0.75rem 1.25rem;
  color: #f9fafb;
  text-decoration: none;
  font-weight: bold;
}

/* Hover AND focus states so the menu works for keyboard users too */
nav a:hover,
nav a:focus {
  background-color: #374151;
  outline: 2px solid #fbbf24;
  outline-offset: -2px;
}

/* Dropdown submenu: hidden until its parent item is hovered or focused */
nav ul ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 11rem;
  background-color: #1f2937;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  z-index: 50;
}

nav li:hover > ul,
nav li:focus-within > ul {
  display: block;
}

/* Unlinked placeholder items for future projects */
.nav-placeholder {
  display: block;
  padding: 0.75rem 1.25rem;
  color: #9ca3af;
  font-weight: bold;
  cursor: default;
}

/* ---- Mobile navigation toggle ----
   Same collapse pattern as Project 4's header. Scoped to the
   .nav-collapsible class so only pages that actually include the
   toggle button (and js/main.js) collapse their menu; the other
   pages sharing this stylesheet keep the wrapping nav and are never
   left with a hidden menu they cannot open. */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  background-color: #374151;
  border: 1px solid rgba(249, 250, 251, 0.35);
  border-radius: 0.4rem;
  color: #f9fafb;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
}

.nav-toggle:hover,
.nav-toggle:focus {
  background-color: #4b5563;
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

.nav-toggle-bars {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle-bar {
  width: 20px;
  height: 2px;
  background-color: #f9fafb;
  border-radius: 2px;
}

@media (max-width: 640px) {
  .nav-collapsible {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
  }

  .nav-collapsible .site-name {
    margin: 0;
  }

  .nav-collapsible .nav-toggle {
    display: inline-flex;
  }

  /* Drop the menu as a full-width panel below the header instead of
     letting it shrink-wrap next to the toggle button. */
  .nav-collapsible nav ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    margin: 0;
    padding: 0.5rem 0;
    background-color: #1f2937;
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.35);
    z-index: 60;
  }

  .nav-collapsible nav ul.is-open {
    display: flex;
  }

  .nav-collapsible nav li {
    width: 100%;
  }

  .nav-collapsible nav li + li {
    border-top: 1px solid rgba(249, 250, 251, 0.15);
  }

  .nav-collapsible nav a {
    padding: 0.95rem 1.5rem;
  }

  /* Submenus render inline and indented inside the open panel, since
     there is no hover state to reveal them on a touch screen. */
  .nav-collapsible nav ul ul {
    display: block;
    position: static;
    min-width: 0;
    padding: 0;
    box-shadow: none;
  }

  .nav-collapsible nav ul ul a {
    padding-left: 2.75rem;
    font-weight: normal;
  }
}

/* ---- Main content ---- */
main {
  max-width: 60rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  flex: 1;
}

h1 {
  font-size: 2.1rem;
  color: #7c2d12;
  border-bottom: 3px solid #7c2d12;
  padding-bottom: 0.4rem;
}

h2 {
  font-size: 1.5rem;
  color: #1f2937;
  margin-top: 2rem;
}

h3 {
  font-size: 1.2rem;
  color: #374151;
}

section {
  margin-bottom: 1.5rem;
}

/* Links inside the page body */
main a {
  color: #075985;
}

main a:hover,
main a:focus {
  color: #7c2d12;
  text-decoration-thickness: 2px;
}

.project-list li {
  margin-bottom: 0.5rem;
}

/* Code sample in the heading-hierarchy section */
pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 0.4rem;
  overflow-x: auto;
  font-size: 0.95rem;
}

code {
  font-family: "Courier New", Courier, monospace;
}

/* ---- Gallery ---- */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

figure {
  margin: 0;
  padding: 0.75rem;
  background-color: #ffffff;
  border: 1px solid #d6d3d1;
  border-radius: 0.5rem;
  text-align: center;
}

figure img {
  display: block;
  margin: 0 auto 0.5rem;
  border-radius: 0.25rem;
}

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

figcaption {
  font-size: 0.9rem;
  color: #44403c;
  max-width: 12rem;
}

/* Photo gallery (Project 1): every thumbnail is the same 3:2 size and
   fills the top of its card edge-to-edge. Scoped to .photo-gallery so
   Project 2's wireframe gallery keeps the padded figure look. */
.photo-gallery figure {
  flex: 0 1 15rem;
  padding: 0;
  overflow: hidden;
}

.photo-gallery figure a {
  display: block;
}

.photo-gallery figure img {
  width: 100%;
  height: 10rem;
  object-fit: cover;
  border-radius: 0;
  margin: 0;
}

.photo-gallery figcaption {
  max-width: none;
  padding: 0.75rem;
}

/* ---- Footer ---- */
footer {
  background-color: #1f2937;
  color: #f9fafb;
  text-align: center;
  padding: 1rem 1.5rem;
  margin-top: 2rem;
}

/* ---- Photo credits ---- */
.photo-credits {
  font-size: 0.9rem;
  line-height: 1.5;
}

.photo-credits li {
  margin-bottom: 0.5rem;
}
