/* Theme variables are reusable color names. var(--name) reads one of these values.
   These defaults preserve the light appearance when dark mode is not requested. */
:root {
  color-scheme: light; /* Tell the browser to use light built-in controls and scrollbars. */
  --page-background: #ffffff;
  --soft-background: #f4f4f4;
  --surface: #ffffff;
  --card-background: #f4fbfd;
  --text: #243746;
  --heading: #333333;
  --muted-text: #555555;
  --date-text: #666666;
  --header-background: #98d8e8;
  --blue-heading: #1b61d3;
  --accent-heading: #e30000;
  --border: #dddddd;
  --card-border: #98d8e8;
  --link: #174785;
  --button-background: #286bb0;
  --button-hover: #174785;
  --button-text: #ffffff;
  --button-shadow: #174785;
  --focus: #174785;
}

/* A media query checks the visitor's device/browser color preference.
   Only the color variables change; the existing layouts keep working. */
@media (prefers-color-scheme: dark) {
  :root:not(:has(input[name="theme-choice"]:checked:not([value="auto"]))) {
    color-scheme: dark; /* Match built-in browser controls to the dark page. */
    --page-background: #101b29;
    --soft-background: #101b29;
    --surface: #192b3d;
    --card-background: #192b3d;
    --text: #edf4fc;
    --heading: #edf4fc;
    --muted-text: #c2d1e2;
    --date-text: #c2d1e2;
    --header-background: #203e57;
    --blue-heading: #98d8e8;
    --accent-heading: #ff9292;
    --border: #48637e;
    --card-border: #48637e;
    --link: #98d8e8;
    --button-background: #98d8e8;
    --button-hover: #b9e8f2;
    --button-text: #101b29;
    --button-shadow: #48637e;
    --focus: #98d8e8;
  }
}

/* :has() lets the page respond to a checked radio button without JavaScript.
   Manual Dark uses the same palette as automatic dark mode.
   Manual Light keeps the light defaults because the system rule above is excluded. */
:root:has(input[name="theme-choice"][value="dark"]:checked) {
  color-scheme: dark; /* Match built-in browser controls to the dark page. */
  --page-background: #101b29;
  --soft-background: #101b29;
  --surface: #192b3d;
  --card-background: #192b3d;
  --text: #edf4fc;
  --heading: #edf4fc;
  --muted-text: #c2d1e2;
  --date-text: #c2d1e2;
  --header-background: #203e57;
  --blue-heading: #98d8e8;
  --accent-heading: #ff9292;
  --border: #48637e;
  --card-border: #48637e;
  --link: #98d8e8;
  --button-background: #98d8e8;
  --button-hover: #b9e8f2;
  --button-text: #101b29;
  --button-shadow: #48637e;
  --focus: #98d8e8;
}

/* Paint the whole browser canvas, including the space outside the centered body. */
html {
  background-color: var(--page-background);
  color: var(--text);
}

/* Fonts: reusable classes keep typography consistent across pages. */
.trispace-words {
  font-family: "Trispace", sans-serif;
  font-optical-sizing: auto;
  font-weight: 100;
  font-style: normal;
  font-variation-settings: "wdth" 100;
}

.reem-kufi-fun-title {
  font-family: "Reem Kufi Fun", sans-serif;
  font-optical-sizing: auto;
  font-style: normal;
}

.overpass-words {
  font-family: "Overpass", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

/* Include padding and borders in widths so elements fit small screens. */
*,
*::before,
*::after {
  box-sizing: border-box; /* Width includes padding and borders, instead of adding them outside it. */
}

body {
  min-height: 100vh; /* 100vh means the full height of the browser window. */
  display: flex; /* Flexbox arranges the direct children along a row or column. */
  flex-direction: column; /* Stack the flex items vertically instead of side by side. */
  max-width: 740px;
  margin: 30px auto;
  padding: 20px;
  text-align: center;
  overflow-wrap: anywhere; /* Allow long text, such as an email address, to break rather than overflow. */
}

main {
  flex: 1; /* Push the footer down when the page has little content. */
  min-width: 0; /* Allow this flex item to shrink below the width of its content. */
}

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

.header {
  font-family: "Reem Kufi Fun", sans-serif;
  background-color: var(--header-background);
  color: var(--blue-heading);
  padding: 20px;
  text-align: center;
  font-size: large;
  margin: 20px;
  border-radius: 500px;
}

/* Stack the home navigation buttons vertically on every screen size. */
.site-nav {
  display: flex; /* Flexbox arranges the direct children along a row or column. */
  flex-direction: column; /* Put each button below the previous one. */
  align-items: center; /* Center the buttons horizontally within this column. */
  gap: 12px;
  margin: 20px auto;
}

.sectionButtons {
  width: fit-content; /* Size the button around its content, within the available space. */
  max-width: 100%;
  margin: 10px auto;
  border-radius: 10px;
  background-color: var(--button-background);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  font-family: "Overpass", sans-serif;
  font-size: 16px;
}

/* Put padding on the link so the whole visible button is clickable. */
.sectionButtons a,
.homeButton a {
  display: flex; /* Flexbox arranges the direct children along a row or column. */
  align-items: center; /* Center items across the main direction (vertically in a row). */
  justify-content: center; /* Center flex items along the main direction (a row by default). */
  min-height: 44px;
  padding: 19px 29px;
  border-radius: inherit; /* Copy the rounded corners from the parent element. */
  color: var(--button-text);
  text-decoration: none;
  font-weight: bold;
}

.site-nav .sectionButtons {
  width: 280px; /* Give the vertical buttons a consistent width. */
  max-width: 100%; /* Keep them inside the page on small phones. */
  margin: 0;
  border-radius: 50px;
}

/* :focus-visible selects a focused link when the browser should show a focus indicator,
   such as when someone navigates with the Tab key. */
.sectionButtons a:focus-visible,
.homeButton a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px; /* Leave 3 pixels between the element and its focus outline. */
}

/* :hover applies while a pointer rests over the link. */
.sectionButtons a:hover,
.homeButton a:hover {
  background-color: var(--button-hover);
}

.homeButton {
  text-align: center;
  margin: 25px auto 40px;
  border-radius: 5px;
  background-color: var(--button-background);
}

/* A shadow below each button makes it look raised before it is pressed.
   The body prefix lets these rules also override the resume's local shadow. */
body .sectionButtons,
body .homeButton,
body .resume-btn,
body #dark-mode-btn {
  box-shadow: 0 4px 0 var(--button-shadow); /* Shadow values: horizontal offset, vertical offset, blur, then color. */
  transition: transform 100ms ease, box-shadow 100ms ease; /* Animate these two properties for 0.1 seconds; ease softens the start and finish. */
}

/* :active lasts while the button is held down.
   :has(a:active) selects a container that contains a link being pressed.
   Moving down 3px and shrinking the shadow by 3px creates a pressed effect
   without moving the surrounding text or cards. */
body .sectionButtons:has(a:active),
body .homeButton:has(a:active),
body .resume-btn:active,
body #dark-mode-btn:active {
  transform: translateY(3px); /* Visually move down 3 pixels without shifting neighboring elements. */
  box-shadow: 0 1px 0 var(--button-shadow); /* A smaller shadow makes the button look closer to the page. */
}

/* Respect reduced-motion preferences: change the shadow without movement. */
@media (prefers-reduced-motion: reduce) { /* Only apply these rules when the visitor requests less motion. */
  body .sectionButtons,
  body .homeButton,
  body .resume-btn,
  body #dark-mode-btn {
    transition: none; /* Apply the new appearance immediately, without animation. */
  }

  body .sectionButtons:has(a:active),
  body .homeButton:has(a:active),
  body .resume-btn:active,
  body #dark-mode-btn:active {
    transform: none; /* Keep the button in its original position. */
  }
}

.introBlurb {
  text-align: center;
  font-size: 20px;
  margin: 20px;
}

.site-footer {
  text-align: center;
  padding: 20px;
  margin-top: 40px;
}

/* Lab cards: two equal columns on larger screens, with space between cards. */
.lab-cards {
  display: grid; /* CSS Grid arranges direct children into rows and columns. */
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* Two equal columns: repeat makes 2; minmax allows shrinking to 0; 1fr shares the space equally. */
  gap: 20px; /* Space between grid or flex items, without adding outer margins. */
  margin-top: 24px;
}

.lab-card {
  display: flex; /* Flexbox arranges the direct children along a row or column. */
  flex-direction: column; /* Stack the flex items vertically instead of side by side. */
  padding: 24px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background-color: var(--card-background);
  color: var(--text);
  text-align: left;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.lab-card h2 {
  margin: 0 0 12px;
  color: var(--blue-heading);
  font-family: "Reem Kufi Fun", sans-serif;
  font-size: 1.3rem; /* rem measures size relative to the root (html) font size. */
}

.lab-card p {
  margin: 0 0 20px;
  line-height: 1.6; /* Each line is 1.6 times the text size, adding room between lines. */
}

/* Keep buttons at the bottom, even when descriptions have different lengths. */
.lab-card .sectionButtons {
  margin: auto 0 0; /* The automatic top margin uses spare vertical space, pushing this button down. */
  background-color: var(--button-background);
}

.weather-card {
  max-width: 320px;
  padding: 16px;
  margin: 20px auto;
  border: 1px solid #98d8e8;
  border-radius: 16px;
  background-color: #f4fbfd;
  color: #243746;
  font-family: "Overpass", sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.weather-card h3 {
  margin: 0 0 8px;
  color: #1b61d3;
  font-family: "Reem Kufi Fun", sans-serif;
  font-size: 1.1rem;
}

.weather-card p {
  margin: 0;
  line-height: 1.6;
}

/* Home page contact section: reuse the site's blue palette and rounded cards. */
.contact-section {
  margin-top: clamp(72px, 10vw, 120px); /* Separate contact details from navigation, with more space on larger screens. */
  padding: 28px;
  border: 1px solid var(--card-border);
  border-top: 5px solid var(--card-border);
  border-radius: 16px;
  background-color: var(--card-background);
  color: var(--text);
  text-align: center; /* Center the heading, description, and contact text. */
  line-height: 1.6; /* Each line is 1.6 times the text size, adding room between lines. */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.contact-section h2 {
  margin: 0 0 8px;
  font-family: "Reem Kufi Fun", sans-serif;
  font-size: 1.6rem;
  color: var(--blue-heading);
}

.contact-intro {
  margin: 0 0 24px;
}

/* Show email and location side by side; remove address's default italics. */
.contact-details {
  display: grid; /* CSS Grid arranges direct children into rows and columns. */
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* Two equal columns: repeat makes 2; minmax allows shrinking to 0; 1fr shares the space equally. */
  gap: 20px; /* Space between grid or flex items, without adding outer margins. */
  font-style: normal;
}

.contact-label {
  display: block;
  margin-bottom: 4px;
  font-weight: bold;
}

.contact-details a,
.contact-card-link {
  display: inline-flex; /* Use flex alignment inside a link that participates in inline layout. */
  align-items: center; /* Center items across the main direction (vertically in a row). */
  min-height: 44px; /* Leave enough room to tap the text links on a phone. */
  color: var(--link);
  text-underline-offset: 4px; /* Place the underline 4 pixels below the text. */
}

.contact-details a:hover,
.contact-card-link:hover {
  text-decoration-thickness: 2px;
}

.contact-details a:focus-visible,
.contact-card-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px; /* Leave 3 pixels between the element and its focus outline. */
  border-radius: 3px;
}

/* Reuse the existing button styles, including the pressed-down effect. */
.contact-actions {
  display: flex; /* Flexbox arranges the direct children along a row or column. */
  justify-content: center; /* Center the button and contact-card link as a group. */
  flex-wrap: wrap; /* Move flex items onto another line when they run out of room. */
  align-items: center; /* Center items across the main direction (vertically in a row). */
  gap: 16px;
  margin-top: 24px;
}

.contact-actions .sectionButtons {
  width: fit-content; /* Keep Email Me compact instead of stretching across the contact card. */
  margin: 0;
  background-color: var(--button-background);
}

.contact-actions .sectionButtons a {
  padding: 10px 20px; /* Reduce the button's bulk while keeping a 44px minimum tap height. */
}

body .contact-actions .sectionButtons {
  box-shadow: 0 2px 0 var(--button-shadow); /* A lighter raised edge for this smaller button. */
}

body .contact-actions .sectionButtons:has(a:active) {
  box-shadow: none; /* Flatten the small shadow while pressed. */
}

.contact-actions .sectionButtons a:focus-visible {
  outline-width: 2px;
  outline-offset: 2px; /* Keep the keyboard focus ring close to the button. */
}

/* At 600px and below, stack navigation and leave more room for content. */
@media (max-width: 600px) { /* A media query: these rules apply only at viewport widths of 600px or less. */
  body {
    padding: 12px;
  }

  /* Stack the contact details and links so they fit narrow screens. */
  .contact-section {
    padding: 20px;
  }

  .contact-details {
    grid-template-columns: 1fr; /* One column takes all available width, so items stack. */
  }

  .contact-actions {
    flex-direction: column; /* Stack the flex items vertically instead of side by side. */
    align-items: center; /* Keep the stacked button and link horizontally centered on phones. */
  }

  /* One card per row makes the lab descriptions easy to read on phones. */
  .lab-cards {
    grid-template-columns: 1fr; /* One column takes all available width, so items stack. */
  }

  .lab-card {
    padding: 20px;
  }

  .site-nav {
    flex-direction: column; /* Stack the flex items vertically instead of side by side. */
    gap: 10px;
  }

  .sectionButtons {
    width: 100%;
  }

  .header {
    margin: 12px 0;
    padding: 16px;
    border-radius: 24px;
  }

  .header h1 {
    font-size: 1.6rem;
  }

  .introBlurb {
    margin: 16px 0;
    font-size: 18px;
  }

  .site-footer {
    padding: 12px 0;
    margin-top: 24px;
  }
}

/* A fieldset groups related choices; visible radio buttons support keyboard use. */
.theme-picker {
  align-self: center;
  display: flex;
  flex-wrap: wrap; /* Let the options wrap instead of overflowing a narrow screen. */
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  margin: 12px auto;
  padding: 8px 12px 12px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background-color: var(--card-background);
  color: var(--text);
  font-family: "Overpass", sans-serif;
}

.theme-picker legend {
  padding: 0 6px;
  font-weight: bold;
}

.theme-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px; /* Make the whole label comfortable to tap. */
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.theme-picker input {
  margin: 0;
  accent-color: var(--link); /* Match the native radio button to the current palette. */
}

.theme-picker label:has(input:checked) {
  background-color: var(--header-background);
  font-weight: bold;
}

.theme-picker label:has(input:focus-visible) {
  outline: 3px solid var(--focus); /* Show which option is focused when using the keyboard. */
  outline-offset: 2px;
}
.hidden 
{
  display: none;
}
.trigger 
{
  cursor: pointer;
}
