/* ==========================================
   TDT Exposure Time Calculator — Styles
   Colours, type and the header/footer follow the TDT website
   (TDTelescope/assets/css/main.css, "2026 refresh" section).
   ========================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* TDT website palette (contrast checked against WCAG 2.1 AA) */
  --navy: #0b1021;
  --navy-deep: #070b18;
  --navy-light: #1a2346;
  --ink: #1d2433;
  --text: #3d4555;
  --muted: #5b6475;
  --line: #e3e6ee;
  --line-strong: #cfd5e2;
  --surface: #f5f6fa;
  --accent: #c2410c;          /* buttons, sliders, active states */
  --accent-dark: #9a3412;
  --accent-tint: #fff7ed;
  --link: #b34700;            /* text links on white */
  --on-navy: #d5dae6;
  --on-navy-accent: #ffb27a;  /* accents and links on navy */
  /* Work-area colours from the organigram */
  --telescope: #1d4ed8;
  --science: #c2410c;
  --instrument: #6d28d9;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(11, 16, 33, 0.05);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  background: var(--navy-deep);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#page-wrapper {
  background: #fff;
}

/* --- Layout width matches the website's .container at every breakpoint --- */
.container,
.app-container {
  width: 1179px;
  max-width: 100%;
  margin: 0 auto;
}

@media (min-width: 1681px) {
  .container,
  .app-container { width: 1493px; }
}

@media (max-width: 1280px) {
  .container,
  .app-container { width: calc(100% - 80px); }
}

@media (max-width: 980px) {
  .container,
  .app-container { width: calc(100% - 40px); }
}

.app-container {
  padding: 0 0 4.5rem;
}

/* --- Accessibility helpers --- */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -160px;
  z-index: 20000;
  background: #fff;
  color: var(--navy);
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

:focus-visible {
  outline: 3px solid var(--link) !important;
  outline-offset: 2px;
}

#header :focus-visible,
#footer :focus-visible,
.result-primary :focus-visible,
.cookie-banner :focus-visible {
  outline-color: var(--on-navy-accent) !important;
}

#main:focus {
  outline: 0;
}

/* ==========================================
   Website header and footer
   Sizes are in px so they match the website, whose root font size differs.
   ========================================== */

#header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#header > .container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16.8px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand img {
  height: 41.6px;
  width: auto;
}

#nav > ul {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

#nav > ul > li {
  position: relative;
}

#nav > ul > li.nav-home {
  display: none;
}

#nav > ul > li > a {
  display: block;
  color: var(--on-navy);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 9.6px 12.8px;
  border-radius: 6px;
}

#nav > ul > li > a:hover,
#nav > ul > li:hover > a {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

#nav > ul > li.active > a {
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--on-navy-accent);
  border-radius: 6px 6px 0 0;
}

#nav > ul > li:has(> ul) > a::after {
  content: '';
  display: inline-block;
  margin-left: 0.45em;
  border: 4px solid transparent;
  border-top-color: currentColor;
  border-bottom: 0;
  vertical-align: middle;
}

#nav > ul > li.nav-cta > a {
  background: var(--accent);
  color: #fff;
  margin-left: 8px;
  padding: 9.6px 17.6px;
}

#nav > ul > li.nav-cta > a:hover {
  background: var(--accent-dark);
}

/* Sub-menus open on hover and on keyboard focus (the website uses a jQuery plugin instead). */
#nav > ul > li > ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  margin-top: 6px;
  padding: 8px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(11, 16, 33, 0.18);
}

#nav > ul > li > ul::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 8px;
}

#nav > ul > li:hover > ul,
#nav > ul > li:focus-within > ul {
  display: block;
}

#nav > ul > li > ul a {
  display: block;
  padding: 7px 18px;
  color: var(--ink);
  font-size: 14.4px;
  text-decoration: none;
}

#nav > ul > li > ul a:hover {
  color: var(--link);
  background: var(--surface);
}

.nav-toggle {
  display: none;
}

/* Between the mobile breakpoint and wide screens, keep the full menu by showing only the
   logo mark; the name stays available to screen readers. */
@media (min-width: 981px) and (max-width: 1280px) {
  .brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  #nav > ul > li > a {
    padding-left: 10.4px;
    padding-right: 10.4px;
  }
}

@media (max-width: 980px) {

  #header > .container {
    min-height: 64px;
  }

  .nav-toggle:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    padding: 6px 12px;
    font: 600 12.8px/1.4 var(--font-sans);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .nav-toggle::before {
    content: '';
    width: 14px;
    height: 10px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
  }

  #nav {
    display: none;
    position: absolute;
    top: 100%;
    left: -20px;
    right: -20px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 8px 20px 20px;
    background: var(--navy);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  }

  body.nav-open #nav {
    display: block;
  }

  #nav > ul {
    display: block;
  }

  #nav > ul > li.nav-home {
    display: block;
  }

  #nav > ul > li > a,
  #nav > ul > li.nav-cta > a {
    margin: 0;
    padding: 12px 0;
    background: none;
    border-radius: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 14px;
  }

  #nav > ul > li.active > a {
    box-shadow: none;
  }

  #nav > ul > li:has(> ul) > a::after {
    display: none;
  }

  #nav > ul > li > ul,
  #nav > ul > li:hover > ul,
  #nav > ul > li:focus-within > ul {
    display: block;
    position: static;
    min-width: 0;
    margin: 0 0 8px;
    padding: 0 0 0 16px;
    background: none;
    border: 0;
    box-shadow: none;
  }

  #nav > ul > li > ul a {
    padding: 8px 0;
    color: var(--on-navy);
  }

  #nav > ul > li > ul a:hover {
    color: #fff;
    background: none;
  }

}

@media (max-width: 480px) {

  .brand {
    font-size: 14.4px;
    white-space: normal;
    line-height: 1.25;
    min-width: 0;
  }

  .brand img {
    height: 32px;
  }

  .nav-toggle {
    flex-shrink: 0;
  }

}

/* Footer */

#footer {
  background: var(--navy-deep);
  color: #c3c9d6;
  padding: 72px 0 40px;
  font-size: 16px;
  line-height: 1.7;
  font-variant-numeric: normal;
}

#footer h2 {
  color: #fff;
  font-family: var(--font-serif);
  font-size: 20.8px;
  font-weight: 700;
  margin: 0 0 20px;
}

#footer p {
  margin: 0 0 1.25em;
}

#footer a {
  color: var(--on-navy-accent);
  text-decoration: underline;
  text-decoration-color: rgba(255, 178, 122, 0.5);
  text-underline-offset: 0.18em;
}

#footer a:hover {
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px 64px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.form-grid .form-full {
  grid-column: 1 / -1;
}

#footer label {
  display: block;
  margin: 0 0 6px;
  color: #e6e9f0;
  font-size: 13.6px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#footer input,
#footer textarea {
  display: block;
  width: 100%;
  padding: 0.75em 1em;
  background: #121a33;
  border: 1px solid #5b6788;
  border-radius: 6px;
  color: #fff;
  font: inherit;
  line-height: 1.25;
  -webkit-appearance: none;
  appearance: none;
}

#footer input:focus,
#footer textarea:focus {
  background: #172042;
  border-color: var(--on-navy-accent);
}

.button {
  display: inline-block;
  padding: 0.8em 1.6em;
  background: var(--accent);
  color: #fff;
  border: 2px solid transparent;
  border-radius: 8px;
  font: 600 15.2px/1.4 var(--font-sans);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-dark);
}

.footer-about img {
  height: 48px;
  width: auto;
  margin-bottom: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  list-style: none;
}

#copyright {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #9aa3b5;
  font-size: 0.9em;
  text-align: center;
}

#copyright .links {
  list-style: none;
}

#copyright .links li {
  display: inline;
  margin-left: 1em;
  padding-left: 1em;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

#copyright .links li:first-child {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}

#copyright a {
  color: #c3c9d6;
}

.link-button {
  display: inline;
  padding: 0;
  background: none;
  border: 0;
  color: #c3c9d6;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.link-button:hover {
  color: #fff;
}

@media (max-width: 980px) {
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 736px) {
  #copyright .links li {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
  }
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* Cookie consent banner (built by ../assets/js/analytics.js) */

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 10003;
  display: flex;
  align-items: center;
  gap: 24px;
  width: 896px;
  max-width: calc(100% - 32px);
  padding: 20px 24px;
  background: #131a33;
  color: #e6e9f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  font-size: 15px;
}

.cookie-banner[hidden],
body.nav-open .cookie-banner {
  display: none;
}

.cookie-banner p {
  line-height: 1.6;
}

.cookie-banner a {
  color: var(--on-navy-accent);
}

.cookie-banner-actions {
  display: flex;
  flex-shrink: 0;
  gap: 12px;
}

/* Reject and Accept are deliberately given equal weight. */
.cookie-banner-actions .button.alt {
  min-width: 8em;
  background: #fff;
  color: var(--navy);
}

.cookie-banner-actions .button.alt:hover {
  background: var(--line);
}

@media (max-width: 736px) {
  .cookie-banner {
    left: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    border-radius: 0;
  }

  .cookie-banner-actions .button.alt {
    flex: 1;
    min-width: 0;
  }
}

/* ==========================================
   Calculator
   ========================================== */

/* --- Page header --- */
.page-header {
  padding: 56px 0 36px;
}

.page-header h1 {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(32px, 3.6vw, 46px);
  line-height: 1.15;
  color: var(--navy);
}

.page-header .lead {
  max-width: 46rem;
  margin-top: 16px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.page-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.page-meta a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: rgba(179, 71, 0, 0.45);
  text-underline-offset: 0.18em;
}

.page-meta a:hover {
  text-decoration-color: currentColor;
}

/* --- Solve-for tabs --- */
.solve-section {
  margin-bottom: 1.5rem;
}

.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.solve-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.solve-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.solve-tab:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.solve-tab.active {
  background: var(--accent-tint);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--ink);
}

.tab-icon {
  display: inline-flex;
  color: var(--muted);
}

.solve-tab.active .tab-icon {
  color: var(--accent);
}

.tab-label {
  font-weight: 600;
}

/* --- Panels grid --- */
.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .panels-grid { grid-template-columns: 1fr; }
}

/* --- Panel shared --- */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}

.panel-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-body {
  padding: 1.2rem;
  transition: max-height 0.4s ease, opacity 0.3s, padding 0.3s;
  max-height: 2000px;
  overflow: hidden;
}

.panel-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  visibility: hidden;
}

/* --- Input groups --- */
.input-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 1rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.input-group-header:first-child {
  margin-top: 0;
}

.group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-telescope { background: var(--telescope); }
.dot-observation { background: var(--science); }
.dot-spectrograph { background: var(--instrument); }

/* --- Input rows --- */
.input-row {
  margin-bottom: 0.85rem;
  transition: opacity 0.3s;
}

/* The quantity being solved for: its inputs are disabled by etc.js and faded here,
   while its "Calculated" tag stays at full strength. */
.input-row.disabled .input-control,
.input-row.disabled .var-symbol,
.input-row.disabled .unit-badge {
  opacity: 0.5;
}

.input-row.disabled .input-label {
  color: var(--muted);
}

.calc-tag {
  margin-left: auto;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.input-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.var-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.4rem;
  padding: 0 0.3rem;
  background: #eef1f7;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--navy);
}

.unit-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.2rem;
}

.input-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- Range slider --- */
.slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  border: 0;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--accent), 0 1px 3px rgba(11, 16, 33, 0.25);
  transition: transform 0.15s;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--accent), 0 1px 3px rgba(11, 16, 33, 0.25);
}

.slider:disabled {
  cursor: default;
}

.slider:disabled::-webkit-slider-thumb {
  background: var(--muted);
  box-shadow: 0 0 0 1px var(--muted);
}

.slider:disabled::-moz-range-thumb {
  background: var(--muted);
  box-shadow: 0 0 0 1px var(--muted);
}

/* --- Number input --- */
.num-input {
  width: 90px;
  padding: 0.35rem 0.5rem;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  transition: border-color 0.2s;
}

.num-input:focus {
  border-color: var(--accent);
}

.num-input::-webkit-inner-spin-button,
.num-input::-webkit-outer-spin-button {
  opacity: 1;
}

/* --- Results panel: the main result echoes the website's key-figures strip --- */
.result-primary {
  text-align: center;
  padding: 1.75rem 1rem;
  margin-bottom: 1.2rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius);
  color: var(--on-navy);
}

.result-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-navy-accent);
  margin-bottom: 0.4rem;
}

.result-value {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.result-value.flash {
  animation: result-flash 0.4s ease-out;
}

@keyframes result-flash {
  0% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.result-unit {
  font-size: 0.85rem;
  color: var(--on-navy);
  margin-top: 0.25rem;
}

/* --- Results grid --- */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.result-card {
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  border-radius: var(--radius-sm);
}

.result-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.result-card-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.result-card-unit {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.05rem;
}

/* --- Panel buttons --- */
.panel-assumptions {
  margin-bottom: 1.5rem;
}

.btn-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-toggle.collapsed svg {
  transform: rotate(-90deg);
}

.btn-toggle svg {
  transition: transform 0.3s;
}

.btn-action {
  height: 30px;
  padding: 0 0.8rem;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  color: var(--ink);
  font: 600 0.8rem var(--font-sans);
  cursor: pointer;
}

.btn-action:hover {
  color: var(--accent-dark);
  border-color: var(--accent);
}

.assumptions-body {
  transition: max-height 0.4s ease, opacity 0.3s, padding 0.3s;
  max-height: 2000px;
  overflow: hidden;
}

.assumptions-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Sub-section titles within assumptions */
.assumptions-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}

.assumptions-section-title:first-child {
  margin-top: 0;
}

.assumptions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.4rem;
}

.assumption-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0.7rem;
  background: var(--surface);
  border-radius: var(--radius-xs);
  gap: 1rem;
}

.assumption-label {
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
}

.assumption-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  white-space: normal;
  word-break: break-word;
}

/* Equations list */
.equations-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.equation-item {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  border-radius: var(--radius-xs);
}

.equation-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  min-width: 140px;
  flex-shrink: 0;
}

.equation-expr {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  color: var(--navy);
  line-height: 1.7;
}

.equation-expr sub {
  font-size: 0.65em;
}

.equation-note {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  margin-left: 0.4rem;
}

/* --- Plots section --- */
.panel-plots {
  margin: 1.5rem 0;
}

/* Axis selector row */
.plot-config {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.plot-select-group {
  flex: 1;
  min-width: 180px;
}

.log-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.log-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.select-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.plot-select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235b6475' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}

.plot-select:focus {
  border-color: var(--accent);
}

/* Validation message */
.plot-message {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-xs);
  margin-bottom: 0.6rem;
  display: none;
}

.plot-message.error {
  display: block;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

/* Constant parameter inputs row */
.plot-constants {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
}

.plot-constants:empty {
  display: none;
}

.const-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 0.2rem;
}

.const-input-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  cursor: default;
}

.const-input-group .const-var {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.3rem;
  padding: 0 0.25rem;
  background: #eef1f7;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--navy);
}

.const-input {
  width: 80px;
  padding: 0.25rem 0.4rem;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: right;
  transition: border-color 0.2s;
}

.const-input:focus {
  border-color: var(--accent);
}

.const-unit {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Single chart canvas */
.chart-wrap-single {
  position: relative;
  height: 380px;
}

@media (max-width: 900px) {
  .plot-config { flex-direction: column; }
  .chart-wrap-single { height: 280px; }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  html { font-size: 14px; }
  .page-header { padding: 40px 0 28px; }
  .solve-tabs { flex-direction: column; }
  .results-grid { grid-template-columns: 1fr; }
  .assumptions-grid { grid-template-columns: 1fr; }
  .result-value { font-size: 2rem; }
  .plot-config { flex-direction: column; }
  .equation-item { flex-direction: column; gap: 0.2rem; }
  .equation-name { min-width: auto; }
  .panel-header { flex-wrap: wrap; }
}

/* Respect the system "reduce motion" setting. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
