/* Shared page layout for the physics article pages (gravity, time, space).
   Design tokens and site navigation live in base.css; each page keeps only its own
   instrument in a local <style> block — the two orbs, the two clocks, the measured rod. */

body {
  background:
    radial-gradient(1100px 620px at 10% -12%, #16233a 0%, transparent 60%),
    radial-gradient(900px 600px at 100% -4%, #241a30 0%, transparent 55%),
    var(--bg);
  padding: clamp(18px, 3vw, 44px);
}

.wrap { max-width: 1080px; margin: 0 auto; }

/* ---------- Hero ---------- */

.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6f7f9c;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 52px);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.lede {
  margin: 14px 0 0;
  max-width: 62ch;
  font-size: clamp(14px, 1.5vw, 16px);
  line-height: 1.65;
  color: var(--muted);
}

/* ---------- Formula ---------- */

.formula-card {
  margin-top: clamp(26px, 4vw, 40px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 12px;
  padding: clamp(20px, 2.6vw, 30px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(700px 220px at 0% 0%, #1a2740 0%, transparent 65%),
    color-mix(in srgb, var(--panel) 92%, transparent);
}

.formula {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 120px;
  font-size: clamp(26px, 3.4vw, 38px);
  letter-spacing: 0.01em;
}

.formula .fvar { font-style: italic; }

.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.74em;
  line-height: 1.15;
}

.frac .num {
  padding: 0 8px 4px;
  border-bottom: 1px solid #445878;
}

.frac .den { padding-top: 5px; }

.rad {
  display: inline-block;
  padding: 2px 4px 0;
  border-top: 1px solid #445878;
}

.terms {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 16px;
  align-content: center;
  font-size: 13px;
}

.terms dt {
  font-style: italic;
  font-weight: 600;
  color: var(--accent);
}

.terms dd {
  margin: 0;
  color: #a6b3cb;
  line-height: 1.45;
}

/* ---------- Sections ---------- */

section { margin-top: clamp(30px, 4.4vw, 52px); }

h2 {
  margin: 0;
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 620;
  letter-spacing: -0.015em;
}

.hint {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: #76849e;
  line-height: 1.5;
}

/* ---------- Lab ---------- */

.lab-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  padding: 18px;
  min-width: 0;
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 270px;
  padding: 40px 14px 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(560px 240px at 50% 118%, #152034 0%, #0a101a 70%);
  overflow: hidden;
}

.stage-caption {
  position: absolute;
  top: 13px;
  left: 0;
  right: 0;
  padding: 0 12px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: #8f9db8;
  font-variant-numeric: tabular-nums;
}

.stage-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 11px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #55627d;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.preset {
  font: inherit;
  font-size: 11.5px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0e1420;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.preset:hover { color: var(--text); border-color: #2e3c56; }

.preset[aria-pressed="true"] {
  color: var(--text);
  border-color: #3d5b8f;
  background: #182539;
}

.slider { margin-bottom: 15px; }

.slider-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.slider-top label {
  font-size: 12.5px;
  color: #9dabc4;
}

.slider-top output {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
  accent-color: var(--accent);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2b3f60, #182337);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: #dbe7fb;
  border: 3px solid #4f7ec4;
  box-shadow: 0 0 12px -2px #4f7ec4;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: #22314a;
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #dbe7fb;
  border: 3px solid #4f7ec4;
}

.readout {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #24334d;
  background:
    linear-gradient(180deg, #16202f, #0d1420);
}

.readout .rlabel {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7a96;
  margin-bottom: 5px;
}

.readout .rvalue {
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: #f2f6ff;
}

.readout .rvalue small {
  font-size: 0.55em;
  font-weight: 500;
  color: #93a3bf;
  margin-left: 4px;
}

.readout .rsub {
  margin-top: 7px;
  font-size: 11.5px;
  color: #8593ad;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

/* ---------- Plot ---------- */

.plot-wrap {
  margin-top: 18px;
  padding: 6px 6px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
}

canvas { display: block; width: 100%; height: 300px; }

.plot-note {
  margin: 12px 2px 0;
  font-size: 12px;
  color: #76849e;
  line-height: 1.6;
}

/* ---------- Table ---------- */

.table-scroll { margin-top: 16px; overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 560px;
}

th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}

th {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6f7d97;
  font-weight: 600;
}

tbody tr:last-child td { border-bottom: 0; }

td.num { font-variant-numeric: tabular-nums; color: #b9c6dd; }
td.force,
td.gain,
td.length { font-variant-numeric: tabular-nums; color: var(--warm); white-space: nowrap; }
.row-note { color: #74829c; font-size: 11.5px; }

/* ---------- Notes ---------- */

.notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.note-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 17px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}

.note-card h3 {
  margin: 0 0 7px;
  font-size: 13px;
  font-weight: 620;
  color: #dbe4f5;
}

.note-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.62;
  color: #8e9cb5;
}

footer {
  margin-top: clamp(30px, 4vw, 48px);
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.65;
  color: #6f7d97;
  max-width: 74ch;
}

@media (max-width: 860px) {
  .formula-card { grid-template-columns: minmax(0, 1fr); }
  .formula { min-height: 96px; }
  .lab-grid { grid-template-columns: minmax(0, 1fr); }
  .notes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .stage { min-height: 230px; }
  .terms { font-size: 12px; }
}
