/* ─── @font-face declarations ─────────────────────── */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/jetbrains-mono-latin-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/space-grotesk-latin-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/space-grotesk-latin-500.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ─── Custom properties ───────────────────────────── */

:root {
  --bg: #05060a;
  --bg-2: #0a0c12;
  --fg: #d8d8e0;
  --fg-2: #f4f4f8;
  --dim: #4a4d5a;
  --dim-2: #2a2d36;
  --accent: #ff3355;
  --px: 0px;
  --py: 0px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  overflow: hidden;
  cursor: crosshair;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Flow field canvas ───────────────────────────── */

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

/* ─── Overlay FX ──────────────────────────────────── */

.fx { position: fixed; inset: 0; pointer-events: none; }

.vignette {
  z-index: 8;
  background:
    radial-gradient(ellipse 90% 70% at 50% 50%, transparent 35%, rgba(5,6,10,0.55) 80%, rgba(5,6,10,0.85) 100%);
}

.scanlines {
  z-index: 11;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.020) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.7;
}

.grain {
  z-index: 12;
  opacity: 0.08;
  mix-blend-mode: overlay;
}

/* ─── Corner frame brackets ───────────────────────── */

.bracket {
  position: fixed;
  width: 18px;
  height: 18px;
  border: 1px solid var(--accent);
  pointer-events: none;
  z-index: 5;
}

.b-tl { top: 14px; left: 14px;     border-right: 0; border-bottom: 0; }
.b-tr { top: 14px; right: 14px;    border-left: 0;  border-bottom: 0; }
.b-bl { bottom: 14px; left: 14px;  border-right: 0; border-top: 0; }
.b-br { bottom: 14px; right: 14px; border-left: 0;  border-top: 0; }

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

.ui {
  position: fixed;
  z-index: 20;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.65;
  color: var(--fg);
  text-transform: none;
  user-select: none;
}

.ui.selectable { user-select: text; }
.ui a { user-select: text; }

.corner { padding: 36px 44px; transition: transform 280ms cubic-bezier(.2,.7,.2,1); }
.tl { top: 0; left: 0;  transform: translate(calc(var(--px) * -0.6), calc(var(--py) * -0.6)); }
.tr { top: 0; right: 0; text-align: right;
      transform: translate(calc(var(--px) *  0.6), calc(var(--py) * -0.6)); }
.bl { bottom: 0; left: 0;
      transform: translate(calc(var(--px) * -0.6), calc(var(--py) *  0.6)); }
.br { bottom: 0; right: 0; text-align: right;
      transform: translate(calc(var(--px) *  0.6), calc(var(--py) *  0.6)); }

.handle {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.012em;
  color: var(--fg-2);
  line-height: 1.1;
  margin-bottom: 4px;
}

.handle .dot { color: var(--accent); }

.rule { color: var(--dim-2); margin: 10px 0 8px; letter-spacing: 0; user-select: none; }
.rule.short { width: 11ch; }

.dim    { color: var(--dim); }
.accent { color: var(--accent); }
.fg     { color: var(--fg-2); }

.row { white-space: nowrap; }

.blink { animation: blink 1.05s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.meter {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0;
  color: var(--fg);
}

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px dashed var(--dim);
  padding-bottom: 1px;
  transition: color 160ms, border-color 160ms;
}

a:hover, a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}

.prompt::before { content: "$ "; color: var(--dim); }
.reply::before  { content: "> "; color: var(--accent); }
.comment        { color: var(--dim); }
.comment::before { content: "// "; }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--dim-2);
  color: var(--fg);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.tag.live { border-color: var(--accent); color: var(--accent); }

/* ─── Responsive: tablet ──────────────────────────── */

@media (max-width: 720px) {
  .corner { padding: 24px 22px; }
  .ui { font-size: 10.5px; }
  .handle { font-size: 22px; }
  .b-tl, .b-tr, .b-bl, .b-br { width: 14px; height: 14px; }
  .tr .rule, .br .rule { display: none; }
}

/* ─── Responsive: mobile ──────────────────────────── */

@media (max-width: 480px) {
  .bracket { display: none; }
  .tr, .br { display: none; }
  .corner { padding: 18px 16px; }
  .tl, .bl {
    position: fixed;
    left: 0;
    right: 0;
    text-align: center;
    transform: none;
  }
  .tl { top: 0; }
  .bl { bottom: 0; }
}

/* ─── Accessibility ───────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .blink { animation: none; }
  .corner { transition: none; }
}

/* ─── Boot screen ─────────────────────────────────── */

.boot {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.2em;
  pointer-events: none;
  transition: opacity 600ms ease;
}

.boot.gone { opacity: 0; }
