/* ============================================================
   guardiola.me — cv  ·  tema: escuro moderno (terminal)
   ============================================================ */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMono-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg:        #0b0e14;   /* fundo da página           */
  --term-bg:   #0d1117;   /* fundo do terminal         */
  --term-bg-2: #11151d;   /* title-bar                 */
  --fg:        #e6edf3;   /* texto padrão              */
  --muted:     #8b949e;   /* texto secundário          */
  --green:     #7ee787;   /* usuário / sucesso         */
  --cyan:      #56d4dd;   /* host / links              */
  --blue:      #79c0ff;   /* path / campos             */
  --yellow:    #e3b341;   /* destaques                 */
  --red:       #ff7b72;   /* erros                     */
  --magenta:   #d2a8ff;   /* acentos                   */
  --border:    #232b36;
  --selection: #2d4f67;

  --font: "JetBrains Mono", ui-monospace, "SF Mono", "Fira Code", "Cascadia Code",
          Menlo, Consolas, "DejaVu Sans Mono", monospace;
  /* fonte sans p/ a barra de título (estilo KDE/Breeze) */
  --ui-font: "Noto Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --fs: 14.5px;
  --lh: 1.55;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1200px 800px at 75% -10%, #141b27 0%, transparent 60%),
    radial-gradient(900px 700px at 0% 110%, #10161f 0%, transparent 55%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  display: flex;
  flex-direction: column;        /* área de trabalho + painel KDE no rodapé */
  -webkit-font-smoothing: antialiased;
}

/* Área de trabalho: ocupa tudo acima do painel e centraliza a janela. */
.desktop {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0px, 3vmin, 32px);
}
.desktop.maxed { padding: 0; }

::selection { background: var(--selection); color: #fff; }

/* ----------------------------- Janela ----------------------------- */

.terminal-window {
  width: min(960px, 100%);
  height: min(680px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--term-bg);
  border: 1px solid #15181b;
  border-radius: 7px;                 /* cantos arredondados estilo Plasma 6 */
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.3),
    0 18px 50px -12px rgba(0, 0, 0, 0.75),
    0 8px 20px -10px rgba(0, 0, 0, 0.6);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Estados da janela (gerenciados por js/desktop.js) */
.terminal-window.is-hidden {
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  visibility: hidden;
}
.terminal-window.is-maximized {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

/* Barra de título estilo KDE Breeze (Plasma 6): ícone à esquerda, título
   centralizado, botões (minimizar/maximizar/fechar) à direita. */
.title-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 6px 0 10px;
  background: #31363b;                 /* titlebar Breeze Dark (ativo) */
  border-bottom: 1px solid #25292e;
  font-family: var(--ui-font);
  user-select: none;
}

.win-icon { display: inline-flex; align-items: center; color: #3daee9; } /* azul Breeze */
.win-icon svg { display: block; }

.title {
  grid-column: 2;
  text-align: center;
  font-size: 12.5px;
  color: #eff0f1;                      /* texto Breeze Dark */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-controls { display: inline-flex; align-items: center; gap: 1px; }
.win-btn {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; margin: 0; border: 0;
  background: transparent;
  color: #c6cace;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.win-btn svg { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
.win-btn:hover       { background: rgba(255, 255, 255, 0.13); color: #fff; }
.win-btn:active      { background: rgba(255, 255, 255, 0.07); }
.win-btn.close:hover { background: #da4453; color: #fff; }   /* fechar: vermelho Breeze */

/* ----------------------------- Tela ----------------------------- */

.screen {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 20px;
  scroll-behavior: smooth;
}

.output { white-space: pre-wrap; word-break: break-word; }

.line { white-space: pre-wrap; min-height: calc(var(--fs) * var(--lh)); }

/* Cores utilitárias para conteúdo impresso */
.muted   { color: var(--muted); }
.err     { color: var(--red); }
.ok      { color: var(--green); }
.warn    { color: var(--yellow); }
.accent  { color: var(--magenta); }
.link    { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }
.field   { color: var(--blue); }
.kbd     { color: var(--yellow); }
.dim     { opacity: 0.75; }
.banner  { color: var(--green); line-height: 1.15; white-space: pre; }
.h-title { color: var(--fg); font-weight: 700; }
.rule    { color: var(--border); }

/* Prompt */
.prompt   { white-space: pre; }
.prompt .u  { color: var(--green); }
.prompt .at { color: var(--muted); }
.prompt .h  { color: var(--cyan); }
.prompt .c  { color: var(--muted); }
.prompt .p  { color: var(--blue); }
.prompt .d  { color: var(--fg); }
.typed { white-space: pre-wrap; }
.counter { color: var(--muted); }

/* Cursor block piscando */
.cursor {
  display: inline-block;
  width: 0.62ch;
  height: 1.05em;
  margin-left: 1px;
  transform: translateY(0.16em);
  background: var(--fg);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Seleção de idioma */
.lang-line { white-space: pre; }
.lang-opt.sel { color: var(--fg); }
.lang-opt.sel .marker { color: var(--green); }
.lang-opt {
  color: var(--muted);
  border-radius: 5px;
  transition: background 0.08s ease;
}
.lang-opt.sel { background: rgba(126, 231, 135, 0.10); color: var(--fg); }

/* ----------------------------- Pager (less) ----------------------------- */

.pager {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--term-bg);
}
.pager.hidden { display: none; }

.pager-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;            /* scroll controlado via JS (scrollTop) */
  padding: 14px 18px;
  white-space: pre-wrap;
  word-break: break-word;
}
.pl { white-space: pre-wrap; min-height: calc(var(--fs) * var(--lh)); }

.pager-status {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 14px;
  font-size: 13px;
  background: #e6edf3;
  color: #0d1117;             /* vídeo reverso (estilo less) */
}
.pager-status .name { font-weight: 600; }
.pager-status .meta { white-space: nowrap; }

/* ----------------------------- Scrollbar ----------------------------- */

.screen::-webkit-scrollbar { width: 10px; }
.screen::-webkit-scrollbar-track { background: transparent; }
.screen::-webkit-scrollbar-thumb {
  background: #2a323d; border-radius: 8px; border: 2px solid var(--term-bg);
}
.screen::-webkit-scrollbar-thumb:hover { background: #3a4452; }
.screen { scrollbar-width: thin; scrollbar-color: #2a323d transparent; }

/* ----------------------------- Input oculto ----------------------------- */

#hidden-input {
  position: fixed;
  top: 0; left: 0;
  width: 1px; height: 1px;
  padding: 0; border: 0; margin: -1px;
  opacity: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px; /* evita zoom no iOS ao focar */
  z-index: -1;
}

/* ----------------------------- noscript ----------------------------- */

.noscript {
  max-width: 640px;
  margin: 12vh auto;
  padding: 24px;
  text-align: center;
  color: var(--fg);
}
.noscript a { color: var(--cyan); }

/* ----------------------------- Painel KDE ----------------------------- */

.kde-panel {
  flex: 0 0 auto;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  background: #2a2e32;                 /* painel Breeze Dark */
  border-top: 1px solid #1c1f22;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
  font-family: var(--ui-font);
  color: #eff0f1;
  position: relative;                  /* âncora dos popups */
  user-select: none;
  z-index: 10;
}

.panel-spacer { flex: 1 1 auto; }

/* Menu de aplicativos (kickoff) */
.panel-kickoff {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 36px;
  border: 0; border-radius: 5px;
  background: transparent; color: #3daee9;   /* azul Breeze */
  cursor: pointer;
  transition: background 0.12s ease;
}
.panel-kickoff svg { fill: currentColor; }
.panel-kickoff:hover,
.panel-kickoff.active { background: rgba(61, 174, 233, 0.18); }

/* Barra de tarefas */
.panel-tasks { display: inline-flex; align-items: center; gap: 4px; }
.task {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px 0 9px;
  border: 0; border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: #eff0f1;
  font-family: var(--ui-font); font-size: 12.5px;
  cursor: pointer; position: relative; max-width: 220px;
  transition: background 0.12s ease, color 0.12s ease;
}
.task .task-icon { display: inline-flex; color: #3daee9; }
.task .task-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task:hover { background: rgba(255, 255, 255, 0.12); }
.task.active { background: rgba(61, 174, 233, 0.16); }   /* janela em foco */
.task.active::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 1px; height: 2px;
  background: #3daee9; border-radius: 2px;
}
.task.minimized { background: transparent; color: #b9bdc1; }   /* recuada */
.task.minimized .task-icon { color: #8b949e; }
.task.minimized:hover { background: rgba(255, 255, 255, 0.08); }

/* Bandeja do sistema (decorativa) */
.panel-tray { display: inline-flex; align-items: center; gap: 8px; padding: 0 6px; color: #b9bdc1; }
.panel-tray svg { display: block; }

/* Relógio digital */
.panel-clock {
  display: inline-flex; flex-direction: column; align-items: flex-end; justify-content: center;
  min-width: 56px; height: 38px; padding: 0 8px;
  border: 0; border-radius: 5px;
  background: transparent; color: #eff0f1;
  font-family: var(--ui-font); line-height: 1.1; cursor: pointer;
  transition: background 0.12s ease;
}
.panel-clock:hover,
.panel-clock.active { background: rgba(255, 255, 255, 0.10); }
.clock-time { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.clock-date { font-size: 10.5px; color: #b9bdc1; }

/* Menu do kickoff (popup) */
.kickoff-menu {
  position: absolute;
  left: 8px; bottom: calc(100% + 6px);
  min-width: 230px; padding: 6px;
  background: #2e3338; border: 1px solid #1c1f22; border-radius: 7px;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.7);
  z-index: 20;
}
.kickoff-menu.hidden { display: none; }
.kickoff-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 5px;
  background: transparent; color: #eff0f1; text-align: left;
  cursor: pointer; font-family: var(--ui-font);
}
.kickoff-item:hover { background: #3daee9; color: #fff; }
.kickoff-item .ki-icon { display: inline-flex; color: #3daee9; }
.kickoff-item:hover .ki-icon { color: #fff; }
.kickoff-item .ki-text { display: flex; flex-direction: column; line-height: 1.25; }
.kickoff-item .ki-title { font-size: 13px; font-weight: 600; }
.kickoff-item .ki-sub { font-size: 11px; color: #b9bdc1; }
.kickoff-item:hover .ki-sub { color: rgba(255, 255, 255, 0.85); }

/* Calendário (popup do relógio) */
.calendar-popup {
  position: absolute;
  right: 8px; bottom: calc(100% + 6px);
  width: 270px; padding: 14px;
  background: #2e3338; border: 1px solid #1c1f22; border-radius: 7px;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.7);
  color: #eff0f1; z-index: 20;
}
.calendar-popup.hidden { display: none; }
.cal-header { text-align: center; margin-bottom: 10px; }
.cal-time { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-date { font-size: 12px; color: #b9bdc1; margin-top: 2px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-dow {
  font-size: 10.5px; color: #8b949e; font-weight: 600;
  padding: 4px 0; text-transform: uppercase;
}
.cal-day, .cal-blank {
  font-size: 12px; padding: 6px 0; border-radius: 5px;
  font-variant-numeric: tabular-nums;
}
.cal-day:hover { background: rgba(255, 255, 255, 0.08); }
.cal-today { background: #3daee9; color: #fff; font-weight: 700; }
.cal-today:hover { background: #3daee9; }
.cal-region {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid #3a4047;
  font-size: 11.5px; color: #b9bdc1; text-align: center;
}
.cal-region-name { color: #eff0f1; font-weight: 600; }

/* ----------------------------- Responsivo ----------------------------- */

@media (max-width: 640px) {
  .desktop { padding: 0; }
  .terminal-window {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
  }
  :root { --fs: 13.5px; }
  .banner { font-size: 11px; }

  .kde-panel { height: 40px; gap: 4px; padding: 0 5px; }
  .task { max-width: 150px; padding: 0 9px 0 7px; }
  .panel-tray { display: none; }
  .kickoff-menu { left: 5px; min-width: 0; width: calc(100vw - 16px); }
  .calendar-popup { right: 5px; width: calc(100vw - 16px); }
}

@media (max-width: 380px) {
  .banner { font-size: 9.5px; }
}

/* ----------------------------- App-terminal (touch) ----------------------------- */
/* Ativado por js/mobile.js (body.is-touch), só em telas de toque. Troca o
   "desktop KDE" por um terminal mobile: janela cheia, sem painel Plasma, e uma
   barra de ações tocável no rodapé (estilo app de terminal, ex.: Termux). */

.action-bar { display: none; }

/* Altura segue o viewport visível (encaixa acima do teclado virtual). */
body.is-touch { height: var(--app-h, 100dvh); }

/* Janela cheia, sem moldura flutuante. */
body.is-touch .desktop { padding: 0; }
body.is-touch .terminal-window {
  width: 100%; height: 100%;
  border: 0; border-radius: 0; box-shadow: none;
}

/* Top-bar fina mantém a identidade; controles de janela saem (sem kickoff p/ reabrir). */
body.is-touch .kde-panel { display: none; }
body.is-touch .win-controls { display: none; }

/* Barra de ações: teclas tocáveis contextuais por tela. */
body.is-touch .action-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 5px;
  padding: 6px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  background: #0d1117;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
body.is-touch .action-bar::-webkit-scrollbar { display: none; }

body.is-touch .act {
  flex: 0 0 auto;
  min-width: 46px; min-height: 46px;       /* alvo de toque confortável */
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.45em;
  padding: 0 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #161b22; color: var(--fg);
  font-family: var(--font); font-size: 13px; line-height: 1;
  white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; user-select: none;
}
body.is-touch .act.grow { flex: 1 1 auto; }       /* chips de comando esticam */
body.is-touch .act:active { background: var(--selection); border-color: var(--cyan); }
body.is-touch .act .k { color: var(--green); font-weight: 700; }

/* Alvos de toque no conteúdo (menu inicial e seleção de idioma). */
body.is-touch .menu-item,
body.is-touch .lang-opt { cursor: pointer; }
body.is-touch .menu-item:active { color: var(--green); }
body.is-touch .lang-opt:active { background: rgba(126, 231, 135, 0.10); }

/* Reduz movimento se solicitado */
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .screen { scroll-behavior: auto; }
  .terminal-window { transition: none; }
}
