/* KESTREL SAR — dawn mountain palette
   rock #232B33 / fog-blue #8FA3B8 / sand #D9CFC0 / rescue orange #E4622B
   ceramic #E9E7E2 / graphite #2A2D31 */

@font-face {
  font-family: "Manrope";
  src: url("../../../open-runtime/3ae11c49db0455a3cc33e37d380f20fdb8c7f8b41dc07625c177e3d87a9d6ae6/Manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --rock: #232B33;
  --rock-deep: #1B2229;
  --fog: #8FA3B8;
  --sand: #D9CFC0;
  --sand-dim: #A79E90;
  --orange: #E4622B;
  --ceramic: #E9E7E2;
  --line: rgba(217, 207, 192, 0.16);
  --line-strong: rgba(217, 207, 192, 0.34);
  --panel: rgba(20, 25, 30, 0.62);
  --panel-solid: rgba(18, 22, 27, 0.9);
  --glass: blur(14px) saturate(1.25);
  --edge: inset 0 1px 0 rgba(233, 231, 226, 0.14);
  --shadow: 0 18px 44px -18px rgba(8, 10, 13, 0.85);
  font-size: 15px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--sand);
  background: var(--rock-deep);
}

button { font: inherit; }

#stage {
  position: fixed;
  inset: 0;
  z-index: 0;
}
#stage canvas { display: block; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px 12px;
  background: linear-gradient(to bottom, rgba(17,21,25,0.78) 0%, rgba(17,21,25,0.42) 55%, rgba(17,21,25,0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 14px; height: 14px;
  border: 2px solid var(--orange);
  border-radius: 50% 0 50% 50%;
  transform: rotate(45deg);
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.16em;
  color: var(--ceramic);
}
.brand-sub {
  font-size: 0.7rem;
  color: var(--sand-dim);
}

.controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.ctl {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--sand);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: var(--edge), var(--shadow);
  transition: border-color .2s, color .2s, background .2s, transform .2s;
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}
.ctl:hover {
  border-color: rgba(228, 98, 43, .65);
  color: var(--ceramic);
  transform: translateY(-1px);
}
.ctl:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.ctl.lang { padding: 7px 12px; }
.ctl.lang.active { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }

[data-testid="explode"][aria-pressed="true"] {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-weight: 600;
}

#lightToggle.active {
  border-color: var(--orange);
  color: var(--ceramic);
}

/* ---------- left sidebar ---------- */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 5;
  width: 300px;
  padding: 84px 30px 150px 34px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    linear-gradient(to right, rgba(17,21,25,0.62) 0%, rgba(17,21,25,0.3) 68%, rgba(17,21,25,0) 100%);
  border-right: 1px solid rgba(217, 207, 192, 0.09);
  pointer-events: none;
  transition: opacity .45s ease;
}
.sidebar > * { pointer-events: auto; }

.kicker {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.kicker::before {
  content: "";
  width: 22px;
  height: 2px;
  flex: none;
  background: linear-gradient(to right, var(--orange), rgba(228, 98, 43, 0));
}
.title {
  margin: 0;
  font-size: 1.86rem;
  line-height: 1.14;
  font-weight: 200;
  letter-spacing: -0.01em;
  color: var(--ceramic);
  max-width: 15ch;
  text-shadow: 0 2px 18px rgba(8, 10, 13, 0.6);
}
.lede {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.68;
  font-weight: 300;
  color: var(--sand);
  max-width: 34ch;
  text-shadow: 0 1px 10px rgba(8, 10, 13, 0.55);
}

.specs {
  margin: 6px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.specs div {
  border-left: 2px solid rgba(228, 98, 43, 0.45);
  padding: 2px 0 2px 11px;
  background: linear-gradient(to right, rgba(233, 231, 226, 0.05), rgba(233, 231, 226, 0));
}
.specs dt {
  font-size: 0.66rem;
  color: var(--sand-dim);
}
.specs dd {
  margin: 2px 0 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ceramic);
}
.note { margin: 0; font-size: 0.66rem; color: var(--sand-dim); }

.coord {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.64rem;
  color: var(--sand-dim);
  letter-spacing: 0.06em;
}
.coord #clock { color: var(--orange); }

/* ---------- bottom module deck ---------- */
.deck {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  padding: 12px 22px 16px;
  background: linear-gradient(to top, rgba(17,21,25,0.9) 0%, rgba(17,21,25,0.55) 60%, rgba(17,21,25,0));
  border-top: 1px solid rgba(217, 207, 192, 0.07);
  transition: padding .35s ease;
}
.deck-title { margin: 0 0 8px; font-size: 0.68rem; color: var(--sand-dim); }
.legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 10px;
  overflow-x: auto;
}
.legend li {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(217, 207, 192, 0.14);
  border-radius: 6px;
  background: rgba(18, 22, 27, 0.6);
  box-shadow: var(--edge);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.72rem;
  color: var(--sand);
  white-space: nowrap;
}
.legend li i {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex: none;
}
.legend li b { color: var(--ceramic); font-weight: 600; }
.legend li small { color: var(--sand-dim); font-size: 0.66rem; }

/* exploded: fold the long copy, keep the sidebar readable over the model */
body.exploded .sidebar {
  opacity: 1;
  background: linear-gradient(to right, rgba(27,34,41,0.93) 0%, rgba(27,34,41,0.86) 70%, rgba(27,34,41,0.35) 100%);
}
body.exploded .sidebar .lede,
body.exploded .sidebar .coord,
body.exploded .sidebar .note { display: none; }
body.exploded .sidebar .specs { grid-template-columns: 1fr; gap: 4px 16px; }
body.exploded .deck { padding-bottom: 10px; }
body.exploded .hint { opacity: 0; }

.hint {
  position: fixed;
  right: 22px;
  bottom: 86px;
  z-index: 5;
  font-size: 0.66rem;
  color: var(--sand-dim);
  transition: opacity .4s;
  pointer-events: none;
}

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .brand-sub { display: none; }
  .controls { width: 100%; justify-content: flex-start; }
  .ctl { padding: 6px 11px; font-size: 0.8rem; }

  .sidebar {
    width: 100%;
    top: auto;
    bottom: 96px;
    padding: 8px 16px 6px;
    background: linear-gradient(to top, rgba(27,34,41,0.78), rgba(27,34,41,0));
    max-height: 34vh;
  }
  .title { font-size: 1.25rem; color: var(--ceramic); }
  .kicker { color: var(--orange); font-weight: 600; }
  .lede { font-size: 0.74rem; max-width: none; color: var(--sand); }
  .specs dt { color: #B9B0A3; }
  .specs dd { color: var(--ceramic); }
  .specs { grid-template-columns: repeat(3, 1fr); gap: 6px 10px; }
  .specs dd { font-size: 0.76rem; }
  .note, .coord { display: none; }
  .legend li small { display: none; }
  .legend li { background: rgba(27,34,41,0.72); color: var(--sand); }
  .legend li b { color: var(--ceramic); }
  .hint { display: none; }
  /* mobile exploded: collapse to a compact caption instead of faint overlay */
  body.exploded .sidebar {
    opacity: 1;
    bottom: 92px;
    max-height: none;
    padding: 6px 16px;
    background: rgba(27,34,41,0.88);
  }
  body.exploded .sidebar .lede,
  body.exploded .sidebar .specs,
  body.exploded .sidebar .note,
  body.exploded .sidebar .coord { display: none; }
  body.exploded .sidebar .title { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .deck, .hint { transition: none; }
}

/* ---------- premium accents: brand mark + focus glow ---------- */
.brand-mark {
  background: linear-gradient(135deg, rgba(228, 98, 43, 0.12), rgba(228, 98, 43, 0));
  box-shadow: 0 0 0 1px rgba(228, 98, 43, 0.25), 0 0 12px rgba(228, 98, 43, 0.25);
}
.brand-name { text-shadow: 0 1px 12px rgba(8, 10, 13, 0.65); }
.ctl.lang.active { box-shadow: var(--edge), 0 8px 22px -10px rgba(228, 98, 43, 0.8); }
.legend li i { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
