/* =========================================================
   TRANSDUTOR — Conversor de arquivos, áudio e vídeo→áudio
   Todo o processamento é local (Canvas API + Web Audio API).
   ========================================================= */

:root{
  --bg:#18160f;
  --panel:#221f18;
  --panel-raised:#2b271e;
  --line:#4a4331;
  --line-soft:#332e22;
  --text:#f2ede1;
  --text-dim:#b3a98f;
  --amber:#e8a33d;
  --amber-bright:#ffc266;
  --rust:#c1443b;
  --green:#7fa65c;
  --radius:10px;
  --radius-lg:14px;
  --mono: 'JetBrains Mono', monospace;
  --display: 'Space Grotesk', sans-serif;
  --body: 'Inter', sans-serif;
  --shadow: 0 8px 24px -8px rgba(0,0,0,.45);
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
html,body{margin:0;padding:0;}
body{
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, #2a2417 0%, transparent 60%),
    var(--bg);
  color:var(--text);
  font-family:var(--body);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;}
button{font-family:inherit;}
img,svg{display:block;}
::selection{background:var(--amber);color:#18160f;}
:focus-visible{outline:2px solid var(--amber-bright);outline-offset:2px;}

.wrap{max-width:1080px;margin:0 auto;padding:0 24px;}

/* ---------- NAVBAR ---------- */
.navbar{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(24,22,15,.85);
  backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line-soft);
}
.navbar .wrap{
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:60px;
}
.brand{
  display:flex;
  align-items:center;
  gap:9px;
  font-family:var(--display);
  font-weight:700;
  font-size:17px;
  letter-spacing:-.01em;
  text-decoration:none;
}
.brand .mark{
  width:20px;height:20px;
  flex-shrink:0;
}
.brand .mark *{stroke:var(--amber);}
.navlinks{display:none;}

/* ---------- HERO ---------- */
header.hero{
  border-bottom:1px solid var(--line-soft);
  padding:64px 0 48px;
  position:relative;
  overflow:hidden;
}
.eyebrow{
  font-family:var(--mono);
  font-size:12px;
  letter-spacing:.18em;
  text-transform:uppercase;
  color:var(--amber);
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:18px;
}
.eyebrow::before{
  content:"";
  width:8px;height:8px;border-radius:50%;
  background:var(--green);
  box-shadow:0 0 8px var(--green);
}
.hero-grid{
  display:grid;
  grid-template-columns:1.3fr 1fr;
  gap:40px;
  align-items:center;
}
h1{
  font-family:var(--display);
  font-weight:700;
  font-size:clamp(40px,6vw,68px);
  line-height:.95;
  letter-spacing:-.01em;
  margin:0 0 18px;
}
h1 span{color:var(--amber);}
.hero-sub{
  font-size:16px;
  color:var(--text-dim);
  max-width:46ch;
  margin:0;
}
.hero-sub b{color:var(--text);font-weight:600;}

/* VU meter signature element */
.vu{
  display:flex;
  align-items:flex-end;
  gap:6px;
  height:180px;
  padding:20px 18px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  justify-content:center;
  box-shadow:var(--shadow);
}
.vu i{
  display:block;
  width:9px;
  border-radius:2px 2px 0 0;
  background:linear-gradient(to top, var(--amber) 0%, var(--amber-bright) 70%, var(--rust) 100%);
  animation: bounce 1.4s ease-in-out infinite;
  transform-origin:bottom;
}
.vu i:nth-child(1){animation-delay:-1.1s;height:40%;}
.vu i:nth-child(2){animation-delay:-.4s;height:65%;}
.vu i:nth-child(3){animation-delay:-1.6s;height:30%;}
.vu i:nth-child(4){animation-delay:-.8s;height:80%;}
.vu i:nth-child(5){animation-delay:-.2s;height:50%;}
.vu i:nth-child(6){animation-delay:-1.3s;height:70%;}
.vu i:nth-child(7){animation-delay:-.6s;height:35%;}
.vu i:nth-child(8){animation-delay:-1.8s;height:60%;}
.vu i:nth-child(9){animation-delay:-.3s;height:45%;}
.vu i:nth-child(10){animation-delay:-1.0s;height:75%;}
@keyframes bounce{
  0%,100%{transform:scaleY(.35);}
  50%{transform:scaleY(1);}
}
@media (prefers-reduced-motion: reduce){
  .vu i{animation:none;transform:scaleY(.6);}
  html{scroll-behavior:auto;}
}

/* feature badges under hero */
.badges{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:28px;
}
.badge{
  display:flex;
  align-items:center;
  gap:7px;
  font-family:var(--mono);
  font-size:11.5px;
  letter-spacing:.03em;
  color:var(--text-dim);
  background:var(--panel);
  border:1px solid var(--line-soft);
  padding:7px 12px;
  border-radius:999px;
}
.badge svg{width:13px;height:13px;flex-shrink:0;}
.badge svg *{stroke:var(--amber);}

/* ---------- STEPS (como funciona) ---------- */
.steps-section{padding:48px 0 8px;}
.steps{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:20px;
  counter-reset:step;
}
.step{
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  padding:20px;
  background:var(--panel);
}
.step-num{
  font-family:var(--display);
  font-size:26px;
  font-weight:700;
  color:var(--amber);
  line-height:1;
  margin-bottom:10px;
}
.step h3{
  font-family:var(--display);
  font-size:16px;
  margin:0 0 6px;
}
.step p{
  font-size:13px;
  color:var(--text-dim);
  margin:0;
}
@media (max-width:700px){ .steps{grid-template-columns:1fr;} }

/* ---------- TABS ---------- */
.tabbar{
  display:flex;
  gap:6px;
  background:var(--panel);
  border:1px solid var(--line-soft);
  border-radius:999px;
  padding:5px;
  margin:0 auto 32px;
  max-width:fit-content;
  box-shadow:var(--shadow);
}
.tab{
  display:flex;
  align-items:center;
  gap:7px;
  padding:9px 18px;
  border-radius:999px;
  border:none;
  background:transparent;
  color:var(--text-dim);
  font-family:var(--mono);
  font-size:12.5px;
  letter-spacing:.03em;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  transition:background .15s ease, color .15s ease;
  white-space:nowrap;
}
.tab svg{width:15px;height:15px;flex-shrink:0;}
.tab svg *{stroke:currentColor;}
.tab.active{background:var(--amber);color:#1c1608;font-weight:600;}

@media (max-width:700px){
  .tabbar{
    position:fixed;
    left:0;right:0;bottom:0;
    z-index:30;
    max-width:none;
    margin:0;
    border-radius:0;
    border:none;
    border-top:1px solid var(--line-soft);
    background:rgba(24,22,15,.94);
    backdrop-filter:blur(10px);
    -webkit-backdrop-filter:blur(10px);
    padding:6px max(10px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
    justify-content:space-around;
    gap:2px;
    box-shadow:none;
  }
  .tab{
    flex-direction:column;
    gap:3px;
    flex:1;
    padding:8px 4px;
    border-radius:10px;
    font-size:10.5px;
    min-height:48px;
    justify-content:center;
  }
  .tab svg{width:20px;height:20px;}
  .tab.active{background:transparent;color:var(--amber);}
  main{padding-bottom:calc(78px + env(safe-area-inset-bottom));}
}

/* ---------- MODULES ---------- */
main{padding:44px 0 40px;}
.section-label{
  font-family:var(--mono);
  font-size:12px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--text-dim);
  margin:0 0 24px;
}
.panels{
  max-width:640px;
  margin:0 auto;
}
.module{
  position:relative;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  padding:26px 22px 24px;
  display:flex;
  flex-direction:column;
  gap:16px;
  scroll-margin-top:80px;
  box-shadow:var(--shadow);
  transition:border-color .2s ease, transform .2s ease;
}
.module[hidden]{display:none;}
.module .screw{
  position:absolute;
  width:6px;height:6px;
  border-radius:50%;
  background:radial-gradient(circle at 35% 35%, #6b6250, #2a2620 70%);
  box-shadow:inset 0 0 0 1px #16130d;
}
.module .screw.tl{top:10px;left:10px;}
.module .screw.tr{top:10px;right:10px;}
.module .screw.bl{bottom:10px;left:10px;}
.module .screw.br{bottom:10px;right:10px;}

.module-head{display:flex;align-items:flex-start;gap:12px;}
.module-icon{
  width:34px;height:34px;
  flex-shrink:0;
  border-radius:8px;
  background:var(--panel-raised);
  border:1px solid var(--line-soft);
  display:flex;
  align-items:center;
  justify-content:center;
}
.module-icon svg{width:18px;height:18px;}
.module-icon svg *{stroke:var(--amber);}
.module-headtext{display:flex;flex-direction:column;gap:2px;}
.module-tag{
  font-family:var(--mono);
  font-size:11px;
  letter-spacing:.12em;
  color:var(--amber);
  text-transform:uppercase;
}
.module-title{
  font-family:var(--display);
  font-weight:600;
  font-size:20px;
}
.module-desc{
  font-size:13px;
  color:var(--text-dim);
  margin:0;
}

.dropzone{
  border:1.5px dashed var(--line);
  border-radius:8px;
  padding:22px 14px;
  text-align:center;
  cursor:pointer;
  transition:border-color .15s ease, background .15s ease;
  background:var(--panel-raised);
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.dropzone.dragover{
  border-color:var(--amber);
  background:#332c1d;
}
.dropzone .dz-icon{
  width:26px;height:26px;
  margin:0 auto 8px;
}
.dropzone .dz-icon svg *{stroke:var(--amber);}
.dropzone p{
  margin:0;
  font-size:13px;
  color:var(--text-dim);
}
.dropzone p b{color:var(--text);}
.dropzone .accepted{
  display:block;
  margin-top:6px;
  font-family:var(--mono);
  font-size:10.5px;
  letter-spacing:.04em;
  color:var(--text-dim);
  opacity:.7;
}
.dropzone input{display:none;}

.file-info{
  display:none;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  font-family:var(--mono);
  font-size:12px;
  background:var(--panel-raised);
  border:1px solid var(--line-soft);
  border-radius:6px;
  padding:9px 10px 9px 12px;
  color:var(--text);
}
.file-info.visible{display:flex;}
.file-info .file-meta{overflow:hidden;display:flex;gap:8px;align-items:baseline;min-width:0;}
.file-info .file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.file-info .file-size{color:var(--text-dim);flex-shrink:0;}
.file-info .file-clear{
  flex-shrink:0;
  width:28px;height:28px;
  border-radius:6px;
  border:1px solid var(--line);
  background:transparent;
  color:var(--text-dim);
  cursor:pointer;
  font-size:13px;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.file-info .file-clear:hover{color:var(--rust);border-color:var(--rust);}

.field-label{
  font-family:var(--mono);
  font-size:10.5px;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:var(--text-dim);
  margin:0 0 8px;
}
.format-row{display:flex;flex-wrap:wrap;gap:8px;}
.format-row button{
  font-family:var(--mono);
  font-size:12.5px;
  letter-spacing:.04em;
  padding:9px 15px;
  min-height:40px;
  border-radius:6px;
  border:1px solid var(--line);
  background:transparent;
  color:var(--text-dim);
  cursor:pointer;
  transition:all .12s ease;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.format-row button.active{
  background:var(--amber);
  border-color:var(--amber);
  color:#1c1608;
  font-weight:600;
}

.convert-btn{
  margin-top:2px;
  width:100%;
  padding:12px;
  border-radius:7px;
  border:1px solid var(--amber);
  background:var(--amber);
  color:#1c1608;
  font-weight:600;
  font-size:14px;
  cursor:pointer;
  transition:filter .12s ease, transform .05s ease;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.convert-btn:active:not(:disabled){transform:translateY(1px);}
.convert-btn:disabled{
  background:transparent;
  color:var(--text-dim);
  border-color:var(--line);
  cursor:not-allowed;
}
.convert-btn.working{filter:brightness(.9);cursor:progress;}
.spinner{
  width:14px;height:14px;
  border-radius:50%;
  border:2px solid rgba(28,22,8,.35);
  border-top-color:#1c1608;
  animation:spin .7s linear infinite;
  display:none;
}
.convert-btn.working .spinner{display:inline-block;}
@keyframes spin{to{transform:rotate(360deg);}}

.progress-track{
  height:4px;
  border-radius:2px;
  background:var(--line-soft);
  overflow:hidden;
}
.progress-bar{
  height:100%;
  width:0%;
  background:linear-gradient(90deg, var(--amber), var(--amber-bright));
  transition:width .2s ease;
}
.status-line{
  font-family:var(--mono);
  font-size:11.5px;
  color:var(--text-dim);
  min-height:14px;
}
.status-line.is-error{color:var(--rust);}
.status-line.is-success{color:var(--green);}
.result{min-height:2px;}
.preview-media{display:block;margin:0 auto 12px;}
.preview-image{
  max-height:220px;
  width:auto;
  max-width:100%;
  border-radius:8px;
  border:1px solid var(--line-soft);
  background:var(--panel-raised);
  object-fit:contain;
}
.preview-audio{
  width:100%;
  border-radius:8px;
  color-scheme:dark;
}
.download-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  width:100%;
  justify-content:center;
  padding:11px;
  border-radius:7px;
  border:1px solid var(--green);
  color:var(--green);
  text-decoration:none;
  font-family:var(--mono);
  font-size:12.5px;
  font-weight:600;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.download-btn svg{width:14px;height:14px;}
.download-btn svg *{stroke:var(--green);}

.module-note{
  font-size:12px;
  color:var(--text-dim);
  border-top:1px solid var(--line-soft);
  padding-top:12px;
  margin:0;
}

/* ---------- FOOTER ---------- */
footer{
  border-top:1px solid var(--line-soft);
  padding:32px 0 60px;
  color:var(--text-dim);
  font-size:13px;
}
footer .foot-grid{
  display:grid;
  grid-template-columns:1fr;
  max-width:560px;
  gap:10px;
}
footer h4{
  font-family:var(--mono);
  font-size:11px;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:var(--text);
  margin:0 0 8px;
}
footer p{margin:0;}
footer .foot-meta{
  margin-top:20px;
  font-family:var(--mono);
  font-size:11px;
  color:var(--text-dim);
  opacity:.7;
}

@media (max-width:860px){
  .hero-grid{grid-template-columns:1fr;}
  .vu{order:-1;height:110px;}
}

/* ---------- TOQUE (iOS/Android) ---------- */
/* Aplica :hover só em dispositivos com ponteiro de verdade, evitando o
   "hover grudado" que aparece depois de um toque em telas sensíveis. */
@media (hover:hover) and (pointer:fine){
  .dropzone:hover{border-color:var(--amber);background:#332c1d;}
  .format-row button:hover{border-color:var(--amber);color:var(--text);}
  .convert-btn:hover:not(:disabled){filter:brightness(1.08);}
  .module:hover{border-color:var(--line);transform:translateY(-2px);}
  .download-btn:hover{background:rgba(127,166,92,.1);}
  .tab:hover:not(.active){color:var(--text);}
}

/* Área de toque mínima e sem o retângulo cinza de toque padrão do Android/iOS */
button, .dropzone, a{
  -webkit-tap-highlight-color:transparent;
}
@supports (padding: max(0px)){
  body{
    padding-left:env(safe-area-inset-left);
    padding-right:env(safe-area-inset-right);
  }
}
