/* Hub — launcher do jogo + oficina de ferramentas. */

:root {
  --hub-bg: #050b12;
  --hub-text: #f1f5f9;
  --hub-text-dim: rgba(226, 232, 240, 0.72);
  --hub-accent: #5eead4;
  --hub-accent-deep: #2dd4bf;
  --hub-line: rgba(148, 163, 184, 0.22);
  --hub-shade-top: rgba(5, 11, 18, 0.18);
  --hub-shade-bottom: rgba(5, 11, 18, 0.88);
  --hub-font: "Figtree", "Segoe UI", system-ui, sans-serif;
  --hub-display: "Syne", "Figtree", system-ui, sans-serif;
  --splash-crossfade-ms: 900ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body.hub {
  min-height: 100vh;
  color: var(--hub-text);
  font: 500 15px/1.5 var(--hub-font);
  background: var(--hub-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hub-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

/* —— Splash (full-bleed hero plane) —— */

.hub-splash {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #0a1520;
  contain: strict;
}

.hub-splash__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  opacity: 0;
  transform: scale(1.04);
  transition:
    opacity var(--splash-crossfade-ms) ease,
    transform 8s ease-out;
  will-change: opacity;
  pointer-events: none;
  user-select: none;
}

.hub-splash__img.is-visible {
  opacity: 1;
  transform: scale(1);
}

.hub-splash__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, var(--hub-shade-top) 0%, transparent 32%),
    linear-gradient(180deg, transparent 42%, var(--hub-shade-bottom) 100%),
    radial-gradient(ellipse 70% 55% at 50% 35%, transparent 0%, rgba(5, 11, 18, 0.35) 100%);
  pointer-events: none;
}

.hub-splash__grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* —— Top bar —— */

.hub-top {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: 20px 28px 0;
  animation: hub-fade-in 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hub-top__nav {
  display: flex;
  gap: 6px;
}

.hub-top__link {
  color: var(--hub-text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 12px;
  border-radius: 999px;
  transition: color 160ms ease, background 160ms ease;
}

.hub-top__link:hover {
  color: var(--hub-text);
  background: rgba(15, 23, 42, 0.35);
}

.hub-top__link:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.65);
  outline-offset: 2px;
}

/* —— Hero (first viewport) —— */

.hub-hero {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: min(78vh, 760px);
  max-width: 720px;
  padding: 48px 28px 40px;
  animation: hub-rise 820ms cubic-bezier(0.22, 1, 0.36, 1) 80ms both;
}

.hub-brand {
  margin: 0 0 14px;
  font-family: var(--hub-display);
  font-size: clamp(2rem, 5.5vw, 3.35rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.95;
  color: #fff;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.45);
}

.hub-headline {
  margin: 0 0 12px;
  max-width: 18ch;
  font-family: var(--hub-display);
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: rgba(248, 250, 252, 0.94);
}

.hub-lead {
  margin: 0 0 28px;
  max-width: 36ch;
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--hub-text-dim);
}

.hub-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.hub-play {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 22px 14px 24px;
  border-radius: 999px;
  text-decoration: none;
  color: #042f2e;
  background: linear-gradient(180deg, #99f6e4 0%, var(--hub-accent) 55%, var(--hub-accent-deep) 100%);
  box-shadow:
    0 0 0 1px rgba(94, 234, 212, 0.35),
    0 12px 32px rgba(45, 212, 191, 0.28);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.hub-play:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow:
    0 0 0 1px rgba(94, 234, 212, 0.5),
    0 16px 36px rgba(45, 212, 191, 0.34);
}

.hub-play:active {
  transform: translateY(0);
}

.hub-play:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.hub-play__label {
  font-family: var(--hub-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hub-play__hint {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
  animation: hub-hint-blink 1.2s steps(1, end) infinite;
}

.hub-ghost {
  color: var(--hub-text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  padding: 10px 8px;
  border-bottom: 1px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}

.hub-ghost:hover {
  color: var(--hub-text);
  border-bottom-color: rgba(94, 234, 212, 0.55);
}

.hub-ghost:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.65);
  outline-offset: 2px;
}

/* —— Workshop (below first viewport) —— */

.hub-workshop {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 28px 28px 36px;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 11, 18, 0.72) 28%, rgba(5, 11, 18, 0.92) 100%);
  content-visibility: auto;
  contain-intrinsic-size: 280px;
  animation: hub-fade-in 900ms cubic-bezier(0.22, 1, 0.36, 1) 220ms both;
}

.hub-workshop__intro {
  margin-bottom: 16px;
}

.hub-workshop__title {
  margin: 0 0 4px;
  font-family: var(--hub-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hub-accent);
}

.hub-workshop__lead {
  margin: 0;
  font-size: 13px;
  color: var(--hub-text-dim);
}

.hub-workshop__list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--hub-line);
}

.hub-tool {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 16px 18px 0;
  margin-right: 20px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid transparent;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.hub-tool:not(:last-child) {
  border-right: 1px solid var(--hub-line);
  padding-right: 20px;
  margin-right: 0;
}

.hub-tool:hover {
  transform: translateY(-2px);
}

.hub-tool:hover .hub-tool__name {
  color: var(--hub-accent);
}

.hub-tool:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.65);
  outline-offset: 4px;
}

.hub-tool__name {
  font-family: var(--hub-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  transition: color 160ms ease;
}

.hub-tool__desc {
  font-size: 12px;
  line-height: 1.35;
  color: var(--hub-text-dim);
}

@keyframes hub-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hub-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes hub-hint-blink {
  0%,
  49% {
    opacity: 0.55;
  }
  50%,
  100% {
    opacity: 0.15;
  }
}

@media (max-width: 900px) {
  .hub-workshop__list {
    grid-template-columns: 1fr 1fr;
  }

  .hub-tool:nth-child(2) {
    border-right: none;
    padding-right: 0;
  }

  .hub-tool:nth-child(-n + 2) {
    border-bottom: 1px solid var(--hub-line);
  }
}

@media (max-width: 560px) {
  .hub-top,
  .hub-hero,
  .hub-workshop {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hub-hero {
    min-height: min(72vh, 640px);
    padding-top: 32px;
  }

  .hub-workshop__list {
    grid-template-columns: 1fr;
  }

  .hub-tool,
  .hub-tool:not(:last-child) {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
    border-bottom: 1px solid var(--hub-line);
  }

  .hub-tool:last-child {
    border-bottom: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-top,
  .hub-hero,
  .hub-workshop,
  .hub-splash__img,
  .hub-play,
  .hub-tool,
  .hub-play__hint {
    animation: none !important;
    transition: none !important;
  }

  .hub-splash__img {
    transform: none;
  }
}
