/* MizanFlow Translator, prototype styles */

:root {
  --ink: #101528;
  --ink-soft: #4a5470;
  --ink-faint: #7c87a3;
  --line: #e3e8f2;
  --paper: #ffffff;
  --paper-dim: #f6f8fc;
  --brand: #1f6feb;
  --brand-deep: #14459c;
  --teal: #0aa08a;
  --amber: #f2a33c;
  --danger: #d4453c;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 21, 40, .05), 0 6px 18px rgba(16, 21, 40, .05);
  --shadow-md: 0 10px 40px rgba(16, 21, 40, .09);
  --max: 1140px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans Ethiopic", "Noto Sans Arabic", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #eaf1ff 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #e6f7f4 0%, transparent 55%),
    #fbfcfe;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
  pointer-events: none;
  z-index: 0;
}
.orb-a { width: 420px; height: 420px; background: #cfe0ff; top: -140px; left: -120px; }
.orb-b { width: 380px; height: 380px; background: #c8f0e8; top: 220px; right: -160px; opacity: .45; }

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(251, 252, 254, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(140deg, var(--brand) 0%, var(--teal) 100%);
  box-shadow: 0 6px 16px rgba(31, 111, 235, .28);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15.5px; letter-spacing: -.01em; }
.brand-text small { color: var(--ink-faint); font-size: 11.8px; }

.head-links { display: flex; gap: 22px; }
.head-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.head-links a:hover { color: var(--brand); border-color: var(--brand); }

main {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 40px) 40px;
}

.hero { max-width: 760px; margin-bottom: clamp(26px, 4vw, 40px); }
.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand-deep);
  background: #eaf1ff;
  border-radius: 999px;
}
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 5.2vw, 47px);
  line-height: 1.08;
  letter-spacing: -.025em;
  font-weight: 760;
  background: linear-gradient(115deg, #101528 30%, #14459c 75%, #0aa08a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { margin: 0 0 20px; color: var(--ink-soft); font-size: clamp(15px, 1.6vw, 17px); }

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-faint);
  font-size: 13.5px;
}
.hero-facts b { color: var(--ink); font-size: 17px; margin-right: 4px; }

.panel {
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  padding: clamp(16px, 2.4vw, 26px);
  box-shadow: var(--shadow-sm);
  margin-bottom: 26px;
  backdrop-filter: blur(8px);
}

.lang-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); }
.field.tight { margin-bottom: 14px; }

select, textarea, input[type="range"] { font-family: inherit; }

.field select, #voiceSelect {
  width: 100%;
  appearance: none;
  padding: 13px 40px 13px 14px;
  font-size: 15px;
  font-weight: 550;
  color: var(--ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237c87a3' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
      no-repeat right 14px center,
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.field select:hover, #voiceSelect:hover { border-color: #c6d2e8; }
.field select:focus-visible, #voiceSelect:focus-visible, textarea:focus-visible, button:focus-visible, input:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(31, 111, 235, .13);
}

.swap {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 1px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  transition: transform .3s, color .15s, border-color .15s, background .15s;
}
.swap:hover { color: var(--brand); border-color: #c6d2e8; background: #f4f8ff; }
.swap svg { width: 19px; height: 19px; }
.swap.spin { transform: rotate(180deg); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid.three { grid-template-columns: repeat(3, 1fr); }

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.result-card { background: linear-gradient(180deg, #fbfdff 0%, #ffffff 100%); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.counter { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); }

.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--teal);
  background: #e7f8f4;
  border: 1px solid #c9efe7;
}

textarea {
  width: 100%;
  min-height: 168px;
  resize: vertical;
  padding: 12px 4px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  background: transparent;
}
textarea::placeholder { color: #a7b1c6; font-size: 16px; }
textarea:focus-visible { border: 0; box-shadow: none; }

.result {
  flex: 1;
  min-height: 168px;
  padding: 12px 4px;
  border-radius: 10px;
  overflow-y: auto;
}
.result-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.result-text[dir="rtl"] { text-align: right; font-size: 20px; }
.result-empty { margin: 0; color: #a7b1c6; font-size: 16px; }
.result.loading .result-text { opacity: .35; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 14px; }
.chip {
  padding: 7px 12px;
  font-size: 12.8px;
  font-family: inherit;
  color: var(--ink-soft);
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .12s;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip:hover { background: #eef4ff; color: var(--brand-deep); border-color: #cfdcf5; }
.chip:active { transform: scale(.97); }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.foot-right, .foot-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, #2f8bf0 100%);
  box-shadow: 0 6px 16px rgba(31, 111, 235, .25);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 8px 22px rgba(31, 111, 235, .32); }

.btn.accent {
  color: #10514a;
  background: #dff7f2;
  border-color: #bdeee5;
}
.btn.accent:hover:not(:disabled) { background: #cdf1ea; }

.btn.ghost { color: var(--ink-soft); background: transparent; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--paper-dim); color: var(--ink); }
.btn.ghost.small { padding: 8px 12px; font-size: 13px; }
.btn.icon { padding: 9px 12px; font-size: 13px; }

.btn.mic { color: #8a4b12; background: #fff4e6; border-color: #ffe0b8; }
.btn.mic:hover { background: #ffe9c9; }
.btn.mic[aria-pressed="true"] {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  animation: pulse 1.5s infinite;
}
.btn.mic[aria-pressed="true"] svg { animation: none; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(212, 69, 60, .45); }
  70% { box-shadow: 0 0 0 12px rgba(212, 69, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(212, 69, 60, 0); }
}

.btn.loading .btn-label::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  vertical-align: -1px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status {
  min-height: 20px;
  margin: 14px 2px 0;
  font-size: 13px;
  color: var(--ink-faint);
}
.status.ok { color: #0b7a68; }
.status.warn { color: #a8641a; }
.status.err { color: var(--danger); }

.panel-head { margin-bottom: 18px; }
.panel-head h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.01em; }
.panel-head p { margin: 0; color: var(--ink-soft); font-size: 14px; max-width: 760px; }

.mini {
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.mini h3 { margin: 0 0 8px; font-size: 15px; }
.mini p { margin: 0 0 10px; font-size: 13.4px; color: var(--ink-soft); }
.mini-note { font-size: 12.8px; color: var(--ink-faint); }
.mini-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-soft); }
.mini-list li { margin-bottom: 5px; }

.upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  text-align: center;
  border: 1.5px dashed #cdd8ea;
  border-radius: 13px;
  background: #fafcff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload:hover, .upload.drag { border-color: var(--brand); background: #f2f7ff; }
.upload svg { width: 22px; height: 22px; color: var(--brand); }
.upload span { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.upload small { font-size: 11.8px; color: var(--ink-faint); }

.file-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-dim);
}
.file-meta { display: flex; flex-direction: column; min-width: 0; }
.file-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta small { color: var(--ink-faint); font-size: 11.8px; }
#audioPlayer { width: 100%; height: 34px; }

.range { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.range span { font-size: 12.5px; color: var(--ink-soft); display: flex; justify-content: space-between; }
.range b { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] {
  width: 100%;
  height: 5px;
  appearance: none;
  background: linear-gradient(90deg, var(--brand) 0%, var(--teal) 100%);
  border-radius: 999px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--brand);
  box-shadow: 0 2px 6px rgba(16, 21, 40, .18);
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 2.5px solid var(--brand);
}

.switch { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; cursor: pointer; }
.switch input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--brand); }

.fineprint { margin: 18px 0 0; font-size: 12.6px; color: var(--ink-faint); }

.site-foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 40px) 34px;
  font-size: 12.5px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .grid, .grid.three { grid-template-columns: 1fr; }
  .head-links { display: none; }
}

@media (max-width: 620px) {
  .site-head { padding: 12px 16px; }
  .brand-text small { display: none; }
  main { padding: 20px 14px 30px; }
  .panel { padding: 15px; border-radius: 18px; }
  .lang-bar { grid-template-columns: 1fr auto; gap: 10px; }
  .lang-bar .field:last-of-type { grid-column: 1 / -1; }
  .swap { grid-row: 1; grid-column: 2; }
  textarea, .result-text { font-size: 16.5px; }
  .result-text[dir="rtl"] { font-size: 18px; }
  .card-foot { flex-direction: column; align-items: stretch; }
  .foot-right, .foot-left { justify-content: space-between; }
  .btn.primary, .btn.mic { flex: 1; }
  .btn.accent { width: 100%; }
  .hero-facts { gap: 8px 18px; font-size: 12.8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
