:root {
  --topbar-blue: #094981;
  --subbar-blue: #195e99; /* slightly darker */
  --topbar-height: 4.5rem; /* explicit topbar height */
  --subbar-height: 2.8rem; /* explicit subbar height */
}

/* styles.css — basic styling for Ellie's webpage */

/* Page layout */
html, body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0; /* use padding instead so border sits flush at the top */
  padding: 2rem;
  min-height: 100vh; 
  display: flex;
  flex-direction: column;
  align-items: center; /* horizontal centering */
  justify-content: flex-start; /* content should start below the fixed header */
  background-color: #ffffff; /* clean white */
  /* subtle decorative accents: very faint, widely spaced radial highlights */
  background-image:
    radial-gradient(circle at 8% 12%, rgba(30,111,184,0.02) 0%, rgba(30,111,184,0.018) 6%, transparent 35%),
    radial-gradient(circle at 92% 88%, rgba(25,94,153,0.015) 0%, rgba(25,94,153,0.013) 8%, transparent 40%);
  background-size: 520px 520px, 680px 680px;
  background-position: left top, right bottom;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed;
  color: #222;
  /* remove earlier top border — we'll use a dedicated header bar */
  border-top: none;
  box-sizing: border-box;
}

/* Top bar header */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%; /* cover the full viewport width */
  height: var(--topbar-height);
  background: var(--topbar-blue); /* blue color */
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  box-shadow: 0 6px 20px rgba(11,35,60,0.12); /* stronger shadow so the bar stands out on white */
}

.topbar h1 {
  color: #ffffff;
  margin: 0;
  font-size: 1.25rem;
  text-align: center;
}

/* keep the topbar heading link visually consistent */
.topbar a {
  color: inherit;
  text-decoration: none;
  display: inline-block;
}

/* Sub navigation bar directly under the top bar */
.subbar {
  position: fixed;
  top: var(--topbar-height); /* sit directly under the topbar */
  left: 0;
  right: 0;
  width: 100%;
  height: var(--subbar-height);
  background: var(--subbar-blue);
  display: flex;
  justify-content: space-around; /* equally spaced */
  align-items: center;
  padding: 0 1rem; /* horizontal padding only */
  box-sizing: border-box;
  z-index: 900;
  box-shadow: 0 4px 12px rgba(11,35,60,0.08);
}

.subbar a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  text-transform: capitalize;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  /* push content below both fixed bars */
  padding-top: calc(var(--topbar-height) + var(--subbar-height) + 1rem);
}

/* Image gallery */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
  width: 100%;
  max-width: 1000px;
}

.gallery-top .photo.top {
  width: 60%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.gallery-row {
  display: flex;
  gap: 1.5rem; /* equal distance between the two images */
  width: 100%;
  justify-content: center;
}

.gallery-row .photo {
  width: clamp(160px, 40%, 420px);
  height: auto;
  border-radius: 8px;
}

/* Utility: explicitly size an image at half the container width while preserving aspect ratio */
.photo.half {
  width: 30%;
  height: auto;
  display: block;
  margin: 0.75rem auto; /* center when used standalone */
}

/* Figure sizing: use for academic figures that should appear the same size
   regardless of their intrinsic image dimensions. Responsive: fixed width on
   larger screens, scale down on small screens. */
.figure-photo {
  width: 250px;        /* target display width for figures */
  max-width: 50%;      /* never overflow small screens */
  height: auto;        /* preserve aspect ratio */
  display: block;
  margin: 1rem auto;   /* centered and spaced */
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@media (max-width: 640px) {
  .figure-photo { width: 90%; }
}

/* Utility to center main content both vertically and horizontally
   while accounting for the fixed topbar and subbar. Use by wrapping
   the main page text in a <div class="main-center"> ... </div>. */
.main-center {
  display: flex;
  flex-direction: column;
  align-items: center;    /* horizontal centering */
  justify-content: center;/* vertical centering */
  text-align: center;     /* center text inside */
  min-height: calc(100vh - var(--topbar-height) - var(--subbar-height) - 2rem);
  width: 100%;
  box-sizing: border-box;
  padding: 1rem; /* small breathing room */
  font-family: inherit; /* ensure same font as body */
}

/* Centered button list for project navigation/source links */
.center-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem;
}

.btn {
  background: var(--topbar-blue);
  color: #ffffff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  display: inline-block;
  min-width: 220px;
  text-align: center;
  transition: transform 120ms ease, background 120ms ease;
}

.btn:hover,
.btn:focus {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--topbar-blue) 85%, black 15%);
}

@media (max-width: 480px) {
  .btn { min-width: 160px; padding: 0.5rem 0.75rem; }
}

/* Specific smaller size for the chain rule example image */
.chain-photo {
  width: 520px; /* bigger default on most screens */
  max-width: 95%;
  height: auto;
  display: block;
  margin: 1.25rem auto;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

@media (min-width: 900px) {
  .chain-photo { width: 720px; }
}

@media (max-width: 420px) {
  .chain-photo { width: 90%; }
}

@media (max-width: 640px) {
  .gallery-top .photo.top { width: 90%; }
  .gallery-row { flex-direction: column; gap: 1rem; }
  .gallery-row .photo { width: 90%; }
}

/* Applet iframe sizing: match the Sine applet and scale responsively */
.applet {
  width: 100%;
  max-width: 1250px; /* slightly larger to make applets a bit bigger */
  aspect-ratio: 1040 / 555; /* preserve original aspect ratio while scaling */
  height: auto;
  display: block;
  margin: 1.25rem auto;
  border: 0;
  box-shadow: 0 6px 20px rgba(11,35,60,0.12);
}

/* wrapper to guarantee horizontal centering regardless of surrounding layout */
.applet-wrap {
  width: 130%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Larger, centered variant for the Polar/Rectangular applet */
.polar-applet {
  /* make the polar iframe fill its wrapper and preserve ratio */
  width: 130%;
  max-width: none;
  aspect-ratio: 791 / 479; /* original polar aspect ratio */
  margin: 0; /* spacing handled by wrapper */
  box-shadow: 0 10px 34px rgba(11,35,60,0.16);
}

/* polar-specific wrapper to allow the iframe to span full content width */
.applet-wrap.polar-wrap {
  width: 130%;
  max-width: 1200px; /* let it expand to the content width (adjust if needed) */
  padding: 1rem 0; /* vertical spacing */
}

/* Questions block for applets: keep question text aligned and same width as the applet wrapper */
.applet-questions {
  max-width: 1200px;
  margin: 0.75rem auto 2rem auto;
  padding: 0.5rem 1rem;
  text-align: left;
  color: #222;
}


/* Headings & text */
h1 {
  color: #2c3e50;
  font-size: 2rem;
  margin: 0 0 0.5rem 0;
  text-align: center;
}

p {
  color: #444;
  line-height: 1.6;
  text-align: center;
  /* allow text to go farther across the page on wide screens, but stay readable and centered */
  max-width: min(90ch, 90%);
  width: 100%;
  margin: 0 auto;
}

/* Small responsive tweak */
@media (max-width: 480px) {
  body { margin: 1rem; }
  h1 { font-size: 1.5rem; }
}

.subbar a.links {
  color: #ffffff; /* white so it shows on the blue subbar */
  text-decoration: none;
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: background-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.subbar a.links:hover,
.subbar a.links:focus,
.subbar a.links:focus-visible {
  background: rgba(255,255,255,0.08);
  outline: none;
  transform: translateY(-1px);
}

.subbar a.links.active,
.subbar a.links[aria-current="page"] {
  background: rgba(255,255,255,0.18);
  font-weight: 700;
}

.flex-container{
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 1rem;
}

.flexydivs{
border: solid;
border-color: darkblue;
border-width: 2px;

}

#item1{
  height: 50px;
  width: 50px;
}

.container{
  display: grid;

}

.griddivs{
  color:black; 
  background-color: blueviolet;
}

#itemg1{
  background-color: lightsalmon;
}

/* Assignments table styling */
.assignments { width: 100%; max-width: 1200px; margin: 0 auto; }
.assign-table { width: 100%; border-collapse: collapse; margin-top: 1rem; table-layout: fixed; }
.assign-table th, .assign-table td { border: 1px solid rgba(0,0,0,0.08); padding: 0.6rem 0.8rem; text-align: left; }
.assign-table thead th { background: rgba(25,94,153,0.06); }
.assign-table thead th:first-child { width: 70%; }
.assign-table thead th:last-child { width: 30%; }
@media (max-width: 520px) {
  .assign-table thead { display: none; }
  .assign-table, .assign-table tbody, .assign-table tr, .assign-table td { display: block; width: 100%; }
  .assign-table tr { margin-bottom: 0.75rem; border-bottom: 1px solid rgba(0,0,0,0.06); }
  .assign-table td { padding-left: 50%; position: relative; }
  .assign-table td::before { position: absolute; left: 0; width: 45%; padding-left: 0.8rem; white-space: nowrap; font-weight: 600; }
  .assign-table td:nth-of-type(1)::before { content: "Assignment"; }
  .assign-table td:nth-of-type(2)::before { content: "Due Date"; }
}

/* Specific table column sizing */
.collection-table thead th:first-child { width: 45%; }
.collection-table thead th:last-child { width: 55%; }
.applets-table thead th:first-child { width: 45%; }
.applets-table thead th:last-child { width: 55%; }
.resources-table thead th:nth-child(1) { width: 30%; }
.resources-table thead th:nth-child(2) { width: 15%; }
.resources-table thead th:nth-child(3) { width: 55%; }

/* Mobile labels for the new tables */
@media (max-width: 520px) {
  .collection-table td:nth-of-type(1)::before { content: "Collection"; }
  .collection-table td:nth-of-type(2)::before { content: "Notes"; }

  .applets-table td:nth-of-type(1)::before { content: "Applet"; }
  .applets-table td:nth-of-type(2)::before { content: "Description"; }

  .resources-table td:nth-of-type(1)::before { content: "Name"; }
  .resources-table td:nth-of-type(2)::before { content: "Type"; }
  .resources-table td:nth-of-type(3)::before { content: "Link"; }
}

/* Sources list styling: unnumbered list with link on the line below the citation */
.resources-list {
  list-style: none;
  padding: 0;
  margin: 0 auto 2rem auto;
  max-width: 860px;
}
.resources-list li {
  margin-bottom: 1.25rem;
}
.resources-list p { margin: 0; }
.resources-list .source-link a {
  display: inline-block; /* appears on its own line because wrapped in its own <p> */
  margin-top: 0.35rem;
  color: #094981; /* use the topbar blue for links */
  text-decoration: underline;
}
