/* hub-common.css — Shared styles for all 4thmovelogic.com hub pages */
/* Game-specific overrides (--accent, body backgrounds, etc.) remain inline per page */

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.5;
}

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden; z-index: 9999;
  padding: 8px 16px; background: var(--accent); color: #000;
  font-weight: bold; text-decoration: none; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; width: auto; height: auto; }

/* Hub navigation icon (fixed bottom-left) */
.hub-icon {
  position: fixed; bottom: 14px; left: 14px; z-index: 999;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(10,10,10,0.85);
  color: rgba(255,255,255,0.45);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s, color 0.2s;
}
.hub-icon:hover { border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.8); }
.hub-icon:active { transform: scale(0.92); }
.hub-icon:focus-visible { outline: 2px solid var(--gold, #ffd54f); outline-offset: 2px; }

@media (pointer: coarse) {
  .hub-icon { width: 52px; height: 52px; bottom: 16px; left: 16px; }
}

/* Section titles with rule line */
.section-title {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 32px 0 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Module/card lock badge */
.lock-badge, .locktag {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(0,0,0,0.6);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.65rem;
  display: flex; align-items: center; gap: 5px;
  color: var(--muted);
}

/* Accessibility: Focus visible */
a:focus-visible, .btn:focus-visible, .module-link:focus-visible, .cta:focus-visible {
  outline: 2px solid var(--gold, #ffd54f);
  outline-offset: 2px;
}

/* ── Hub Layout ─────────────────────────────── */
/* Pages must define :root vars: --accent, --accent-soft, --accent-dark, --accent-glow, --accent-tint, --accent-alt */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 24px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.logo { display: flex; align-items: center; gap: 14px; }

.logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.logo-text h1 { margin: 0; font-size: 1.3rem; font-weight: 900; letter-spacing: 1px; }
.logo-text .subtitle { font-size: 0.7rem; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }
.nav-links { display: flex; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); text-decoration: none;
  font-weight: 700; font-size: 0.82rem; letter-spacing: 0.5px;
  transition: all 0.15s ease;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* ── Level Card (hero) ─────────────────────── */
.level-card {
  background: linear-gradient(135deg, var(--panel) 0%, var(--accent-tint) 100%);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 24px; margin-bottom: 24px;
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 24px; align-items: center;
}

.level-badge {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px var(--accent-glow);
}
.level-badge .lvl-num { font-family: var(--mono); font-size: 1.8rem; font-weight: 900; line-height: 1; }
.level-badge .lvl-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }

.level-info { display: flex; flex-direction: column; gap: 8px; }
.title-display { display: flex; align-items: center; gap: 10px; }
.title-emoji { font-size: 1.8rem; }
.title-name { font-size: 1.4rem; font-weight: 900; color: var(--gold); }

.xp-section { display: flex; flex-direction: column; gap: 6px; }
.xp-text { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.xp-text span { color: var(--text); }
.xp-bar-bg { height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; }
.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-alt));
  border-radius: 4px; transition: width 0.5s ease;
}
.next-unlock { font-size: 0.7rem; color: var(--muted); }
.next-unlock strong { color: var(--gold); }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; text-align: right; }
.stat-box { background: rgba(0, 0, 0, 0.3); padding: 10px 14px; border-radius: 10px; }
.stat-box .label { font-size: 0.6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-box .value { font-family: var(--mono); font-size: 1rem; font-weight: 900; }
.stat-box .value.chips { color: var(--green); }

.section-title .unlock-info { font-size: 0.65rem; color: var(--accent); font-weight: 600; }

/* ── Module Grid & Cards ───────────────────── */
.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.module-card {
  background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 20px; transition: all 0.2s ease;
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.module-card:hover:not(.locked) {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.module-card.locked { opacity: 0.5; }
.module-card.locked .module-link { pointer-events: none; }
.lock-badge .lock-icon { font-size: 0.8rem; }

.module-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.module-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}
.module-info { flex: 1; }
.module-info h3 { margin: 0 0 4px 0; font-size: 1rem; font-weight: 800; }
.module-info .difficulty { font-family: var(--mono); font-size: 0.65rem; color: var(--accent); letter-spacing: 1px; text-transform: uppercase; }

.module-desc { font-size: 0.85rem; color: var(--muted); margin-bottom: 16px; flex: 1; }
.module-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }
.module-status { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.module-status.complete { color: var(--green); }

.module-link {
  padding: 8px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-glow); border-radius: 999px;
  color: var(--text); text-decoration: none;
  font-weight: 700; font-size: 0.75rem; letter-spacing: 0.5px;
  transition: all 0.15s ease;
}
.module-link:hover {
  background: var(--accent-soft); filter: brightness(1.4);
  transform: translateY(-1px);
}

.coming-soon { opacity: 0.4; cursor: not-allowed; }

/* ── Responsive: Hub ───────────────────────── */
@media (max-width: 768px) {
  .level-card { grid-template-columns: 1fr; text-align: center; }
  .level-badge { margin: 0 auto; }
  .stats-grid { text-align: center; }
  .title-display { justify-content: center; }
}

@media (max-width: 600px) {
  .modules-grid { grid-template-columns: 1fr; }
  header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
