/* Colleague — black canvas, white line-work. */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #000000;
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.62);
  --ink-faint: rgba(255, 255, 255, 0.34);
  --line: rgba(255, 255, 255, 0.9);
  --line-soft: rgba(255, 255, 255, 0.28);
}

html,
body {
  min-height: 100%;
}

body {
  position: relative;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden; /* no sideways scroll from entrance transforms */
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 44px;
  animation: fade-down 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.logo img {
  height: 34px;
  width: auto;
  display: block;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Hamburger (mobile only) ---------- */

.burger {
  display: none; /* desktop shows the full nav instead */
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease;
}

/* The three dashes fold into an X while the menu is open. */
.burger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger.open span:nth-child(2) {
  opacity: 0;
}

.burger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-item {
  position: relative;
}

/* Sits to the left of the Calculators dropdown, styled to match it. */
.nav-link {
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease;
}

/* Outlined, matching the Calculators button — not a filled grey pill. */
.nav-link:hover,
.nav-link:focus-visible,
.nav-link.active {
  border-color: var(--line);
}

.nav-btn {
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.nav-btn:hover,
.nav-item:hover .nav-btn,
.nav-item.open .nav-btn {
  border-color: var(--line);
}

.chev {
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.nav-item:hover .chev,
.nav-item.open .chev {
  transform: rotate(180deg);
}

/* Calculators dropdown */
.nav-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 268px;
  list-style: none;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg);

  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.nav-item:hover .nav-menu,
.nav-item.open .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* A category row: a button that reveals its calculators alongside it. */
.nav-cat {
  position: relative;
  border-radius: 11px;
}

.cat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 11px;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nav-cat:hover > .cat-btn,
.nav-cat.open > .cat-btn {
  background: rgba(255, 255, 255, 0.1);
}

/* Marks the category holding whatever calculator is on screen. */
.nav-cat.active > .cat-btn {
  background: rgba(255, 255, 255, 0.14);
  font-weight: 600;
}

.chev-right {
  flex: none;
  opacity: 0.55;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-cat:hover .chev-right,
.nav-cat.open .chev-right {
  opacity: 1;
  transform: translateX(2px);
}

.nav-cat.empty > .cat-btn {
  opacity: 0.4;
  cursor: default;
}

/* The flyout opens leftwards, because the parent menu hugs the right edge. */
.sub-menu {
  position: absolute;
  top: -8px;
  right: calc(100% + 9px);
  /* Wide enough that the longest subsection name stays on one line. */
  min-width: 290px;
  max-height: min(72vh, 580px);
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);

  opacity: 0;
  visibility: hidden;
  transform: translateX(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.nav-cat:hover > .sub-menu,
.nav-cat.open > .sub-menu,
.nav-cat:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Items are an <a> on the homepage and a <span> on the calculator page;
   both stay white and undecorated rather than the browser's blue underline. */
.sub-menu li[data-id] {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sub-menu li[data-id] > a,
.sub-menu li[data-id] > span {
  display: block;
  padding: 9px 13px;
  color: var(--ink);
  text-decoration: none;
}

.sub-menu li[data-id]:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sub-menu li[data-id].active {
  background: rgba(255, 255, 255, 0.14);
  font-weight: 600;
}

/* Subsection labels, shown only once a category has more than one. */
/* One level of the flyout. Only ever one is visible at a time. */
.sub-pane {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sub-pane[hidden] {
  display: none;
}

/* A subsection row on level one — same shape as a category row. */
.group-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 10px 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.group-btn:hover,
.group-btn:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.group-name {
  flex: 1;
}

.group-count {
  flex: none;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

.group-btn:hover .chev-right,
.group-btn:focus-visible .chev-right {
  opacity: 1;
  transform: translateX(2px);
}

/* Back out to the subsection list. Sticks to the top so it stays reachable
   in a long list without scrolling back up. */
.sub-back {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  padding-bottom: 4px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.back-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 9px 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.back-btn:hover,
.back-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.chev-left {
  flex: none;
  transition: transform 0.2s ease;
}

.back-btn:hover .chev-left,
.back-btn:focus-visible .chev-left {
  transform: translateX(-2px);
}

.sub-empty {
  padding: 9px 13px;
  font-size: 0.84rem;
  color: var(--ink-faint);
}

/* ---------- Stage ---------- */

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 116px 24px 40px;
}

/* Pinned to the top of the stage (no auto margin) so the figure always
   sits the same distance from the top, however tall it gets. */
.calc-figure {
  width: min(440px, 72vw);
  height: auto;
  display: block;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Required: the display above otherwise beats the hidden attribute, and a
   calculator showing its equation would still reserve the figure's space. */
.calc-figure[hidden] {
  display: none;
}

/* ---------- Equation figure ----------
 * Stands in for the line-art on any calculator that has a defining formula.
 * Sized to occupy roughly the same block as the figure it replaces.
 */
.calc-eq {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Wider than the figure it replaces: a long formula gets room to stay on
     one line before app.js has to shrink it. */
  width: min(760px, 92vw);
  min-height: 132px;
  padding: 22px 12px;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-align: center;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* The whole formula lives on one line. Fractions still stack internally —
   it's the left and right of "=" that must never break apart. */
.eq-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 0 2px;
  font-size: clamp(1.15rem, 1rem + 1.4vw, 1.75rem);
}

.calc-eq[hidden] {
  display: none;
}

/* Numerator over denominator, with the bar drawn as a border. */
.eq-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0 0.22em;
  font-size: 0.92em;
}

.eq-num {
  padding: 0 0.35em 0.12em;
}

.eq-den {
  padding: 0.12em 0.35em 0;
  border-top: 1.5px solid currentColor;
}

/* A radical sign plus an overbar across the radicand. */
.eq-sqrt {
  display: inline-flex;
  align-items: stretch;
  vertical-align: middle;
}

.eq-sqrt::before {
  content: "√";
  font-size: 1.05em;
  line-height: 1;
}

.eq-rad {
  padding: 0.08em 0.18em 0;
  border-top: 1.5px solid currentColor;
}

/* line-height 0 keeps these from stretching the line box; resetting
   vertical-align to baseline and offsetting by hand then puts them where a
   typesetter would, rather than where the browser's default lands them. */
.calc-eq sup,
.calc-eq sub {
  font-size: 0.62em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

.calc-eq sup {
  top: -0.52em;
}

.calc-eq sub {
  top: 0.26em;
}

.calc-blurb {
  max-width: 46ch;
  margin: -6px auto 4px;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}

.calc-box-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ---------- Calculator box ---------- */

/* Same style and layout as before, just scaled down. */
.calc-box {
  width: min(452px, 100%);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  background: var(--bg);
  padding: 20px 22px 24px;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.calc-head {
  margin-bottom: 18px;
}

.calc-title {
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.calc-sub {
  margin-top: 3px;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Fields */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.field-row {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.field-row.two {
  grid-template-columns: 1fr 1fr;
}

.field-row.three {
  grid-template-columns: 1fr 1fr 1fr;
}

/* The solver calculators lay their variables out two-up. The field for
   whichever variable you're solving for drops out of the flow entirely —
   `hidden` alone wouldn't win against .field's display:flex. */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.field[hidden] {
  display: none;
}

.field label .unit {
  color: var(--ink-faint);
  font-weight: 400;
}

/* Input paired with a unit menu, for variables measured in a convertible
   unit. The menu sizes to its content so the number keeps the room. */
.field-input {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.unit-select {
  width: auto;
  flex: none;
  min-width: 82px;
  max-width: 42%;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.unit-select:focus {
  color: var(--ink);
}

/* The solved-for variable's menu, which lives beside the answer. Pushing the
   label left keeps the number and its unit together on the right. */
.result-main .result-label {
  margin-right: auto;
}

.result-main .out-unit {
  min-width: 74px;
  align-self: center;
}

.result-main .out-unit[hidden] {
  display: none;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.2s ease;
  -moz-appearance: textfield;
  appearance: none;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input:focus,
select:focus {
  border-color: var(--line);
}

input::placeholder {
  color: var(--ink-faint);
}

select {
  cursor: pointer;
  /* white chevron, inlined so nothing is fetched from the network */
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 L6 8 L9.5 4.5' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

select option {
  background: #000;
  color: #fff;
}

/* ---------- Unit converter ----------
 * Category word sits top-left with a chevron; below it the two values sit
 * side by side with the swap control between them, each over its own unit
 * menu. Nothing is labelled — which side is which is obvious from the layout.
 */
.conv-cat-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 4px 2px;
}

.conv-cat-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.conv-cat-chev {
  flex: none;
  color: var(--ink-soft);
  transition: color 0.15s ease, transform 0.15s ease;
}

.conv-cat-wrap:hover .conv-cat-chev,
.conv-cat-wrap:focus-within .conv-cat-chev {
  color: var(--ink);
  transform: translateY(1px);
}

/* A real native select, laid transparently over the word so the control
   stays accessible and uses the platform picker on a phone. */
.conv-cat-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  opacity: 0;
  cursor: pointer;
}

.conv-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px 14px;
  align-items: center;
}

#conv-value {
  grid-area: 1 / 1 / 2 / 2;
}

#conv-out-value {
  grid-area: 1 / 3 / 2 / 4;
}

#conv-from {
  grid-area: 2 / 1 / 3 / 2;
}

#conv-to {
  grid-area: 2 / 3 / 3 / 4;
}

/* Spans both rows so it sits centred between the two columns. */
.conv-swap {
  grid-area: 1 / 2 / 3 / 3;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.conv-swap:hover,
.conv-swap:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line);
}

/* The arrows point along the axis the swap happens on: sideways beside two
   columns, and upright again once they stack on a phone. */
.conv-swap svg {
  transform: rotate(90deg);
}

#conv-value,
#conv-out-value {
  font-size: 1.05rem;
  padding: 12px 13px;
}

/* Course rows (GPA calculators) */

.rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 82px 68px 32px;
  gap: 8px;
  align-items: center;
}

.row-head {
  display: grid;
  grid-template-columns: 1fr 82px 68px 32px;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 9px;
}

/* Value rows (resistors, capacitors) and (x, y) rows (regression) */

.vrows,
.xyrows {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 11px;
}

.vrow {
  display: flex;
  align-items: center;
  gap: 9px;
}

.vrow .v-item {
  flex: 1;
}

.vunit {
  font-size: 0.8rem;
  color: var(--ink-faint);
  min-width: 20px;
}

.xyrow,
.row-head.three {
  display: grid;
  grid-template-columns: 1fr 1fr 34px;
  gap: 9px;
  align-items: center;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--line);
  color: var(--ink);
}

.add-btn {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.add-btn:hover {
  border-color: var(--line);
}

/* Results */

.result {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.result-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.result-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.result-value {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.result-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.result-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
}

.result-item span:first-child {
  color: var(--ink-soft);
}

.result-item span:last-child {
  font-weight: 600;
}

.note {
  margin-top: 14px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

.note.warn {
  color: #ffffff;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 13px;
}

/* ---------- Footer ---------- */

/* Sits in normal flow so it can never overlap a tall calculator. */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 24px 34px;
  font-size: 0.76rem;
  font-weight: 500;
}

.site-footer a {
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--ink);
}

.footer-dot {
  color: var(--ink-faint);
}

/* ---------- Homepage ---------- */

.home {
  padding: 132px 24px 20px;
  max-width: 1140px;
  margin: 0 auto;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 84px;
}

.hero-fig {
  width: min(430px, 78vw);
  height: auto;
  margin-bottom: 10px;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Sits lower than it used to — the paragraph that was under it is gone, so
   the title drops and the buttons come up to close the gap. */
.hero-title {
  margin-top: 34px;
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  max-width: 15ch;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}

.hero-actions {
  margin-top: 26px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.22s both;
}

.btn {
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--bg);
  background: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 12px 24px;
  text-decoration: none;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn:hover { opacity: 0.85; }

.btn.ghost {
  color: var(--ink);
  background: transparent;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

.section {
  padding: 56px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 34px;
  text-align: center;
}

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

.feature {
  border: 1.5px solid var(--line-soft);
  border-radius: 20px;
  padding: 26px 26px 30px;
  text-align: center;
  transition: border-color 0.25s ease;
}

.feature:hover { border-color: var(--line); }

.feature-fig {
  width: 190px;
  max-width: 70%;
  height: auto;
  display: block;
  margin: 0 auto 6px;
}

.feature h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* "What Colleague does" — description left, floating calculator right.
   Sized so the whole section reads at roughly hero height, with a
   large calculator filling the right side. */

#what {
  padding-top: 72px;
  padding-bottom: 72px;
}

.what-split {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 88px;
  align-items: center;
}

/* Push the calculator to the right edge of its column. */
.what-visual {
  justify-self: end;
  width: 100%;
}

.what-copy p {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.what-copy p:last-child { margin-bottom: 0; }

.what-copy strong {
  color: var(--ink);
  font-weight: 600;
}

/* Wrapper gives 3-D depth and handles the scroll-in reveal. */
.what-visual {
  perspective: 1100px;
  opacity: 0;
  transform: translateX(40px);
  transition:
    opacity 1s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.what-visual.reveal {
  opacity: 1;
  transform: none;
}

/* Continuous gentle float (separate element so the cursor tilt below
   can drive the image's transform without fighting this animation). */
.what-float {
  transform-style: preserve-3d;
  animation: calc-float 6.5s ease-in-out infinite;
}

@keyframes calc-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-16px) rotate(-0.7deg); }
}

.calc-img {
  width: 100%;
  height: auto;
  display: block;
  transform: rotateX(0) rotateY(0);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .what-float { animation: none; }
  .what-visual { transition: opacity 0.4s ease; transform: none; }
}

/* All-calculators list */

.calc-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* Headings break the grid to run the full width. */
.cat-header,
.group-header {
  grid-column: 1 / -1;
}

.cat-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 34px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

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

.cat-header h3 {
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cat-header span {
  font-size: 0.78rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.group-header {
  margin-top: 16px;
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.calc-list-item a {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1.5px solid var(--line-soft);
  border-radius: 16px;
  padding: 14px 18px 14px 10px;
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.calc-list-item a:hover {
  border-color: var(--line);
  transform: translateY(-2px);
}

/* Both thumbnail kinds share a slot width, so the titles stay in a column
   whether a row shows a formula or the line-art. */
.calc-list-item img,
.calc-list-item .list-eq {
  width: 130px;
  flex-shrink: 0;
}

.calc-list-item .list-eq {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 0 4px;
  color: var(--ink);
}

/* Thumbnails are the one place equations may wrap. Forcing a long formula
   onto a single 130px line drove the type down to 5px; wrapping keeps it
   readable. The full-size equation on the calculator page stays nowrap. */
.calc-list-item .list-eq .eq-line {
  flex-wrap: wrap;
  white-space: normal;
  font-size: 0.92rem;
  line-height: 1.35;
}

.calc-list-item h3 {
  font-size: 0.94rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.calc-list-item p {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.closing {
  text-align: center;
}

.closing-line {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 22px;
}

/* ---------- Legal pages (Terms / Privacy) ---------- */

.legal-main {
  max-width: 740px;
  margin: 0 auto;
  padding: 124px 24px 8px;
}

.legal-card {
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 40px 44px 46px;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.legal-card h1 {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 5px;
}

.legal-meta {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-faint);
  margin-bottom: 20px;
}

.legal-note {
  font-size: 0.82rem;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 28px;
  line-height: 1.55;
}

.legal-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 26px 0 9px;
}

.legal-card p,
.legal-card li {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink-soft);
}

.legal-card p {
  margin-bottom: 12px;
}

.legal-card ul {
  padding-left: 22px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legal-card strong {
  color: var(--ink);
  font-weight: 600;
}

.legal-card a.inline-link {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  .legal-main {
    padding: 100px 16px 6px;
  }

  .legal-card {
    padding: 28px 22px 32px;
    border-radius: 16px;
  }

  .legal-card h1 {
    font-size: 1.4rem;
  }
}

/* ---------- Motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-down {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .topbar, .iso, .calc-box { animation: none; }
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .topbar {
    padding: 18px 20px;
  }

  .logo img {
    height: 26px;
  }

  /* The three-dash button replaces the inline links on phones. */
  .burger {
    display: flex;
  }

  /* Nav becomes a panel that drops from the hamburger. */
  .nav {
    position: absolute;
    top: calc(100% - 6px);
    right: 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: min(240px, calc(100vw - 40px));
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--bg);

    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  }

  .nav.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-btn,
  .nav-link {
    font-size: 0.95rem;
    padding: 13px 14px;
    width: 100%;
    justify-content: space-between;
    border-radius: 12px;
  }

  /* Inside the stacked panel the link is a full-width row, not a pill. */
  .nav-link {
    display: block;
    box-sizing: border-box;
  }

  .nav-btn:hover,
  .nav-item:hover .nav-btn {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.08);
  }

  /* Inside the panel the calculator list sits inline rather than
     floating, so it can't spill off the screen. */
  .nav-item {
    width: 100%;
  }

  .nav-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    border: none;
    border-radius: 0;
    padding: 2px 0 6px;
    margin-top: 2px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
  }

  /* Same rule as the categories below: .open is the only opener, so hover
     and focus are left alone entirely. */
  .nav-item.open .nav-menu {
    max-height: 70vh;
    overflow-y: auto;
  }

  /* Categories become a second accordion level rather than a flyout —
     there's no room beside the panel on a phone. */
  .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    border: none;
    border-radius: 0;
    padding: 0 0 4px 10px;
    margin: 0;
    min-width: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
  }

  /* Well clear of the tallest category, so nothing is ever clipped — the
     outer .nav-menu is what scrolls. Raise this if a category ever grows
     past roughly 130 calculators. */
  .nav-cat.open > .sub-menu {
    max-height: 6000px;
  }

  /* Deliberately nothing for :hover or :focus-within here. Collapsed is the
     base state and .open is the only thing that reveals a category, so
     hovering can't spring them all open on touch — and focus landing inside
     a drilled-in pane can't collapse the panel out from under it. */

  .nav-cat:hover > .cat-btn {
    background: transparent;
  }

  .nav-cat.open > .cat-btn,
  .nav-cat.active > .cat-btn {
    background: rgba(255, 255, 255, 0.08);
  }

  /* The chevron points down once it's an accordion. */
  .nav-cat.open .chev-right {
    transform: rotate(90deg);
  }

  /* Roomier menu rows so they're easy to hit with a thumb. */
  .cat-btn {
    padding: 13px 15px;
    font-size: 0.92rem;
  }

  .sub-menu li[data-id] > a,
  .sub-menu li[data-id] > span {
    padding: 12px 15px;
    font-size: 0.9rem;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 26px 24px 32px;
    font-size: 0.8rem;
  }

  .site-footer a {
    padding: 6px 2px;
  }

  .stage {
    padding: 100px 16px 20px;
    gap: 16px;
  }

  .calc-figure {
    width: min(320px, 82vw);
  }

  .calc-blurb {
    font-size: 0.86rem;
  }

  .calc-box {
    padding: 18px 16px 22px;
    border-radius: 18px;
  }

  /* Homepage */
  .home {
    padding: 100px 18px 12px;
  }

  .hero {
    padding-bottom: 54px;
  }

  .section {
    padding: 42px 0;
  }

  .section-title {
    font-size: 1.28rem;
    margin-bottom: 24px;
  }

  .feature-grid,
  .calc-list {
    grid-template-columns: 1fr;
  }

  .what-split {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .what-copy p {
    font-size: 0.95rem;
  }

  /* Rise straight up on phones — a sideways slide would push the
     layout past the right edge on a narrow screen. */
  .what-visual {
    transform: translateY(24px);
  }

  .feature {
    padding: 22px 20px 24px;
  }

  .calc-list-item img,
  .calc-list-item .list-eq {
    width: 104px;
  }

  .calc-list-item .list-eq {
    min-height: 48px;
  }

  .field-row.two,
  .field-row.three {
    grid-template-columns: 1fr;
  }

  /* 16px stops iOS Safari zooming in when a field is focused, and the
     taller controls keep every target comfortably tappable. */
  input[type="number"],
  input[type="text"],
  select {
    font-size: 16px;
    padding: 12px;
    border-radius: 12px;
  }

  .field label {
    font-size: 0.86rem;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
    font-size: 1.35rem;
  }

  .add-btn {
    min-height: 44px;
    font-size: 0.92rem;
    padding: 11px 18px;
  }

  /* Course rows go two-line on phones — the name takes the full width,
     then grade / credits / remove sit underneath it. */
  .row-head {
    display: none;
  }

  .row {
    grid-template-columns: 1fr 92px 44px;
    gap: 8px;
  }

  .row > *:first-child {
    grid-column: 1 / -1;
  }

  .rows {
    gap: 16px;
  }

  .result-value {
    font-size: 1.7rem;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Unit converter, small screens ---------- */

@media (max-width: 640px) {
  /* Two value columns are too cramped on a phone, so the pair stacks and
     the swap control moves to the middle of the stack. */
  .conv-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #conv-value {
    grid-area: 1 / 1 / 2 / 2;
  }

  #conv-from {
    grid-area: 2 / 1 / 3 / 2;
  }

  .conv-swap {
    grid-area: 3 / 1 / 4 / 2;
    justify-self: center;
    margin: 2px 0;
  }

  .conv-swap svg {
    transform: none;
  }

  #conv-out-value {
    grid-area: 4 / 1 / 5 / 2;
  }

  #conv-to {
    grid-area: 5 / 1 / 6 / 2;
  }
}
