/* ============ CAPTAIN — hud.css ============ */
/* Tech UI kit: corner brackets, scanline/dot-grid texture, circuit-trace
   hover borders, target-lock CTAs, carousel, tuning panel. Footage untouched. */

@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* ---------- corner brackets on text overlays (driven by --hud) ---------- */
.ov { --hud: 0; }
.ov[data-side] { position: absolute; }
.ov::before, .ov::after {
  content: ''; position: absolute; width: calc(var(--hud) * 20px); height: calc(var(--hud) * 20px);
  border: 1.5px solid var(--cyan); opacity: calc(var(--hud) * .8); pointer-events: none;
  transition: opacity .1s linear;
}
.ov::before { top: -14px; border-right: none; border-bottom: none; }
.ov[data-side="right"]::before { left: -14px; }
.ov[data-side="left"]::before  { left: -14px; }
.ov::after { bottom: -14px; border-left: none; border-top: none; right: -14px; }
/* tick marks flanking the index label */
.ov-index { position: relative; }

/* ---------- scanline + dot-grid micro-texture ---------- */
.hud-texture { position: relative; }
.hud-texture::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(127,216,255,.035) 0 1px, transparent 1px 3px),
    radial-gradient(rgba(127,216,255,.05) 1px, transparent 1px);
  background-size: 100% 3px, 14px 14px;
  animation: hud-drift 14s linear infinite;
  border-radius: inherit;
}
@keyframes hud-drift { to { background-position: 0 -60px, 140px 140px; } }
body.no-scanlines .hud-texture::before { display: none; }

/* ---------- circuit-trace hover border (conic-gradient + mask) ---------- */
.circuit { position: relative; }
.circuit::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: conic-gradient(from var(--ang),
    transparent 0 76%, var(--cyan) 86%, #fff 88%, var(--cyan) 90%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .3s;
}
.circuit:hover::after { opacity: 1; animation: circuit-spin 1.1s linear infinite; }
@keyframes circuit-spin { to { --ang: 360deg; } }
@supports not (background: conic-gradient(from 0deg, red, blue)) {
  .circuit:hover { border-color: var(--cyan); }
}

/* ---------- target-lock CTA buttons ---------- */
.cta {
  position: relative; overflow: hidden;
  font-size: 10.5px; letter-spacing: .22em;
  padding: 15px 22px;
  border: 1px solid var(--line); border-radius: 3px;
  color: var(--text);
  background: rgba(10, 14, 30, .5);
  backdrop-filter: blur(8px);
  display: inline-flex; align-items: center; gap: 9px;
  transition: color .35s ease, border-color .35s ease, transform .35s ease;
}
.cta-bkt { color: var(--cyan); opacity: .6; transition: transform .35s ease, opacity .35s ease; display: inline-block; }
.cta:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); }
.cta:hover .cta-bkt { opacity: 1; }
.cta:hover .cta-bkt:first-child { transform: translateX(-5px); }
.cta:hover .cta-bkt:last-child  { transform: translateX(5px); }
.cta::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(127,216,255,.35) 50%, transparent 60%);
  transform: translateX(-120%); transition: transform .5s ease;
}
.cta:hover::after { transform: translateX(120%); }
.cta-amber { border-color: rgba(255,180,94,.5); color: var(--amber); }
.cta-amber .cta-bkt { color: var(--amber); }
.cta-amber:hover { border-color: var(--amber); color: var(--ink); background: var(--amber); }
.cta-amber:hover .cta-bkt { color: var(--ink); }

/* ---------- ORBITAL ARCHIVE CONSOLE ---------- */
#orbit {
  position: fixed; inset: 0; z-index: 60;
  opacity: 0; transition: opacity .45s ease; pointer-events: none;
}
#orbit.open { opacity: 1; pointer-events: auto; }
.ob-veil { position: absolute; inset: 0; background: rgba(5,6,14,.45); }
.ob-x {
  position: absolute; top: 22px; inset-inline-end: 26px; z-index: 5;
  font-size: 14px; color: var(--dim); padding: 8px; transition: color .3s;
}
.ob-x:hover { color: var(--amber); }
.ob-title {
  position: absolute; top: 24px; inset-inline-start: clamp(20px, 4vw, 48px); z-index: 5;
  display: flex; align-items: center; gap: 10px; font-size: 9.5px; letter-spacing: .28em;
}
.ob-title i { font-style: normal; color: var(--amber); }
.ob-title b { font-weight: 400; color: var(--cyan); }

/* the dial */
.ob-ring {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(74vh, 66vw); height: min(74vh, 66vw);
  z-index: 3; cursor: grab; outline: none;
  touch-action: none;                    /* drag never scrolls the page */
}
.ob-ring.grabbing { cursor: grabbing; }
.ob-ring::before, .ob-ring::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
}
.ob-ring::before { inset: 0; border: 1px solid rgba(127,216,255,.18); }
.ob-ring::after  { inset: 8%; border: 1px dashed rgba(127,216,255,.10); }
.ob-dial { position: absolute; inset: 0; }

.ob-node {
  position: absolute; top: 50%; left: 50%;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: opacity .25s ease;
}
.ob-dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--cyan); background: rgba(10,14,30,.9);
  transition: all .3s ease;
}
.ob-node.active .ob-dot {
  background: var(--amber); border-color: var(--amber);
  box-shadow: 0 0 14px rgba(255,180,94,.7); transform: scale(1.5);
}
.ob-lbl {
  font-size: 8.5px; letter-spacing: .2em; color: var(--amber);
  white-space: nowrap; max-width: 34vw; overflow: hidden; text-overflow: ellipsis;
}

/* centre readout */
.ob-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(400px, 46vw); max-height: 44vh; overflow: hidden; z-index: 4;
  padding: clamp(20px, 3vh, 32px);
  background: rgba(10,14,30,.55); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 8px;
  display: flex; flex-direction: column; gap: 10px; text-align: center;
  pointer-events: none;
}
.ob-center > * { position: relative; z-index: 1; }
.ob-center.in { animation: ob-in .4s ease both; }
@keyframes ob-in { from { opacity: 0; transform: translate(-50%,-46%); } to { opacity: 1; transform: translate(-50%,-50%); } }
.obc-tag { font-size: 8.5px; letter-spacing: .24em; color: var(--amber); }
.obc-title { font-size: clamp(17px, 1.9vw, 23px); font-weight: 700; line-height: 1.22; }
.obc-body { font-size: 13.5px; line-height: 1.7; color: var(--text); opacity: .88; }
.obc-meta { font-size: 8.5px; letter-spacing: .2em; color: var(--cyan); opacity: .75; }
.ob-readout {
  position: absolute; left: 0; right: 0; bottom: 58px; z-index: 5; text-align: center;
  font-size: 10px; letter-spacing: .28em; color: var(--dim);
}
.ob-hint {
  position: absolute; left: 0; right: 0; bottom: 34px; z-index: 5; text-align: center;
  font-size: 8.5px; letter-spacing: .24em; color: var(--dim); opacity: .5;
}
html[lang="fa"] .ob-center { text-align: center; }
html[lang="fa"] .obc-body { line-height: 1.95; }

@media (max-width: 820px) {
  .ob-ring { width: 86vw; height: 86vw; }
  .ob-center { width: 72vw; max-height: 40vh; padding: 18px; }
  .obc-body { font-size: 12.5px; }
  .ob-lbl { display: none; }
}

/* ---------- hidden tuning panel ---------- */
#tuning {
  position: fixed; bottom: 16px; inset-inline-start: 16px; z-index: 90;
  width: 260px; max-height: 82vh; overflow-y: auto;
  background: rgba(6, 9, 20, .92); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; color: var(--text); font-size: 10px; letter-spacing: .05em;
  display: none; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
#tuning.on { display: block; }
.tn-head { display: flex; justify-content: space-between; align-items: center; color: var(--cyan); font-size: 10px; letter-spacing: .2em; margin-bottom: 10px; }
.tn-reset { font-size: 8.5px; letter-spacing: .2em; color: var(--amber); border: 1px solid rgba(255,180,94,.4); border-radius: 3px; padding: 3px 8px; }
.tn-h { font-size: 8.5px; letter-spacing: .22em; color: var(--dim); margin: 12px 0 6px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.tn-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; color: var(--text); }
.tn-row input[type="range"] { flex: 1; accent-color: var(--cyan); height: 3px; }
.tn-row input[type="checkbox"] { accent-color: var(--cyan); }
.tn-row select { background: rgba(10,14,30,.8); color: var(--text); border: 1px solid var(--line); border-radius: 3px; font: inherit; font-size: 9px; margin-inline-start: auto; }
.tn-val { min-width: 34px; text-align: end; color: var(--cyan); font-size: 9px; }

@media (prefers-reduced-motion: reduce) {
  .hud-texture::before { animation: none; }
  .circuit:hover::after { animation: none; }
}
