/*
 * Otto Brand System — Canonical Stylesheet
 * Source: communication/otto-brand-tokens.yaml
 * Design: docs/plans/2026-03-15-otto-brand-system-design.md
 *
 * Import this in any HTML artifact Otto generates.
 * Usage: <link rel="stylesheet" href="otto-brand.css">
 *        or copy the :root block into your <style> tag.
 */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ═══════════════════════════════════════════
   TOKENS
   ═══════════════════════════════════════════ */

:root {
  /* Core brand */
  --otto: #7C5CFC;
  --accent: #00D1FF;

  /* Chambers */
  --discover: #EF4444;
  --build: #EAB308;
  --review: #A855F7;
  --ship: #22C55E;

  /* Semantic aliases */
  --error: var(--discover);
  --warning: var(--build);
  --success: var(--ship);

  /* Surfaces */
  --base: #0B0E14;
  --raised: #0F1219;
  --overlay: #151923;
  --sunken: #080A0F;
  --border: #1E2330;

  /* Text */
  --text: #E2E8F0;
  --text2: #94A3B8;
  --text3: #64748B;

  /* Derived */
  --otto-hover: #6B4AEB;
  --otto-glow: rgba(124, 92, 252, 0.3);
  --accent-glow: rgba(0, 209, 255, 0.3);

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Motion */
  --ease-default: all 0.2s ease;
  --ease-reveal: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  --ease-constellation: all 1.2s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */

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

body {
  font-family: var(--font);
  background: var(--base);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--otto-glow); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════ */

h1 { font-size: 42px; font-weight: 900; letter-spacing: -2px; line-height: 1.1; }
h2 { font-size: 28px; font-weight: 800; letter-spacing: -1px; line-height: 1.2; }
h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.3; }
h4 { font-size: 16px; font-weight: 600; line-height: 1.4; }

h1, h2, h3, h4 { color: var(--text); margin-bottom: 16px; }

p { color: var(--text2); margin-bottom: 12px; }

code, pre {
  font-family: var(--mono);
  font-size: 13px;
}

code {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
}

pre {
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

/* Gradient text (display use only) */
.otto-gradient {
  background: linear-gradient(135deg, #E2E8F0, #7C5CFC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══════════════════════════════════════════
   MICRO LABELS (Section tags)
   ═══════════════════════════════════════════ */

.otto-tag {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--otto);
  margin-bottom: 8px;
  display: block;
}

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */

.otto-card {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--ease-default);
}

.otto-card:hover {
  border-color: rgba(124, 92, 252, 0.3);
  box-shadow: 0 0 20px rgba(124, 92, 252, 0.05);
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */

.otto-btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--ease-default);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.otto-btn-primary {
  background: var(--otto);
  color: white;
}

.otto-btn-primary:hover {
  background: var(--otto-hover);
  box-shadow: 0 0 16px var(--otto-glow);
}

.otto-btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}

.otto-btn-ghost:hover {
  color: var(--text);
  border-color: var(--text3);
}

.otto-btn-accent {
  background: var(--accent);
  color: var(--base);
}

.otto-btn-accent:hover {
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ═══════════════════════════════════════════
   STAGES (showcase areas)
   ═══════════════════════════════════════════ */

.otto-stage {
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.otto-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.otto-stage-label {
  position: absolute;
  top: 12px;
  left: 16px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ═══════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════ */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(30, 35, 48, 0.5);
  color: var(--text2);
}

tr:hover td {
  color: var(--text);
  background: rgba(124, 92, 252, 0.02);
}

/* ═══════════════════════════════════════════
   CHAMBER BADGES
   ═══════════════════════════════════════════ */

.chamber-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
}

.chamber-discover { color: var(--discover); background: rgba(239, 68, 68, 0.1); }
.chamber-build    { color: var(--build);    background: rgba(234, 179, 8, 0.1); }
.chamber-review   { color: var(--review);   background: rgba(168, 85, 247, 0.1); }
.chamber-ship     { color: var(--ship);     background: rgba(34, 197, 94, 0.1); }

/* ═══════════════════════════════════════════
   SEVERITY INDICATORS
   ═══════════════════════════════════════════ */

.severity-green  { color: var(--success); }
.severity-yellow { color: var(--warning); }
.severity-red    { color: var(--error); }

/* ═══════════════════════════════════════════
   SIGNATURE
   ═══════════════════════════════════════════ */

.otto-signature {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  text-align: center;
  letter-spacing: 1px;
}

/* ═══════════════════════════════════════════
   LAYOUT UTILITIES
   ═══════════════════════════════════════════ */

.otto-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px 120px;
}

.otto-section {
  margin-top: 80px;
}

.otto-hero {
  text-align: center;
  padding: 60px 0 40px;
}

/* ═══════════════════════════════════════════
   CONSTELLATION ANIMATIONS
   ═══════════════════════════════════════════ */

@keyframes nodePulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes edgeFlow {
  0% { stroke-dashoffset: 20; }
  100% { stroke-dashoffset: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes breathe {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.02); }
}

/* ═══════════════════════════════════════════
   ACCESSIBILITY ENFORCEMENT
   Every product must inherit these rules.
   Source: communication/accessibility-profile.yaml
   ═══════════════════════════════════════════ */

/* Focus indicators — keyboard users must see where they are */
:focus-visible {
  outline: 2px solid var(--otto);
  outline-offset: 2px;
}

/* Remove default outline only when focus-visible handles it */
:focus:not(:focus-visible) {
  outline: none;
}

/* Button focus glow */
button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--otto);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--otto-glow);
}

/* Input focus ring */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--otto);
  outline-offset: 0;
  border-color: var(--otto);
}

/* Link focus */
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ═══════════════════════════════════════════
   REDUCED MOTION
   Respect user OS preferences.
   ═══════════════════════════════════════════ */

@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;
  }
}

/* ═══════════════════════════════════════════
   FORM ACCESSIBILITY
   Labels, spellcheck, flexible input.
   Source: communication/form-standards.yaml
   ═══════════════════════════════════════════ */

/* Error state for inputs */
.otto-input-error,
input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--error) !important;
}

/* Error message styling */
.otto-error-msg {
  color: var(--error);
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Disabled state */
input:disabled,
textarea:disabled,
select:disabled,
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════
   TOAST NOTIFICATIONS
   Non-blocking, bottom-right.
   Source: communication/ux-standards.yaml
   ═══════════════════════════════════════════ */

.otto-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 700;
  animation: toastEnter 0.3s ease-out;
}

.otto-toast-success { border-left: 3px solid var(--success); }
.otto-toast-error   { border-left: 3px solid var(--error); }
.otto-toast-warning { border-left: 3px solid var(--warning); }
.otto-toast-info    { border-left: 3px solid var(--otto); }

@keyframes toastEnter {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════
   EMPTY / LOADING STATES
   ═══════════════════════════════════════════ */

.otto-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text3);
}

.otto-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px;
}

.otto-empty-body {
  font-size: 14px;
  color: var(--text3);
  margin-bottom: 16px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* Skeleton shimmer */
.otto-skeleton {
  background: linear-gradient(
    90deg,
    var(--raised) 25%,
    var(--overlay) 50%,
    var(--raised) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Thinking dots (AI processing) */
.otto-thinking {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.otto-thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--otto);
  animation: thinkPulse 1.4s ease-in-out infinite;
}

.otto-thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.otto-thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════════
   MODAL
   Max-width 480px, focus-trapped, closeable.
   ═══════════════════════════════════════════ */

.otto-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.otto-modal {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 480px;
  width: 90%;
  z-index: 600;
  animation: modalOpen 0.4s ease-out;
}

.otto-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.otto-modal-body {
  color: var(--text2);
  margin-bottom: 24px;
}

.otto-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@keyframes modalOpen {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════════
   RESPONSIVE FOUNDATION
   Mobile-first breakpoints.
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
  .otto-page {
    padding: 24px 16px 80px;
  }

  h1 { font-size: 28px; letter-spacing: -1px; }
  h2 { font-size: 22px; }
  h3 { font-size: 18px; }

  .otto-hero { padding: 40px 0 24px; }
  .otto-section { margin-top: 48px; }

  .otto-modal { width: 95%; padding: 20px; }
}

@media (max-width: 480px) {
  .otto-page {
    padding: 16px 12px 64px;
  }

  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
}

/* ═══════════════════════════════════════════
   TOUCH TARGET MINIMUM
   44x44px for mobile interactive elements.
   ═══════════════════════════════════════════ */

@media (pointer: coarse) {
  button, [role="button"], a, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ═══════════════════════════════════════════
   SCROLLBAR (webkit)
   ═══════════════════════════════════════════ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }
