/*
  DIVERSION - Left Gaming Portal Stylesheet
  Copyright (C) 2026 Left Gaming / Douglas Knoll
  SPDX-License-Identifier: GPL-3.0-or-later
*/

:root {
  --bg-darkest: #05070b;
  --bg-darker: #090c13;
  --bg-dark: #0f1420;
  --bg-card: rgba(15, 20, 32, 0.75);
  --bg-card-hover: rgba(22, 30, 48, 0.85);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 240, 255, 0.25);

  --color-cyan: #00f0ff;
  --color-cyan-glow: rgba(0, 240, 255, 0.4);
  --color-magenta: #f43f5e;
  --color-magenta-glow: rgba(244, 63, 94, 0.4);
  --color-green: #10b981;
  --color-green-glow: rgba(16, 185, 129, 0.4);
  --color-amber: #f59e0b;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base & Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  background-color: var(--bg-darkest);
  font-family: var(--font-sans);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Background Ambient Canvas */
.bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

/* Global Portal Wrap */
.portal-wrap {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Typography Helpers */
.text-gradient {
  background: linear-gradient(135deg, #00f0ff 0%, #a855f7 50%, #f43f5e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Header & Navigation */
.portal-header {
  position: sticky;
  top: 16px;
  z-index: 50;
  margin-top: 16px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(9, 12, 19, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.brand-symbol {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: var(--radius-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.brand-symbol svg {
  width: 24px;
  height: 24px;
}

.brand-group:hover .brand-symbol {
  transform: scale(1.06) rotate(6deg);
  border-color: var(--color-cyan);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-main);
}

.brand-sub {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  color: var(--color-cyan);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.github-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 240, 255, 0.07);
  border: 1px solid rgba(0, 240, 255, 0.22);
  color: var(--color-cyan);
}

.github-link:hover {
  background: rgba(0, 240, 255, 0.16);
  border-color: var(--color-cyan);
  color: #fff;
}

/* Hero Section */
.hero-section {
  padding: clamp(48px, 9vw, 96px) 0 clamp(32px, 6vw, 64px);
  display: flex;
  justify-content: center;
  text-align: center;
}

.hero-content {
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  background: rgba(0, 240, 255, 0.07);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-full);
  margin-bottom: 24px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-cyan);
  box-shadow: 0 0 10px var(--color-cyan);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.badge-text {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--color-cyan);
}

.hero-headline {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 22px;
}

.hero-lead {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 680px;
  line-height: 1.65;
  margin-bottom: 36px;
}

.hero-metrics {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 28px;
  background: rgba(15, 20, 32, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 28px;
  margin-bottom: 38px;
  backdrop-filter: blur(12px);
}

.metric-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metric-num {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-cyan);
}

.metric-label {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-divider {
  width: 1px;
  height: 32px;
  background: var(--border-subtle);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  font-size: 0.98rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  min-height: 50px;
}

.btn-primary {
  background: var(--color-cyan);
  color: #04060a;
  border: 1px solid var(--color-cyan);
  box-shadow: 0 4px 20px -2px var(--color-cyan-glow);
}

.btn-primary:hover {
  background: #38f5ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px 0 var(--color-cyan-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Section Header */
.section-header {
  text-align: center;
  margin-bottom: clamp(36px, 6vw, 64px);
}

.section-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--color-cyan);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: clamp(20px, 3vw, 36px);
  margin-bottom: clamp(60px, 10vw, 120px);
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.game-card:hover {
  transform: translateY(-6px);
  background: var(--bg-card-hover);
}

.card-untangle:hover {
  border-color: var(--color-cyan);
  box-shadow: 0 16px 36px -10px var(--color-cyan-glow);
}

.card-flux:hover {
  border-color: var(--color-magenta);
  box-shadow: 0 16px 36px -10px var(--color-magenta-glow);
}

.card-sentinel:hover {
  border-color: var(--color-green);
  box-shadow: 0 16px 36px -10px var(--color-green-glow);
}

.card-visual {
  position: relative;
  width: 100%;
  height: 230px;
  background: #080a11;
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}

.preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.visual-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 4px 10px;
  background: rgba(9, 12, 19, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.visual-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 14, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.game-card:hover .visual-overlay {
  opacity: 1;
}

.play-overlay-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transform: scale(0.92);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.game-card:hover .play-overlay-btn {
  transform: scale(1);
}

.play-overlay-btn:hover {
  background: var(--color-cyan);
}

.card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.game-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.tag-cyan {
  background: rgba(0, 240, 255, 0.1);
  color: var(--color-cyan);
  border: 1px solid rgba(0, 240, 255, 0.25);
}

.tag-magenta {
  background: rgba(244, 63, 94, 0.1);
  color: var(--color-magenta);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.tag-green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.game-meta-info {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #fff;
}

.card-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.card-specs {
  list-style: none;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.card-specs li span {
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}

.btn-card-primary {
  flex: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 46px;
}

.card-untangle .btn-card-primary:hover {
  background: var(--color-cyan);
  color: #000;
  border-color: var(--color-cyan);
}

.card-flux .btn-card-primary:hover {
  background: var(--color-magenta);
  color: #fff;
  border-color: var(--color-magenta);
}

.card-sentinel .btn-card-primary:hover {
  background: var(--color-green);
  color: #000;
  border-color: var(--color-green);
}

.btn-card-secondary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  min-height: 46px;
}

.btn-card-secondary:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Mathematics Section */
.math-section {
  padding: clamp(40px, 8vw, 90px) 0;
  border-top: 1px solid var(--border-subtle);
}

.math-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.math-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

.math-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.math-num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-cyan);
  line-height: 1;
}

.math-title-wrap h4 {
  font-size: 1.12rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.math-spec-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.math-formula {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: #38bdf8;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border-left: 3px solid var(--color-cyan);
  overflow-x: auto;
}

.math-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* Manifesto Section */
.manifesto-section {
  padding: clamp(30px, 6vw, 70px) 0 clamp(60px, 8vw, 100px);
}

.manifesto-card {
  background: linear-gradient(135deg, rgba(16, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.4) 100%);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 6vw, 56px);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.8);
}

.manifesto-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--color-cyan);
  margin-bottom: 16px;
}

.manifesto-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 24px;
}

.manifesto-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 1.02rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 820px;
  margin-bottom: 32px;
}

.manifesto-body strong {
  color: var(--text-main);
}

.manifesto-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.copyleft-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
}

.copyleft-symbol {
  font-size: 1.2rem;
  line-height: 1;
}

/* Footer */
.portal-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 32px 0 48px;
  margin-top: 20px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-logo {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-main);
}

.footer-copy {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.footer-copy code {
  font-family: var(--font-mono);
  color: var(--color-cyan);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-cyan);
}

.dot {
  color: var(--border-subtle);
}

/* Interactive Modal Player */
.game-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  background: rgba(4, 6, 10, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: none;
  margin: 0;
  padding: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.game-modal[open] {
  display: flex;
}

.modal-shell {
  width: 95vw;
  height: 92vh;
  max-width: 1400px;
  background: var(--bg-darkest);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.95), 0 0 30px rgba(0, 240, 255, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(15, 20, 32, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-game-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-game-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-cyan);
  box-shadow: 0 0 8px var(--color-cyan);
}

.modal-game-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

.modal-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-select {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
}

.modal-select:focus {
  border-color: var(--color-cyan);
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.modal-close {
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.3);
  padding: 6px 10px;
}

.modal-close:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: #f43f5e;
  color: #fff;
}

.modal-frame-container {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  background: #06080d;
}

.game-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Screen reader utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 900px) {
  .hero-headline {
    font-size: 2.5rem;
  }
  .modal-shell {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
  .btn-text-desktop {
    display: none;
  }
}

@media (max-width: 640px) {
  .portal-header {
    top: 8px;
    margin-top: 8px;
  }
  .header-inner {
    padding: 8px 16px;
  }
  .brand-sub {
    display: none;
  }
  .nav-item:not(.github-link) {
    display: none;
  }
  .hero-section {
    padding: 36px 0 24px;
  }
  .hero-headline {
    font-size: 2.1rem;
  }
  .hero-metrics {
    gap: 12px 18px;
    padding: 12px 18px;
  }
  .metric-divider {
    display: none;
  }
  .games-grid {
    grid-template-columns: 1fr;
  }
  .card-actions {
    flex-direction: column;
  }
  .btn-card-primary, .btn-card-secondary {
    width: 100%;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}
