/* Razor's Edge — web proposal. Night palette to match the simulator hero; typography after export/proposal.css */
:root {
  --bg: #070a14;
  --bg-2: #0b0f1d;
  --ink: #dfe2ec;
  --ink-strong: #ffffff;
  --muted: #9aa1b8;
  --rule: rgba(255, 255, 255, 0.1);
  --laser: #4d86ff;
  --laser-soft: rgba(77, 134, 255, 0.22);
  --link: #86a9ff;
  --sand: #c8a878;
  --serif: "Charter", "Iowan Old Style", "Source Serif Pro", Georgia, serif;
  --sans: "Avenir Next", "Avenir", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --measure: 40rem;
  --wide: 58rem;
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

a { color: var(--link); text-decoration: underline; text-decoration-color: rgba(134, 169, 255, 0.35); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--laser); outline-offset: 3px; }

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

.hero { position: relative; background: var(--bg); }
.hero__stage {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: #120f22;
}
.hero__sim { position: absolute; inset: 0; }
.hero__poster, .hero__fallback, .hero__sim iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  object-fit: cover;
}
.hero__sim iframe {
  pointer-events: none;           /* scrolling and touches go to the page */
  opacity: 0;
  transition: opacity 1.4s ease;
}
.hero.is-live .hero__sim iframe { opacity: 1; }
.hero__fallback[hidden] { display: none; }
/* Darken the top for the title and the bottom for the controls */
.hero__stage::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 6, 18, 0.55) 0%, rgba(6, 6, 18, 0) 30%),
    linear-gradient(0deg, rgba(4, 5, 11, 0.9) 0%, rgba(4, 5, 11, 0) 26%);
}

.hero__title {
  position: absolute; z-index: 2;
  left: 0; right: 0;
  top: clamp(1.5rem, 9vh, 6rem);
  padding: 0 1.5rem;
  text-align: center;
  font-family: var(--sans);
  pointer-events: none;
}
.hero__eyebrow {
  margin: 0;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.32em; text-transform: uppercase;
  color: rgba(196, 206, 255, 0.82);
}
.hero__title h1 {
  margin: 0.3rem 0 0.4rem;
  font-size: clamp(2.9rem, 8vw, 6.75rem);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #fff;
  text-shadow: 0 0 30px rgba(80, 130, 255, 0.5), 0 0 2px rgba(150, 180, 255, 0.6);
}
.hero__subtitle {
  margin: 0;
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  color: rgba(255, 255, 255, 0.82);
}
.hero__status {
  position: absolute; z-index: 2;
  left: 0; right: 0; bottom: 9.5rem;
  margin: 0;
  text-align: center;
  font-family: var(--sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  transition: opacity 0.4s;
}
.hero__status:empty { opacity: 0; }
.hero__status .dot { display: inline-block; width: 7px; height: 7px; margin-right: 0.6em; border-radius: 50%; background: var(--c, var(--laser)); box-shadow: 0 0 8px var(--c, var(--laser)); vertical-align: 0.05em; }

.hero__scroll {
  position: absolute; z-index: 3;
  top: 1rem; right: 1.25rem;
  font-family: var(--sans); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(8, 10, 20, 0.35);
  backdrop-filter: blur(6px);
}
.hero__scroll:hover { color: #fff; }

/* Controls ------------------------------------------------------------------------------ */

.controls {
  position: absolute; z-index: 3;
  left: 50%; bottom: 1.25rem;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 2rem);
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center;
  gap: 0.9rem 1.6rem;
  padding: 0.9rem 1.4rem 1rem;
  font-family: var(--sans);
  color: var(--ink);
  background: rgba(9, 11, 22, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.controls[hidden] { display: none; }
.control { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.control__label {
  padding: 0;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted);
}
.control__value { letter-spacing: 0.06em; text-transform: none; font-weight: 500; color: rgba(255, 255, 255, 0.75); margin-left: 0.4em; }
.control--anim { flex-direction: column; }
.control--anim .seg + .swatches { margin-top: 0.1rem; }

.seg {
  display: inline-flex; flex-wrap: wrap;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.03);
}
.seg button, .swatches button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.seg button {
  min-height: 34px;
  padding: 0.3rem 0.85rem;
  border: 0; border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem; font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg button:hover { color: #fff; }
.seg button[aria-pressed="true"] {
  color: #fff;
  background: var(--laser-soft);
  box-shadow: inset 0 0 0 1px rgba(110, 155, 255, 0.65), 0 0 14px rgba(77, 134, 255, 0.25);
}

.swatches { display: flex; gap: 0.55rem; align-items: center; padding-left: 0.2rem; }
.swatches button {
  width: 24px; height: 24px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: var(--c);
  box-shadow: 0 0 6px color-mix(in srgb, var(--c) 45%, transparent);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.swatches button:hover { transform: scale(1.1); }
.swatches button[aria-pressed="true"] {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(9, 11, 22, 0.9), 0 0 14px var(--c);
}

.slider { display: flex; align-items: center; gap: 0.6rem; font-size: 0.78rem; color: var(--muted); min-height: 40px; }
.slider input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 11rem; height: 4px; margin: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(160, 190, 255, 0.35), var(--sand));
  cursor: pointer;
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 0;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.slider input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 0;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.5);
}

.control--link {
  align-self: flex-end;
  min-height: 40px;
  display: inline-flex; align-items: center;
  padding: 0 0.2rem;
  font-size: 0.88rem; font-weight: 500;
  color: var(--link);
  text-decoration: none;
  white-space: nowrap;
}
.control--link:hover { color: #fff; }

/* No WebGL: concept image, no controls */
.hero.no-webgl .hero__poster, .hero.no-webgl .hero__sim, .hero.no-webgl .hero__status { display: none; }
.hero.no-webgl .hero__title { top: auto; bottom: clamp(2rem, 9vh, 6rem); }

/* Narrow screens: the stage is shorter and the controls sit below it */
@media (max-width: 900px) {
  .hero__stage { height: 64vh; height: 64svh; min-height: 380px; }
  .hero__status { bottom: 1rem; }
  .controls {
    position: static; transform: none;
    width: auto; max-width: none;
    margin: 0;
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1.1rem 1rem;
    padding: 1.1rem 1rem 1.4rem;
    border-radius: 0; border-width: 1px 0 0;
    background: var(--bg-2);
    box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .control--dust, .control--anim, .control--link { grid-column: 1 / -1; }
  .slider input[type="range"] { flex: 1; width: auto; }
  .seg { width: 100%; }
  .seg button { flex: 1 1 auto; min-height: 42px; padding: 0.3rem 0.6rem; }
  .swatches { gap: 0.9rem; padding: 0.3rem 0 0 0.2rem; }
  .swatches button { width: 32px; height: 32px; }
  .control--link { justify-content: center; border: 1px solid rgba(134, 169, 255, 0.35); border-radius: 999px; min-height: 44px; }
  .hero__scroll { display: none; }
  .hero__eyebrow { font-size: 0.68rem; letter-spacing: 0.22em; }
}
/* Portrait: render the sim taller than the stage, so the ridge sits lower and the empty
   foreground is cropped off the bottom */
@media (max-width: 900px) and (orientation: portrait) {
  .hero__sim { bottom: auto; height: 135%; }
}
@media (max-width: 420px) {
  .controls { grid-template-columns: 1fr; }
  .seg button { font-size: 0.8rem; }
}

/* ------------------------------------------------------------------------------------ */
/* Proposal */

.proposal {
  background:
    radial-gradient(1200px 400px at 50% 0, rgba(60, 70, 140, 0.18), transparent 70%),
    linear-gradient(180deg, var(--bg-2) 0, var(--bg) 40rem);
  padding: clamp(3rem, 8vw, 6rem) 1.4rem 4rem;
}
.proposal article { max-width: var(--measure); margin: 0 auto; }

.proposal h2, .proposal h3 {
  font-family: var(--sans);
  color: var(--ink-strong);
  line-height: 1.2;
}
.proposal h2 {
  position: relative;
  font-size: clamp(1.55rem, 3vw, 1.95rem);
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 4.5rem 0 1.1rem;
  padding-top: 1.4rem;
}
.proposal h2::before {
  content: "";
  position: absolute; left: 0; top: 0;
  width: 3rem; height: 2px;
  border-radius: 2px;
  background: var(--laser);
  box-shadow: 0 0 10px var(--laser), 0 0 22px rgba(77, 134, 255, 0.6);
}
.proposal h3 {
  font-size: 1.22rem;
  font-weight: 600;
  margin: 2.6rem 0 0.6rem;
}
.proposal p { margin: 0 0 1.15em; }
.proposal strong { color: var(--ink-strong); font-weight: 600; }

.lede blockquote {
  margin: 2.4rem 0 2.6rem;
  padding: 0.2rem 0 0.2rem 1.4rem;
  border-left: 2px solid var(--laser);
  box-shadow: -8px 0 16px -10px rgba(77, 134, 255, 0.9);
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  line-height: 1.45;
  color: var(--ink-strong);
}
.lede blockquote p { margin: 0; }

.proposal ul, .proposal ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.proposal li { margin: 0.35em 0; }
.proposal li::marker { color: var(--laser); }
.proposal ol li::marker { font-family: var(--sans); font-weight: 600; }

/* Figures */
.proposal figure { margin: 2.6rem 0; }
.proposal figure img {
  display: block;
  width: 100%; height: auto;
  border-radius: 10px;
  background: #111;
}
.proposal figure.lead, .proposal figure.wide, .proposal figure.sim-embed {
  width: min(var(--wide), calc(100vw - 2.8rem));
  position: relative; left: 50%; transform: translateX(-50%);
}
.proposal figure.lead { margin-top: 0; }
.proposal figcaption {
  margin-top: 0.8rem;
  font-family: var(--sans);
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}
.proposal figcaption em { font-style: normal; }
.proposal figure.wide figcaption, .proposal figure.sim-embed figcaption { max-width: var(--measure); margin-inline: auto; }

/* Live simulator embeds */
.sim-embed__frame {
  position: relative;
  aspect-ratio: var(--ratio, 16 / 9);
  border-radius: 12px;
  overflow: hidden;
  background: #05070d;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.sim-embed__frame img.sim-embed__poster {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 0;
}
.sim-embed__frame iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.sim-embed.is-live .sim-embed__frame iframe { opacity: 1; }
.sim-embed__badge {
  position: absolute; z-index: 2; top: 0.7rem; left: 0.7rem;
  padding: 0.25rem 0.65rem 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(6, 8, 16, 0.6);
  backdrop-filter: blur(6px);
  font-family: var(--sans); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}
.sim-embed__badge::before {
  content: "";
  display: inline-block; width: 6px; height: 6px; margin-right: 0.5em;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  vertical-align: 0.1em;
}
.sim-embed.is-loading .sim-embed__badge::before { animation: blink 1s infinite alternate; background: var(--laser); }
.sim-embed.is-live .sim-embed__badge::before { background: #5fe39a; box-shadow: 0 0 6px #5fe39a; }
.no-webgl .sim-embed__badge { display: none; }
@keyframes blink { to { opacity: 0.25; } }
.sim-embed__open { white-space: nowrap; margin-left: 0.3em; }

/* Task list (pandoc: ul.task-list > li > input[type=checkbox]) */
.proposal ul.task-list { list-style: none; padding-left: 0; }
.proposal ul.task-list ul.task-list { padding-left: 0; margin: 0.3em 0 0.2em; }
.proposal ul.task-list li { position: relative; padding-left: 1.9em; }
.proposal ul.task-list li::marker { content: none; }
.proposal ul.task-list li input[type="checkbox"] {
  position: absolute; left: 0; top: 0.36em;
  appearance: none; -webkit-appearance: none;
  font-size: inherit;
  width: 0.95em; height: 0.95em; margin: 0;
  border: 1.5px solid rgba(110, 155, 255, 0.85);
  border-radius: 4px;
  background: rgba(77, 134, 255, 0.06);
  box-shadow: 0 0 8px rgba(77, 134, 255, 0.2);
}
.proposal ul.task-list li input[type="checkbox"]:checked { background: var(--laser); }
.proposal ul.task-list li > label { display: contents; }
.proposal ul.task-list li input[type="checkbox"] { pointer-events: none; }

code { font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2rem 1.4rem 3rem;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
}
.site-footer p { margin: 0.3rem 0; }

/* Controls under an inline embed */
.embed-controls {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 0.75rem;
  margin: 0.7rem auto 0;
  font-family: var(--sans, "Avenir Next", sans-serif);
}
.embed-controls .control { align-items: center; }
.embed-controls .slider input[type="range"] { width: min(18rem, 55vw); }
