/* ===== FONTES =====
   Servidas pelo próprio app (P29): o navegador não pede nada ao Google, e o
   IP de quem visita não sai daqui. Lora e Raleway, licença OFL
   (assets/fonts/*-OFL.txt), só o subconjunto latino (cobre o português). */
@font-face { font-family: "Lora"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/lora-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/lora-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 500; font-display: swap; src: url("../assets/fonts/lora-latin-500-italic.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 600; font-display: swap; src: url("../assets/fonts/lora-latin-600-italic.woff2") format("woff2"); }
@font-face { font-family: "Raleway"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/raleway-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Raleway"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/raleway-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Raleway"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/raleway-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Raleway"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/raleway-latin-700-normal.woff2") format("woff2"); }

/* ===== TOKENS =====
   Paleta revisada em 16/10/2026: mais leve nos dois temas. Superfícies
   sólidas, bordas finas, dourado como acento (não como brilho) e um modo
   escuro neutro com um toque de violeta, em vez de roxo saturado. */
:root {
  color-scheme: light;

  --font-body:    "Raleway", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-heading: "Lora", Georgia, "Times New Roman", serif;

  --text-2xs: 0.74rem;
  --text-xs:  0.82rem;
  --text-sm:  0.9rem;
  --text-md:  0.96rem;
  --text-lg:  1.08rem;
  --text-xl:  1.28rem;
  --text-2xl: clamp(1.55rem, 2.4vw, 1.95rem);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(31, 26, 46, 0.04);
  --shadow-md: 0 10px 30px rgba(31, 26, 46, 0.10);

  /* ---- Claro (padrão) ---- */
  --bg:            #F7F5F2;
  --bg-alt:        #F1EEF4;
  --surface-panel: #FFFFFF;   /* barra lateral, cabeçalho */
  --surface-card:  #FFFFFF;   /* cartões, tabelas, modais */
  --surface-shell: #FFFFFF;
  --surface-soft:  #F5F3F8;   /* campos, chips, áreas internas */
  --surface-hover: #F1EEF6;   /* passar o mouse */
  --border:        #EAE6EF;
  --border-strong: #DAD5E3;

  --text:         #1F1A2E;
  --muted:        #6C6680;    /* 5,3:1 sobre branco */
  --muted-strong: #4A4459;

  /* Marca */
  --accent:        #8C6D1F;   /* dourado para texto e ícones (4,8:1 sobre branco) */
  --accent-bright: #E0BC57;   /* dourado para preenchimentos (botões, seleção) */
  --accent-display: #A98526;  /* dourado para títulos grandes (3,4:1, texto grande) */
  --accent-soft:   rgba(201, 168, 62, 0.13);
  --on-accent:     #1F1A2E;   /* texto sobre o dourado */
  --focus-ring:    rgba(201, 168, 62, 0.38);
  --purple:        #2D1B69;
  --purple-mid:    #3D2A80;
  --avatar-bg:     #ECE7F6;
  --avatar-text:   #3D2A80;

  /* Semânticas */
  --success: #1B7A45;
  --warning: #8C6000;
  --danger:  #B83232;
  --info:    #1A5F9E;
  --danger-rgb: 184, 50, 50;

  --app-gradient: var(--bg);   /* mantido por compatibilidade: fundo liso */

  /* Aliases antigos (usados em telas que não tinham os tokens) */
  --bg-hover:   var(--surface-hover);
  --bg-mid:     var(--surface-soft);
  --bg-panel:   var(--surface-card);
  --text-muted: var(--muted);
  --accent-glow: var(--accent-soft);
  --accent-dim:  var(--accent);
}

/* ---- Escuro (opção) ---- */
[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #131118;
  --bg-alt:        #17151D;
  --surface-panel: #17151D;
  --surface-card:  #1C1A23;
  --surface-shell: #1C1A23;
  --surface-soft:  #23212C;
  --surface-hover: #26232F;
  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);

  --text:         #ECEAF1;
  --muted:        #9E99AD;    /* 6:1 sobre os cartões */
  --muted-strong: #C6C2D1;

  --accent:        #D9BA66;
  --accent-bright: #D4B35A;
  --accent-display: #D9BA66;
  --accent-soft:   rgba(217, 186, 102, 0.12);
  --on-accent:     #1A1622;
  --focus-ring:    rgba(217, 186, 102, 0.40);
  --avatar-bg:     #2C2840;
  --avatar-text:   #D8D2EE;

  --success: #6BCB98;
  --warning: #E6BB68;
  --danger:  #EE8E8E;
  --info:    #8BBBEE;
  --danger-rgb: 238, 142, 142;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 14px 40px rgba(0, 0, 0, 0.5);
}

/* ===== RESET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* `hidden` sempre vence: componentes com display próprio (flex, grid)
   apareciam mesmo escondidos, como o aviso vazio do Dashboard */
[hidden] { display: none !important; }

/* ===== BASE ===== */
html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* A Raleway usa algarismos "antigos" (2026 com o 0 baixo); no app, alinhados */
  font-variant-numeric: lining-nums;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Campos e botões não herdam a fonte do corpo por padrão: sem isto, os
   algarismos voltavam ao estilo antigo (ex.: "MP3", datas no select) */
button, input, select, textarea {
  font-family: inherit;
  font-variant-numeric: inherit;
}

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

::selection { background: var(--accent-soft); }

/* Números que se comparam em coluna (tempo, BPM, datas, contadores) */
.num { font-variant-numeric: lining-nums tabular-nums; }

/* ===== HEADER ===== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 3.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-panel);
  gap: 1rem;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;   /* ícone e nome formam um elemento só */
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text);
}

.brand-name span {
  color: var(--accent);
}

.slogan {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 0.1rem;
}

/* ===== TEHILLAH MARK — harpa (assets/brand/harp.svg, P12) =====
   Só o desenho, sem fundo nem moldura: junto do nome, os dois são um elemento só */
.tehillah-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--purple);
}

[data-theme="dark"] .tehillah-mark { color: var(--text); }

.tehillah-mark__svg {
  display: block;
  width: 2.3rem;
  height: 2.3rem;
}

/* ===== HERO ===== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 9rem 1.25rem 10rem;
  position: relative;
  overflow: hidden;
}

.hero h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  color: var(--text);
  font-style: italic;
  line-height: 1.05;
  margin-bottom: 1.25rem;
  max-width: 14ch;
  position: relative;
}

.hero h2 span {
  color: var(--accent-display);
}

.hero p {
  font-size: var(--text-lg);
  color: var(--muted-strong);
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: 2.5rem;
  position: relative;
}

/* ===== SEÇÕES DA LANDING ===== */
.landing-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
}

.landing-section__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-2xl);
  color: var(--text);
  text-align: center;
  margin-bottom: 2rem;
}

.landing-section__lead {
  font-size: var(--text-lg);
  color: var(--muted-strong);
  line-height: 1.7;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.landing-section--group { padding-bottom: 6rem; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.feature-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
}

.feature-card h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--text);
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.65;
}

/* ===== BOTÃO =====
   Base de todos os botões (landing e app). Antes vinha em caixa alta,
   espaçado, com brilho e "pulo" no hover — e o app herdava isso. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent-bright);
  color: var(--on-accent);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover { background: color-mix(in srgb, var(--accent-bright) 88%, var(--text)); }

/* CTA da landing: maior, mesmo estilo */
.btn--hero {
  padding: 0.85rem 1.8rem;
  font-size: var(--text-md);
  border-radius: var(--radius-md);
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 2rem 1.25rem;
  color: var(--muted);
  font-size: var(--text-xs);
  border-top: 1px solid var(--border);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.theme-toggle svg {
  display: block;
  flex-shrink: 0;
}

/* ===== BOTÃO DE ÍCONE (rodapé dos menus: tema e Sair) ===== */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn svg { display: block; width: 18px; height: 18px; }

/* Bolinha da conta: foto ou iniciais do usuário; abre o menu da conta */
.icon-btn--avatar { width: auto; padding: 0.15rem; border-radius: 999px; }
.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--avatar-bg);
  color: var(--avatar-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xs);
  font-weight: 600;
}
.icon-btn--avatar:hover .avatar { box-shadow: 0 0 0 2px var(--border-strong); }
.avatar--photo { background-size: cover; background-position: center; }

/* Menu da conta: a bolinha abre "Meu perfil" e "Sair" acima do rodapé do menu
   (js/utils/accountMenu.js). Ações da conta entram aqui, não no rodapé. */
.sidebar__footer,
.menu-foot__actions { position: relative; }
.icon-btn--avatar[aria-expanded="true"] .avatar { box-shadow: 0 0 0 2px var(--accent-bright); }
.account-menu {
  position: absolute;
  left: 0.4rem;
  bottom: calc(100% + 0.35rem);
  z-index: 50;
  min-width: 11rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  box-shadow: var(--shadow-md);
}
.account-menu[hidden] { display: none; }
.account-menu__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.account-menu__item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted-strong); }
.account-menu__item:hover,
.account-menu__item:focus-visible { background: var(--surface-hover); outline: none; }
.account-menu__item[aria-current="page"] { font-weight: 600; }

/* Empurra os itens seguintes para a direita numa linha flex */
.menu-spacer { flex: 1; }

/* ===== MÓDULOS POR AMBIENTE =====
   Em produção só Partituras está liberado (ver js/config/features.js e
   vercel.json). Aqui, e não em app.css, para valer também no viewer. */
[data-env="production"] [data-module]:not([data-module="scores"]):not([data-module="organizations"]) { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 760px) {
  header {
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .hero {
    padding: 6rem 1rem 7rem;
  }

  .hero h2 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .landing-section { padding: 0 1rem 3.5rem; }
}

/* Landing: "Já tem conta? Entrar" abaixo do botão principal */
.hero p.hero__alt {
  margin: 1rem 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.hero__alt a { color: var(--accent); font-weight: 600; }

/* ── Seletor de instrumentos/vozes (cadastro e perfil, D15) ─────────── */
.parts-picker__group { border: 0; padding: 0; margin: 0 0 0.6rem; }
.parts-picker__group legend { font-size: 0.74rem; font-weight: 600; color: var(--muted); margin-bottom: 0.3rem; }
.parts-picker__options { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.parts-picker__option { position: relative; }
.parts-picker__option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.parts-picker__option span {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted-strong);
}
.parts-picker__option input:checked + span { background: var(--accent-soft); border-color: var(--accent-bright); color: var(--text); }
.parts-picker__option input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ===== AVISO DE ERRO DO SERVIDOR, COM O CÓDIGO (P30) ===== */
.error-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 310;
  max-width: 26rem;
  margin-left: auto;
  padding: 0.9rem 2.6rem 0.9rem 1rem;
  border: 1px solid var(--danger);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.error-toast__code { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.error-toast__hint { margin-top: 0.25rem; color: var(--muted); }
.error-toast__close {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 1.25rem;
  cursor: pointer;
}
.error-toast__close:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ===== ENVIAR FEEDBACK (beta, P29) ===== */
.feedback-dialog {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.45);
}
.feedback-dialog__card {
  width: 100%;
  max-width: 30rem;
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.feedback-dialog__title { font-family: var(--font-heading); font-size: var(--text-lg); font-weight: 600; }
.feedback-dialog__hint { margin-top: 0.4rem; font-size: var(--text-sm); color: var(--muted); line-height: 1.5; }
.feedback-dialog__text { width: 100%; margin-top: 0.9rem; resize: vertical; font: inherit; }
.feedback-dialog__status { min-height: 1.2rem; margin-top: 0.4rem; font-size: var(--text-sm); color: var(--danger); }
.feedback-dialog__actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.6rem; }
