/* PANEL — idea vault. Dark, kinetic, always-on. */

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

:root {
  --bg: #04060b;
  --bg-2: #070b14;
  --ink: #dfeaf5;
  --dim: #6d8299;
  --dimmer: #3d4c5e;
  --line: rgba(120, 170, 210, 0.14);
  --panel: rgba(140, 190, 230, 0.035);
  --panel-2: rgba(140, 190, 230, 0.06);
  --accent: #00e5ff;
  /* --mono is for digits/latin only (clock, counters, ids) */
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas,
    'Liberation Mono', monospace;
  /* Hebrew-first UI stack; falls back through what Windows/macOS actually ship */
  --sans: 'Rubik', 'Heebo', 'Assistant', 'Segoe UI', system-ui, -apple-system,
    'Arial Hebrew', Arial, sans-serif;
  --r: 14px;
  --maxw: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* The real pointer is only hidden once app.js is alive AND knows where the
   mouse actually is. Hiding it up-front meant: no pointer at all if the JS
   failed, and a decoy glyph parked at screen centre on every page load until
   you happened to move. `body *` is needed to beat UA cursors on a/button. */
body.cursor-live,
body.cursor-live * {
  cursor: none;
}

@media (pointer: coarse), (hover: none) {
  #cursor {
    display: none !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

.mono {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* digits / latin fragments inside an RTL page */
.num {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}

/* small Hebrew label — the RTL stand-in for the old .mono chrome text */
.meta-b,
.chip-lab,
.go,
.back,
.blk-h {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  font-weight: 600;
}

.dim {
  color: var(--dim);
}

/* ─────────────────────────────  AMBIENT FX  ───────────────────────────── */

/* one canvas for every animated element — two full-screen canvases meant two
   clears and two composites per frame for no visual gain */
#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  display: block;
}

/* No filter: blur() here. A full-screen blur(80px) re-rasterises the whole
   layer every frame — it was the single most expensive thing on the page in
   Firefox. The radial gradients are already soft, so the look survives. */
.fx-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.55;
}

.fx-aurora i {
  position: absolute;
  display: block;
  width: 60vw;
  height: 60vw;
  min-width: 460px;
  min-height: 460px;
  border-radius: 50%;
  /* transform-only animation on its own compositor layer = no repaint */
  will-change: transform;
}

.fx-aurora i:nth-child(1) {
  background: radial-gradient(circle, var(--accent) 0%, transparent 68%);
  top: -14%;
  left: -10%;
  animation: drift-a 26s ease-in-out infinite;
  opacity: 0.34;
}

.fx-aurora i:nth-child(2) {
  background: radial-gradient(circle, #7b2bff 0%, transparent 68%);
  bottom: -18%;
  right: -12%;
  animation: drift-b 34s ease-in-out infinite;
  opacity: 0.3;
}

.fx-aurora i:nth-child(3) {
  background: radial-gradient(circle, #ff2e97 0%, transparent 70%);
  top: 38%;
  left: 52%;
  animation: drift-c 44s ease-in-out infinite;
  opacity: 0.16;
}

@keyframes drift-a {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(16vw, 12vh, 0) scale(1.22);
  }
}

@keyframes drift-b {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1.1);
  }
  50% {
    transform: translate3d(-18vw, -14vh, 0) scale(0.86);
  }
}

@keyframes drift-c {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(0.9);
  }
  50% {
    transform: translate3d(-12vw, 16vh, 0) scale(1.3);
  }
}

/* mix-blend-mode removed: blending forces the compositor to re-read the whole
   backdrop each frame. Plain alpha looks the same over a near-black page. */
.fx-scan {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.55;
}

/* Static grain. It used to be inset:-150% (≈16× the viewport) repainting four
   times a second — a large cost for an effect nobody can consciously see move. */
.fx-noise {
  position: fixed;
  inset: 0;
  z-index: 61;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.fx-vignette {
  position: fixed;
  inset: 0;
  z-index: 59;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 45%,
    transparent 40%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

/* slow light bar that crosses the screen every 9s */
.fx-sweep {
  position: fixed;
  top: 0;
  left: -30vw;
  width: 22vw;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(160, 220, 255, 0.05),
    transparent
  );
  will-change: transform;
  animation: sweep 9s linear infinite;
}

@keyframes sweep {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(160vw);
  }
}

/* ─────────────────────────────  CURSOR  ───────────────────────────── */

#cursor {
  position: fixed;
  top: 0;
  left: 0;
  /* above the boot overlay (100), or there is no pointer during boot */
  z-index: 120;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
}

body.cursor-live #cursor {
  opacity: 1;
}

.cur-dot,
.cur-ring {
  position: absolute;
  /* left/top MUST be explicit. Without them these boxes fall back to their
     static position, which in an RTL container aligns by the RIGHT edge —
     shifting each element left by its own width and pulling the dot 24px out
     of the ring. */
  left: 0;
  top: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.cur-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.cur-ring {
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  transition: width 0.25s, height 0.25s, opacity 0.25s;
}

body.hot .cur-ring {
  width: 56px;
  height: 56px;
  opacity: 0.7;
}

/* ─────────────────────────────  BOOT  ───────────────────────────── */

#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: opacity 0.6s ease, visibility 0.6s;
}

#boot.done {
  opacity: 0;
  visibility: hidden;
}

.boot-inner {
  width: min(520px, 84vw);
}

.boot-log {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.9;
  color: var(--accent);
  margin: 0 0 14px;
  min-height: 132px;
  white-space: pre-wrap;
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 50%, transparent);
}

.boot-bar {
  height: 2px;
  background: var(--panel-2);
  overflow: hidden;
}

.boot-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transition: width 0.2s linear;
}

/* ─────────────────────────────  HUD  ───────────────────────────── */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 42px);
  /* backdrop-filter removed — it forced a live blur of everything behind the
     header (including both animating canvases) on every single frame. */
  background: linear-gradient(
    to bottom,
    rgba(4, 6, 11, 0.94) 40%,
    rgba(4, 6, 11, 0.6) 75%,
    transparent
  );
}

.hud-mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.42em;
  position: relative;
}

.hud-mid {
  display: flex;
  gap: 8px;
  margin-inline: auto;
}

.hud-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--panel);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--dim);
  white-space: nowrap;
}

.hud-chip.num {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
}

.hud-chip.ghost {
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.2s, color 0.2s;
}

.hud-chip.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hud-chip b {
  color: var(--accent);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
  flex: none;
}

.dot.warn {
  background: #ff2e97;
  box-shadow: 0 0 8px #ff2e97;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

.hud-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
  overflow: hidden;
}

.hud-line i {
  position: absolute;
  inset-block: 0;
  width: 22%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: rail 5.5s ease-in-out infinite;
}

@keyframes rail {
  0% {
    left: -25%;
  }
  100% {
    left: 105%;
  }
}

/* ─────────────────────────────  LAYOUT  ───────────────────────────── */

#view {
  position: relative;
  z-index: 10;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(96px, 14vh, 150px) clamp(16px, 4vw, 42px) 120px;
}

.foot {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 42px) 40px;
  border-top: 1px solid var(--line);
}

/* ─────────────────────────────  TYPE  ───────────────────────────── */

.title-xl {
  font-size: clamp(2.6rem, 9vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0.12em 0 0.22em;
  position: relative;
}

.title-xl.accent {
  color: var(--accent);
  text-shadow: 0 0 44px color-mix(in srgb, var(--accent) 42%, transparent);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
  margin-bottom: 18px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
}

.lede {
  font-size: clamp(1rem, 2.1vw, 1.22rem);
  color: var(--dim);
  max-width: 62ch;
  margin: 0 0 26px;
}

/* glitch on hover — layered chromatic copies */
[data-glitch] {
  position: relative;
  display: inline-block;
}

/* headings must stay block-level, or the inline-block above drops them onto
   the previous line and the tall glyphs collide with the eyebrow */
h1[data-glitch],
h2[data-glitch] {
  display: block;
}

[data-glitch]::before,
[data-glitch]::after {
  content: attr(data-glitch);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

[data-glitch]::before {
  color: #00e5ff;
  transform: translate(-2px, -1px);
}

[data-glitch]::after {
  color: #ff2e97;
  transform: translate(2px, 1px);
}

[data-glitch]:hover::before,
[data-glitch]:hover::after,
[data-glitch].fire::before,
[data-glitch].fire::after {
  opacity: 0.85;
  animation: glitch 0.42s steps(2) 2;
}

@keyframes glitch {
  0% {
    clip-path: inset(0 0 82% 0);
    transform: translate(-4px, 0);
  }
  25% {
    clip-path: inset(58% 0 22% 0);
    transform: translate(4px, -1px);
  }
  50% {
    clip-path: inset(28% 0 54% 0);
    transform: translate(-3px, 1px);
  }
  75% {
    clip-path: inset(76% 0 8% 0);
    transform: translate(3px, 0);
  }
  100% {
    clip-path: inset(0 0 92% 0);
    transform: translate(0, 0);
  }
}

/* ─────────────────────────────  404  ───────────────────────────── */

.hero-404 {
  margin-bottom: 58px;
}

/* ─────────────────────────────  CARDS  ───────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border-radius: var(--r);
  background: linear-gradient(160deg, var(--panel-2), rgba(6, 10, 18, 0.7));
  border: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
  transform: translateY(26px);
  opacity: 0;
  animation: card-in 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--i) * 70ms + 120ms);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
    border-color 0.35s, box-shadow 0.35s;
}

@keyframes card-in {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.card.hidden {
  display: none;
}

.card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 22px 60px -22px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* rotating conic border-beam, masked to the 1px edge */
.card-beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--beam),
    transparent 0deg,
    var(--accent) 40deg,
    transparent 110deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s;
  animation: spin-beam 4s linear infinite;
}

@keyframes spin-beam {
  to {
    --beam: 360deg;
  }
}

.card:hover .card-beam {
  opacity: 1;
}

/* faint blueprint grid that shifts on hover */
.card-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at 78% 8%, #000, transparent 62%);
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.4s;
}

.card:hover .card-grid {
  transform: translate(-8px, 8px) scale(1.08);
  opacity: 0.9;
}

.card-corner {
  position: absolute;
  width: 11px;
  height: 11px;
  border: 1px solid var(--accent);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}

.card-corner.tl {
  top: 8px;
  left: 8px;
  border-right: 0;
  border-bottom: 0;
  transform: translate(4px, 4px);
}
.card-corner.tr {
  top: 8px;
  right: 8px;
  border-left: 0;
  border-bottom: 0;
  transform: translate(-4px, 4px);
}
.card-corner.bl {
  bottom: 8px;
  left: 8px;
  border-right: 0;
  border-top: 0;
  transform: translate(4px, -4px);
}
.card-corner.br {
  bottom: 8px;
  right: 8px;
  border-left: 0;
  border-top: 0;
  transform: translate(-4px, -4px);
}

.card:hover .card-corner {
  opacity: 0.9;
  transform: translate(0, 0);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.idx {
  color: var(--dimmer);
  font-size: 0.62rem;
}

.card-title {
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.15;
}

.card:hover .card-title {
  color: var(--accent);
}

.card-tag {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  opacity: 0.9;
}

.card-sum {
  margin: 0;
  color: var(--dim);
  font-size: 0.85rem;
  line-height: 1.62;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--dim);
  background: var(--panel);
}

.tag.alt {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: color-mix(in srgb, var(--accent) 85%, white);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.go {
  color: var(--accent);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.go b {
  transition: transform 0.3s;
}

/* RTL: forward motion is leftward */
.card:hover .go b {
  transform: translateX(-5px);
}

.empty {
  text-align: center;
  color: var(--dimmer);
  padding: 60px 0;
}

/* ─────────────────────────────  PILLS  ───────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 100px;
  border: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--panel);
}

.st-active {
  color: #7cff5a;
}
.st-active .dot {
  background: #7cff5a;
  box-shadow: 0 0 8px #7cff5a;
}
.st-seed {
  color: #00e5ff;
}
.st-seed .dot {
  background: #00e5ff;
  box-shadow: 0 0 8px #00e5ff;
}
.st-paused {
  color: #ffb020;
}
.st-paused .dot {
  background: #ffb020;
  box-shadow: 0 0 8px #ffb020;
  animation: none;
}
.st-shipped {
  color: #b388ff;
}
.st-shipped .dot {
  background: #b388ff;
  box-shadow: 0 0 8px #b388ff;
}
.st-archived {
  color: var(--dim);
}
.st-archived .dot {
  background: var(--dim);
  box-shadow: none;
  animation: none;
}

/* ─────────────────────────────  IDEA PAGE  ───────────────────────────── */

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  margin-bottom: 30px;
  transition: color 0.2s, transform 0.2s;
}

/* RTL: "back" travels toward the start edge, which is the right */
.back:hover {
  color: var(--accent);
  transform: translateX(4px);
}

.hero-idea {
  margin-bottom: 46px;
}

.hero-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.rule {
  height: 1px;
  background: var(--line);
  margin: 26px 0;
  position: relative;
  overflow: hidden;
}

.rule i {
  position: absolute;
  inset-block: 0;
  width: 34%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: rail 4.5s ease-in-out infinite;
}

.summary {
  font-size: 1.06rem;
  max-width: 74ch;
  color: var(--ink);
  opacity: 0.92;
  margin: 0;
}

.chips {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 44px;
}

.chip-row {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.chip-lab {
  color: var(--dimmer);
  min-width: 48px;
  font-size: 0.72rem;
}

.blocks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 46px;
}

.blk {
  padding: 26px 0;
  border-top: 1px solid var(--line);
  position: relative;
  transition: background 0.4s;
}

.blk::before {
  content: '';
  position: absolute;
  top: -1px;
  inset-inline-start: 0;
  height: 1px;
  width: 0;
  background: var(--accent);
  transition: width 0.6s ease;
}

.blk:hover::before {
  width: 100%;
}

.blk-h {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  font-size: 0.68rem;
  margin: 0 0 12px;
}

.blk-n {
  color: var(--dimmer);
}

.blk-b {
  margin: 0;
  color: var(--dim);
  font-size: 1rem;
  line-height: 1.75;
  max-width: 76ch;
}

.links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 46px;
}

.lnk {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 11px 17px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.25s;
}

.lnk:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 26px -6px var(--accent);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 26px;
}

.pg {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  flex: 1 1 220px;
  transition: all 0.28s;
}

.pg.next {
  text-align: end;
  align-items: flex-end;
}

.pg:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 16px 40px -20px var(--accent);
}

.pg b {
  font-size: 1.02rem;
  font-weight: 700;
}

/* arrow + word as flex children, so RTL places the arrow on the outer edge
   instead of leaving it to bidi neutral resolution */
.pg-lab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pg-lab i {
  font-style: normal;
  transition: transform 0.28s;
}

.pg.prev:hover .pg-lab i {
  transform: translateX(4px);
}

.pg.next:hover .pg-lab i {
  transform: translateX(-4px);
}

/* ─────────────────────────────  REVEAL  ───────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 80ms);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* ── adaptive quality ──────────────────────────────────────────────────
   fx.js adds .q1 / .q2 to <body> after two consecutive slow seconds. Fast
   machines never see these; slow ones shed the costliest layers and stay
   smooth instead of crawling. Measured: dropping the aurora alone took
   headless Firefox from 14fps to 30fps. */

body.q1 .fx-aurora {
  display: none;
}

body.q2 .fx-noise,
body.q2 .fx-scan,
body.q2 .fx-sweep {
  display: none;
}

/* ─────────────────────────────  LOGIN GATE  ───────────────────────────── */

body.p-login #view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding-block: 40px;
}

.gate {
  position: relative;
  width: min(400px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 40px 34px 34px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--panel-2), rgba(6, 10, 18, 0.86));
  overflow: hidden;
  isolation: isolate;
  animation: card-in 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9);
}

.gate-beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--beam),
    transparent 0deg,
    var(--accent) 50deg,
    transparent 130deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.7;
  animation: spin-beam 5s linear infinite;
  pointer-events: none;
}

.gate-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--accent);
  opacity: 0.55;
}
.gate-corner.tl {
  top: 10px;
  left: 10px;
  border-right: 0;
  border-bottom: 0;
}
.gate-corner.tr {
  top: 10px;
  right: 10px;
  border-left: 0;
  border-bottom: 0;
}
.gate-corner.bl {
  bottom: 10px;
  left: 10px;
  border-right: 0;
  border-top: 0;
}
.gate-corner.br {
  bottom: 10px;
  right: 10px;
  border-left: 0;
  border-top: 0;
}

.gate-mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.42em;
  text-align: center;
  color: var(--ink);
  text-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent);
  position: relative;
  margin-bottom: 10px;
}

.gate-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gate-label {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--dim);
}

.gate-field input {
  width: 100%;
  padding: 12px 4px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.25em;
  outline: none;
}

.gate-field input::placeholder {
  color: var(--dimmer);
  letter-spacing: 0.25em;
}

.gate-line {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  height: 1px;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transition: width 0.32s ease;
}

.gate-field input:focus ~ .gate-line {
  width: 100%;
}

.gate-error {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ff2e97;
  margin: -4px 0 0;
  animation: shake 0.35s;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.gate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
  padding: 13px 18px;
  border-radius: 100px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.25s;
}

.gate-btn b {
  color: var(--accent);
  transition: transform 0.25s;
}

.gate-btn:hover {
  background: var(--accent);
  color: #04060b;
  box-shadow: 0 0 34px -6px var(--accent);
}

.gate-btn:hover b {
  color: #04060b;
  transform: translateX(-5px);
}

/* the logged-in header gets a subtle logout affordance */
.hud-logout {
  color: var(--dim);
  transition: color 0.2s, border-color 0.2s;
}
.hud-logout:hover {
  color: #ff2e97;
  border-color: #ff2e97;
}

/* ─────────────────────────────  MOTION OFF  ───────────────────────────── */

body.fx-off .fx-aurora,
body.fx-off .fx-sweep,
body.fx-off .fx-noise,
body.fx-off #fx {
  display: none;
}

body.fx-off *,
body.fx-off *::before,
body.fx-off *::after {
  animation: none !important;
  transition-duration: 0.01ms !important;
}

body.fx-off .card,
body.fx-off .reveal {
  opacity: 1 !important;
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .fx-aurora,
  .fx-sweep,
  .fx-noise {
    display: none;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card,
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ─────────────────────────────  SMALL SCREENS  ───────────────────────── */

@media (max-width: 720px) {
  .hud-mid {
    display: none;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .blk {
    padding-inline: 0;
  }
}
