/* jamestrigg.co.uk – Modern theme with depth, gradients & animations */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --color-bg-deep: #0f0e12;
  --color-bg-mid: #1a1820;
  --color-bg-elevated: #25222d;
  --color-bg-card: rgba(37, 34, 45, 0.85);
  --color-accent: #e85d2c;
  --color-accent-light: #ff7a4a;
  --color-accent-glow: rgba(232, 93, 44, 0.4);
  --color-text: #f4f2f8;
  --color-text-muted: #a8a3b3;
  --color-border: rgba(255, 255, 255, 0.08);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 60px var(--color-accent-glow);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

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

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg-deep);
  color: var(--color-text);
  line-height: 1.65;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated gradient background */
.bg-animated {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

/* Conway's Game of Life canvas (injected by game-of-life-bg.js) */
.bg-animated .gol-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
}

.bg-animated::before {
  content: '';
  position: absolute;
  width: 140%;
  height: 140%;
  top: -20%;
  left: -20%;
  background: 
    radial-gradient(ellipse 50% 40% at 40% 30%, rgba(232, 93, 44, 0.22), transparent 50%),
    radial-gradient(ellipse 45% 35% at 85% 55%, rgba(120, 80, 200, 0.14), transparent 50%),
    radial-gradient(ellipse 45% 35% at 15% 75%, rgba(44, 150, 232, 0.12), transparent 50%),
    linear-gradient(180deg, var(--color-bg-deep) 0%, var(--color-bg-mid) 100%);
  animation: gradientDrift 35s ease-in-out infinite;
}

.bg-animated::after {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 30% 20%, rgba(232, 93, 44, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(120, 80, 200, 0.05) 0%, transparent 40%);
  animation: bgPulse 14s ease-in-out infinite alternate;
}

@keyframes gradientDrift {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(4%, -3%); }
  50% { transform: translate(-5%, 4%); }
  75% { transform: translate(-2%, -5%); }
}

@keyframes bgPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Floating orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--color-accent);
  top: -100px;
  right: -100px;
  animation: orbFloat1 20s ease-in-out infinite;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: #7c5cff;
  bottom: -50px;
  left: -50px;
  animation: orbFloat2 25s ease-in-out infinite;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: #2c96e8;
  top: 50%;
  left: 50%;
  animation: orbFloat3 18s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-60px, 50px) scale(1.08); }
  66% { transform: translate(-30px, -40px) scale(1.12); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(70px, -50px) scale(1.1); }
  66% { transform: translate(30px, 60px) scale(1.06); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-50px, -70px) scale(1.15); }
  66% { transform: translate(40px, -30px) scale(1.08); }
}

/* Glassmorphism card */
.glass-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card), var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Content container */
.content-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

.content-wrap .introduction {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* Typography */
h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.6s ease-out;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-accent-light);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  animation: fadeInUp 0.6s ease-out;
}

h2:first-of-type {
  margin-top: 0;
}

p {
  margin: 0.75em 0;
  color: var(--color-text-muted);
}

p:first-of-type {
  margin-top: 0;
}

ul {
  margin: 0.75em 0;
  padding-left: 1.5em;
}

li {
  margin: 0.4em 0;
  color: var(--color-text-muted);
}

strong {
  color: var(--color-text);
}

a {
  color: var(--color-accent-light);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:hover {
  color: var(--color-accent);
  text-shadow: 0 0 20px var(--color-accent-glow);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 0.6s ease-out;
}

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 1.25rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 14, 18, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.nav-link {
  color: var(--color-text-muted);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--color-accent);
  background: rgba(232, 93, 44, 0.1);
}

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 2rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  -webkit-text-fill-color: transparent;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-accent) 50%, var(--color-text-muted) 100%);
  background-size: 200% auto;
  animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.hero p {
  font-size: 1.15rem;
  max-width: 480px;
  margin: 1rem auto 0;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Faction tooltips (Tarsus Empire V) */
.faction-tooltip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--color-text-muted);
}

.faction-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(-0.5rem);
  padding: 0.75rem 1rem;
  min-width: 220px;
  max-width: 380px;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  white-space: normal;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 50;
  pointer-events: none;
}

.faction-tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Utility */
.effective {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
  margin: 2rem 0;
}

/* Introduction / Home */
.introduction {
  max-width: 880px;
  margin: 0 auto;
}

.introduction h1 {
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.intro-content {
  margin-bottom: 0;
}

.intro-block {
  margin-bottom: 2rem;
}

.app-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

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

.app-card-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
}

.app-card-icon-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
}

.app-card h2 {
  margin-top: 0;
  border: none;
  padding: 0;
}

.app-card p {
  flex: 1;
  margin-bottom: 0;
}

.app-links {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background: var(--color-accent-light);
  color: #fff;
  box-shadow: 0 0 20px var(--color-accent-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Nav dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  min-width: 180px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}

.nav-dropdown-item:hover {
  background: rgba(232, 93, 44, 0.1);
  color: var(--color-accent);
}

/* App page */
.app-page {
  max-width: 720px;
  margin: 0 auto;
}

.app-page-hero {
  display: block;
  max-width: 100%;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md);
}

.app-screenshots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.app-screenshots img {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

/* 16:9 responsive video: padding-bottom hack works reliably in Safari and all browsers */
.video-embed {
  position: relative;
  width: 100%;
  max-width: 720px;
  height: 0;
  padding-bottom: 56.25%; /* 9/16 */
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-production {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

.app-page .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  color: var(--color-text-muted);
}

.app-page .back-link:hover {
  color: var(--color-accent);
}

.app-page .tagline {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.app-page .availability {
  color: var(--color-text-muted);
  font-style: italic;
  margin: 1rem 0;
}
