/* ============================================================
   IYKYK — Base Design System
   Design tokens, CSS reset, typography, and shared utilities
   ============================================================ */

/* SECURITY: No external font CDN. Runtime CDNs violate the strict CSP and the
   "no third-party sources" rule (CLAUDE.md #5, #7). We rely on the native system
   font stack below. To use Inter, self-host the woff2 and add an @font-face here
   pointing at /assets/fonts/ (a Phase 5 polish item). */

/* --- Design Tokens --- */
:root {
  /* Surface colors (dark mode) */
  --surface-0: #000000;
  --surface-1: #0a0a0a;
  --surface-2: #141414;
  --surface-3: #1c1c1e;
  --surface-4: #2c2c2e;
  --surface-5: #3a3a3c;

  /* Text colors */
  --text-primary: #ffffff;
  --text-secondary: #a1a1a6;
  --text-tertiary: #636366;
  --text-inverse: #000000;

  /* Accent colors */
  --accent-primary: #ff9f0a;
  --accent-primary-hover: #ffb340;
  --accent-secondary: #30d158;
  --accent-danger: #ff453a;
  --accent-info: #0a84ff;

  /* Operator button */
  --btn-operator: #ff9f0a;
  --btn-operator-hover: #ffb340;
  --btn-operator-active: #e68f00;

  /* Number button */
  --btn-number: #333333;
  --btn-number-hover: #444444;
  --btn-number-active: #555555;

  /* Function button */
  --btn-function: #a5a5a5;
  --btn-function-hover: #b5b5b5;
  --btn-function-active: #c5c5c5;

  /* Status colors */
  --status-online: #30d158;
  --status-offline: #636366;
  --status-sent: #a1a1a6;
  --status-read: #0a84ff;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Courier New', monospace;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-display: 3.5rem;

  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.1;
  --line-height-normal: 1.5;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 350ms ease-out;

  /* Z-index layers */
  --z-base: 1;
  --z-dropdown: 10;
  --z-overlay: 100;
  --z-modal: 200;
  --z-notification: 300;

  /* Safe areas (iOS notch, home indicator) */
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
}

/* --- CSS Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--surface-0);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

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

ul, ol {
  list-style: none;
}

/* --- Utility Classes --- */
.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;
}

.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* SECURITY: strict CSP forbids inline style="" attributes. Use these classes
   instead of inline styles in markup. */
.hidden {
  display: none !important;
}

.chat-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-tertiary);
}

.auth-back-btn {
  position: absolute;
  top: var(--space-lg);
  left: var(--space-lg);
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  opacity: 0;
}

/* --- App Container --- */
#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* --- Screen Containers --- */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
  will-change: opacity;
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
