/* XML Formatter — maguey-terminal theme */
:root {
  --bg: #0B0F14;
  --fg: #E9E3D7;
  --accent: #5FA8D3;
  --accent2: #2F5D50;
  --muted: #0F1620;
  --muted-text: #A79F92;
  --border: rgba(233,227,215,0.16);
  --danger: #B0302F;
  --success: #2F5D50;
  --highlight: #EB8F2C;
  --brand-pop: #7CF2C7;
  --code-bg: rgba(233,227,215,0.06);
  --code-border: rgba(233,227,215,0.18);
  --link: #5FA8D3;
  --link-hover: #8CC7E8;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  top: -44px;
  left: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 16px;
  text-decoration: none;
  font-weight: 600;
  z-index: 999;
  transition: top 0.1s;
}
.skip-link:focus { top: 0; }

header {
  padding: 1.25rem 2rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
header h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.tagline {
  margin: 0;
  color: var(--muted-text);
  font-size: 0.875rem;
}

main#app {
  padding: 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.toolbar-actions { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.toolbar-settings {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted-text);
}
.toolbar-settings label { white-space: nowrap; }
.toolbar-settings select {
  background: var(--muted);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.8125rem;
  cursor: pointer;
}
.toolbar-settings select:focus-visible { outline: 2px solid var(--accent); }

/* buttons */
.btn {
  background: var(--muted);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 13px;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: rgba(95,168,211,0.15); border-color: var(--accent); color: var(--accent); }
.btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-small {
  background: transparent;
  color: var(--muted-text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  font-family: inherit;
}
.btn-small:hover { color: var(--fg); border-color: rgba(233,227,215,0.4); }
.btn-small:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--muted-text);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8125rem;
  line-height: 1;
}
.btn-icon:hover { color: var(--fg); }
.btn-icon:focus-visible { outline: 2px solid var(--accent); }

/* two-pane layout */
.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  height: 420px;
}
.pane {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--code-bg);
}
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.625rem;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
  flex-shrink: 0;
}
.pane-header label,
.pane-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-text);
}
.output-actions { display: flex; gap: 0.375rem; }

#xml-input {
  flex: 1;
  width: 100%;
  background: transparent;
  color: var(--fg);
  border: none;
  outline: none;
  padding: 0.625rem 0.75rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
  resize: none;
  caret-color: var(--accent);
  tab-size: 2;
}
#xml-input::placeholder { color: var(--muted-text); opacity: 0.6; }

#xml-output {
  flex: 1;
  margin: 0;
  padding: 0.625rem 0.75rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
  overflow: auto;
  white-space: pre;
  color: var(--fg);
  outline: none;
  background: transparent;
}

#xml-input:focus-visible,
#xml-output:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
#xml-output:empty::before {
  content: 'Output will appear here…';
  color: var(--muted-text);
  opacity: 0.5;
  white-space: normal;
}

/* status bar */
.status-bar {
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  border: 1px solid transparent;
  transition: opacity 0.15s;
}
.status-bar.success { background: rgba(47,93,80,0.2); border-color: var(--brand-pop); color: var(--brand-pop); }
.status-bar.error { background: rgba(176,48,47,0.15); border-color: var(--danger); color: #e57373; }
.status-bar.info { background: rgba(95,168,211,0.1); border-color: var(--accent); color: var(--accent); }
.hidden { display: none !important; }

/* keyboard legend + privacy note */
.legend-hint { color: var(--muted-text); opacity: 0.65 }
.keyboard-legend {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted-text);
  flex-wrap: wrap;
}
kbd {
  background: var(--muted);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.7rem;
  font-family: inherit;
  color: var(--fg);
}
.privacy-note {
  font-size: 0.75rem;
  color: var(--muted-text);
  margin: 0;
  opacity: 0.7;
}

/* how-to content section */
.content {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 2rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.8;
}
.content h2 {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.content h2:first-child { margin-top: 0; }
.content h3 { color: var(--highlight); font-size: 1rem; margin-top: 1.25rem; }
.content p { margin: 0.625rem 0; }
.content ul { padding-left: 1.5rem; margin: 0.5rem 0; }
.content li { margin-bottom: 0.375rem; }
.content code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
  color: var(--brand-pop);
}
.content pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
  margin: 0.75rem 0;
}
.content a { color: var(--link); }
.content a:hover { color: var(--link-hover); }

/* FAQ */
.faq {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem 2rem 3rem;
}
.faq h2 {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.faq dl { margin: 0; }
.faq-item { margin-bottom: 1.375rem; }
.faq-item dt { font-weight: 600; color: var(--fg); margin-bottom: 0.2rem; }
.faq-item dd { margin: 0; color: var(--muted-text); line-height: 1.7; }

/* footer */
footer {
  text-align: center;
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted-text);
}
footer a { color: var(--link); text-decoration: none; }
footer a:hover { color: var(--link-hover); }

/* sub-page breadcrumb bar */
.breadcrumb-bar {
  padding: 0.5rem 2rem;
  font-size: 0.8125rem;
  color: var(--muted-text);
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}
.breadcrumb-bar a { color: var(--accent); text-decoration: none; }
.breadcrumb-bar a:hover { color: var(--link-hover); }

/* sub-page CTA box */
.page-cta {
  max-width: 800px;
  margin: 1.5rem auto 0;
  padding: 0.875rem 1.5rem;
  background: rgba(95,168,211,0.08);
  border: 1px solid rgba(95,168,211,0.3);
  border-radius: 6px;
  font-size: 0.9375rem;
}
.page-cta p { margin: 0; }
.page-cta a { color: var(--accent); font-weight: 600; text-decoration: none; }
.page-cta a:hover { color: var(--link-hover); }

/* responsive */
@media (max-width: 768px) {
  header { padding: 1rem; }
  main#app { padding: 0.75rem 1rem; }
  .panes { grid-template-columns: 1fr; height: auto; }
  #xml-input, #xml-output { min-height: 200px; }
  .toolbar-settings { margin-left: 0; width: 100%; }
  .content, .faq { padding: 1rem; }
}
