body {
  font-family: sans-serif;
  margin: 0;
  padding: 1em;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #f0e8dc;
}
img.logo {
  max-width: 280px;
  width: 100%;
  margin: 0 auto;
  background: radial-gradient(circle,rgba(255, 255, 255, 1) 20%, rgba(255, 255, 255, 0) 60%);
}

.container {
  display: grid;
  grid-template-columns: 1fr; 
  gap: 2rem;
  width: 100%;
  max-width: 900px;
  padding: 1em;
  margin: 0;
}

p.intro {
  text-wrap: balance;
  margin: 0 auto;
  width: 100%;
  max-width: 800px;
  position: relative;
  display: block;
  text-align: center;
  margin: 1.5em 0;
}
  p.footnote {
      font-size: 0.8em;
  }

@media (min-width: 768px) {
  .container {
    grid-template-columns: 250px 1fr;
  }
}

.viewing-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
img#base {
  outline: 5px solid #fff; 
  border-radius: 1em; 
  z-index: 10;
  box-shadow: 0px 15px 10px rgba(0,0,0,0.4);
}

#pizza-area, #crust-wrapper {
  position: relative;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

.topping {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 10;
}
button {
  padding: 0.5em;
  margin: 1.5em auto 1.5em auto;
  font-size: 0.9em;
  border-radius: 0.5em;
  border: 2px solid #fff;
  background-color: #ffa500;
  color: #000;
  box-shadow: 2px 3px 3px rgba(0,0,0,0.25);
  font-weight: bold;
  text-transform: uppercase;
  background: linear-gradient(0deg,rgba(255, 165, 0, 1) 0%, rgba(255, 225, 168, 1) 50%, rgba(255, 165, 0, 1) 100%);
}
button:hover {
  border: 2px solid orange;
  background-color: #fff;
  background: linear-gradient(0deg, rgba(255, 255, 255, 1) 0%, rgba(255, 165, 0, 1) 50%, rgba(255, 255, 255, 1) 100%);
}
h2, legend {
  padding: 0.25em 0.35em;
  text-align: center;
  border: 2px solid orange;
  border-radius: 0.25em;
  font-size: 1.3em; /* Ensure legend matches h2 style */
  font-weight: bold; /* Ensure legend matches h2 style */
  margin-bottom: 0.5em;
  background-color: #fff;
  box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
}
fieldset {
  border: 2px solid orange;
  border-radius: 0.5em;
  padding: 0.5em 1.5em 1.5em;
  background-color: #fff;
  container-type: inline-size;
}
p#nutrient-label {
  padding: 0 2em 1em 0;
  font-weight: bold;
}
div.nutrient-menu {
  display: flex;
}
.visible {
  display: block;
}

#crust-wrapper {
  background-image: url('../img/crust_base.png');
  background-size: cover;
  background-position: center;
  display: none;
}

#pie-chart {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.caption {
  text-align: center;
  margin: 0.25em 0;
}
p#nutrient-caption-rda {font-weight: bold;}

text {
  font-weight: bold;
  font-size: 1.5em;
  fill: white;
  text-shadow: 0px 0px 3px #000, 0px 0px 5px #000, 0px 0px 6px #000;
}
g path {
  stroke: #e5d6bf;
  stroke-width: 2px;
}

#toppings-list label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 5px 0;
  margin: 0 0 0.25em;
}

#toppings-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0px;
  }

  @container (min-width: 300px) {
    #toppings-list {
      grid-template-columns: 1fr 1fr;
    }
  }

  .checkbox-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
  }

  .checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }

  .custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #555;
    border-radius: 3px;
    margin-right: 8px;
    position: relative;
  }

  .checkbox-wrapper input[type="checkbox"]:checked + .custom-checkbox::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 12px;
    border: solid #0a0;
    border-width: 0 4px 4px 0;
    transform: rotate(45deg);
  }

body select#nutrient-select {
  font-size: 1.2rem;
  background-color: #fff;
  border: 1px solid orange;
  margin-bottom: 1em;
  padding: 0 0.5em;
}
div.caption-wrapper {
  padding: 0 1em 0.5em;
  border: 1px solid #000;
  border-top: none;
  box-shadow: 0px 5px 5px rgba(0,0,0,0.3);
  top: -0.5em;
  position: relative;
  z-index: 1;
}

/* --- Accessibility Styles --- */

/* Add a clear focus indicator for keyboard users */
:is(button, input, select):focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

/* Hides elements visually but keeps them accessible to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 480px) {
  .main-view, .controls-column {
    width: 100%;
    align-items: center;
  }
}