/* Slop Typography CSS — fluid, accessible, slop-tested */

/* Base typography reset and variables */
:root {
  /* Fluid type steps */
  --step--2: clamp(11px, 1vw, 13px);
  --step--1: clamp(13px, 1.5vw, 15px);
  --step-0: clamp(16px, 2vw, 19px);
  --step-1: clamp(18px, 2.5vw, 22px);
  --step-2: clamp(20px, 3.5vw, 28px);
  --step-3: clamp(24px, 4.5vw, 36px);
  --step-4: clamp(32px, 6vw, 52px);
  --step-5: clamp(36px, 8vw, 72px);
  --step-6: clamp(48px, 12vw, 120px);

  /* Slop palette */
  --slime-light: #d4e6ff;
  --slime-dark: #4c6e8f;
  --ink: #16152a;
  --paper: #fff;
  --accent: #8b5edf;
  --accent-hover: #6d4bc1;
  --accent-active: #5a3e9d;
  --border: rgba(139, 90, 212, 0.3);
  --bg-overlay: rgba(255, 255, 255, 0.9);

  /* Font families */
  --font-display: 'Rubik Wet Paint', cursive;
  --font-body: 'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive;
  --font-mono: ui-monospace, 'Cascadia Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace;

  /* Spacing and layout */
  --gap: 1.5rem;
  --card-padding: 2rem;
  --radius: 12px;
}

/* Global typography styles */
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Fluid type scale demo */
.fluid-demo {
  display: grid;
  gap: 1rem;
  margin: var(--gap) 0;
}

.fluid-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.fluid-label {
  font-weight: 700;
  min-width: 8rem;
  font-family: var(--font-mono);
  font-size: var(--step--2);
}

.fluid-sample {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--accent);
  text-align: right;
  flex: 1;
}

/* Variable font controls */
.variable-controls {
  display: grid;
  gap: 0.75rem;
  margin: var(--gap) 0;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  align-items: center;
  gap: 1rem;
}

.control-row label {
  font-weight: 700;
  font-size: var(--step--1);
  font-family: var(--font-mono);
}

.control-row input[type="range"] {
  width: 100%;
  cursor: pointer;
}

.control-row output {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-align: right;
}

/* Preview area */
.variable-preview {
  margin: var(--gap) 0;
  padding: 1.5rem;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(4px);
}

.preview-heading {
  font-family: var(--font-display);
  font-size: var(--step-4);
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.preview-body {
  margin: 0.5rem 0;
}

.preview-body.small {
  font-size: var(--step--2);
  opacity: 0.8;
}

/* Balanced text demo */
.balanced-demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: var(--gap) 0;
}

.balanced-pair {
  display: grid;
  gap: 1rem;
}

.balanced-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
}

.balanced-heading {
  font-size: var(--step-2);
  margin-bottom: 0.5rem;
}

.balanced-body {
  font-size: var(--step--1);
}

.unbalanced {
  opacity: 0.6;
  filter: grayscale(80%);
}

/* Hanging punctuation */
.hanging-demo {
  display: grid;
  gap: 1.5rem;
  margin: var(--gap) 0;
}

.hanging-item {
  padding: 1rem;
  border-left: 4px solid var(--accent);
  background: var(--bg-overlay);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.hanging-quote {
  font-style: italic;
  padding-left: 1rem;
  border-left: 2px solid var(--slime-dark);
}

.hanging-list {
  list-style: none;
  padding: 0;
}

.hanging-list li {
  padding: 0.25rem 0;
}

.hanging-dl {
  margin: 0;
}

.hanging-dl dt {
  font-weight: 700;
  margin-top: 0.5rem;
}

.hanging-dl dd {
  margin: 0 0 0.5rem;
}

/* Code blocks */
.code-block {
  margin: var(--gap) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f8f9fa;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: #e9ecef;
  border-bottom: 1px solid var(--border);
}

.code-lang {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 700;
  color: var(--slime-dark);
}

.code-copy {
  margin-left: auto;
  padding: 0.25rem 0.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: var(--step--2);
}

.code-copy:hover {
  background: var(--accent-hover);
}

.code-pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  background: #fff;
}

.ln {
  color: #999;
  user-select: none;
  padding-right: 1rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

/* Playground */
.playground {
  margin: var(--gap) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-padding);
  background: var(--bg-overlay);
}

.playground-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.playground-controls label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--step--1);
  font-family: var(--font-mono);
}

.playground-output {
  display: grid;
  gap: 0.5rem;
}

.playground-line {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.3);
}

.placeholder {
  color: #888;
  font-style: italic;
}

/* Accessibility section */
.a11y-demo {
  display: grid;
  gap: 1.5rem;
  margin: var(--gap) 0;
}

.a11y-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
}

.a11y-item h3 {
  margin-top: 0;
  font-size: var(--step-2);
  color: var(--accent);
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
}

/* Share buttons */
.share-btn {
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: var(--step--1);
}

.share-btn:hover {
  background: var(--accent-hover);
}

/* Reduced motion override */
body.reduce-motion .variable-preview,
body.reduce-motion .playground-line {
  transition: none !important;
  animation: none !important;
}

/* Focus-visible outlines for keyboard navigation */
.typography-control:focus-visible,
.playground-control:focus-visible {
  outline: 3px solid var(--lavender-500);
  outline-offset: 2px;
}

/* Interactive elements hover states */
.typography-control:hover,
.playground-control:hover {
  cursor: pointer;
}

/* Share button focus */
.share-btn:focus-visible {
  outline: 3px solid var(--lavender-500);
  outline-offset: 2px;
}

/* Print styles enhancement */
@media print {
  .variable-controls,
  .playground-controls,
  .toast {
    display: none;
  }
  .playground-output {
    break-inside: avoid;
  }
  .code-block {
    border: 1px solid var(--border);
    page-break-inside: avoid;
  }
}

/* Dark mode adjustments */n
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e0e0e0;
    --paper: #121212;
    --bg-overlay: rgba(18, 18, 18, 0.95);
    --border: rgba(139, 90, 212, 0.5);
    --slime-light: #2d3e50;
    --slime-dark: #4c6e8f;
  }
  .fluid-sample {
    color: var(--accent);
  }
  .code-block {
    background: #1e1e1e;
    border-color: var(--border);
  }
  .code-header {
    background: #2d2d2d;
    border-color: var(--border);
  }
  .playground {
    background: var(--bg-overlay);
  }
}

/* Print styles */
@media print {
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  .variable-controls,
  .playground-controls,
  .toast {
    display: none;
  }
  .playground-output {
    break-inside: avoid;
  }
}
