/* ===========================================================================
   OmniScrypt tools: shared stylesheet
   ---------------------------------------------------------------------------
   Loaded by every tool, after shared/css/tailwind.build.css and before the
   tool's own css/tool.css. Everything that makes the tools look and feel the
   same lives here; a tool's own file only adds what exists in that tool.

   The look is EventHarmon!'s.

   Sections:
     1. Tokens
     2. Base typography
     3. Surfaces (slabs, wells, buttons, pills)
     4. Popups (every popup in every tool)
     5. Toast
     6. Ambient orbs and scrollbars
     7. Utilities and accessibility
   =========================================================================== */

/* ---------------------------------------------------------------- 1. TOKENS */

:root {
  --text-main: #0f172a;
  --text-muted: #475569;
  --studio-indigo: #485282;
  --studio-accent: #4f46e5;
  --danger: #e11d48;
  --warning: #d97706;
  --success: #059669;

  --border-soft: #cbd5e1;
  --radius-slab: 16px;
  --radius-well: 12px;
}

/* ------------------------------------------------------ 2. BASE TYPOGRAPHY */

/* The base every tool shares. EventHarmon! adds its own, larger text rules in
   its css/tool.css; they are not applied to the other tools. */
body, input, textarea, button, select {
  font-size: 11pt;
  line-height: 1.5;
  font-family: 'Geist', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.01em;
}

.header-14 {
  font-size: 14pt;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.subheading-12 {
  font-size: 12pt;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.015em;
}

body {
  background: radial-gradient(circle at 50% 0%, #ffffff 0%, #e9edf6 100%) fixed;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.font-display {
  font-family: 'Geist', 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
}

.tabular-nums { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ 3. SURFACES */

.crystal-slab-3d {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95) 0%, rgba(246, 248, 253, 0.88) 100%);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid #ffffff;
  border-radius: 18px;
  box-shadow:
    0 14px 28px -4px rgba(35, 45, 75, 0.14),
    0 4px 10px -2px rgba(35, 45, 75, 0.08),
    inset 0 2px 0 #ffffff,
    inset 0 -3px 0 rgba(175, 188, 215, 0.4),
    inset 1.5px 0 0 rgba(255, 255, 255, 0.8),
    inset -1.5px 0 0 rgba(175, 188, 215, 0.3);
  position: relative;
}

.crystal-well-3d {
  background: #fdfdfd;
  border: 1px solid rgba(170, 184, 212, 0.6);
  border-radius: 13px;
  box-shadow:
    inset 0 3px 6px rgba(30, 40, 70, 0.12),
    inset 0 1px 2px rgba(30, 40, 70, 0.08),
    0 1px 0 #ffffff;
  transition: border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s;
}

.crystal-well-3d:focus-within {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow:
    inset 0 2px 4px rgba(30, 40, 70, 0.08),
    0 0 0 3px rgba(99, 102, 241, 0.18),
    0 1px 0 #ffffff;
}

.btn-3d {
  background: linear-gradient(180deg, #535c8b 0%, #3a4267 100%);
  border: 1px solid #6672a8;
  border-radius: 12px;
  box-shadow:
    0 4px 10px rgba(45, 52, 85, 0.3),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 0 rgba(20, 25, 45, 0.5);
  color: #ffffff;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-3d:hover:not(:disabled) {
  background: linear-gradient(180deg, #5c6699 0%, #424b75 100%);
  box-shadow:
    0 6px 14px rgba(45, 52, 85, 0.38),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.5),
    inset 0 -2px 0 rgba(20, 25, 45, 0.5);
  transform: translateY(-1px);
}

.btn-3d:active:not(:disabled) {
  transform: translateY(1.5px);
  box-shadow: 0 1px 3px rgba(45, 52, 85, 0.3), inset 0 2px 3px rgba(0, 0, 0, 0.4);
}

.btn-3d:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

/* Brief green flash after Copy / Download succeeds. */
.btn-3d.is-confirmed {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%);
  border-color: #34d399;
}

/* Destructive confirm buttons (for example "Clear" in a confirmation popup). */
.btn-3d.btn-danger {
  background: linear-gradient(180deg, #e11d48 0%, #9f1239 100%);
  border-color: #fb7185;
}

.pill-3d {
  background: linear-gradient(180deg, #ffffff 0%, #eef2f9 100%);
  border: 1px solid rgba(185, 198, 222, 0.7);
  box-shadow:
    0 2px 4px rgba(40, 50, 80, 0.08),
    inset 0 1px 0 #ffffff,
    inset 0 -1.5px 0 rgba(180, 195, 220, 0.4);
}

/* ------------------------------------------------------------- 4. POPUPS */

/* Every popup is a native <dialog class="modal-dialog">, opened with
   shared/js/modal.js. The dialog itself is invisible; the crystal slab inside
   it is the card, and the frosted backdrop dims and blurs the tool behind. */
.modal-dialog {
  width: calc(100% - 2rem);
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  max-height: calc(100dvh - 2rem);
  color: inherit;
}

.modal-dialog::backdrop {
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* -------------------------------------------------------------- 5. TOAST */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 60;
  max-width: min(92vw, 460px);
  padding: 0.6rem 1rem;
  border-radius: 12px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 10pt;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="warn"] { background: #92400e; }
.toast[data-kind="info"] { background: #3730a3; }

/* ------------------------------------------ 6. AMBIENT ORBS AND SCROLLBARS */

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  will-change: transform;
  animation: drift 22s ease-in-out infinite alternate;
}

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(30px, -20px) scale(1.06); }
  100% { transform: translate(-20px, 20px) scale(0.95); }
}

.spatial-scroll { scrollbar-width: thin; scrollbar-color: rgba(130, 145, 175, 0.4) transparent; }
.spatial-scroll::-webkit-scrollbar { width: 5px; }
.spatial-scroll::-webkit-scrollbar-track { background: transparent; }
.spatial-scroll::-webkit-scrollbar-thumb {
  background: rgba(130, 145, 175, 0.4);
  border-radius: 999px;
}

/* --------------------------------------------- 7. UTILITIES & ACCESSIBILITY */

/* A visible focus ring on every interactive element. The default outline is
   removed by Tailwind's reset, which leaves keyboard users with no indication
   of where they are on the page. */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
[contenteditable]:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Visible to screen readers, invisible on screen. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .orb { animation: none; }
  .btn-3d, .toast { transition: none; }
}

@media print {
  .no-print,
  .orb,
  .toast,
  .modal-dialog {
    display: none !important;
  }
}
