/* ========================================= */
/* RESUMÉ (resume.r4ul.com.br)               */
/* ========================================= */

/* Cores de status são semânticas (ok / aguardando / parado) e por isso não
   seguem o ciclo de --hero-color: um LED "running" tem que continuar verde
   mesmo quando o tema da página está roxo. */
:root {
  --status-ok: #00ff66;
  --status-ok-glow: rgba(0, 255, 102, 0.6);
  --status-wait: #ffb000;
  --status-wait-glow: rgba(255, 176, 0, 0.55);
  --status-off: #3a3a3a;
}

/* Linha de comando "$ ..." no topo de cada rack */
.cmd-line {
  font-size: 0.8rem;
  color: #666;
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .cmd-line {
    font-size: 0.875rem;
  }
}

/* LED genérico de status (reaproveitado por unidades, módulos e daemons) */
.unit-led,
.module-led {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-off);
  flex-shrink: 0;
}

/* ========================================= */
/* MISSION LOG — systemctl list-units        */
/* ========================================= */

.unit-table {
  font-size: 0.8rem;
  line-height: 1.6;
}

.unit-list {
  list-style: none;
}

/* Mobile: unidade empilhada (nome / cargo / anos + estado) */
.unit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name name"
    "role role"
    "years state";
  column-gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.unit-name { grid-area: name; }
.unit-role { grid-area: role; }
.unit-years { grid-area: years; }
.unit-state { grid-area: state; text-align: right; }

.unit-head {
  display: none;
}

.unit-row .unit-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #e0e0e0;
  overflow-wrap: anywhere;
}

.unit-row .unit-role {
  color: #b0b0b0;
}

.unit-row .unit-years {
  color: #666;
  white-space: nowrap;
}

.unit-row .unit-state {
  white-space: nowrap;
}

.unit-row.is-active .unit-led {
  background: var(--status-ok);
  box-shadow: 0 0 8px var(--status-ok-glow);
  animation: led-pulse 2s infinite ease-in-out;
}

.unit-row.is-active .unit-state {
  color: var(--status-ok);
  text-shadow: 0 0 6px var(--status-ok-glow);
}

.unit-row.is-exited .unit-name {
  color: #888;
}

.unit-row.is-exited .unit-state {
  color: #555;
}

.unit-footer {
  margin-top: 12px;
  color: #555;
}

/* Desktop: uma linha por unidade, colunas alinhadas como no systemctl */
@media (min-width: 768px) {
  .unit-table {
    font-size: 0.9rem;
  }

  .unit-row {
    grid-template-columns: minmax(14rem, 1.1fr) 1.4fr 9rem 10rem;
    grid-template-areas: "name role years state";
    padding: 8px 0;
  }

  .unit-years,
  .unit-state {
    text-align: left;
  }

  .unit-head {
    display: grid;
    color: #555;
    font-size: 0.7rem;
    letter-spacing: 1px;
    border-bottom: 1px solid #2a2a2a;
  }

  .unit-head .unit-name,
  .unit-head .unit-role,
  .unit-head .unit-years,
  .unit-head .unit-state {
    color: #555;
    font-weight: 700;
  }

  /* alinha "UNIT" com o texto das linhas, que vem depois do LED (8px + gap) */
  .unit-head .unit-name {
    padding-left: 16px;
  }
}

/* ========================================= */
/* ESTUDOS — apt install / daemons           */
/* ========================================= */

.apt-preamble {
  font-size: 0.75rem;
  line-height: 1.6;
  color: #555;
}

.pkg-list,
.daemon-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.pkg-list {
  gap: 20px;
}

.pkg-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.pkg-name {
  font-weight: 700;
  color: #e0e0e0;
}

.pkg-status {
  font-size: 0.75rem;
  color: var(--status-wait);
  letter-spacing: 1px;
  white-space: nowrap;
}

.pkg-desc {
  font-size: 0.85rem;
  color: #b0b0b0;
  line-height: 1.6;
}

.pkg-vendor {
  color: #666;
}

.pkg-link {
  display: inline-block;
  margin-left: 6px;
  color: #00d9ff;
  text-decoration: none;
  border-bottom: 1px dashed rgba(0, 217, 255, 0.4);
  white-space: nowrap;
}

.pkg-link:hover,
.pkg-link:focus-visible {
  color: var(--hero-color);
  border-bottom-color: var(--hero-color);
}

.pkg-bar {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.pkg-bar-track {
  color: var(--hero-color);
  text-shadow: 0 0 4px var(--hero-shadow);
  transition: color 0.5s ease;
  letter-spacing: 1px;
}

.pkg-bar-pct {
  color: #e0e0e0;
  min-width: 4ch;
}

/* Telas muito estreitas: a barra ASCII (22 caracteres) precisa caber
   sem gerar scroll horizontal */
@media (max-width: 360px) {
  .pkg-bar {
    font-size: 0.75rem;
  }

  .pkg-bar-track {
    letter-spacing: 0;
  }
}

.daemon-comment {
  font-size: 0.75rem;
  color: #666;
  font-style: italic;
}

.daemon-list {
  gap: 14px;
}

.daemon {
  display: grid;
  grid-template-columns: 1.5ch 4.5ch 1fr;
  grid-template-areas:
    "spin pid  name"
    ".    desc desc";
  column-gap: 8px;
  font-size: 0.85rem;
  line-height: 1.6;
}

.daemon-spin {
  grid-area: spin;
  color: var(--status-ok);
  text-shadow: 0 0 6px var(--status-ok-glow);
}

.daemon-pid {
  grid-area: pid;
  color: #555;
}

.daemon-name {
  grid-area: name;
  font-weight: 700;
  color: #e0e0e0;
}

.daemon-title {
  font-weight: 400;
  color: #00d9ff;
  margin-left: 6px;
}

.daemon-desc {
  grid-area: desc;
  color: #999;
}

/* ========================================= */
/* MÓDULOS — certificações em slots de rack  */
/* ========================================= */

.module-grid {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Cada módulo é uma placa encaixada no slot: alças de ejeção nas laterais
   (::before/::after) e LED de status no canto. */
.module {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 18px;
  min-height: 108px;
  font-size: 0.8rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.module::before,
.module::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: #2f2f2f;
}

.module::before { left: 5px; }
.module::after { right: 5px; }

.module-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.65rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.module-vendor {
  color: #888;
  font-weight: 700;
}

.module-slot {
  margin-left: auto;
  color: #444;
}

.module-name {
  color: #e0e0e0;
  font-weight: 700;
  line-height: 1.4;
}

.module-meta {
  margin-top: auto;
  color: #666;
  font-size: 0.75rem;
}

.module.is-loaded {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  border: 1px solid #2a2a2a;
}

.module.is-loaded::before,
.module.is-loaded::after {
  background: color-mix(in srgb, var(--hero-color) 35%, #2f2f2f);
}

.module.is-loaded .module-led {
  background: var(--status-ok);
  box-shadow: 0 0 8px var(--status-ok-glow);
}

.module.is-loaded:hover {
  border-color: color-mix(in srgb, var(--hero-color) 60%, #2a2a2a);
  background: color-mix(in srgb, var(--hero-color) 5%, transparent);
  box-shadow: 0 0 12px var(--hero-shadow);
}

/* Slot vazio: prova ainda não feita, LED âmbar piscando */
.module.is-empty {
  border: 1px dashed #3a3a3a;
  background: repeating-linear-gradient(135deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 6px,
      transparent 6px,
      transparent 12px);
}

.module.is-empty .module-led {
  background: var(--status-wait);
  box-shadow: 0 0 8px var(--status-wait-glow);
  animation: module-await 1.2s steps(1, end) infinite;
}

.module.is-empty .module-name {
  color: var(--status-wait);
  letter-spacing: 2px;
  font-size: 0.75rem;
}

.module.is-empty .module-meta strong {
  color: #b0b0b0;
}

@keyframes module-await {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0.15; }
}

/* Formação */
.edu-list {
  list-style: none;
  font-size: 0.85rem;
  line-height: 1.6;
}

.edu-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "course course"
    "school years";
  column-gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.edu-course { grid-area: course; color: #e0e0e0; font-weight: 700; }
.edu-school { grid-area: school; color: #00d9ff; }
.edu-years { grid-area: years; color: #666; white-space: nowrap; }

@media (min-width: 768px) {
  .edu-row {
    grid-template-columns: 1fr 10rem 9rem;
    grid-template-areas: "course school years";
  }
}

/* ========================================= */
/* INVENTORY                                 */
/* ========================================= */

/* Nomes longos (ex.: "SRE / Observabilidade") não podem estourar o tile
   na grade de 2 colunas do celular */
.skill-item {
  overflow-wrap: anywhere;
}

/* Detalhe opcional embaixo do nome do skill (ex.: Claude / LLMs) */
.skill-note {
  font-size: 0.65rem;
  color: #777;
  line-height: 1.4;
  margin: 2px 0;
}

/* ========================================= */
/* EASTER EGG — sudo cat cv.pdf              */
/* ========================================= */

.cv-hint {
  background: none;
  border: none;
  font-family: "Space Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: #444;
  opacity: 0.45;
  cursor: pointer;
  padding: 4px 8px;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.cv-hint:hover,
.cv-hint:focus-visible {
  opacity: 1;
  color: var(--hero-color);
  outline: 1px dashed var(--hero-color);
}

/* .back-link usa display:inline-flex, que venceria o [hidden] do navegador */
.cv-overlay[hidden],
.cv-overlay [hidden] {
  display: none !important;
}

.cv-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.92);
}

.cv-window {
  width: 100%;
  max-width: 680px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border: 2px solid var(--hero-color);
  box-shadow: 0 0 50px var(--hero-shadow);
}

.cv-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
  color: var(--hero-color);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.cv-close {
  background: none;
  border: 1px solid #2a2a2a;
  color: #999;
  font-family: inherit;
  font-size: 0.7rem;
  letter-spacing: 1px;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.cv-close:hover,
.cv-close:focus-visible {
  color: var(--hero-color);
  border-color: var(--hero-color);
  outline: none;
}

.cv-body {
  padding: 16px;
  overflow-y: auto;
  user-select: text;
  -webkit-user-select: text;
}

.cv-log {
  font-family: "Space Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  color: #b0b0b0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 8em;
}

.cv-actions {
  margin-top: 8px;
}

.cv-request-text {
  font-size: 0.85rem;
  color: var(--status-wait);
}

.cv-actions .back-link {
  margin-top: 0.75rem;
}

/* ========================================= */
/* REDUCED MOTION                            */
/* ========================================= */

@media (prefers-reduced-motion: reduce) {
  .unit-led,
  .module-led {
    animation: none !important;
  }
}
