/* --- VARIABLES & FALLBACKS --- */
:root {
  --primary-text: #222222;
}

/* --- UNIVERSAL SELECTOR --- */
* {
  box-sizing: border-box;
}

/* --- ELEMENT SELECTOR --- */
body {
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--primary-text, black);
  background-color: rgb(250, 250, 250);
  margin: auto;
}

/* --- POSITIONING & SHORT/LONG BOX MODEL --- */
header {
  margin-top: 0.1in;
  margin-bottom: 10pt;
  margin-left: 0px;
  margin-right: 0px;
  padding: 2vh 5% 1rem 5%;
  border-bottom: 3px solid green;
}

section {
  position: relative;
  margin: 20px auto;
  padding-top: 15px;
  padding-bottom: 15px;
  padding-left: 2vw;
  padding-right: 2vw;
  border-width: 2px;
  border-style: dashed;
  border-color: hsl(120, 50%, 70%);
  border-radius: 8px;
}

/* --- SELECTOR LIST --- */
h1, h3 {
  text-align: center;
}

/* --- CLASS SELECTOR --- */
.resource-section {
  background-color: rgba(0, 0, 0, 0.05);
}

/* --- ID SELECTOR --- */
#attendance {
  background-color: color-mix(in srgb, white 90%, green 10%);
}

/* --- DISPLAY PROPERTIES --- */
hr { display: none; }
main { display: block; }
nav a { display: inline-block; }

/* --- FLEXBOX LAYOUT --- */
nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  width: 100%;
  max-width: 600px;
  min-width: 300px;
  height: 40px;
}

/* --- GRID LAYOUT --- */
#attendance ul {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  row-gap: 5px;
  column-gap: 10px;
}

/* --- COMBINATORS --- */
header > h1 { color: darkgreen; }
main section { box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
label + input { margin-left: 5px; }
h2 ~ div { padding-left: 10px; }

/* --- ATTRIBUTE SELECTOR & PSEUDO-CLASSES --- */
input[type="text"] { border: 1px solid gray; }
nav a:hover { color: orange; font-weight: bold; }
nav a:active { color: red; }

/* --- MODERN SELECTORS (2023) --- */
section:has(form) {
  border: 2px solid darkred;
}

#agenda {
  & h3 {
    color: purple;
  }
}

/* --- RESPONSIVENESS (MEDIA QUERY) --- */
@media (max-width: 600px) {
  #attendance ul {
    grid-template-columns: 1fr;
  }
  nav {
    flex-direction: column;
    height: auto;
  }
}

/* --- NEW STICKY ELEMENT --- */
section h2 {
  position: sticky;
  top: 0;
  background-color: rgb(250, 250, 250); /* Matches the body background so text doesn't overlap */
  padding-top: 10px;
  padding-bottom: 10px;
  z-index: 10;
}