/* ============================================================
   Joe's Games — joesgames.dev
   ============================================================ */

:root {
  /* surfaces */
  --bg:          #05080f;
  --bg-2:        #0a1020;
  --panel:       rgba(16, 24, 40, 0.66);
  --panel-solid: #0d1626;
  --line:        rgba(125, 211, 252, 0.14);
  --line-strong: rgba(125, 211, 252, 0.30);

  /* text */
  --text:        #e8f0fb;
  --text-dim:    #9fb3cd;
  --text-faint:  #6b809b;

  /* brand */
  --cyan:        #22d3ee;
  --teal:        #5eead4;
  --rose:        #f43f5e;
  --accent:      var(--cyan);
  --accent-soft: rgba(34, 211, 238, 0.16);

  /* geometry */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shell: 1180px;

  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- animated backdrop ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 620px at 12% -8%,  rgba(34, 211, 238, 0.20), transparent 62%),
    radial-gradient(760px 540px at 92% 4%,   rgba(94, 234, 212, 0.13), transparent 60%),
    radial-gradient(820px 700px at 60% 108%, rgba(244, 63, 94, 0.10),  transparent 62%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 58%);
}

.backdrop::before {
  content: '';
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(to right, rgba(125, 211, 252, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(125, 211, 252, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(120% 85% at 50% 0%, #000 32%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 85% at 50% 0%, #000 32%, transparent 78%);
  animation: drift 48s linear infinite;
}

@keyframes drift {
  to { transform: translate3d(-46px, -46px, 0); }
}

/* ---------- shared ---------- */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 20px;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
}

:where(button, a, [tabindex]):focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: linear-gradient(180deg, rgba(5, 8, 15, 0.86), rgba(5, 8, 15, 0.58));
  border-bottom: 1px solid var(--line);
}

.site-header .shell {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #12324a, #0a1626);
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.28);
}
.brand-mark svg { width: 17px; height: 17px; display: block; }

.brand em {
  font-style: normal;
  color: var(--cyan);
}

.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  transition: color .16s ease, background .16s ease;
}
.header-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

/* ---------- hero ---------- */

.hero {
  padding: 26px 0 18px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 8px 0 0;
}

.hero h1 .glow {
  background: linear-gradient(100deg, var(--cyan), var(--teal) 55%, #a5f3fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(34, 211, 238, 0.35));
}

.hero p {
  max-width: 58ch;
  margin: 10px auto 0;
  color: var(--text-dim);
  font-size: clamp(0.93rem, 1.3vw, 1rem);
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  white-space: nowrap;
}

/* ---------- arcade ---------- */

.arcade { padding: 8px 0 72px; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.tabs::-webkit-scrollbar { height: 6px; }
.tabs::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

.tab {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 15px 8px 11px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.tab:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
.tab:active { transform: translateY(1px); }

.tab img {
  width: 31px;
  height: 31px;
  flex: none;
  border-radius: 9px;
  background: #0b1220;
  border: 1px solid var(--line);
  object-fit: cover;
}

.tab-text { min-width: 0; }

.tab-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-genre {
  display: block;
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab[aria-selected='true'] {
  background: linear-gradient(160deg, var(--accent-soft), rgba(255, 255, 255, 0.02));
  border-color: color-mix(in srgb, var(--tab-accent, var(--cyan)) 42%, transparent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2) inset,
              0 6px 24px -12px var(--tab-accent, var(--cyan));
}
.tab[aria-selected='true'] .tab-genre { color: var(--tab-accent, var(--cyan)); }

.tab .live-dot {
  margin-left: 4px;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 99px;
  background: var(--tab-accent, var(--cyan));
  box-shadow: 0 0 10px var(--tab-accent, var(--cyan));
  opacity: 0;
  transition: opacity .2s ease;
}
.tab.is-running .live-dot { opacity: 1; animation: pulse 1.8s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- stage ---------- */

.stage-frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel-solid);
  box-shadow: 0 40px 80px -48px rgba(0, 0, 0, 0.95),
              0 0 60px -30px color-mix(in srgb, var(--accent) 55%, transparent);
  overflow: hidden;
  transition: box-shadow .3s ease;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: var(--stage-max, calc(100vh - 480px));
  min-height: 300px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(34, 211, 238, 0.10), transparent 60%),
    #060b14;
}

/* the game sits centred at its own aspect ratio; the stage is the bezel */
.stage iframe {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: var(--game-aspect, 16 / 9);
  border: 0;
  display: block;
  background: #000;
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.12),
              0 0 70px -18px color-mix(in srgb, var(--accent) 70%, transparent);
}

/* faint circuitry in the bezel so the side bars read as cabinet, not dead space */
.stage.is-playing::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(125, 211, 252, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(125, 211, 252, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(90% 80% at 50% 50%, transparent 38%, #000 78%);
  -webkit-mask-image: radial-gradient(90% 80% at 50% 50%, transparent 38%, #000 78%);
  pointer-events: none;
}

/* idle / cover screen */

.cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 24px;
  text-align: center;
  overflow-y: auto;
}

.cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(125, 211, 252, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(125, 211, 252, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(75% 75% at 50% 50%, #000, transparent 76%);
  -webkit-mask-image: radial-gradient(75% 75% at 50% 50%, #000, transparent 76%);
  pointer-events: none;
}

.cover > * { position: relative; }

.cover-art {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 60px -12px var(--accent), 0 20px 40px -24px #000;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  50% { transform: translateY(-7px); }
}

.cover h2 {
  font-size: clamp(1.55rem, 3.4vw, 2.15rem);
  margin-top: 14px;
}

.cover .cover-tagline {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.cover .cover-blurb {
  max-width: 50ch;
  margin: 10px 0 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.cover-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 16px;
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.cover code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--teal);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

/* buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn[hidden] { display: none; }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn-play {
  padding: 13px 30px;
  font-size: 15.5px;
  color: #04131a;
  border-color: transparent;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent));
  box-shadow: 0 10px 34px -12px var(--accent);
}
.btn-play:hover {
  background: linear-gradient(140deg, #fff, var(--accent));
  box-shadow: 0 14px 42px -12px var(--accent);
}

.btn-ghost {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
}
.btn-ghost:hover { color: var(--text); }

/* boot overlay */

.boot {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: #060b14;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  transition: opacity .45s ease;
}
.boot[hidden] { display: none; }
.boot.is-gone { opacity: 0; pointer-events: none; }

.boot-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* stage toolbar */

.stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  background: rgba(6, 11, 20, 0.8);
}

.stage-status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-right: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 99px;
  background: var(--text-faint);
  transition: background .2s ease, box-shadow .2s ease;
}
.stage-bar.is-live .status-dot {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.stage-bar.is-live .stage-status { color: var(--accent); }

/* anchored sections must clear the sticky header */
#arcade, #games { scroll-margin-top: 78px; }

/* ---------- about ---------- */

.section { padding: 10px 0 78px; }

.section-head { margin-bottom: 22px; }
.section-head h2 {
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  margin-top: 8px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
  gap: 14px;
}

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 26px 50px -34px #000;
}

.game-card { display: flex; flex-direction: column; }

.game-card-art {
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 0 34px -10px var(--accent);
}

.game-card-genre {
  margin: 2px 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.btn-card {
  align-self: flex-start;
  margin-top: 18px;
  padding: 9px 17px;
  font-size: 13.5px;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}
.btn-card:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
}

.game-card > p:last-of-type { flex: 1 1 auto; }

.card h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.card-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  color: var(--cyan);
}
.card-icon svg { width: 18px; height: 18px; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(5, 8, 15, 0.6);
}
.site-footer .shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-block: 26px;
  font-size: 13px;
  color: var(--text-faint);
}
.site-footer .footer-links {
  margin-left: auto;
  display: flex;
  gap: 18px;
}
.site-footer a { color: var(--text-dim); }

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .hero { padding: 22px 0 18px; }
  .header-nav a { padding: 7px 9px; font-size: 13px; }
  .tab { flex: 0 0 auto; min-width: 0; }
  .tab-genre { display: none; }
  .stage { aspect-ratio: auto; height: min(58vh, 420px); min-height: 0; max-height: none; }
  /* portrait games deserve the taller pane on a phone */
  .stage.is-portrait { height: min(74vh, 560px); }
  .cover-art { width: 68px; height: 68px; border-radius: 16px; }
  .cover .cover-blurb { display: none; }
  .cover-meta { display: none; }
  .stage-bar { padding: 8px; gap: 6px; }
  .btn-ghost { padding: 8px 10px; }
  .btn-ghost .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stage-status { font-size: 10px; letter-spacing: 0.06em; }
  .site-footer .footer-links { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto; }
}

.brand-word { white-space: nowrap; }
