/* ═══════════════════════════════════════════════════════
   FAUX OS V2.1 - Shared Components
   ═══════════════════════════════════════════════════════ */

/* ── Card - clean surface, subtle gradient ── */
.card {
  background: rgba(255, 255, 255, 0.015);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: var(--sp-4);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  transition: all var(--dur-fast) var(--ease-smooth);
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;

  &:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--ink-faint);
  }

  &:active {
    transform: translateY(1px);
  }
}

.btn--primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 700;

  &:hover {
    background: var(--c-bone);
  }
}

.btn--accent {
  background: var(--accent);
  color: var(--c-white);
  border-color: var(--accent);

  &:hover {
    filter: brightness(1.1);
  }
}

/* Sharp button variant */
.btn--brutal {
  border-radius: 0;
  border: 2px solid var(--c-white);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--fs-xs);

  &:hover {
    background: var(--c-white);
    color: var(--c-black);
  }
}

/* ── Form Elements ── */
.input {
  width: 100%;
  padding: var(--sp-3);
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  transition: border-color var(--dur-fast);

  &:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-dim);
  }

  &::placeholder {
    color: var(--ink-faint);
  }
}

textarea.input {
  min-height: 100px;
  resize: vertical;
}

/* ── Modal Overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  padding: var(--sp-6);

  &.is-active {
    display: flex;
  }
}

.modal {
  width: min(480px, 90vw);
  background: var(--bg-surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: var(--sp-8);
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--dur-slow) var(--ease-out);
  position: relative;

  /* Constructivist accent: top-left corner mark */
  &::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px;
    width: 22px; height: 22px;
    border-top: 3px solid var(--accent);
    border-left: 3px solid var(--accent);
    border-radius: var(--r-md) 0 0 0;
    opacity: 0.6;
    pointer-events: none;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal__title {
  font-family: var(--font-pixel);
  font-size: var(--fs-sm);
  letter-spacing: var(--tracking-pixel);
  margin-bottom: var(--sp-4);
}

.modal__text {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: var(--leading-loose);
  margin-bottom: var(--sp-6);
}

.modal__actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* ── Legal Float Link (always-accessible imprint) ── */
.legal-float {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 12px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-family: inherit;
  color: var(--ink-faint, #666);
  text-decoration: none;
  opacity: 0.35;
  transition: opacity 0.2s;
  white-space: nowrap;
  z-index: 1;
  letter-spacing: 0.02em;
}

.legal-float:hover,
.legal-float:active {
  opacity: 0.7;
  text-decoration: none;
  color: var(--ink-muted, #999);
}

/* Inside welcome overlay - positioned at very bottom */
.legal-float--bottom {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  margin-top: auto;
  padding-top: var(--sp-6, 24px);
}

/* Inside modal - inline at bottom of modal card */
.legal-float--inline {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  display: block;
  text-align: center;
  margin-top: var(--sp-4, 16px);
  font-size: 10px;
}

/* ── Typography Utilities ── */
.text-pixel {
  font-family: var(--font-pixel);
  letter-spacing: var(--tracking-pixel);
}

.text-muted  { color: var(--ink-muted); }
.text-faint  { color: var(--ink-faint); }
.text-accent { color: var(--accent); }

/* ── Section Title ── */
.section-title {
  font-family: var(--font-pixel);
  font-size: var(--fs-sm);
  letter-spacing: var(--tracking-pixel);
  margin-bottom: var(--sp-4);
  padding-left: var(--sp-3);
  border-left: 2px solid var(--accent);
}

/* ── Toggle Switch ── */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;

  & input {
    opacity: 0;
    width: 0;
    height: 0;
  }
}

.toggle__track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--c-slate);
  border-radius: var(--r-full);
  transition: background var(--dur-normal);

  &::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--c-white);
    border-radius: 50%;
    transition: transform var(--dur-normal) var(--ease-spring);
  }
}

input:checked + .toggle__track {
  background: var(--accent);

  &::before {
    transform: translateX(22px);
  }
}

/* ── Pill Tags - dashed border, wobble on hover ── */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.pill {
  border: 1px dashed var(--border);
  border-radius: var(--r-full);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}

/* ═══════════════════════════════════════════════════
   REDUCED MOTION — toggled via .reduced-motion on <html>
   Kills all CSS animations and flattens transitions
   to a near-instant swap. JS-driven effects (particles,
   glitch intervals, ghost trails) are handled in settings.js.
   ═══════════════════════════════════════════════════ */
.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* ═══════════════════════════════════════════════════
   MOTION WARNING TOAST
   ═══════════════════════════════════════════════════ */
.motion-warning {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 380px;
  z-index: var(--z-notification);
  background: var(--c-charcoal);
  border: 1.5px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: var(--sp-4);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
  pointer-events: auto;

  &.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  &.is-leaving {
    opacity: 0;
    transform: translateY(8px);
  }
}

.motion-warning__title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--sp-2);
  color: var(--accent);
}

.motion-warning__body {
  line-height: 1.5;
  color: var(--ink-muted);
  margin-bottom: var(--sp-3);
}

.motion-warning__toggle-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
}

.motion-warning__toggle-label {
  font-size: 11px;
  color: var(--ink);
}

.motion-warning__hint {
  margin-bottom: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-left: 2px solid var(--accent);
  font-size: 10px;
  line-height: 1.5;
  color: var(--ink-faint);

  & strong {
    color: var(--ink-muted);
  }
}

.motion-warning__actions {
  display: flex;
  gap: var(--sp-2);
}

.motion-warning__btn-close {
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;

  &:hover {
    background: rgba(232, 93, 48, 0.08);
  }
}

/* Mobile: full-width, bottom */
@media (max-width: 768px) {
  .motion-warning {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
}
