/* ─────────────────────────────────────────────────────────────────────────────
   shared.css — Longboard Technology site-wide tokens & primitives
   Imported by every page. Defines brand variables, typography, site nav.
   Component-level CSS (sliders, viewport, etc.) lives in each tool's page.
   ──────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700;900&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

/* ── Brand tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Palette — navy + accent green, white text. Accent is reserved for primary
     actions and structural accents. Generators should use neutral grays/whites
     for secondary content. */
  --navy:        #07091a;
  --navy-mid:    #0d1330;
  --navy-soft:   #131a3a;
  /* Brand accent (kelly green, sampled from ABEC11 Strikers reference). */
  --accent:        #1ec73d;                        /* HSL(131°, 73%, 45%)  */
  --accent-bright: #46e262;                        /* HSL(131°, 73%, 58%)  */
  --accent-dim:    rgba(30, 199, 61, 0.12);        /* low-alpha bg fill    */
  --accent-glow:   rgba(30, 199, 61, 0.35);        /* hover / focus halo   */

  --white:       #ffffff;
  --text:        #e8eaf0;
  --text-mid:    rgba(255, 255, 255, 0.75);
  --text-dim:    rgba(255, 255, 255, 0.55);
  --text-faint:  rgba(255, 255, 255, 0.30);

  --border:      rgba(30, 199, 61, 0.20);          /* tinted with --accent */
  --border-mid:  rgba(255, 255, 255, 0.12);
  --border-dim:  rgba(255, 255, 255, 0.06);

  /* Surfaces (tool sidebars, cards) — bluer than --navy so the foreground
     palette reads as "lit room over deep space" rather than a single flat
     dark. Top nav stays on --navy itself for the deeper backdrop feel. */
  --surface:     #141f33;       /* HSL(220°, 43%, 14%) — sidebar / gen-header */
  --surface-2:   #1d2742;       /* HSL(222°, 38%, 19%) — cards inside sidebar */
  --surface-3:   #283355;       /* HSL(222°, 35%, 25%) — focused inputs, hovers */

  --ok:          #3ecf7a;
  --warn:        #f5a623;
  --err:         #e55353;

  /* Anodized purple — for slider clamp markers. Three stops give a metallic
     "bar caught by a top-light" gradient. Used in shared.css below. */
  --anodize-bright: #b693e0;
  --anodize-mid:    #6840a0;
  --anodize-deep:   #3a2266;
  --anodize-glow:   rgba(106, 60, 160, 0.35);

  /* Type */
  --display:     'Orbitron', system-ui, sans-serif;
  --mono:        'Space Mono', 'SF Mono', monospace;

  /* Layout */
  --nav-h:       56px;
  --radius:      10px;
  --sidebar-w:   300px;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--navy);
  color: var(--text);
  font-family: var(--mono);
  overflow-x: hidden;
  max-width: 100vw;
}
a { color: inherit; }

/* ── Site nav ─────────────────────────────────────────────────────────────── */
.nav-accent-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; background: var(--accent); z-index: 101;
}
.site-nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h); z-index: 100;
  background: rgba(7, 9, 26, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.25rem; gap: 1rem;
  font-family: var(--display);
  max-width: 100vw;
  overflow: hidden;
}
.nav-logo {
  font-size: 0.62rem; font-weight: 900; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--white); text-decoration: none;
  white-space: nowrap; flex-shrink: 0;
}
.nav-logo span { color: var(--accent); }
.nav-links {
  display: flex; gap: 0; list-style: none;
  margin-left: auto; flex-shrink: 0;
}
.nav-links a {
  display: block; padding: 0 0.75rem;
  height: var(--nav-h); line-height: var(--nav-h);
  font-size: 0.5rem; letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim); text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.nav-links a:hover { color: var(--white); }
.nav-links a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tool app shell ───────────────────────────────────────────────────────── */
/* Used by tool pages: nav at top, then app fills remaining viewport */
.tool-app {
  display: flex; flex-direction: column;
  height: 100vh;
  padding-top: var(--nav-h);
  max-width: 100vw;
  overflow: hidden;
}
.tool-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-mid);
  flex-shrink: 0;
}
.tool-header h1 {
  font-family: var(--display);
  font-size: 0.9rem; font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tool-body { display: flex; flex: 1; overflow: hidden; min-height: 0; }
.tool-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border-mid);
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.tool-sidebar-inner {
  padding: 16px;
  display: flex; flex-direction: column; gap: 18px;
  width: 100%; min-width: 0;
}
.tool-viewport {
  flex: 1; position: relative;
  background: #0a0c14;
  overflow: hidden; min-width: 0;
}

/* Mobile: stack sidebar below viewport */
@media (max-width: 640px) {
  .tool-body { flex-direction: column-reverse; }
  .tool-sidebar {
    width: 100%; border-right: none;
    border-top: 1px solid var(--border-mid);
    max-height: 52vh; flex-shrink: 0;
  }
  .tool-sidebar-inner { padding: 12px; gap: 14px; }
  .tool-viewport { flex: 1; min-height: 180px; }
  .nav-links a { padding: 0 0.5rem; font-size: 0.45rem; }
}
@media (min-width: 641px) and (max-width: 900px) {
  :root { --sidebar-w: 240px; }
}

/* ── Section labels (used in sidebars) ────────────────────────────────────── */
.section-label {
  font-family: var(--display);
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border-mid);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px;
  font-family: var(--display);
  font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  cursor: pointer; border: none;
  border-radius: 4px;
  transition: all 0.15s;
  min-height: 44px; width: 100%;
}
.btn-primary {
  background: var(--accent); color: var(--navy);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-bright);
  box-shadow: 0 0 14px var(--accent-glow);
}
.btn-primary:disabled {
  background: var(--surface-3); color: var(--text-faint);
  cursor: not-allowed; box-shadow: none;
}
.btn-secondary {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-mid);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent); color: var(--accent);
}
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

/* Mission report — ghost link below the action buttons. Quiet by design:
   reads as a label, never competes with the primary/secondary actions. */
.btn-feedback {
  background: none; color: var(--text-dim); border: none;
  padding: 8px 12px; margin-top: 6px;
  font-family: var(--display);
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  cursor: pointer; text-align: center; width: 100%;
  min-height: 0; border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.btn-feedback:hover { color: var(--text); background: var(--surface-2); }
.btn-feedback:active { transform: translateY(1px); }

.btn-row { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 640px) { .btn-row { flex-direction: row; } }

/* ── Feedback modal ───────────────────────────────────────────────────────────
   Wraps the embedded Tally form in our brand frame. Modal is injected lazily
   by shared.js; this CSS owns the wrapper styling — Tally owns the form fields
   inside the iframe. */
.feedback-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.feedback-modal.visible { display: flex; }
.feedback-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.feedback-frame {
  position: relative; z-index: 1;
  width: 100%; max-width: 640px;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.feedback-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-mid);
  flex-shrink: 0;
}
.feedback-title {
  font-family: var(--display);
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text);
}
.feedback-close {
  background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  font-size: 1.3rem; line-height: 1;
  padding: 2px 10px; border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.feedback-close:hover { color: var(--text); background: var(--surface-3); }
.feedback-body {
  flex: 1; overflow-y: auto;            /* scroll the modal body, not the iframe */
  background: var(--surface);
  min-height: 0;
}
.feedback-iframe {
  width: 100%; min-height: 600px;       /* dynamicHeight postMessage updates this at runtime */
  border: none; display: block;
}
@media (max-width: 640px) {
  .feedback-modal { padding: 0; }
  .feedback-frame {
    max-width: none; max-height: 100vh; height: 100vh;
    border-radius: 0; border: none;
  }
}

/* ── Info icon + tooltip popover ──────────────────────────────────────────────
   Small italic 'i' in a muted circle. Tap-reveals a brief popover anchored
   to the icon. Hit target is intentionally larger than the visual circle so
   it stays touch-friendly inside cramped controls. */
.info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 10px; height: 10px;
  flex-shrink: 0;
  border: none; padding: 0; margin: 0 0 0 5px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-dim);
  font-family: 'Times New Roman', serif;     /* italic 'i' renders cleaner in serif */
  font-size: 9px; font-weight: 700; font-style: italic;
  line-height: 1;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
/* Expand the touch target without growing the visual */
.info-btn::before {
  content: ''; position: absolute; inset: -8px;
}
.info-btn:hover, .info-btn.active, .info-btn:focus-visible {
  background: var(--accent-dim); color: var(--accent);
  outline: none;
}

/* Variant for use inside mode/style cards — top-right corner of the card */
.mode-btn, .pattern-btn { position: relative; }
.mode-btn .info-btn, .pattern-btn .info-btn {
  position: absolute; top: 5px; right: 5px;
  margin: 0;
}

/* When a clamp label is showing in the same control-name-wrap, hide the info
   icon to free up horizontal space. The "Min applied" / "Max applied" badge
   competes with the label + icon + value on the same line, and the row is
   already in a state where the user is reading constraint feedback, not help.
   Falls back gracefully on browsers without :has() — icon stays visible and
   the row overflows slightly, same as before this rule existed. */
.control-name-wrap:has(.clamp-label.visible) .info-btn {
  display: none;
}

.tooltip-popover {
  position: absolute;
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 0.72rem; line-height: 1.5;
  color: var(--text);
  max-width: 240px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.15s, transform 0.15s;
}
.tooltip-popover.visible {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 640px) {
  .tooltip-popover { max-width: calc(100vw - 24px); }
}

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(7, 9, 26, 0.3);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.spinner.visible { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Validation messages ──────────────────────────────────────────────────── */
.validation-msg {
  font-size: 0.7rem;
  padding: 7px 10px; border-radius: 4px;
  border-left: 3px solid var(--err);
  background: rgba(229, 83, 83, 0.08);
  color: var(--err);
  display: none;
  line-height: 1.4;
}
.validation-msg.visible { display: block; }

/* ── Stat values ─────────────────────────────────────────────────────────── */
.stat-val.ok   { color: var(--ok); }
.stat-val.warn { color: var(--warn); }
.stat-val.err  { color: var(--err); }

/* ── Slider markers (min/max constraint indicators) ──────────────────────── */
/* Bracket-shaped boundary markers: min = "[" (opens right toward valid zone),
   max = "]" (opens left). Treated as small machined anodized parts —
   horizontal gradient on the vertical bar reads as light raking across a
   polished rod, vertical gradient on the bracket ticks reads as light from
   above. Top-edge inset highlight + bottom-edge inset shadow add millimetre-
   scale dimension; outer glow lifts the marker off the slider track. */
.slider-marker {
  position: absolute; top: 50%;
  transform: translate(-50%, -50%);
  width: 4px; height: 16px;
  border-radius: 1px;
  background: linear-gradient(
    to right,
    var(--anodize-bright) 0%,
    var(--anodize-mid)    50%,
    var(--anodize-deep)   100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),    /* top highlight */
    inset 0 -1px 0 rgba(0, 0, 0, 0.30),         /* bottom shadow */
    0 0 5px var(--anodize-glow);                /* ambient halo */
  pointer-events: none;
  display: none;
}
.slider-marker.visible { display: block; }

.slider-marker::before,
.slider-marker::after {
  content: ''; position: absolute;
  width: 7px; height: 2px;
  border-radius: 1px;
  background: linear-gradient(
    to bottom,
    var(--anodize-bright) 0%,
    var(--anodize-mid)    50%,
    var(--anodize-deep)   100%
  );
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, 0.22),
    0 0 3px var(--anodize-glow);
}
.slider-marker.is-min::before { top: 0;    left: 100%; }
.slider-marker.is-min::after  { bottom: 0; left: 100%; }
.slider-marker.is-max::before { top: 0;    right: 100%; }
.slider-marker.is-max::after  { bottom: 0; right: 100%; }

/* ── Starfield canvas helper ──────────────────────────────────────────────── */
/* IMPORTANT: <canvas> is a replaced element with intrinsic dimensions (default
   300×150 px). For replaced elements with `width: auto`, `inset: 0` alone does
   NOT auto-stretch — the intrinsic size wins and the canvas displays at 300×150
   in the top-left of its containing block. Forcing explicit width/height in CSS
   overrides the intrinsic and lets the layout fill the containing block as
   expected. Without this rule, stars only appear in a 300×150 corner. */

/* Full-viewport variant — landing page background atmosphere. */
canvas.starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

/* Constrained nav-strip variant — sits inside .site-nav, between the nav's
   navy background and its text/logo children. The nav uses overflow:hidden
   so the canvas is naturally clipped to the 56 px banner.
   width: calc(100% + 2.5rem) with left: -1.25rem extends the canvas through
   .site-nav's horizontal padding so stars reach the viewport edges; the nav's
   overflow:hidden clips anything past the border box. */
canvas.starfield-nav {
  position: absolute;
  top: 0; left: -1.25rem;
  width: calc(100% + 2.5rem); height: 100%;
  z-index: 0; pointer-events: none;
}
.site-nav > .nav-logo,
.site-nav > .nav-links { position: relative; z-index: 1; }

/* ── Tool viewport overlays ─────────────────────────────────────────────── */
.viewport-hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-size: 0.6rem; letter-spacing: 0.1em;
  color: var(--text-dim);
  background: rgba(7, 9, 26, 0.75);
  padding: 5px 12px; border-radius: 20px;
  pointer-events: none; white-space: nowrap;
  border: 1px solid var(--border-mid);
}
.viewport-status {
  position: absolute; top: 12px; left: 12px;
  font-size: 0.65rem; letter-spacing: 0.05em;
  color: var(--text-dim);
  background: rgba(7, 9, 26, 0.8);
  padding: 4px 10px; border-radius: 20px;
  pointer-events: none; display: none;
  border: 1px solid var(--border-mid);
}
.loading-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: rgba(7, 9, 26, 0.9);
  opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
.loading-overlay.visible { opacity: 1; pointer-events: all; }
.loading-ring {
  width: 40px; height: 40px;
  border: 2px solid var(--border-mid);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loading-msg {
  font-size: 0.7rem; letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
}
@media (max-width: 640px) { .viewport-hint { display: none; } }
