/* VagaMatch — vocabulário de cronograma: fundo cobalto com grade de linha do tempo,
   fichas de papel e a nota desenhada como barra de Gantt com um marco. */

:root {
  --cobalto: #2B44C7;
  --cobalto-fundo: #2238A8;
  --papel: #F6F7FC;
  --tinta: #131A3A;
  --tinta-suave: #4A5278;
  --linha: #D5DAF0;
  --marco: #FFC533;
  --recusa: #E4484B;
  --verde: #1D7F4C;

  --fonte-titulo: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif-condensed, sans-serif;
  --fonte-texto: "Avenir Next", Avenir, "Segoe UI", Roboto, system-ui, sans-serif;

  --passo-1: 0.8125rem;  /* 13 */
  --passo-2: 0.9375rem;  /* 15 */
  --passo-3: 1.0625rem;  /* 17 */
  --passo-4: 1.375rem;   /* 22 */
  --passo-5: 1.875rem;   /* 30 */

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--fonte-texto);
  font-size: var(--passo-2);
  line-height: 1.45;
  color: var(--tinta);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 56px),
    var(--cobalto);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--marco); outline-offset: 2px; }

/* --- Marca e cabeçalho ------------------------------------------------------- */

.brand {
  font-family: var(--fonte-titulo);
  font-weight: 800;
  font-size: var(--passo-4);
  letter-spacing: 0.01em;
  color: #fff;
}
.brand-big { font-size: 2.75rem; line-height: 1; }

.app {
  height: 100%;
  height: 100dvh;
  max-width: 30rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem max(0.75rem, env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.counter { color: #fff; opacity: 0.85; font-size: var(--passo-1); }

.tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0.625rem 0 0.75rem;
  padding: 0.1875rem;
  border-radius: 0.75rem;
  background: var(--cobalto-fundo);
}
.tab {
  flex: 1;
  border: 0;
  border-radius: 0.5625rem;
  padding: 0.5rem 0.25rem;
  background: transparent;
  color: #fff;
  font-weight: 600;
}
.tab[aria-pressed="true"] { background: var(--papel); color: var(--tinta); }

/* --- Deck -------------------------------------------------------------------- */

.deck { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stack { flex: 1; min-height: 0; position: relative; }

.card {
  position: absolute;
  inset: 0 0 0.875rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.125rem 1.125rem 0.875rem;
  overflow: hidden;
  border-radius: 1.375rem;
  background: var(--papel);
  box-shadow: 0 0.5rem 0 var(--cobalto-fundo);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  transition: transform 0.2s ease-out;
}
.card.dragging { transition: none; cursor: grabbing; }
.card.leaving { transition: transform 0.23s ease-in; }
.card.pos-1 { transform: translateY(0.5rem) scale(0.965); filter: brightness(0.93); }
.card.pos-2 { transform: translateY(1rem) scale(0.93); filter: brightness(0.86); }

/* A nota como barra de cronograma: trilho de 0 a 10, barra até a nota, marco na ponta. */
.score { display: flex; align-items: center; gap: 0.875rem; margin-bottom: 0.5rem; }
.score-track {
  position: relative;
  flex: 1;
  height: 0.875rem;
  border-radius: 0.4375rem;
  background: var(--linha);
}
.score-track::after {            /* as dez divisões da escala, por cima da barra */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1.5px), var(--papel) calc(10% - 1.5px) 10%);
}
.score-fill {
  position: relative;
  height: 100%;
  min-width: 0.875rem;
  border-radius: 0.4375rem;
  background: var(--tinta);
}
.score-fill::after {
  content: "";
  position: absolute;
  right: -0.5625rem;
  top: 50%;
  z-index: 2;
  width: 1.125rem;
  height: 1.125rem;
  background: var(--marco);
  border: 2px solid var(--tinta);
  transform: translateY(-50%) rotate(45deg);
}
.score-value { white-space: nowrap; color: var(--tinta-suave); font-size: var(--passo-1); }
.score-value strong {
  font-family: var(--fonte-titulo);
  font-size: var(--passo-5);
  font-weight: 800;
  line-height: 1;
  color: var(--tinta);
}
.score-none { font-size: var(--passo-1); color: var(--tinta-suave); }

.card-title, .sheet-title {
  font-family: var(--fonte-titulo);
  font-weight: 800;
  font-size: var(--passo-5);
  line-height: 1.08;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
}
.card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.card-company { font-size: var(--passo-3); font-weight: 600; }
.card-city { color: var(--tinta-suave); }

.tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.25rem; }
.tag {
  padding: 0.125rem 0.5rem;
  border: 1.5px solid var(--tinta);
  border-radius: 0.375rem;
  font-size: var(--passo-1);
  font-weight: 600;
  white-space: nowrap;
}
.tag-agro { border-color: var(--verde); color: var(--verde); }
.tag-post { background: var(--tinta); color: var(--papel); }
.tag-plain { border-style: dashed; color: var(--tinta-suave); border-color: var(--tinta-suave); }

.card-salary { font-weight: 700; margin-top: 0.125rem; }

.card-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 2px dashed var(--linha);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.card-why { font-size: var(--passo-3); font-weight: 600; line-height: 1.35; }
.card-summary { color: var(--tinta-suave); white-space: pre-line; }
.card-reqs { margin: 0.125rem 0 0; padding-left: 1.125rem; }
.card-reqs li::marker { color: var(--cobalto); }
.card-warn { font-size: var(--passo-1); color: var(--tinta-suave); }

.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.5rem;
  font-size: var(--passo-1);
  color: var(--tinta-suave);
}
.card-more { white-space: nowrap; text-decoration: underline; text-underline-offset: 0.15em; }

.stamp {
  position: absolute;
  top: 4.25rem;
  z-index: 2;
  padding: 0.125rem 0.75rem;
  border: 3px solid;
  border-radius: 0.5rem;
  background: var(--papel);
  font-family: var(--fonte-titulo);
  font-weight: 800;
  font-size: var(--passo-5);
  opacity: 0;
  pointer-events: none;
}
.stamp-like { left: 1rem; color: var(--verde); transform: rotate(-9deg); }
.stamp-reject { right: 1rem; color: var(--recusa); transform: rotate(9deg); }

.actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding-top: 0.875rem;
}
.act {
  width: 3.75rem;
  height: 3.75rem;
  border: 0;
  border-radius: 50%;
  background: var(--papel);
  font-size: 1.625rem;
  line-height: 1;
  box-shadow: 0 0.25rem 0 var(--cobalto-fundo);
}
.act:active { transform: translateY(0.1875rem); box-shadow: 0 0.0625rem 0 var(--cobalto-fundo); }
.act:disabled { opacity: 0.45; }
.act-reject { color: var(--recusa); }
.act-like { background: var(--marco); color: var(--tinta); }
.act-undo { width: 3rem; height: 3rem; font-size: 1.25rem; color: var(--tinta); }

.empty {
  margin: auto 0;
  padding: 1.5rem 0.5rem;
  color: #fff;
  font-size: var(--passo-3);
  text-align: left;
  max-width: 22rem;
}

/* --- Listas ------------------------------------------------------------------ */

.list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.875rem;
  background: var(--papel);
}
.row-score {
  flex: none;
  width: 2.25rem;
  font-family: var(--fonte-titulo);
  font-weight: 800;
  font-size: var(--passo-4);
  text-align: center;
}
.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
}
.row-title { font-size: var(--passo-3); line-height: 1.25; overflow-wrap: anywhere; }
.row-sub { font-size: var(--passo-1); color: var(--tinta-suave); }
.row-move {
  flex: none;
  border: 1.5px solid var(--tinta);
  border-radius: 0.5rem;
  padding: 0.375rem 0.625rem;
  background: none;
  font-size: var(--passo-1);
  font-weight: 600;
}

/* --- Detalhe (folha que sobe) ------------------------------------------------ */

.backdrop { position: fixed; inset: 0; background: rgba(19, 26, 58, 0.55); z-index: 10; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  max-width: 30rem;
  max-height: 92dvh;
  margin: 0 auto;
  padding: 1rem 1.125rem max(1.25rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 1.375rem 1.375rem 0 0;
  background: var(--papel);
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  animation: subir 0.22s ease-out;
}
@keyframes subir { from { transform: translateY(2.5rem); opacity: 0; } }
.sheet-close {
  align-self: flex-end;
  border: 0;
  border-radius: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: var(--linha);
  font-weight: 600;
}
.sheet .score { margin: 0.625rem 0 0.25rem; }
.sheet-h { margin-top: 0.875rem; font-size: var(--passo-2); font-weight: 700; }
.sheet-p { max-width: 38rem; }
.sheet-raw { white-space: pre-line; color: var(--tinta-suave); overflow-wrap: anywhere; }
.sheet-list { margin: 0; padding-left: 1.125rem; }
.sheet-foot { margin-top: 1rem; font-size: var(--passo-1); color: var(--tinta-suave); }
.apply-row {
  position: sticky;
  bottom: calc(-1 * max(1.25rem, env(safe-area-inset-bottom)));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem -1.125rem 0;
  padding: 0.75rem 1.125rem max(1.25rem, env(safe-area-inset-bottom));
  background: var(--papel);
  border-top: 2px dashed var(--linha);
}
.apply, .primary {
  display: block;
  border: 0;
  border-radius: 0.75rem;
  padding: 0.8125rem 1rem;
  background: var(--marco);
  color: var(--tinta);
  font-weight: 700;
  font-size: var(--passo-3);
  text-align: center;
  text-decoration: none;
  box-shadow: 0 0.25rem 0 #C99512;
}

/* --- Login ------------------------------------------------------------------- */

.login {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: 1.5rem;
}
.login-form {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.login-lead { color: #fff; opacity: 0.9; font-size: var(--passo-3); margin-bottom: 1.25rem; }
.field-label { color: #fff; font-weight: 600; }
.field {
  border: 0;
  border-radius: 0.75rem;
  padding: 0.8125rem 1rem;
  background: var(--papel);
  font-size: var(--passo-3);
}
.login-error {
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--papel);
  color: var(--recusa);
  font-weight: 600;
}
.primary { margin-top: 0.5rem; width: 100%; }

/* --- Aviso curto ------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(6.5rem, calc(env(safe-area-inset-bottom) + 6.5rem));
  z-index: 20;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: 0.5rem 0.875rem;
  border-radius: 0.625rem;
  background: var(--tinta);
  color: #fff;
  font-size: var(--passo-2);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .card, .card.leaving { transition: none; }
  .sheet { animation: none; }
}
