/* =============================================
   Microlensing: Finding Planets With Gravity — page styles (derived from fly-by.css)
   Loaded after /css/main.css; reuses its variables, .section-label,
   .section-title, .section-divider, .btn, .guide-cards and .footer.
   ============================================= */
:root {
  --space: #000000;
  --ink: var(--text-primary);
  --ink-dim: var(--text-muted);
  --ink-soft: #d8d2c6;
  --panel: rgba(12, 12, 16, 0.82);
  --rule: rgba(232, 228, 217, 0.14);
  --teal: #6fd3b4;
  --blue: #a9c4ff;
  --display: 'Cinzel', serif;
  --math: "Cambria Math", "STIX Two Math", Cambria, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --nav-h: 64px;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Hero / simulator ---------- */
#hero { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; background: var(--space); font-size: 15px; line-height: 1.45; }
#view, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { cursor: grab; touch-action: none; z-index: 1; }
#overlay.dragging { cursor: grabbing; }

.title { position: absolute; left: max(24px, env(safe-area-inset-left)); top: calc(var(--nav-h) + 18px); max-width: 430px; z-index: 3; pointer-events: none; }
.title a { pointer-events: auto; }
.title .section-label { margin-bottom: 6px; }
.title h1 { font-family: var(--display); font-weight: 700; font-size: clamp(24px, 2.6vw, 36px); line-height: 1.1; letter-spacing: 0.02em; margin: 0 0 10px; color: var(--ink); text-shadow: 0 0 12px #000; }
.title .lede { max-width: 44ch; margin: 0 0 8px; font-size: 15px; line-height: 1.5; color: var(--ink-soft); text-shadow: 0 0 8px #000, 0 0 16px #000; }
.title .hint { margin: 0; color: var(--ink-dim); font-size: 13px; text-shadow: 0 0 8px #000; }
.title .hint a { color: var(--gold); }
#readout { font-variant-numeric: tabular-nums; }
.coarse { display: none; }
@media (pointer: coarse) { .coarse { display: inline; } .fine { display: none; } }

#callouts { position: absolute; inset: 0; pointer-events: none; z-index: 2; transition: opacity 0.25s; }
#callouts.hidden { opacity: 0; }
.callout { position: absolute; max-width: 22ch; font-size: 12.5px; line-height: 1.3; color: #e6dfd2; text-shadow: 0 0 4px #000, 0 0 8px #000, 0 0 16px #000; white-space: normal; }
.callout b { display: block; font-family: var(--display); font-weight: 600; font-size: 13.5px; letter-spacing: 0.04em; color: var(--gold-light); }
.callout[data-k="src"] b { color: var(--blue); }
.callout[data-k="planet"] b { color: #e8c766; }

#caption { position: absolute; top: calc(var(--nav-h) + 18px); z-index: 3; max-width: min(440px, 44vw); padding: 6px 14px; text-align: center;
  background: rgba(8, 9, 14, 0.72); border: 1px solid rgba(232, 228, 217, 0.12); border-radius: 10px; pointer-events: none; }
#caption[hidden] { display: none; }
#capMain { margin: 0 0 2px; font-family: var(--display); font-size: 14px; line-height: 1.3; color: var(--gold-light); }
#capSub { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink-soft); }

/* Light curve card (bottom) */
#curveCard { position: absolute; left: 16px; bottom: 16px; z-index: 3; display: flex; gap: 12px; align-items: stretch;
  background: rgba(8, 9, 14, 0.8); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 10px 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#curve { display: block; width: 100%; height: 170px; flex: none; min-width: 0; }
.tel { width: 118px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; border-right: 1px solid var(--rule); padding-right: 12px; }
.tel p { margin: 0; font-size: 11.5px; line-height: 1.3; color: var(--ink-dim); text-align: center; }
.tel b { color: var(--ink); font-weight: 700; }
#telescope { width: 92px; height: 92px; border-radius: 6px; border: 1px solid var(--rule); }
#telNum { font-variant-numeric: tabular-nums; color: var(--gold-light); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-dim); margin-top: 2px; }
.legend span::before { content: ""; display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
.legend .lg-full::before { border-color: #e8c766; }
.legend .lg-host::before { border-color: rgba(232,228,217,0.5); border-top-style: dashed; }
.legend .lg-common::before { border-color: var(--teal); border-top-style: dotted; }
.legend .lg-now::before { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--blue); }
.curve-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#mapLegend { position: absolute; z-index: 3; right: 350px; top: calc(var(--nav-h) + 18px); max-width: 300px; font-size: 12.5px; line-height: 1.45; color: var(--ink-soft);
  background: rgba(8, 9, 14, 0.75); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 12px; pointer-events: none; }
#mapLegend[hidden] { display: none; }
#mapLegend b { color: var(--gold-light); font-weight: 700; }
.mapbar { display: block; height: 8px; border-radius: 4px; margin: 6px 0 2px; background: linear-gradient(to right, rgb(30,40,70), rgb(90,115,160), rgb(150,190,255)); }

/* Settings panel */
#panel {
  position: absolute; top: calc(var(--nav-h) + 16px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 4;
  width: 318px; max-height: calc(100% - var(--nav-h) - 32px);
  overflow-y: auto; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle); border-radius: 10px; padding: 6px 16px 14px;
  scrollbar-width: thin; scrollbar-color: rgba(232,228,217,.25) transparent;
}
#panel.collapsed > :not(.panel-head) { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0 4px; }
.panel-head h2 { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); margin: 0; }
details { border-top: 1px solid var(--rule); padding: 4px 0; }
summary { cursor: pointer; list-style: none; padding: 8px 0; font-family: var(--display); font-size: 14px; letter-spacing: 0.05em; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--ink-dim); font-family: 'Lato', sans-serif; }
details[open] summary::after { content: "−"; }
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; margin: 6px 0 12px; }
.row label { font-size: 13.5px; }
.row output { font-size: 12.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.row input[type=range], .row select { grid-column: 1 / -1; width: 100%; }
.hint-s { grid-column: 1 / -1; font-size: 12px; color: var(--ink-dim); margin: 0; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--rule); border-radius: 1px; }
input[type=range]::-moz-range-track { height: 2px; background: var(--rule); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); margin-top: -6px; border: 0; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); border: 0; }
select { background: rgba(255,255,255,0.05); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 13.5px; }
select option { background: #1a1b26; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--gold); width: 15px; height: 15px; flex: none; }
.check input:disabled + span { opacity: 0.45; }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 10px; }
.presets button:last-child:nth-child(odd) { grid-column: 1 / -1; }
#hero button, .credit-box button { font: inherit; font-size: 13px; color: var(--ink); background: rgba(255,255,255,0.05); border: 1px solid var(--rule); border-radius: 6px; padding: 7px 9px; cursor: pointer; text-align: left; }
#hero button:hover, .credit-box button:hover { background: rgba(255,255,255,0.1); }
#hero button[aria-pressed=true] { border-color: var(--gold); color: var(--gold-light); }
#hero .presets button.featured { border-color: rgba(111, 211, 180, 0.45); background: rgba(111, 211, 180, 0.09); }
#hero .presets button.featured:hover { background: rgba(111, 211, 180, 0.17); }
#hero .presets button.featured[aria-pressed=true] { border-color: var(--gold); color: var(--gold-light); }
#hero .icon-btn { padding: 5px 10px; text-align: center; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.view-note { border-left: 2px solid var(--teal); padding: 4px 0 4px 10px; margin: 0 0 8px; color: var(--ink-soft); font-size: 13px; }
.view-note[hidden] { display: none; }
.now { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 4px 0 10px; font-size: 13px; }
.now dt { color: var(--ink-dim); }
.now dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
#customBox[hidden] { display: none; }

#error { display: none; position: absolute; inset: 0; place-items: center; padding: 24px; text-align: center; font-size: 17px; z-index: 5; }
#error p { max-width: 46ch; }

/* Bare mode (?ui=0) for embedding and for making figures */
body.bare #navbar, body.bare .title, body.bare #panel, body.bare main, body.bare footer,
body.bare #caption, body.bare #curveCard, body.bare #mapLegend { display: none; }
body.bare.show-curve #curveCard { display: flex; }
body.bare #hero { height: 100vh; }

/* ---------- Science write-up ---------- */
.ml-science { max-width: var(--max-width); margin: 0 auto; padding: 80px 24px 24px; }
.ml-science section { padding: 0; margin: 0 0 88px; }
.ml-science .section-title { margin-bottom: 1rem; }
.ml-science h3 { font-family: var(--display); font-weight: 600; font-size: 1.05rem; letter-spacing: 0.03em; margin: 0 0 6px; color: var(--ink); }
.prose { max-width: 68ch; font-size: 17px; line-height: 1.7; color: var(--ink-soft); }
.prose p { margin: 0 0 14px; }
.prose strong { color: var(--ink); font-weight: 700; }
.muted { color: var(--ink-dim); }
.real-note { max-width: 68ch; margin: 0 0 22px; padding: 10px 16px; border-left: 2px solid var(--gold); font-size: 16.5px; line-height: 1.6; color: var(--ink); background: rgba(201, 168, 76, 0.05); }
.guess { border: 1px solid var(--border-subtle); border-radius: 10px; padding: 18px 22px; max-width: 68ch; margin: 0 0 26px; background: rgba(201, 168, 76, 0.04); }
.guess p { margin: 0 0 8px; } .guess p:last-child { margin: 0; }

.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 28px 24px; margin: 8px 0 22px; }
.numbers > div { border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.numbers .n { font-family: var(--display); font-size: 34px; line-height: 1; color: var(--gold-light); font-variant-numeric: lining-nums; }
.numbers .n small { font-size: 17px; color: var(--ink-dim); }
.numbers .l { font-size: 14px; line-height: 1.5; color: var(--ink-dim); margin-top: 10px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 30px 40px; margin-top: 26px; }
.features p { margin: 0; font-size: 16px; line-height: 1.65; color: var(--ink-soft); }

.ml-science figure { margin: 30px 0 0; }
.ml-science figure img { width: 100%; height: auto; display: block; border-radius: 4px; background: #050505; }
figcaption { font-size: 14px; color: var(--ink-dim); margin-top: 10px; max-width: 80ch; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pair span, .strip span { display: block; font-size: 13px; color: var(--ink); margin-top: 6px; }
.experiment { margin-top: 44px; }
.experiment .prose { margin-bottom: 4px; }
.wide-fig img { max-width: 1100px; }
.chart { width: 100%; max-width: 900px; height: auto; display: block; background: #08090d; border-radius: 6px; }

.eq { font-family: var(--math); font-size: 18px; margin: 16px 0 18px; padding: 10px 0 10px 18px; border-left: 2px solid var(--gold); overflow-x: auto; color: var(--ink); line-height: 1.7; }
.prose i, .eq i { font-family: var(--math); font-style: italic; }
ol.steps { padding-left: 1.4em; margin: 0; }
ol.steps li { margin: 0 0 18px; padding-left: 4px; }
ol.steps li::marker { color: var(--gold); font-family: var(--display); }

.ml-science table { border-collapse: collapse; width: 100%; max-width: 820px; font-size: 14.5px; margin: 18px 0 8px; font-variant-numeric: tabular-nums; }
.ml-science th, .ml-science td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ml-science th { font-weight: 700; color: var(--ink-dim); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.limits { list-style: none; padding: 0; margin: 0; max-width: 68ch; font-size: 16.5px; line-height: 1.65; color: var(--ink-soft); }
.limits li { padding: 12px 0; border-top: 1px solid var(--rule); }
.limits strong { color: var(--ink); font-weight: 700; }
ol.refs { font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); max-width: 80ch; padding-left: 1.6em; margin: 0; }
ol.refs li { margin: 0 0 10px; }
ol.refs i { color: var(--ink); }
.credit-box { border: 1px solid var(--border-subtle); border-radius: 8px; padding: 18px 20px; max-width: 68ch; margin-top: 18px; }
.credit-box code { font-family: var(--math); font-size: 17px; color: var(--ink); }
.credit-box button { margin-top: 12px; }
.ml-more { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 0 0 48px; }

@media (max-width: 700px) {
  #hero { height: auto; min-height: 0; }
  #view, #overlay { position: absolute; top: 0; height: 64svh; }
  #hero { padding-top: 64svh; }
  .title { top: calc(var(--nav-h) + 10px); right: 16px; max-width: none; }
  .title .lede { display: none; }
  .title h1 { font-size: 22px; }
  #caption { top: auto; bottom: calc(100% - 64svh + 10px); left: 10px !important; width: calc(100% - 20px); max-width: none; }
  #curveCard { position: relative; left: auto; bottom: auto; margin: 10px; flex-direction: column; }
  .tel { width: auto; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--rule); padding: 0 0 8px; justify-content: flex-start; }
  #telescope { width: 64px; height: 64px; }
  #curve { height: 150px; }
  #panel { position: relative; top: auto; right: auto; width: auto; max-height: none; margin: 0 10px 12px; }
  #mapLegend { top: calc(var(--nav-h) + 80px); right: 10px; left: 10px; max-width: none; }
  .pair, .strip { grid-template-columns: 1fr; }
}
body.mapview .title .lede { display: none; }
#panel.collapsed ~ #mapLegend, body.bare #mapLegend { right: 24px; }
.legend span[hidden] { display: none; }
body.bare:not(.show-labels) #callouts { display: none; }
body.bare #view, body.bare #overlay { }
