/* ============================================================================
   foyer-base.css — shared styling for the engine-injected DOM.
   Everything is driven by --fx-* custom properties. A variation sets these in
   its own :root (plus window.FoyerTheme for the canvas) and that's the whole
   retheme. Defaults below are the calm near-white "Vellum" baseline.
   ========================================================================== */
:root {
  --fx-ink: #23262b;
  --fx-ink-soft: rgba(35, 38, 43, 0.58);
  --fx-ink-faint: rgba(35, 38, 43, 0.38);
  --fx-ink-ghost: rgba(35, 38, 43, 0.13);
  --fx-hair: rgba(35, 38, 43, 0.09);
  --fx-accent: #ff6600;
  --fx-panel-bg: rgba(253, 254, 254, 0.92);
  --fx-panel-border: rgba(35, 38, 43, 0.13);
  --fx-panel-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 18px 50px -28px rgba(40, 54, 60, 0.30);
  --fx-blur: 14px;
  --fx-radius: 16px;
  --fx-font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  --fx-font-serif: "Larken", Georgia, "Times New Roman", serif;
}

#fx-stage {
  position: fixed; inset: 0; z-index: 1; display: block;
  touch-action: none; cursor: grab;
}
#fx-stage.dragging { cursor: grabbing; }
#fx-cv { display: block; width: 100%; height: 100%; }

/* ---- controls (recenter + linear/exponential toggle) ---- */
#fx-controls { z-index: 20; }
/* linear/exponential toggle lives on the RIGHT SIDE, vertically centered,
   as a quiet vertical stack — keeps the top edge clean for the pill. */
#fx-toggle {
  position: fixed; top: 50%; right: 30px; transform: translateY(-50%); z-index: 20;
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px; user-select: none;
}
#fx-toggle button {
  border: 0; background: transparent; font-family: var(--fx-font-sans);
  font-size: 9.5px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--fx-ink-faint); padding: 6px 2px 6px 14px; cursor: pointer;
  transition: color 0.4s ease; position: relative; text-align: right;
}
#fx-toggle button.active { color: var(--fx-ink); }
#fx-toggle button.active::after {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 11px; background: var(--fx-ink);
}
#fx-toggle button:not(.active):hover { color: var(--fx-ink-soft); }

#fx-recenter {
  position: fixed; bottom: 32px; right: 34px; z-index: 20;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--fx-ink-ghost); background: var(--fx-panel-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color 0.4s ease, transform 0.4s cubic-bezier(.2,.8,.2,1);
}
#fx-recenter:hover { border-color: var(--fx-ink-faint); }
#fx-recenter:active { transform: scale(0.94); }
#fx-recenter svg { display: block; width: 18px; height: 18px; }
#fx-recenter circle, #fx-recenter line { stroke: var(--fx-ink-soft); fill: none; stroke-width: 1.1; }

#fx-hint {
  position: fixed; bottom: 34px; left: 34px; z-index: 20;
  font-size: 9.5px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fx-ink-ghost); font-family: var(--fx-font-sans);
  pointer-events: none; user-select: none;
}

/* ---- detail card ---- */
.fx-card {
  position: fixed; z-index: 40; width: 286px;
  background: var(--fx-panel-bg); border: 1px solid var(--fx-panel-border);
  border-radius: var(--fx-radius); padding: 22px 24px 24px;
  backdrop-filter: blur(var(--fx-blur)) saturate(1.03);
  -webkit-backdrop-filter: blur(var(--fx-blur)) saturate(1.03);
  box-shadow: var(--fx-panel-shadow);
  font-family: var(--fx-font-sans); color: var(--fx-ink);
  opacity: 0; transform: translateY(6px) scale(0.99); pointer-events: none;
  transition: opacity 0.36s cubic-bezier(.2,.7,.2,1), transform 0.36s cubic-bezier(.2,.7,.2,1);
}
.fx-card.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.fx-card .ch { font-size: 9px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--fx-ink-faint); }
.fx-card .nm { margin-top: 9px; font-size: 21px; font-weight: 500; letter-spacing: -0.01em; color: var(--fx-ink); }
.fx-card .last { margin-top: 4px; font-size: 12px; color: var(--fx-ink-soft); }
.fx-card .rule { height: 1px; background: var(--fx-hair); margin: 18px 0 16px; }
.fx-card .barlabels { display: flex; justify-content: space-between; font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fx-ink-faint); margin-bottom: 7px; }
.fx-card .bar { height: 3px; background: var(--fx-ink-ghost); border-radius: 2px; position: relative; overflow: hidden; }
.fx-card .bar .you { position: absolute; left: 0; top: 0; bottom: 0; background: var(--fx-ink); width: 0; transition: width 0.55s cubic-bezier(.2,.7,.2,1); }
.fx-card .barpct { display: flex; justify-content: space-between; font-size: 10px; color: var(--fx-ink-soft); margin-top: 6px; }
.fx-card .stats { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.fx-card .stat .k { font-size: 8.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--fx-ink-faint); }
.fx-card .stat .v { margin-top: 3px; font-size: 15px; font-weight: 500; color: var(--fx-ink); letter-spacing: -0.01em; }
.fx-card .stat .v small { font-size: 10px; font-weight: 400; color: var(--fx-ink-faint); letter-spacing: 0; }
.fx-card-close { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%; border: none; background: none; cursor: pointer; color: var(--fx-ink-faint); font-size: 15px; line-height: 1; display: none; }

/* ---- waitlist modal ---- */
.fx-modal-backdrop {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: color-mix(in srgb, var(--fx-ink) 22%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none; transition: opacity 0.32s ease;
}
.fx-modal-backdrop.show { opacity: 1; pointer-events: auto; }
.fx-modal {
  position: relative; width: min(25rem, 100%);
  background: var(--fx-panel-bg); border: 1px solid var(--fx-panel-border);
  border-radius: calc(var(--fx-radius) + 4px); padding: 34px 32px 32px;
  box-shadow: var(--fx-panel-shadow); color: var(--fx-ink); font-family: var(--fx-font-sans);
  transform: translateY(8px) scale(0.985); transition: transform 0.32s cubic-bezier(.2,.7,.2,1);
}
.fx-modal-backdrop.show .fx-modal { transform: translateY(0) scale(1); }
.fx-modal-close { position: absolute; top: 16px; right: 16px; width: 26px; height: 26px; border: none; background: none; cursor: pointer; color: var(--fx-ink-faint); font-size: 18px; line-height: 1; border-radius: 50%; transition: color 0.2s; }
.fx-modal-close:hover { color: var(--fx-ink); }
.fx-modal-title { font-family: var(--fx-font-serif); font-size: 1.4rem; font-weight: 500; letter-spacing: -0.015em; color: var(--fx-ink); }
.fx-modal-sub { margin-top: 9px; font-size: 0.875rem; line-height: 1.55; color: var(--fx-ink-soft); }
.fx-modal-form { margin-top: 20px; }
.fx-modal-input {
  width: 100%; padding: 0.8rem 0.9rem; border-radius: 0.7rem;
  border: 1px solid var(--fx-panel-border); background: color-mix(in srgb, var(--fx-panel-bg) 60%, transparent);
  font-family: var(--fx-font-sans); font-size: 0.95rem; color: var(--fx-ink); outline: none;
  transition: border-color 0.2s;
}
.fx-modal-input:focus { border-color: var(--fx-accent); }
.fx-modal-input::placeholder { color: var(--fx-ink-faint); }
.fx-modal-error { min-height: 1.1rem; margin-top: 7px; font-size: 0.75rem; color: #e0533b; }
.fx-modal-submit {
  width: 100%; margin-top: 6px; padding: 0.82rem 1rem; border: none; border-radius: 9999px;
  background: var(--fx-ink); color: var(--fx-panel-bg); cursor: pointer;
  font-family: var(--fx-font-sans); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.01em;
  transition: opacity 0.18s, transform 0.18s;
}
.fx-modal-submit:hover { opacity: 0.9; }
.fx-modal-submit:active { transform: scale(0.99); }
.fx-modal-success { display: none; text-align: center; padding: 6px 0 4px; }
.fx-modal.done, .fx-modal-backdrop.done .fx-modal { }
.fx-modal-backdrop.done .fx-modal .fx-modal-body { display: none; }
.fx-modal-backdrop.done .fx-modal .fx-modal-success { display: block; }
.fx-modal-check { width: 2.9rem; height: 2.9rem; margin: 0 auto 16px; border-radius: 50%; background: var(--fx-accent); display: flex; align-items: center; justify-content: center; }
.fx-modal-check svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 520px) {
  .fx-card { width: calc(100vw - 36px); left: 18px !important; right: 18px; bottom: 18px !important; top: auto !important; }
  .fx-card-close { display: block; }
  #fx-toggle { top: 18px; right: 18px; }
  #fx-recenter { bottom: 18px; right: 18px; }
  #fx-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fx-card, .fx-modal, .fx-modal-backdrop, #fx-recenter { transition: none; }
}
