/* Electrode Potential and Current: Moving Away from Equilibrium (CHM2001, Lectures 3-4; formerly The Fermi Level and Electrode Potential)
   Layout only - every colour comes from the model-shell palette at runtime, through inline styles
   and the --fle-* custom properties that the script sets on the model container. Same layout and
   slider style as current-and-charge.css (Faraday's law). */

.fle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.fle-layout > * {
  min-width: 0;
}

/* Elements with their own display value would otherwise ignore the hidden attribute. */
.fle-layout [hidden] {
  display: none !important;
}

.fle-stage {
  display: block;
  width: 100%;
  height: 470px;
}

/* The verdict sits directly above the picture it explains. */
.fle-verdict {
  min-height: 4.6rem;           /* about the same height whatever it says, so the page does not jump */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 0 0.5rem;
  padding: 0.5rem 0.8rem;
  text-align: center;
  border: 3px solid;
  border-radius: 10px;
}

.fle-verdict-main {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.2;
}

.fle-verdict-sub {
  display: block;
  font-size: 1.02rem;
  margin-top: 0.2rem;
  line-height: 1.45;
}

.fle-verdict-sub:empty {
  display: none;
}

/* The controls: one coloured strip directly under the picture. */
.fle-strip {
  margin: 0.4rem 0 0;
  padding: 0.6rem 0.8rem;
  border: 3px solid var(--fle-red, red);
  border-radius: 12px;
  background: var(--fle-bg, #fff);
}

.fle-strip-head {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  text-align: center;
  text-wrap: balance;
}

/* The numbers substituted into each equation, updated live. */
.fle-calc {
  margin-top: 0.6rem;
  padding: 0.5rem 0.8rem;
  border: 2px solid var(--fle-grid, #ccc);
  border-radius: 10px;
  font-size: 1.02rem;
}

.fle-calc:empty {
  display: none;
}

.fle-calc-row {
  display: grid;
  grid-template-columns: 7.4rem minmax(0, 1fr);
  gap: 0.3rem;
  margin: 0.15rem 0;
  line-height: 1.45;
}

.fle-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

.fle-tab {
  flex: 1 1 9rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 0.45rem 0.5rem;
  border: 2px solid;
  border-radius: 999px;
  cursor: pointer;
}

.fle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.fle-row--centre {
  justify-content: center;
}

.fle-strong {
  font-weight: 800;
}

.fle-go {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.55rem 0.8rem;
  font: inherit;
  font-weight: 800;
  border: 2px solid;
  border-radius: 999px;
  cursor: pointer;
}

.fle-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.3rem;
}

.fle-chips--centre {
  justify-content: center;
}

.fle-chip {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.3rem 0.7rem;
  border: 2px solid;
  border-radius: 999px;
  cursor: pointer;
}

/* Slider: a dark outlined track, filled up to the thumb, and a large white thumb with a dark ring. */
.fle-slider {
  display: grid;
  grid-template-columns: 8.4rem minmax(0, 1fr) 5.6rem;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}

.fle-slider label {
  font-weight: 800;
}

.fle-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --p: 50%;
}

.fle-slider input[type="range"]::-webkit-slider-runnable-track {
  box-sizing: border-box;
  height: 16px;
  border: 2px solid var(--fle-fg, #000);
  border-radius: 8px;
  /* as the lecture's potential axis: reduction faster to the left of E_eq, oxidation faster to the right */
  background: linear-gradient(to right, var(--fle-zl, #f3c4c4) 0 calc(50% - 1.5px), var(--fle-fg, #000) calc(50% - 1.5px) calc(50% + 1.5px), var(--fle-zr, #c4d6ee) calc(50% + 1.5px) 100%);
}

.fle-slider input[type="range"]::-moz-range-track {
  box-sizing: border-box;
  height: 16px;
  border: 2px solid var(--fle-fg, #000);
  border-radius: 8px;
  /* as the lecture's potential axis: reduction faster to the left of E_eq, oxidation faster to the right */
  background: linear-gradient(to right, var(--fle-zl, #f3c4c4) 0 calc(50% - 1.5px), var(--fle-fg, #000) calc(50% - 1.5px) calc(50% + 1.5px), var(--fle-zr, #c4d6ee) calc(50% + 1.5px) 100%);
}

.fle-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin-top: -6px;
  border: 4px solid var(--fle-fg, #000);
  border-radius: 50%;
  background: var(--fle-bg, #fff);
}

.fle-slider input[type="range"]::-moz-range-thumb {
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  border: 4px solid var(--fle-fg, #000);
  border-radius: 50%;
  background: var(--fle-bg, #fff);
}

.fle-slider input[type="range"]:focus-visible {
  outline: 3px solid var(--fle-fg, #000);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Under the slider: which side of E_eq is which */
.fle-zones {
  display: grid;
  grid-template-columns: 8.4rem minmax(0, 1fr) 5.6rem;
  gap: 0.5rem;
  margin: -0.35rem 0 0.4rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.fle-zones-row {
  display: flex;
  justify-content: space-between;
  gap: 0.3rem;
}

.fle-zone-red { color: var(--fle-rd, #c00); }
.fle-zone-ox { color: var(--fle-ox, #1565c0); }

.fle-val {
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.fle-small {
  margin: 0.5rem 0 0.1rem;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.4;
}

.fle-small--left {
  text-align: left;
}

/* The graph, opened with "Show the current", under the picture */
.fle-plotwrap {
  margin: 0.6rem 0 0;
}

.fle-plot {
  display: block;
  width: 100%;
  height: 280px;
}

.fle-notes {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  line-height: 1.45;
}

.fle-notes li {
  margin: 0.25rem 0;
}

/* Test your knowledge */
.fle-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.fle-progress {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.fle-dot {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: 2px solid;
  display: inline-grid;
  place-items: center;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0;
  cursor: pointer;
}

.fle-dot[aria-current="true"] {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.fle-score {
  font-weight: 800;
  font-size: 0.9rem;
}

.fle-task {
  margin: 0.6rem 0 0.2rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.fle-intro {
  margin: 0 0 0.6rem;
  line-height: 1.5;
}

.fle-step {
  margin-bottom: 0.4rem;
  padding: 0.35rem 0.5rem;
  border: 2px solid;
  border-radius: 8px;
}

.fle-step-q {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.fle-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.3rem;
}

.fle-options button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: 2px solid;
  border-radius: 8px;
  cursor: pointer;
}

.fle-feedback {
  margin: 0.6rem 0 0;
  min-height: 2.6em;
  line-height: 1.45;
}

@media (max-width: 820px) {
  .fle-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .fle-verdict-main {
    font-size: 1.2rem;
  }
}

@media (max-width: 560px) {
  .fle-slider {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "label value" "input input";
  }
  .fle-slider label { grid-area: label; }
  .fle-slider input { grid-area: input; }
  .fle-val { grid-area: value; }
  .fle-zones { grid-template-columns: minmax(0, 1fr); }
  .fle-zones > span:empty { display: none; }
  .fle-calc-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fle-tab,
  .fle-chip {
    transition: none;
  }
}


/* ---------------- Overpotential, live (right-hand column), as in the other CHM2001 models ---------------- */
.fle-live {
  margin: 0 0 0.6rem;
  padding: 0.55rem 0.7rem 0.6rem;
  border: 3px solid var(--fle-fg, #000);
  border-radius: 12px;
  background: var(--fle-bg, #fff);
}

.fle-live-title {
  margin: 0;
  font-weight: 800;
  font-size: 1.05rem;
}

.fle-live .fle-process {
  margin: 0.2rem 0 0.1rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.fle-eqtab {
  border-collapse: collapse;
  margin: 0.2rem auto 0.35rem;
}

.fle-eqtab td {
  padding: 0.05rem 0.25rem;
  text-align: center;
  white-space: nowrap;
}

.fle-eqtab .fle-sym td {
  font-size: 1.5rem;
  font-weight: 800;
}

.fle-eqtab .fle-num td {
  font-size: 1.08rem;
  font-weight: 700;
  border-top: 1px dashed var(--fle-grid, #bbb);
  padding-top: 0.2rem;
}

.fle-live .fle-calc {
  margin: 0;
  padding: 0.3rem 0 0;
  border: 0;
  border-top: 2px solid var(--fle-red, red);
  border-radius: 0;
  font-size: 0.98rem;
}

.fle-live .fle-calc-row {
  grid-template-columns: 5.4rem minmax(0, 1fr);
}

.fle-flash {
  background: #fff1a8;
  color: inherit;
  border-radius: 3px;
  box-shadow: 0 0 0 2px #e0b800;
}

.high-contrast .fle-flash {
  background: transparent;
  box-shadow: 0 0 0 2px currentColor;
}

.fle-so {
  margin: 0.4rem 0 0;
  padding: 0.35rem 0.55rem;
  border-left: 4px solid var(--fle-grid, #999);
  background: var(--fle-red-t, #f6f6f6);
  line-height: 1.45;
}

.fle-so:empty {
  display: none;
}

/* the Butler-Volmer preview: closed, quieter, clearly marked as later material */
.fle-preview {
  margin: 0.45rem 0 0;
  padding: 0.25rem 0.55rem;
  border: 2px dashed var(--fle-grid, #bbb);
  border-radius: 8px;
  font-size: 0.92rem;
}

.fle-preview > summary {
  cursor: pointer;
  font-style: italic;
  font-weight: 700;
}

.fle-preview p {
  margin: 0.35rem 0 0.15rem;
  line-height: 1.5;
}

/* text in drop-downs */
.fle-more {
  margin: 0.5rem 0 0;
  padding: 0.35rem 0.6rem;
  border: 2px solid var(--fle-grid, #ccc);
  border-radius: 10px;
}

.fle-more > summary {
  font-weight: 800;
  cursor: pointer;
}

.fle-more ul {
  margin: 0.35rem 0 0.2rem;
  padding-left: 1.1rem;
  line-height: 1.45;
}

.fle-more li {
  margin: 0.2rem 0;
}

.fle-more .fle-go {
  margin-top: 0.5rem;
}

/* [Zn2+] choice under the electrode choice */
.fle-conc-head {
  align-self: center;
  font-weight: 800;
  margin-right: 0.2rem;
}

.fle-strip [data-control="couples"] {
  margin-bottom: 0.35rem;
}
