/**
 * FORGE — Shared Monochrome Design System.
 *
 * Linked (not bundled) by every page in `landing/` — index.html, admin.html,
 * staff.html — so there is zero build step and zero duplicated design
 * tokens. Pure black/white/gray only: no hue, no gradients, no cyan/blue
 * "AI slop" accent color. Semantic state (success/danger/live) is conveyed
 * through weight, fill-vs-outline, icons, and motion — never color.
 */

:root {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-elevated-2: #121212;
  --text: #ffffff;
  --text-muted: #999999;
  --text-faint: #777777;
  --border: rgba(255, 255, 255, 0.15);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-hairline: rgba(255, 255, 255, 0.08);
  --glow: rgba(255, 255, 255, 0.06);
  --glow-strong: rgba(255, 255, 255, 0.14);
  --radius-lg: 4px;
  --radius-md: 3px;
  --radius-sm: 2px;
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --nav-h: 72px;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  min-height: 100vh;
}

body {
  background-image: radial-gradient(circle at 20% 0%, var(--glow) 0%, transparent 55%),
    radial-gradient(circle at 85% 15%, var(--glow) 0%, transparent 60%);
  background-repeat: no-repeat;
}

a { color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
img, svg { display: block; }

::selection { background: var(--text); color: #000; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.3px; margin: 0; }

/* Official Cyber Anvil mark — white vector on dark surfaces. */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  line-height: 0;
  background: transparent;
  color: #fff;
}

.brand-mark.lg { width: 56px; height: 56px; }
.brand-mark.sm { width: 22px; height: 22px; }

.brand-mark svg,
.forge-mark-svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: #fff;
}

.eyebrow-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn,
.nav-toggle,
.snap-dot,
.sheet-close {
  touch-action: manipulation;
}

.btn:active,
.nav-toggle:active,
.snap-dot:active,
.sheet-close:active,
.nav-links a:active {
  transform: scale(0.92);
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-solid {
  background: var(--text);
  color: #000;
}

.btn-solid:hover:not(:disabled) {
  box-shadow: 0 0 0 1px var(--text), 0 0 24px var(--glow-strong);
  transform: translateY(-2px);
}

.btn-magnetic {
  will-change: transform;
}

.btn-solid.btn-magnetic:hover:not(:disabled) {
  transform: none;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--text);
  background: var(--glow);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--glow); }

.btn-sm { padding: 9px 18px; font-size: 11px; letter-spacing: 0.6px; }
.btn-block { width: 100%; }

/* Destructive actions are conveyed by weight + icon, never a color. */
.btn-critical {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text);
  font-weight: 800;
}

.btn-critical:hover:not(:disabled) {
  background: var(--text);
  color: #000;
}

/* ------------------------------------------------------------------ */
/* Cards / surfaces                                                     */
/* ------------------------------------------------------------------ */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px var(--border-strong), 0 24px 60px -30px rgba(255, 255, 255, 0.08);
}

.tilt-card {
  --spot-x: 50%;
  --spot-y: 50%;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.tilt-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  background: radial-gradient(
    420px circle at var(--spot-x) var(--spot-y),
    rgba(255, 255, 255, 0.18),
    transparent 42%
  );
  transition: opacity 0.22s ease;
}

.tilt-card.is-tilting::before { opacity: 1; }
.tilt-card > * { position: relative; z-index: 3; }

@property --beam-from {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.border-beam {
  position: relative;
}

.border-beam::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  z-index: 4;
  background: conic-gradient(
    from var(--beam-from),
    transparent 0deg,
    transparent 250deg,
    rgba(255, 255, 255, 0.15) 280deg,
    #ffffff 312deg,
    rgba(255, 255, 255, 0.15) 338deg,
    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;
  animation: beam-from-spin 3.4s linear infinite;
  will-change: --beam-from;
}

.border-beam:nth-child(2)::after { animation-delay: -1.1s; }
.border-beam:nth-child(3)::after { animation-delay: -2.2s; }

@keyframes beam-from-spin {
  to { --beam-from: 360deg; }
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.panel-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* ------------------------------------------------------------------ */
/* Badges / pills                                                       */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  white-space: nowrap;
}

.badge-filled { background: var(--text); color: #000; border-color: var(--text); }
.badge-outline { background: transparent; color: var(--text); }
.badge-muted { color: var(--text-faint); border-color: var(--border); }
.badge-strike { text-decoration: line-through; opacity: 0.6; }

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-dot.pulse { animation: pulse-dot 1.8s ease-in-out infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
  50% { opacity: 0.4; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0); }
}

/* ------------------------------------------------------------------ */
/* Forms                                                                */
/* ------------------------------------------------------------------ */

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--glow);
}

textarea { min-height: 100px; resize: vertical; }

input[type="color"] {
  width: 44px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
}

.field { margin-bottom: 18px; }
.field-row { display: flex; align-items: center; gap: 12px; }
.field-row input[type="text"] { flex: 1; }

/* Toggle switch — inverted fill communicates on/off, no color. */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-track {
  position: absolute;
  inset: 0;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.switch-track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
  background: var(--text);
  border-color: var(--text);
}

.switch input:checked + .switch-track::before {
  transform: translateX(20px);
  background: #000;
}

/* ------------------------------------------------------------------ */
/* Tables                                                               */
/* ------------------------------------------------------------------ */

.data-table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border-hairline);
  vertical-align: middle;
}

.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: var(--glow); }
.data-table tbody tr:last-child td { border-bottom: none; }

.cell-muted { color: var(--text-faint); font-size: 12px; }
.cell-strong { font-weight: 700; }

/* ------------------------------------------------------------------ */
/* Modals                                                               */
/* ------------------------------------------------------------------ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 300;
}

.modal-overlay.visible {
  display: flex;
  animation: fade-in 0.18s ease;
}

.modal {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 30px;
  position: relative;
  animation: modal-in 0.2s ease;
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 16px;
  letter-spacing: 0.4px;
}

.modal p.modal-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 20px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-actions { display: flex; gap: 12px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ */
/* Toast / status                                                       */
/* ------------------------------------------------------------------ */

.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 400;
}

.toast {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  max-width: 320px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
  animation: toast-in 0.25s ease;
}

.toast.toast-error { border-color: var(--text); font-weight: 700; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.status-line {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
  display: none;
}

.status-line.visible { display: block; }
.status-line.ok { border-color: var(--border-strong); color: var(--text); }
.status-line.error { border-color: var(--text); color: var(--text); font-weight: 700; }

/* ------------------------------------------------------------------ */
/* Search                                                               */
/* ------------------------------------------------------------------ */

.search-shell { position: relative; width: 100%; max-width: 560px; }

.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-row:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--glow);
}

.search-input-row svg { flex-shrink: 0; opacity: 0.6; }

.search-input-row input {
  border: none;
  padding: 0;
  background: transparent;
  font-size: 14px;
}

.search-input-row input:focus { box-shadow: none; }

.search-kbd {
  font-size: 10px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-family: var(--font-mono);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-height: 420px;
  overflow-y: auto;
  display: none;
  z-index: 250;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.85);
}

.search-results.visible { display: block; animation: fade-in 0.15s ease; }

.search-result-group-label {
  padding: 10px 16px 6px;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-top: 1px solid var(--border-hairline);
  transition: background 0.12s ease;
}

.search-result-item:hover, .search-result-item.active { background: var(--glow); }

.search-result-main { min-width: 0; }
.search-result-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-score { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); flex-shrink: 0; }

.search-result-title mark, .search-result-sub mark {
  background: var(--text);
  color: #000;
  border-radius: 2px;
  padding: 0 1px;
}

.search-empty { padding: 24px 16px; text-align: center; color: var(--text-faint); font-size: 12px; }

/* ------------------------------------------------------------------ */
/* Terminal / log viewer                                                */
/* ------------------------------------------------------------------ */

.terminal {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  height: 260px;
  overflow-y: auto;
  color: var(--text-muted);
}

.terminal-line { white-space: pre-wrap; word-break: break-word; }
.terminal-line .t-tag { color: var(--text); font-weight: 700; }
.terminal-line.t-error { color: var(--text); font-weight: 700; }
.terminal-line .t-time { color: var(--text-faint); }

/* ------------------------------------------------------------------ */
/* Animations                                                           */
/* ------------------------------------------------------------------ */

/* ------------------------------------------------------------------ */
/* Animations                                                           */
/* ------------------------------------------------------------------ */

.load-beam {
  position: fixed;
  top: 0;
  left: 0;
  height: 1px;
  width: 0;
  z-index: 500;
  pointer-events: none;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
  animation: load-beam 0.4s ease forwards;
  will-change: width, opacity;
}

@keyframes load-beam {
  0% { width: 0; opacity: 1; }
  70% { width: 100%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

.page-landing .navbar {
  opacity: 0;
  transform: translateY(-20px);
  animation: nav-enter 0.7s var(--ease-out-expo) 0.04s forwards;
  will-change: transform, opacity;
}

@keyframes nav-enter {
  to { opacity: 1; transform: translateY(0); }
}

.load-stagger {
  opacity: 0;
  transform: translateY(30px);
  animation: load-up 0.85s var(--ease-out-expo) forwards;
  animation-delay: calc(var(--stagger, 0) * 50ms + 80ms);
  will-change: transform, opacity;
}

@keyframes load-up {
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(40px) scale(0.98);
  transition:
    opacity 0.75s var(--ease-out-expo),
    transform 0.75s var(--ease-out-expo);
  transition-delay: calc(var(--stagger, 0) * 100ms);
  will-change: transform, opacity;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Keep 3D perspective as the post-reveal transform so tilt JS can take over. */
.tilt-card.reveal {
  transform: perspective(1000px) rotateX(0deg) rotateY(0deg) translateY(40px) scale(0.98);
  transition:
    opacity 0.75s var(--ease-out-expo),
    transform 0.75s var(--ease-out-expo),
    border-color 0.25s ease,
    box-shadow 0.25s ease;
  transition-delay: calc(var(--stagger, 0) * 100ms);
}
.tilt-card.reveal.visible { transform: perspective(1000px) rotateX(0deg) rotateY(0deg); }

.decode-text, [data-decode] { font-variant-ligatures: none; }
.decode-text.is-decoding, [data-decode].is-decoding {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* High-tech background grid — opt-in overlay, pointer-events none. */
.fx-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 20%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 20%, #000 20%, transparent 78%);
}

.fx-grid-sweep {
  position: absolute;
  left: 0;
  right: 0;
  height: 22%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.07),
    transparent
  );
  animation: fx-grid-sweep 7.5s linear infinite;
  will-change: transform;
}

.fx-grid-beam {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, #fff, transparent);
  opacity: 0.28;
  animation: fx-grid-beam 12s linear infinite;
  will-change: transform;
}

@keyframes fx-grid-sweep {
  from { transform: translate3d(0, -120%, 0); }
  to { transform: translate3d(0, 520%, 0); }
}

@keyframes fx-grid-beam {
  from { transform: translate3d(-10vw, 0, 0); }
  to { transform: translate3d(110vw, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .tilt-card.reveal, .tilt-card.reveal.visible { transform: none; }
  .badge-dot.pulse { animation: none; }
  .border-beam::after,
  .fx-grid-sweep,
  .fx-grid-beam,
  .load-beam,
  .page-landing .navbar,
  .load-stagger { animation: none; }
  .load-beam { display: none; }
  .page-landing .navbar,
  .load-stagger { opacity: 1; transform: none; }
  .btn-magnetic { transform: none !important; }
}

/* ------------------------------------------------------------------ */
/* Layout helpers                                                       */
/* ------------------------------------------------------------------ */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-1 { flex: 1; min-width: 0; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }

@media (max-width: 1000px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* Dual-engine: mobile gym-phone UX (< 768px)                           */
/* ------------------------------------------------------------------ */

.touch-trail {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.sheet-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sheet {
  width: 100%;
  max-width: 480px;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 14px 22px calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translate3d(0, 110%, 0);
  transition: transform 0.42s cubic-bezier(0.32, 1.4, 0.48, 1);
  will-change: transform;
}

.sheet-overlay.open .sheet { transform: translate3d(0, 0, 0); }

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  margin: 4px auto 18px;
}

.sheet h3 {
  font-size: 18px;
  letter-spacing: 0.4px;
  margin: 0 0 8px;
  text-align: center;
}

.sheet p {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  margin: 0 0 22px;
  line-height: 1.5;
}

.sheet .btn {
  min-height: 52px;
  margin-bottom: 12px;
}

.sheet-close {
  display: block;
  width: 100%;
  min-height: 48px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}

.snap-dots {
  display: none;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.snap-dot {
  position: relative;
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.snap-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  transform: translate(-50%, -50%);
}

.snap-dot.active::after {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

body.sheet-open {
  overflow: hidden;
}

.phone-frame {
  position: relative;
  width: clamp(180px, 22vw, 248px);
  aspect-ratio: 9 / 19.4;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 28px;
  background: #000;
  padding: 10px 8px 12px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 30px 80px -28px rgba(255, 255, 255, 0.12);
  transform-style: preserve-3d;
  will-change: transform;
}

.phone-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 20px;
}

.phone-frame > .phone-rail {
  position: absolute;
  width: 3px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 1px;
  z-index: 5;
  pointer-events: none;
}

.phone-rail-mute { left: -3px; top: 72px; height: 18px; }
.phone-rail-vol { left: -3px; top: 102px; height: 36px; }
.phone-rail-pwr { right: -3px; top: 108px; height: 46px; }

.phone-notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  z-index: 4;
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  overflow: hidden;
  background: #050505;
  display: flex;
  flex-direction: column;
  padding: 28px 12px 14px;
}

.phone-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.phone-reps {
  font-family: var(--font-mono);
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 18px;
}

.phone-reps span { color: #fff; }

.phone-bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.phone-bar {
  height: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  overflow: hidden;
}

.phone-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
  animation: phone-fill 2.8s ease-in-out infinite;
  transform-origin: left center;
}

.phone-bar:nth-child(1) > span { animation-duration: 2.4s; }
.phone-bar:nth-child(2) > span { animation-duration: 3.1s; animation-delay: 0.2s; }
.phone-bar:nth-child(3) > span { animation-duration: 2.7s; animation-delay: 0.4s; }

@keyframes phone-fill {
  0% { width: 18%; }
  50% { width: 92%; }
  100% { width: 18%; }
}

.phone-mesh {
  flex: 1;
  width: 100%;
  min-height: 0;
  animation: mesh-osc 3.4s ease-in-out infinite;
  transform-origin: 50% 55%;
  will-change: transform;
}

@keyframes mesh-osc {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-1.4deg) scale(1); }
  50% { transform: translate3d(0, -5px, 0) rotate(1.4deg) scale(1.03); }
}

.phone-scan {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 1px;
  background: #fff;
  box-shadow: 0 0 10px #fff;
  animation: phone-scan 2.4s ease-in-out infinite;
  will-change: transform;
  pointer-events: none;
}

@keyframes phone-scan {
  0% { transform: translate3d(0, 40px, 0); opacity: 0.3; }
  50% { transform: translate3d(0, 210px, 0); opacity: 1; }
  100% { transform: translate3d(0, 40px, 0); opacity: 0.3; }
}

@media (max-width: 767px) {
  .btn, .nav-toggle, .nav-links a {
    min-height: 48px;
    min-width: 48px;
  }

  .btn-sm { padding: 12px 18px; font-size: 12px; }

  .btn-solid:hover:not(:disabled),
  .btn-outline:hover:not(:disabled) {
    transform: none;
  }

  .btn:active,
  .nav-toggle:active,
  .snap-dot:active,
  .sheet-close:active,
  .nav-links a:active,
  .card:active {
    transform: scale(0.92);
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .phone-frame { width: min(220px, 58vw); }

  .snap-carousel .snap-track {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 20px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    padding-bottom: 6px;
    margin-inline: -8px;
    padding-inline: 8px;
    scrollbar-width: none;
  }

  .snap-carousel .snap-track::-webkit-scrollbar { display: none; }

  .snap-carousel .snap-track > * {
    flex: 0 0 min(82vw, 340px);
    scroll-snap-align: start;
    max-width: min(82vw, 340px);
  }

  .snap-dots { display: flex; }

  .toast-stack { right: 16px; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}

@media (min-width: 768px) {
  .sheet-overlay { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .phone-bar > span,
  .phone-scan,
  .phone-mesh { animation: none; }
  .sheet { transition: none; }
}
