/* Argonauta Hub - Deep sea meets starlit navigation */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --base: #0B1120;
  --surface: #111B2E;
  --surface-hover: #182640;
  --border: rgba(201, 169, 110, 0.12);
  --border-hover: rgba(201, 169, 110, 0.3);
  --gold: #C9A96E;
  --gold-dim: rgba(201, 169, 110, 0.6);
  --ocean: #5B8FB9;
  --text: #E8E2D6;
  --text-muted: #8A9BB5;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--base);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
}

/* === Starfield background === */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.starfield::before,
.starfield::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: var(--gold);
  animation: drift 60s linear infinite;
}

.starfield::before {
  width: 2px; height: 2px;
  top: 20%; left: 15%;
  box-shadow:
    80vw 10vh 0 0.5px var(--gold-dim),
    25vw 45vh 0 1px rgba(91, 143, 185, 0.4),
    60vw 70vh 0 0.5px var(--gold-dim),
    10vw 80vh 0 1px rgba(91, 143, 185, 0.3),
    90vw 30vh 0 0.5px var(--gold-dim),
    45vw 15vh 0 1px rgba(201, 169, 110, 0.3),
    70vw 55vh 0 0.5px rgba(91, 143, 185, 0.4),
    30vw 90vh 0 1px var(--gold-dim),
    55vw 35vh 0 0.5px rgba(91, 143, 185, 0.3),
    85vw 75vh 0 1px var(--gold-dim);
  opacity: 0.7;
}

.starfield::after {
  width: 1.5px; height: 1.5px;
  top: 50%; left: 70%;
  box-shadow:
    -50vw 20vh 0 1px rgba(201, 169, 110, 0.25),
    -20vw -30vh 0 0.5px rgba(91, 143, 185, 0.3),
    20vw 40vh 0 1px rgba(201, 169, 110, 0.2),
    -60vw 60vh 0 0.5px rgba(91, 143, 185, 0.25),
    10vw -20vh 0 1px rgba(201, 169, 110, 0.3),
    -35vw -10vh 0 0.5px rgba(91, 143, 185, 0.2);
  opacity: 0.5;
  animation-duration: 90s;
  animation-direction: reverse;
}

@keyframes drift {
  from { transform: translateY(0) translateX(0); }
  to { transform: translateY(-30px) translateX(15px); }
}

/* === Layout === */
.hub {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 3.5rem 2rem 6rem;
}

/* === Header === */
.hub-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hub-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 1.25rem;
  animation: float 6s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(201, 169, 110, 0.2));
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hub-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 4.2rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.hub-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* === Chips de navegação (sticky) === */
.chips {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 0.5rem;
  justify-content: safe center;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.75rem 0.25rem;
  margin: 0 -0.25rem 1.25rem;
  background: rgba(11, 17, 32, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid rgba(201, 169, 110, 0.25);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.chip svg {
  width: 13px;
  height: 13px;
}

.chip:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.chip.active {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(201, 169, 110, 0.08);
}

/* === Barra de pesquisa === */
.barra {
  display: flex;
  gap: 0.6rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}
.pesquisa-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1rem;
  height: 46px;
  background: rgba(17, 27, 46, 0.8);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  color: var(--text-muted);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pesquisa-wrap svg { width: 17px; height: 17px; flex-shrink: 0; }
.pesquisa-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.12); color: var(--gold); }
.pesquisa {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  -webkit-appearance: none;
  appearance: none;
}
.pesquisa::placeholder { color: var(--text-muted); }
.pesquisa::-webkit-search-cancel-button { -webkit-appearance: none; }
.toggle-all {
  height: 46px;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  padding: 0 1.1rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.toggle-all:hover { border-color: var(--gold); background: rgba(201, 169, 110, 0.08); }
.toggle-all:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sem-resultados { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin: 2rem 0; }
[hidden] { display: none !important; }

/* === Categorias: botões em grelha; a aberta ocupa a linha toda === */
.categorias {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 720px;
  margin: 0 auto;
  gap: 0.75rem;
}
.category { scroll-margin-top: 1rem; }
.category[open] { grid-column: 1 / -1; margin-bottom: 0.4rem; }
.category[open] .links { max-width: none; }
.category:not([open]) > .category-header { height: 100%; }

.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 76px;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: transform 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.category-header::-webkit-details-marker { display: none; }
.category-header:hover {
  background: var(--surface-hover);
  border-color: var(--gold-dim);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
.category-header:active { transform: translateY(0); }
.category-header:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.category[open] > .category-header {
  background: rgba(201, 169, 110, 0.1);
  border-color: var(--gold);
  margin-bottom: 0.9rem;
}
.category-rule { display: none; }
.category-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(201, 169, 110, 0.1);
  color: var(--gold);
}
.category-icon svg { width: 19px; height: 19px; }
.category-title {
  flex: 1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: normal;
  hyphens: none;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
}
.category-count {
  flex-shrink: 0;
  min-width: 26px;
  padding: 0.15rem 0.5rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(201, 169, 110, 0.12);
  border-radius: 999px;
}
.category-caret {
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.category[open] .category-caret { transform: rotate(45deg); border-color: var(--gold); }

.link-tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border-hover);
  border-radius: 4px;
  vertical-align: 1px;
}

.category-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(201, 169, 110, 0.1);
  color: var(--gold);
}

.category-icon svg {
  width: 18px;
  height: 18px;
}

.category-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.category-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(201, 169, 110, 0.4), transparent);
}

.category-count {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* === Grelha de links === */
.links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

/* === Card de link === */
.link-card {
  position: relative;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, var(--gold)), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.link-card:hover,
.link-card:focus-visible {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(201, 169, 110, 0.08);
}

.link-card:hover::before,
.link-card:focus-visible::before {
  opacity: 1;
}

.link-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.link-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  margin-top: 1px;
  color: var(--accent, var(--gold));
  background: color-mix(in srgb, var(--accent, var(--gold)) 12%, transparent);
}

.link-icon svg {
  width: 16px;
  height: 16px;
}

.link-body { min-width: 0; }

.link-name {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
}

.link-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 0.1rem;
}

.link-url {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-muted);
  opacity: 0.75;
  word-break: break-all;
  margin-top: 0.3rem;
}

/* Acentos por link */
.link-card[data-accent="gold"]   { --accent: #C9A96E; }
.link-card[data-accent="ocean"]  { --accent: #5B8FB9; }
.link-card[data-accent="coral"]  { --accent: #E07A5F; }
.link-card[data-accent="sage"]   { --accent: #7FB685; }
.link-card[data-accent="violet"] { --accent: #9B8EC4; }
.link-card[data-accent="rose"]   { --accent: #C97B84; }
.link-card[data-accent="amber"]  { --accent: #D4A03C; }
.link-card[data-accent="teal"]   { --accent: #4ECDC4; }

/* === Footer === */
.hub-footer {
  text-align: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.hub-footer p {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 1.6;
}

.hub-footer code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.3rem;
}

/* === Responsive === */
@media (max-width: 680px) {
  .hub {
    padding: 2.5rem 1.1rem 4rem;
  }
  .hub-header {
    margin-bottom: 1.75rem;
  }
  .links {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .categorias { grid-template-columns: 1fr; gap: 0.6rem; }
  .category-header { min-height: 64px; padding: 0.7rem 0.75rem; gap: 0.55rem; }
  .category-icon { width: 32px; height: 32px; }
  .category-title { font-size: 1rem; }
  .category-caret { display: none; }
  .barra { margin-bottom: 1.5rem; }
  .toggle-all { padding: 0 0.8rem; }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hub-logo { animation: none; }
  .starfield::before, .starfield::after { animation: none; }
  .link-card { transition-duration: 0.1s; }
}
