/* ═══════════════════════════════════════════════════════════════
   STYLEGUARD — style.css  v0.1.0
   Theme: shadcn/ui dark + light via [data-theme]
   New in v0.1: fix popover · copy button · legend badges
═══════════════════════════════════════════════════════════════ */

/* ── 1. SHARED TOKENS ─────────────────────────────────────── */
:root {
  --radius:    0.625rem;
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);

  --font-sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur-mid:  250ms;

  --viol-passive: #f97316;
  --viol-weak:    #0d9488;
  --viol-long:    #dc2626;
  --viol-banned:  #9333ea;
}


/* ── 2. DARK TOKENS ───────────────────────────────────────── */
[data-theme="dark"] {
  color-scheme: dark;
  --background:           #09090b;
  --card:                 #18181b;
  --secondary:            #27272a;
  --muted:                #27272a;
  --accent:               #27272a;
  --foreground:           #fafafa;
  --card-foreground:      #fafafa;
  --primary:              #e4e4e7;
  --primary-foreground:   #18181b;
  --secondary-foreground: #fafafa;
  --muted-foreground:     #a1a1aa;
  --accent-foreground:    #fafafa;
  --border:               rgba(255,255,255,0.10);
  --input:                rgba(255,255,255,0.15);
  --ring:                 #71717a;
  --shield-fill:          #18181b;
  --shield-stroke:        rgba(255,255,255,0.18);
  --toggle-border:        rgba(255,255,255,0.18);
  --stat-error-bg:  rgba(248,113,113,.12); --stat-error-fg:  #fca5a5;
  --stat-warn-bg:   rgba(251,191, 36,.10); --stat-warn-fg:   #fcd34d;
  --stat-info-bg:   rgba( 96,165,250,.10); --stat-info-fg:   #93c5fd;
  --stat-score-bg:  rgba( 52,211,153,.10); --stat-score-fg:  #6ee7b7;
  --viol-passive-bg: rgba(249,115, 22,.10);
  --viol-weak-bg:    rgba( 13,148,136,.08);
  --viol-long-bg:    rgba(220, 38, 38,.09);
  --viol-banned-bg:  rgba(147, 51,234,.09);
  --popover-bg:      #1c1c1f;
  --popover-border:  rgba(255,255,255,0.14);
  --popover-shadow:  0 8px 32px rgba(0,0,0,.55);
}


/* ── 3. LIGHT TOKENS ──────────────────────────────────────── */
[data-theme="light"] {
  color-scheme: light;
  --background:           #ffffff;
  --card:                 #ffffff;
  --secondary:            #f4f4f5;
  --muted:                #f4f4f5;
  --accent:               #f4f4f5;
  --foreground:           #09090b;
  --card-foreground:      #09090b;
  --primary:              #18181b;
  --primary-foreground:   #fafafa;
  --secondary-foreground: #18181b;
  --muted-foreground:     #71717a;
  --accent-foreground:    #18181b;
  --border:               rgba(0,0,0,0.10);
  --input:                rgba(0,0,0,0.08);
  --ring:                 #a1a1aa;
  --shield-fill:          #f4f4f5;
  --shield-stroke:        rgba(0,0,0,0.15);
  --toggle-border:        rgba(0,0,0,0.15);
  --stat-error-bg:  rgba(220, 38, 38,.07); --stat-error-fg:  #b91c1c;
  --stat-warn-bg:   rgba(161,109,  8,.07); --stat-warn-fg:   #92400e;
  --stat-info-bg:   rgba( 37, 99,235,.07); --stat-info-fg:   #1d4ed8;
  --stat-score-bg:  rgba(  5,150,105,.07); --stat-score-fg:  #065f46;
  --viol-passive-bg: rgba(249,115, 22,.10);
  --viol-weak-bg:    rgba( 13,148,136,.10);
  --viol-long-bg:    rgba(220, 38, 38,.08);
  --viol-banned-bg:  rgba(147, 51,234,.08);
  --popover-bg:      #ffffff;
  --popover-border:  rgba(0,0,0,0.12);
  --popover-shadow:  0 8px 32px rgba(0,0,0,.14);
}


/* ── 4. THEME TRANSITION ──────────────────────────────────── */
body, .site-header, .pane, .pane-header, .pane-step, .stat,
#results-panel, .violation-legend, .site-footer, .btn,
.doc-textarea, .fix-popover, .changelog-panel {
  transition:
    background-color var(--dur-mid) var(--ease-out),
    border-color     var(--dur-mid) var(--ease-out),
    color            var(--dur-mid) var(--ease-out),
    box-shadow       var(--dur-mid) var(--ease-out);
}


/* ── 5. RESET & BASE ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--foreground);
  background-color: var(--background);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}


/* ── 6. HEADER ────────────────────────────────────────────── */
.site-header {
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand { display: flex; align-items: center; gap: 0.625rem; }
.brand-shield { flex-shrink: 0; }
.shield-bg { fill: var(--shield-fill); stroke: var(--shield-stroke); }
.brand-text { display: flex; flex-direction: column; gap: 1px; }

.brand-name {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--foreground);
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  font-weight: 400;
  line-height: 1;
}

.header-right { display: flex; align-items: center; gap: 0.75rem; }

.version-tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  padding: 0.2em 0.5em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}

.version-tag:hover {
  color: var(--foreground);
  background: var(--secondary);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.version-tag:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}


/* ── 7. THEME TOGGLE ──────────────────────────────────────── */
.btn--icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2rem;
  padding: 0 0.75rem;
  border-radius: 9999px;
  background: var(--secondary);
  border: 1px solid var(--toggle-border);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition:
    background   var(--dur-fast) var(--ease-out),
    box-shadow   var(--dur-fast) var(--ease-out);
}

.btn--icon:hover { background: var(--accent); box-shadow: 0 0 0 1px var(--ring); }
.btn--icon:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.theme-toggle-label { line-height: 1; }

[data-theme="dark"]  .icon-sun   { display: none; }
[data-theme="dark"]  .icon-moon  { display: block; }
[data-theme="light"] .icon-moon  { display: none; }
[data-theme="light"] .icon-sun   { display: block; }
[data-theme="dark"]  .label-dark  { display: inline; }
[data-theme="dark"]  .label-light { display: none; }
[data-theme="light"] .label-dark  { display: none; }
[data-theme="light"] .label-light { display: inline; }

.btn--icon.toggling svg { animation: spin-icon 0.35s var(--ease-out) both; }

@keyframes spin-icon {
  from { transform: rotate(-30deg) scale(0.8); opacity: 0; }
  to   { transform: rotate(0)      scale(1);   opacity: 1; }
}


/* ── 8. APP SHELL ─────────────────────────────────────────── */
.app-shell {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  align-items: stretch;
}


/* ── 9. PANES ─────────────────────────────────────────────── */
.pane {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pane:focus-within { box-shadow: 0 0 0 1px var(--ring); }

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.pane-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1;
}

.pane-step {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--muted-foreground);
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.45em;
  line-height: 1.4;
}

.char-counter {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}

#char-count { color: var(--foreground); }


/* ── 10. TEXTAREA ─────────────────────────────────────────── */
.doc-textarea {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--foreground);
  background: transparent;
  width: 100%;
  flex: 1;
  min-height: 380px;
  resize: vertical;
  padding: 1rem;
  border: none;
  outline: none;
  caret-color: var(--foreground);
  tab-size: 2;
  word-break: break-word;
  overflow-wrap: break-word;
}

.doc-textarea::placeholder { color: var(--muted-foreground); opacity: 0.5; }

.doc-textarea::-webkit-scrollbar       { width: 4px; }
.doc-textarea::-webkit-scrollbar-track { background: transparent; }
.doc-textarea::-webkit-scrollbar-thumb { background: var(--secondary); border-radius: 2px; }


/* ── 11. INPUT ACTIONS ────────────────────────────────────── */
.input-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border);
}

.btn {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0 0.875rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background    var(--dur-fast) var(--ease-out),
    color         var(--dur-fast) var(--ease-out),
    border-color  var(--dur-fast) var(--ease-out),
    opacity       var(--dur-fast) var(--ease-out);
}

.btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn--primary:hover   { opacity: 0.88; }
.btn--primary:active  { opacity: 0.75; }
.btn--primary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.btn--ghost {
  background: transparent;
  color: var(--muted-foreground);
}
.btn--ghost:hover  { background: var(--accent); color: var(--accent-foreground); }
.btn--ghost:active { opacity: 0.8; }
.btn--ghost:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Copy clean button — sits in pane header */
.btn--copy {
  font-size: 0.6875rem;
  height: 1.75rem;
  padding: 0 0.625rem;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}
.btn--copy:hover { color: var(--foreground); border-color: var(--ring); background: var(--secondary); }

.drop-hint {
  margin-left: auto;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  opacity: 0.6;
}


/* ── 12. STATS BAR ────────────────────────────────────────── */
#stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  gap: 0.2rem;
  border-right: 1px solid var(--border);
}
.stat:last-child { border-right: none; }

.stat-value {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.65;
}

.stat--error { background: var(--stat-error-bg); }
.stat--error .stat-value, .stat--error .stat-label { color: var(--stat-error-fg); }

.stat--warn  { background: var(--stat-warn-bg); }
.stat--warn  .stat-value, .stat--warn  .stat-label { color: var(--stat-warn-fg); }

.stat--info  { background: var(--stat-info-bg); }
.stat--info  .stat-value, .stat--info  .stat-label { color: var(--stat-info-fg); }

.stat--score { background: var(--stat-score-bg); }
.stat--score .stat-value, .stat--score .stat-label { color: var(--stat-score-fg); }

.stat-value.updated { animation: pop-value 0.3s var(--ease-out) forwards; }

@keyframes pop-value {
  0%   { transform: scale(1.25); opacity: 0.5; }
  100% { transform: scale(1);    opacity: 1; }
}


/* ── 13. RESULTS PANEL ────────────────────────────────────── */
#results-panel {
  flex: 1;
  min-height: 280px;
  overflow-y: auto;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 300;
  line-height: 1.8;
  color: var(--foreground);
  white-space: pre-wrap;
  word-break: break-word;
  position: relative; /* needed for popover positioning */
}

#results-panel::-webkit-scrollbar       { width: 4px; }
#results-panel::-webkit-scrollbar-track { background: transparent; }
#results-panel::-webkit-scrollbar-thumb { background: var(--secondary); border-radius: 2px; }

.results-empty {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  text-align: center;
}

.results-empty-icon { color: var(--muted-foreground); opacity: 0.3; }

.results-empty p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  max-width: 24ch;
  line-height: 1.55;
}


/* ── 14. VIOLATION SPANS ──────────────────────────────────── */
.violation-passive, .violation-weak, .violation-long, .violation-banned {
  border-radius: 2px;
  padding: 0 2px;
  cursor: pointer;   /* pointer not help — it's now clickable */
  text-decoration-skip-ink: auto;
  transition: filter var(--dur-fast) var(--ease-out),
              outline var(--dur-fast) var(--ease-out);
}

/* Focused state for keyboard navigation */
.violation:focus {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.violation-passive {
  color: var(--viol-passive);
  background: var(--viol-passive-bg);
  text-decoration: underline wavy var(--viol-passive);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.violation-passive:hover { filter: brightness(1.15); }

.violation-weak {
  color: var(--viol-weak);
  background: var(--viol-weak-bg);
  text-decoration: underline dashed var(--viol-weak);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.violation-weak:hover { filter: brightness(1.15); }

.violation-long {
  color: var(--viol-long);
  background: var(--viol-long-bg);
  text-decoration: underline double var(--viol-long);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.violation-long:hover { filter: brightness(1.15); }

.violation-banned {
  color: var(--viol-banned);
  background: var(--viol-banned-bg);
  text-decoration: underline dotted var(--viol-banned);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.violation-banned:hover { filter: brightness(1.15); }


/* ── 15. FIX POPOVER ──────────────────────────────────────── */
.fix-popover {
  position: absolute;
  z-index: 200;
  width: 280px;
  background: var(--popover-bg);
  border: 1px solid var(--popover-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--popover-shadow);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  animation: popover-in 0.18s var(--ease-out) both;
}

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

.fix-popover[hidden] { display: none; }

.fix-popover-rule {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.fix-popover-body {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--foreground);
  line-height: 1.5;
}

.fix-popover-suggestion {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--stat-score-fg);
  line-height: 1.5;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.125rem;
}

.fix-popover-suggestion[hidden] { display: none; }


/* ── 16. VIOLATION LEGEND + BADGES ───────────────────────── */
.violation-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.875rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.legend-swatch {
  display: inline-block;
  width: 1.25em;
  height: 0.125em;
  border-radius: 1px;
  flex-shrink: 0;
}

.legend-swatch--passive { background: var(--viol-passive); }
.legend-swatch--weak    { background: var(--viol-weak); }
.legend-swatch--long    { background: var(--viol-long); }
.legend-swatch--banned  { background: var(--viol-banned); }

/* Count badge */
.legend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 500;
  min-width: 1.2em;
  height: 1.2em;
  padding: 0 0.3em;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--foreground);
  line-height: 1;
}

.legend-badge[hidden] { display: none; }


/* ── 17. FOOTER ───────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.site-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer-inner p { opacity: 0.5; }

.changelog-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25em 0.65em;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background   var(--dur-fast) var(--ease-out),
    color        var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.changelog-toggle-btn:hover { background: var(--secondary); color: var(--foreground); border-color: var(--ring); }
.changelog-toggle-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.changelog-toggle-chevron { transition: transform var(--dur-fast) var(--ease-out); }
.changelog-toggle-btn[aria-expanded="true"] .changelog-toggle-chevron { transform: rotate(180deg); }


/* ── 18. CHANGELOG PANEL ──────────────────────────────────── */
.changelog-panel {
  border-top: 1px solid var(--border);
  background: var(--card);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition:
    max-height   var(--dur-mid) var(--ease-out),
    opacity      var(--dur-mid) var(--ease-out);
}

.changelog-panel:not([hidden]) { max-height: 480px; opacity: 1; }

.changelog-panel[hidden] {
  display: block !important;
  visibility: visible;
  pointer-events: none;
}

.changelog-inner { max-width: 1280px; margin: 0 auto; padding: 1rem 1.5rem 1.25rem; }

.changelog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.875rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
}

.changelog-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--foreground);
}

.changelog-gh-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
.changelog-gh-link:hover { color: var(--foreground); }

.changelog-content {
  overflow-y: auto;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.changelog-content::-webkit-scrollbar       { width: 4px; }
.changelog-content::-webkit-scrollbar-track { background: transparent; }
.changelog-content::-webkit-scrollbar-thumb { background: var(--secondary); border-radius: 2px; }

.changelog-release { display: flex; flex-direction: column; gap: 0.375rem; }
.changelog-release-header { display: flex; align-items: baseline; gap: 0.625rem; }
.changelog-version { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; color: var(--foreground); }
.changelog-date    { font-family: var(--font-mono); font-size: 0.625rem; color: var(--muted-foreground); }

.changelog-latest-badge {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stat-score-fg);
  background: var(--stat-score-bg);
  border-radius: 999px;
  padding: 0.1em 0.55em;
}

.changelog-items { list-style: none; display: flex; flex-direction: column; gap: 0.2rem; }
.changelog-item {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--muted-foreground);
  line-height: 1.5;
  display: flex;
  gap: 0.5rem;
}
.changelog-item::before { content: '—'; color: var(--ring); flex-shrink: 0; }

.changelog-loading, .changelog-error, .changelog-empty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  padding: 0.5rem 0;
}
.changelog-error { color: var(--stat-error-fg); }

@keyframes spin { to { transform: rotate(360deg); } }
.changelog-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--border);
  border-top-color: var(--muted-foreground);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}


/* ── 19. UTILITY ──────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.pane--input.drag-over {
  outline: 1px dashed var(--ring);
  outline-offset: -3px;
}


/* ── 20. PAGE LOAD ────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.site-header  { animation: fade-up 0.3s var(--ease-out) both; }
.pane--input  { animation: fade-up 0.35s 0.05s var(--ease-out) both; }
.pane--output { animation: fade-up 0.35s 0.10s var(--ease-out) both; }
.site-footer  { animation: fade-up 0.3s 0.15s var(--ease-out) both; }


/* ── 21. RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; padding: 1rem; gap: 0.875rem; align-items: start; }
  .doc-textarea { min-height: 260px; }
  #results-panel { min-height: 220px; }
  .drop-hint { display: none; }
}

@media (max-width: 560px) {
  .header-inner  { padding: 0 1rem; height: 48px; }
  .brand-tagline { display: none; }
  .app-shell     { padding: 0.75rem; gap: 0.75rem; }
  .btn           { height: 1.875rem; font-size: 0.75rem; }
  #stats-bar { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(3) { border-top: 1px solid var(--border); }
  .stat-value { font-size: 1.125rem; }
  .doc-textarea  { min-height: 200px; font-size: 0.75rem; }
  #results-panel { font-size: 0.75rem; }
  .site-footer-inner { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 0.75rem 1rem; }
  .fix-popover { width: calc(100vw - 2rem); left: 1rem !important; }
}

@media (max-width: 360px) {
  #stats-bar { grid-template-columns: 1fr; }
  .stat { border-right: none; border-top: 1px solid var(--border); }
  .stat:first-child { border-top: none; }
}

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