:root { --panel-w: 300px; }

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000000;
}

body[data-ui="off"] { --panel-w: 0px; }

.view {
  position: fixed;
  inset: 0 var(--panel-w) 0 0;
}

#hero {
  display: block;
  width: 100%;
  height: 100%;
}

/* Without WebGL 2 (webgl.js), a dark backdrop with a little light in it. */
body[data-fallback] #hero { visibility: hidden; }
body[data-fallback] .view { background: radial-gradient(ellipse 70% 55% at 50% 55%, #1c2636, #050608 70%); }

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--panel-w);
  box-sizing: border-box;
  padding: 12px;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: #111215;
  scrollbar-width: thin;
  /* Keep room for the scrollbar, so folding the panel doesn't change its width. */
  scrollbar-gutter: stable;
}

body[data-ui="off"] .sidebar { display: none; }

.sidebar .tp-rotv {
  --tp-base-background-color: #1a1c21;
  --tp-container-background-color: rgba(255, 255, 255, 0.06);
  --tp-input-background-color: rgba(255, 255, 255, 0.07);
  --tp-label-foreground-color: #a8aebb;
  --cnt-usz: 22px;
  font-size: 12px;
}

/* Phones: the scene on top, the settings in a sheet below it. */
@media (max-width: 720px) {
  :root {
    --panel-w: 0px;
    --sheet-h: min(56dvh, 520px);
  }

  body[data-ui="off"] { --sheet-h: 0px; }

  .view { inset: 0 0 var(--sheet-h) 0; }

  .sidebar {
    top: auto;
    left: 0;
    width: auto;
    height: var(--sheet-h);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 0;
    overscroll-behavior: contain;
  }
}

/* Fingers: taller rows, and text fields large enough that the page doesn't zoom in on them. */
@media (pointer: coarse) {
  .sidebar .tp-rotv { --cnt-usz: 30px; font-size: 13px; }
  .sidebar input { font-size: 16px; }
}

/* ---------- The demo landing page over the scene (landing.js) ---------- */

.landing {
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --display: "Raleway", "Space Grotesk", system-ui, sans-serif;
  position: absolute;
  inset: 0;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0 clamp(20px, 3cqw, 48px);
  container-type: size;
  color: #ffffff;
  font-family: var(--sans);
  pointer-events: none;
}

.landing[hidden] { display: none; }

/* A soft shade where the copy sits, so it reads over bright scenes too. */
.landing::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 16%),
    linear-gradient(to right, rgba(0, 0, 0, 0.5), transparent 55%);
}

.landing[data-layout="center"]::before {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 16%),
    radial-gradient(ellipse 60% 45% at 50% 55%, rgba(0, 0, 0, 0.35), transparent);
}

.landing a {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.landing h1,
.landing h2,
.landing p { margin: 0; }

.landing_nav,
.landing_button,
.landing h2 {
  font-family: var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Nav: brand, links in the middle, the main button. */
.landing_nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  height: 72px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
}

.landing_brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.landing_brand svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.landing_links { display: flex; gap: clamp(20px, 3cqw, 48px); }
.landing_links a { opacity: 0.75; }
.landing_links a:hover { opacity: 1; }
.landing_actions { display: flex; justify-content: flex-end; }

.landing_button {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  border: 1px solid #ffffff;
  background: #ffffff;
  color: #0b0b0c !important;
  font-size: 13px;
}

.landing_ghost {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.2);
  color: #ffffff !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.landing_main {
  display: grid;
  min-height: 0;
  padding: clamp(24px, 6cqh, 72px) 0 clamp(28px, 6cqh, 64px);
}

.landing h1 {
  font-family: var(--display);
  font-size: clamp(44px, min(8cqw, 13cqh), 150px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.015em;
}

.landing_body {
  margin-bottom: 24px !important;
  font-size: clamp(15px, 1.3cqw, 19px);
  opacity: 0.85;
}

.landing_ctas { display: flex; flex-wrap: wrap; gap: 12px; }

/* Left: the headline at the top, its line and buttons at the foot, and
   the frame-time card on the right. */
.landing[data-layout="left"] .landing_main {
  grid-template-columns: 1fr minmax(280px, 26cqw);
  gap: 32px;
}

.landing[data-layout="left"] .landing_copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.landing h1 > * { display: block; }

/* Centred: the headline and its foot together in the middle, no card. */
.landing[data-layout="center"] .landing_copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4cqh, 40px);
  text-align: center;
}

.landing[data-layout="center"] h1 { font-size: clamp(40px, min(7cqw, 11cqh), 124px); }
.landing[data-layout="center"] .landing_ctas { justify-content: center; }
.landing[data-layout="center"] .landing_card { display: none; }

/* The frame-time card: its name, the latest figure and ten seconds of it. */
.landing_card {
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 14, 16, 0.45);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}

.landing h2 { font-size: 12px; font-weight: 500; opacity: 0.6; }
.landing_figure { font-size: 32px; font-variant-numeric: tabular-nums; }

.landing_chart {
  display: block;
  width: 100%;
  height: clamp(70px, 14cqh, 140px);
  overflow: visible;
}

.landing_chart path { vector-effect: non-scaling-stroke; fill: none; }
.landing_budget { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; stroke-dasharray: 3 4; }
.landing_chart .landing_area { fill: url(#landing-fill); stroke: none; }
.landing_chart .landing_line { stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.5; stroke-linejoin: round; }

/* Narrower: the card goes first, then the nav links. */
@container (max-width: 1000px) {
  .landing[data-layout="left"] .landing_main { grid-template-columns: 1fr; }
  .landing_card { display: none; }
}

@container (max-width: 720px) {
  .landing_links { display: none; }
  .landing_nav { grid-template-columns: 1fr auto; }
}
