/* Design tokens matching weltsein.de */
:root {
  --brand: #4a7a3f;
  --brand-light: #5a8f4e;
  --bg: #faf9f7;
  --bg-secondary: #f0eee9;
  --text: #3d4a3f;
  --text-muted: #7a8b7e;
  --border: #d8d4cc;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --max-width: 700px;
}

html.dark {
  --brand: #8fa37a;
  --brand-light: #a0b48c;
  --bg: #1a1b17;
  --bg-secondary: #242421;
  --text: #c8d4ca;
  --text-muted: #7a8b7e;
  --border: #3a3a36;
}

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

html { font-size: 18px; }

body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s, color 0.2s;
}

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

h1 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.2rem);
  line-height: 1.3;
  margin-bottom: 0.5em;
  color: var(--text);
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}
.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.site-title {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.site-title:hover { color: var(--brand); text-decoration: none; }
.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.nav-current {
  font-size: 0.9rem;
  color: var(--brand);
  font-weight: 600;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.lang-toggle, .theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-toggle:hover, .theme-toggle:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Main */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--brand); }

/* Form */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--text);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
}

textarea, select, input[type="file"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.2s;
}
textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
}
textarea { resize: vertical; }
input[type="file"] {
  padding: 0.4rem;
  font-size: 0.9rem;
}
small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

/* Buttons */
.actions {
  margin: 1.5rem 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
}
.btn:hover {
  border-color: var(--brand);
  text-decoration: none;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover {
  background: var(--brand-light);
  border-color: var(--brand-light);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Messages */
.msg {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin: 1rem 0;
}
.msg-error {
  background: #f8d7da;
  color: #842029;
  border: 1px solid #f1aeb5;
}
html.dark .msg-error {
  background: #3a1f1f;
  color: #f5c2c7;
  border-color: #5a2d2d;
}

/* Result */
#result {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
audio {
  width: 100%;
  border-radius: 4px;
}
#btn-download {
  align-self: flex-start;
}
