/* lowerdot — estilos da home
   Fonte Jost no body, fundo claro, texto preto. Mobile-first. */

:root {
  --ink: #111111;
  --bg: #f9f9fd;
  --paper: #ffffff;
  --muted: #8a8a8a;
  --line: #f2f2f8;
  --line-2: #d6d6db;
  --chip: #111111;
  --chip-ink: #ffffff;
  --radius-bar: 32px;
  --radius-pop: 20px;
  --maxw: 1280px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Jost", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100dvh;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(24px, 8vh, 96px) clamp(16px, 4vw, 32px) 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Logo ---------- */
.logo {
  margin: 0 0 clamp(20px, 4vh, 40px);
  line-height: 0;
}
.logo__img {
  display: block;
  height: auto;
  width: clamp(200px, 42vw, 320px);
}

/* Glifos reutilizáveis (fill preto) */
.g-pill, .g-circle, .g-minidot { fill: var(--ink); }
.g-dunot { fill: none; stroke: var(--ink); stroke-width: 2.2; }

/* ---------- Campo de busca ---------- */
.search {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.search__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 12px 6px 22px;
  border: 3px solid var(--line);
  border-radius: var(--radius-bar);
  background: var(--paper);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.search__bar:focus-within {
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.15);
  border-color: var(--ink);
}

.search__input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: clamp(0.9375em, 2.4vw, 1.125em);
  color: var(--ink);
  padding: 7px 0;
}
.search__input::placeholder { color: var(--muted); }

/* ---------- Chips de filtro ---------- */
.chips {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}
.chip {
  font: inherit;
  font-size: 0.8125em;
  font-weight: 500;
  color: var(--chip-ink);
  background: var(--chip);
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.12s ease, transform 0.06s ease;
}
.chip:hover { opacity: 0.85; }
.chip:active { transform: scale(0.96); }

/* ---------- Botão gerar (chip Morse: fundo transparente, borda preta) ---------- */
.chip--go {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 2px solid var(--ink);
  /* compensa a borda de 2px p/ manter a mesma altura/largura dos chips */
  padding: 8px 11px;
}
.chip--go .morse-glyph {
  display: block;
  height: 9px;
  width: auto;
  fill: var(--ink);
}
.chip--go:hover { opacity: 1; background: var(--ink); }
.chip--go:hover .morse-glyph { fill: var(--paper); }

/* ---------- Popover de filtros ---------- */
.filters {
  position: absolute;
  top: 0;                 /* topo na borda superior do searchwrap (desktop) */
  right: 0;
  width: min(420px, 100%);
  max-height: 78vh;       /* evita ficar comprido demais */
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pop);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  padding: 20px;
  z-index: 20;
}
.filters__hint { margin: 0; color: var(--muted); font-size: 0.875em; }

/* ---------- Área de fretboards ---------- */
.boards {
  width: 100%;
  margin-top: clamp(28px, 6vh, 56px);
  display: flex;
  flex-wrap: wrap;
  gap: 28px 32px;
  justify-content: center;
  align-items: flex-start;
}
.boards__empty {
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 0.9375em;
  margin: 8px 0 0;
}

/* ---------- Cartão de acorde + diagrama ---------- */
.chord {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.chord__name {
  font-size: 1.125em;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.fretboard { display: block; height: auto; max-width: 100%; }

/* Glifos do braço (todos pretos; sem bordas/preenchimento de grade) */
.gl-pill, .gl-circle, .gl-minidot { fill: var(--ink); }
.gl-dunot { fill: none; stroke: var(--ink); stroke-width: 2.2; }
.gl-disc { fill: none; stroke: var(--ink); }  /* stroke-width inline (anel grosso) */
.fb-open-bg, .fb-fret-ref { fill: rgba(0, 0, 0, 0.045); }
.fb-label { fill: var(--muted); font-size: 11px; font-family: monospace; }

/* ---------- Barra de ferramentas ---------- */
.toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
  background: transparent;
  z-index: 30;
  pointer-events: none;
}
.toolbar__right { pointer-events: auto; }
.lang { position: relative; }
.toolbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 0.8125em;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}
.toolbar__btn:hover { background: rgba(0, 0, 0, 0.05); }
.lang__icon { display: inline-flex; }

/* Material Symbols — fonte subsetada self-hosted (só os glifos usados). */
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 400;
  font-display: block; /* evita mostrar o nome do ícone antes da fonte carregar */
  src: url('/fonts/material-symbols-subset.woff2') format('woff2');
}
.mi {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  color: currentColor;
  user-select: none;
}

/* ---------- Menus flutuantes genéricos ---------- */
.menu {
  position: absolute;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 40;
  min-width: 180px;
}
.lang__menu { top: calc(100% + 8px); right: 0; }
.menu__item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: inherit;
  font-size: 0.875em;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
  text-align: left;
}
.menu__item:hover { background: rgba(0, 0, 0, 0.05); }
.menu__item.is-active { font-weight: 600; }
.menu__check { display: inline-flex; }

/* ---------- Formulário de filtros ---------- */
.menu.filters {
  padding: 16px;
  border-radius: var(--radius-pop);
  min-width: 0;
  width: min(440px, 100%);
}
.ff-title { margin: 4px 6px 12px; font-size: 0.9375em; font-weight: 600; }
.ff-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
}
.ff-row__label { flex: 0 0 92px; color: var(--muted); font-size: 0.8125em; }
.ff-row__opts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1 1 auto; }
.seg {
  font: inherit;
  font-size: 0.8125em;
  color: var(--ink);
  background: #f2f2f4;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
}
.seg:hover { background: #eaeaee; }
.seg.is-active { background: var(--ink); color: #fff; }
.ff-select {
  font: inherit;
  font-size: 0.8125em;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  background: var(--paper);
  color: var(--ink);
}
.ff-tune-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ff-tune {
  width: 42px;
  font: inherit;
  font-size: 0.8125em;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 4px;
  background: var(--paper);
  color: var(--ink);
}
.ff-reset {
  font: inherit;
  font-size: 0.75em;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px 4px;
  text-decoration: underline;
}

/* Ações do formulário (rodapé): Cancelar / Aplicar */
.ff-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.ff-btn {
  font: inherit;
  font-size: 0.875em;
  font-weight: 500;
  border-radius: 999px;
  padding: 5px 15px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.12s ease, transform 0.06s ease, background 0.12s ease;
}
.ff-btn:active { transform: scale(0.97); }
.ff-btn--primary { background: var(--ink); color: var(--paper); }
.ff-btn--primary:hover { opacity: 0.85; }
.ff-btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.ff-btn--ghost:hover { background: rgba(0, 0, 0, 0.05); }

/* ---------- Feedback do parser ---------- */
.parse-hint {
  position: absolute;          /* overlay: não empurra os elementos vizinhos */
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 8px 14px;
  font-size: 0.8125em;
  color: #b00020;
  background: var(--paper);
  border: 2px solid rgba(176, 0, 32, 0.25);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.parse-hint[hidden] { display: none; }
.parse-hint code {
  font-family: "Ubuntu Mono", ui-monospace, monospace;
  background: rgba(176, 0, 32, 0.08);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ===================== Layout v2 (header/main/footer fixos) ===================== */
:root { --appbar-h: 56px; }

body {
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;            /* só a main rola */
}

/* ---------- Header ---------- */
.appbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--appbar-h);
  padding:
    max(8px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    8px
    max(14px, env(safe-area-inset-left));
  position: relative;
  z-index: 30;
}
body[data-view="results"] .appbar { border-bottom: 1px solid var(--line); }
/* Blur/gradiente num ::before (NÃO na .appbar) para não criar containing block
   em descendentes fixed — senão os menus fullscreen do mobile ficariam presos à appbar. */
body[data-view="results"] .appbar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(249, 249, 253, 0.92), rgba(249, 249, 253, 0.55));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.appbar__center { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.appbar__tools { flex: none; display: flex; align-items: center; justify-content: flex-end; min-width:150px; }

.appbar__morse, .appbar__logo { display: none; flex: none; }
.appbar__morse {
  align-items: center; justify-content: center;
  width: 42px; height: 36px; padding: 5px 8px;
  border: none; border-radius: 12px; background: rgba(0, 0, 0, 0.04);
  color: var(--ink); cursor: pointer;
}
.appbar__morse:hover { background: rgba(0, 0, 0, 0.08); }
.appbar__morse svg { width: 26px; height: auto; }
.appbar__logo { line-height: 0; }
.appbar__logo img { display: block; height: 25px; width: auto; }
body[data-view="results"] .appbar__logo { display: flex; width:150px; }

/* ---------- Main rolável ---------- */
.main {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.main__inner {
  width: 100%;
  max-width: var(--maxw);
  min-height: 100%;
  margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right)) 28px max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

/* ---------- Hero (estado home) ---------- */
.hero {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 5vh, 40px);
  padding-bottom: 10vh;
  margin-top: -25vh;
}
.hero__logo { line-height: 0; }
.hero__logo img { display: block; width: clamp(190px, 40vw, 300px); height: auto; }
.hero__slot { width: 100%; display: flex; justify-content: center; }
.hero__hint { margin: 4px 0 0; color: var(--muted); font-size: 0.9375em; text-align: center; }
body[data-view="results"] .hero { display: none; }
body[data-view="home"] .boards { display: none; }

/* ---------- Searchwrap (realocada entre hero e header) ---------- */
.searchwrap { position: relative; width: 100%; }
.hero .searchwrap { max-width: 1080px; }
.appbar__center .searchwrap { max-width: 1080px; }

/* ---------- Barra de label (estado results) ---------- */
.resultbar {
  display: none;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 14px;
}
body[data-view="results"] .resultbar { display: flex; }
.resultbar__type { font-size: 0.9375em; color: var(--muted); }
.resultbar__type b { color: var(--ink); font-weight: 600; letter-spacing: 1px; }
.resultbar__inst { display: none; font-size: 0.9375em; font-weight: 600; color: var(--ink); white-space: nowrap; }

/* ---------- Boards ---------- */
.boards { margin-top: 0; flex: 0 0 auto; }

/* ---------- Footer ---------- */
.footer {
  flex: none;
  z-index: 30;
  background: linear-gradient(to top, rgba(249, 249, 253, 0.95), rgba(249, 249, 253, 0.4));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding:
    10px
    max(18px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  font-size: 0.8125em;
  color: var(--muted);
}
.footer__copy { font-weight: 300; }
.footer__copy b { color: var(--ink); font-weight: 700; }
.footer__links { display: flex; gap: 18px; }
.footer__links a { color: var(--muted); text-decoration: none; }
.footer__links a:hover { color: var(--ink); }

/* ===================== Login / Conta ===================== */
.account { position: relative; }
.account__btn { padding: 4px; }
.account__face { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
/* avatar texticon: círculo preto, letra branca */
.account__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375em;
  line-height: 1;
}
.account__menu { top: calc(100% + 8px); right: 0; min-width: 160px; }

/* View de autenticação: ocupa a main, escondendo hero/resultbar/boards */
.authview { display: none; }
body[data-view="auth"] .hero,
body[data-view="auth"] .resultbar,
body[data-view="auth"] .boards { display: none; }
body[data-view="auth"] .authview {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(16px, 8vh, 80px);
}
.authcard {
  position: relative;
  width: min(380px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pop);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14);
  padding: 28px 26px 22px;
}
.authcard__close {
  position: absolute; top: 12px; right: 12px;
  display: inline-flex; padding: 4px;
  border: none; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px;
}
.authcard__close:hover { background: rgba(0, 0, 0, 0.05); color: var(--ink); }
.authcard__title { margin: 0 0 6px; font-size: 1.375em; font-weight: 600; }
.authcard__hint { margin: 0 0 14px; font-size: 0.8125em; color: var(--muted); }
.authform { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.authfield { display: flex; flex-direction: column; gap: 5px; }
.authfield__label { font-size: 0.75em; color: var(--muted); font-weight: 500; }
.authfield__input {
  font: inherit; font-size: 0.9375em;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--paper); color: var(--ink);
}
.authfield__input:focus { outline: none; border-color: var(--ink); }
.authsubmit {
  margin-top: 4px;
  font: inherit; font-size: 0.9375em; font-weight: 600;
  color: #fff; background: var(--ink);
  border: none; border-radius: 999px;
  padding: 11px 16px; cursor: pointer;
  transition: opacity 0.12s ease, transform 0.06s ease;
}
.authsubmit:hover { opacity: 0.88; }
.authsubmit:active { transform: scale(0.98); }
.authsubmit:disabled { opacity: 0.5; cursor: default; }
.authmsg { margin: 4px 0 0; font-size: 0.8125em; }
.authmsg--error { color: #b00020; }
.authmsg--ok { color: #1a7f37; }
.authcard__links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 16px; }
.authlink {
  font: inherit; font-size: 0.8125em;
  color: var(--muted); background: transparent; border: none; cursor: pointer;
  text-decoration: underline; padding: 2px;
}
.authlink:hover { color: var(--ink); }

/* ===================== Responsividade ===================== */
@media (max-width: 720px) {
  /* fonte geral (base) maior no mobile para leitura */
  html, body { font-size: 18px; }

  /* chips menores e centralizados; input em linha própria */
  .search__bar { flex-wrap: wrap; justify-content: center; }
  .search__input { flex-basis: 100%; order: -1; text-align: left; padding: 8px 6px; }
  .chips { flex-wrap: wrap; justify-content: center; gap: 4px; }
  .chip { font-size: 0.75em; padding: 3px 10px; }

  /* gerar pelo Enter/“Ir” do teclado; oculta o botão no mobile */
  .chip--go { display: none; }

  /* results: morse aparece, logo some, searchbar flutuante */
  body[data-view="results"] .appbar__logo { display: none; }
  body[data-view="results"] .appbar__morse { display: inline-flex; }
  body[data-view="results"] .appbar__center { position: static; }
  body[data-view="results"] .searchwrap {
    position: fixed;
    left: 8px; right: 8px;
    top: calc(env(safe-area-inset-top) + var(--appbar-h) + 4px);
    width: auto;
    max-width: none;
    z-index: 50;
    padding: 4px;
    border-radius: 26px;
    background: var(--paper);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.2);
    display: none;
  }
  body[data-view="results"] .searchwrap.is-open { display: block; }

  /* label mostra o instrumento no mobile */
  .resultbar__inst { display: inline; }
  .resultbar__type { font-size: 0.875em; }

  .boards { gap: 22px; }
}
