/**
 * port.xyz — Material Design 3 (M3) Stylesheet
 * Primary Font: Google Sans
 * Secondary Font: Roboto
 * Dynamic Theme: Dark Zinc with Deep Sky / Indigo Tonal Palettes
 */

:root {
  --md-font-primary: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --md-font-secondary: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Material Design 3 Dark Theme Palette */
  --md-sys-color-primary: #8ab4f8;
  --md-sys-color-on-primary: #002d64;
  --md-sys-color-primary-container: #1e3a5f;
  --md-sys-color-on-primary-container: #d2e3fc;

  --md-sys-color-secondary: #c2c7cf;
  --md-sys-color-on-secondary: #2c3138;
  --md-sys-color-secondary-container: #42474f;
  --md-sys-color-on-secondary-container: #dee3ec;

  --md-sys-color-tertiary: #a8c7fa;
  --md-sys-color-background: #090d16;
  --md-sys-color-on-background: #e2e8f0;

  --md-sys-color-surface: rgba(18, 24, 38, 0.75);
  --md-sys-color-surface-hover: rgba(26, 35, 54, 0.85);
  --md-sys-color-surface-container: rgba(22, 30, 48, 0.65);
  --md-sys-color-on-surface: #f1f5f9;
  --md-sys-color-on-surface-variant: #94a3b8;

  --md-sys-color-outline: rgba(148, 163, 184, 0.2);
  --md-sys-color-outline-variant: rgba(148, 163, 184, 0.12);

  /* Elevation Shadows */
  --md-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.25), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --md-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --md-elevation-3: 0 4px 14px 3px rgba(0, 0, 0, 0.35), 0 2px 4px 0 rgba(0, 0, 0, 0.4);
  --md-elevation-4: 0 8px 24px 4px rgba(0, 0, 0, 0.45), 0 4px 8px 0 rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  font-family: var(--md-font-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Background Vanta Canvas */
#vanta-waves-canvas,
#vanta-clouds-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

#site-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Material Top App Bar */
.md-top-app-bar {
  position: sticky;
  top: 0;
  width: 100%;
  height: 72px;
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
  transition: box-shadow 0.25s ease;
}

.md-top-app-bar.scrolled {
  box-shadow: var(--md-elevation-2);
  background: rgba(9, 13, 22, 0.92);
}

.md-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface);
}

.md-brand-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: transform 0.2s ease;
}

.md-brand:hover .md-brand-logo-img {
  transform: scale(1.05);
}

.md-brand-text {
  font-family: var(--md-font-primary);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #f8fafc;
}

.md-brand-text .tld {
  color: #60a5fa;
  font-weight: 500;
}

/* Search Bar (M3 Search View / Pill) */
.md-search-pill {
  flex: 1;
  max-width: 520px;
  height: 48px;
  margin: 0 24px;
  border-radius: 28px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--md-sys-color-outline);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.md-search-pill:focus-within {
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.25);
}

.md-search-icon {
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
}

.md-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-font-secondary);
  font-size: 15px;
}

.md-search-input::placeholder {
  color: rgba(148, 163, 184, 0.6);
}

.md-kbd {
  font-family: var(--md-font-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  color: var(--md-sys-color-on-surface-variant);
}

/* Top Bar Actions */
.md-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Material Buttons */
.md-btn {
  font-family: var(--md-font-primary);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  height: 40px;
  padding: 0 20px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.md-btn-filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-elevation-1);
}

.md-btn-filled:hover {
  background: #a8c7fa;
  box-shadow: var(--md-elevation-2);
  transform: translateY(-1px);
}

.md-btn-outlined {
  background: rgba(30, 41, 59, 0.4);
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.md-btn-outlined:hover {
  background: rgba(138, 180, 248, 0.1);
  border-color: var(--md-sys-color-primary);
}

/* Main Container */
.md-container {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 80px;
  flex: 1;
}

/* Hero Section */
.md-hero {
  text-align: center;
  margin-bottom: 40px;
}

.md-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(138, 180, 248, 0.25);
  font-family: var(--md-font-primary);
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-primary);
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.md-hero-title {
  font-family: var(--md-font-primary);
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.15;
  margin-bottom: 16px;
  color: #fafafa;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.md-hero-subtitle {
  font-family: var(--md-font-secondary);
  font-size: 18px;
  color: var(--md-sys-color-on-surface-variant);
  max-width: 680px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

/* Filter Chips Bar */
.md-filter-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 36px;
}

.md-chip {
  font-family: var(--md-font-primary);
  font-size: 14px;
  font-weight: 500;
  height: 38px;
  padding: 0 18px;
  border-radius: 19px;
  background: rgba(22, 30, 48, 0.7);
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(12px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.md-chip:hover {
  background: rgba(30, 41, 59, 0.85);
  color: var(--md-sys-color-on-surface);
  border-color: rgba(138, 180, 248, 0.4);
}

.md-chip.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 16px rgba(138, 180, 248, 0.25);
}

/* Ports Count & Meta Header */
.md-section-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0 4px;
}

.md-section-title {
  font-family: var(--md-font-primary);
  font-size: 22px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.md-section-count {
  font-family: var(--md-font-secondary);
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
}

/* Game Cards Grid */
.md-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

/* Material Design Card */
.md-card {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--md-elevation-1);
  cursor: pointer;
  position: relative;
}

.md-card:hover {
  background: var(--md-sys-color-surface-hover);
  border-color: rgba(138, 180, 248, 0.45);
  transform: translateY(-4px);
  box-shadow: var(--md-elevation-3);
}

.md-card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f1522;
  overflow: hidden;
}

.md-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.md-card:hover .md-card-thumb {
  transform: scale(1.04);
}

.md-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  font-family: var(--md-font-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: lowercase;
  background: rgba(14, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fafafa;
  backdrop-filter: blur(8px);
}

.md-card-badge.featured {
  background: rgba(30, 58, 138, 0.9);
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.4);
}

.md-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.md-card-category {
  font-family: var(--md-font-primary);
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-primary);
  margin-bottom: 6px;
  text-transform: lowercase;
  letter-spacing: 0.2px;
}

.md-card-title {
  font-family: var(--md-font-primary);
  font-size: 18px;
  font-weight: 700;
  color: #fafafa;
  line-height: 1.3;
  margin-bottom: 8px;
}

.md-card-desc {
  font-family: var(--md-font-secondary);
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

.md-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.md-card-porter {
  font-family: var(--md-font-secondary);
  font-size: 12px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.md-card-porter-icon {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

/* Modal / Dialog (Material M3 Dialog) */
.md-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease-out;
}

.md-dialog {
  background: #111827;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 28px;
  width: 100%;
  max-width: 540px;
  padding: 32px;
  box-shadow: var(--md-elevation-4);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.md-dialog-title {
  font-family: var(--md-font-primary);
  font-size: 24px;
  font-weight: 700;
  color: #fafafa;
}

.md-dialog-desc {
  font-family: var(--md-font-secondary);
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.6;
}

/* Theater Player Modal */
.md-player-modal {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: none;
  flex-direction: column;
}

.md-player-bar {
  height: 56px;
  background: #090d16;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  color: #fafafa;
}

.md-player-title {
  font-family: var(--md-font-primary);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.md-player-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.md-player-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 768px) {
  .md-top-app-bar { padding: 0 16px; }
  .md-search-pill { display: none; }
  .md-hero-title { font-size: 36px; }
  .md-container { padding: 24px 16px 60px; }
  .md-grid { grid-template-columns: 1fr; }
}
