/* ═══════════════════════════════════════════════════
   Urhola Hub — Front Page Styles
   Matches AtlasPacker / TexturePacker visual language
   ═══════════════════════════════════════════════════ */

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

:root {
  --bg:        #1e1e2e;
  --bg-panel:  #262637;
  --bg-input:  #1a1a2a;
  --bg-hover:  #32324a;
  --border:    #3a3a55;
  --text:      #cdd6f4;
  --text-dim:  #6c7086;
  --accent:    #89b4fa;
  --accent2:   #a6e3a1;
  --red:       #f38ba8;
  --green:     #a6e3a1;
  --blue:      #89b4fa;
  --warn:      #fab387;
  --purple:    #cba6f7;
  --radius:    6px;
  --gap:       8px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

html, body {
  scroll-padding-top: 3rem;
}

body {
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100%;
}

/* ─── Skip Link ─── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  padding: 6px 16px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 10000;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

/* ─── Header ─── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header .logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  align-items: center;
}
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.nav-links a:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--border);
}

/* ─── Mobile menu toggle ─── */
.mobile-menu-toggle {
  display: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.mobile-menu-toggle:hover {
  background: var(--bg-hover);
}

/* ─── Mobile navigation ─── */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(30, 30, 46, 0.98);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-100%);
  transition: all 0.25s ease;
}
.mobile-nav.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.mobile-nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.mobile-nav a:hover {
  color: var(--accent);
  background: var(--bg-hover);
}
.mobile-nav-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.mobile-nav-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ─── Main content ─── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* ─── Hero section ─── */
.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 32px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.hero-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--radius);
  overflow: hidden;
}
.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 2s ease-in-out;
  filter: blur(3px) brightness(0.2);
}
.hero-slide.active {
  opacity: 1;
}
.hero-content {
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
}
.hero p {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ─── Section titles ─── */
.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-align: left;
  margin: 20px 0 10px 0;
}

/* ─── Library toolbar ─── */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.filter-chip {
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-chip:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.filter-chip.active {
  background: rgba(137, 180, 250, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}
.sort-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sort-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.sort-select {
  padding: 3px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-appearance: auto;
}
.sort-select:hover,
.sort-select:focus {
  border-color: var(--accent);
  outline: none;
}
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 13px;
}

/* ─── Games grid ─── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* ─── Game cards ─── */
.game-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: default;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.game-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(137, 180, 250, 0.08);
}

/* ─── Shot image (canvas) ─── */
.game-image {
  width: 100%;
  background: var(--bg-input);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-image canvas {
  display: block;
  width: 300px;
  height: 150px;
  image-rendering: auto;
  border-radius: calc(var(--radius) - 1px);
}
.game-placeholder {
  color: var(--text-dim);
  font-size: 24px;
  opacity: 0.3;
  padding: 40px;
}

/* ─── Card text ─── */
.game-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.game-types {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-self: flex-start;
}
.game-type {
  display: inline-block;
  background: rgba(137, 180, 250, 0.12);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid rgba(137, 180, 250, 0.2);
}
/* Type-specific badge colors */
.game-type--game {
  background: rgba(166, 227, 161, 0.12);
  color: #a6e3a1;
  border-color: rgba(166, 227, 161, 0.25);
}
.game-type--tool {
  background: rgba(250, 179, 135, 0.12);
  color: #fab387;
  border-color: rgba(250, 179, 135, 0.25);
}
.game-type--browser {
  background: rgba(137, 180, 250, 0.12);
  color: #89b4fa;
  border-color: rgba(137, 180, 250, 0.25);
}
.game-type--download {
  background: rgba(203, 166, 247, 0.12);
  color: #cba6f7;
  border-color: rgba(203, 166, 247, 0.25);
}
.game-type--wallpaper {
  background: rgba(245, 194, 231, 0.12);
  color: #f5c2e7;
  border-color: rgba(245, 194, 231, 0.25);
}
.game-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.game-date {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.date-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 3px;
}
.game-description {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ─── Controls accordion ─── */
.game-controls {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.game-controls summary {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  color: var(--text-dim);
  transition: background 0.15s;
  list-style: none;
}
.game-controls summary::-webkit-details-marker { display: none; }
.game-controls summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 6px;
  font-size: 8px;
  transition: transform 0.15s;
  color: var(--text-dim);
}
.game-controls[open] summary::before {
  transform: rotate(90deg);
}
.game-controls summary:hover {
  background: var(--bg-hover);
}
.controls-body {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
}
.controls-list {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ─── Action buttons ─── */
.game-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  flex-wrap: wrap;
}
.btn {
  padding: 5px 14px;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover {
  filter: brightness(1.1);
}
.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  filter: brightness(1.1);
}

/* ─── About & Contact ─── */
.about-container,
.contact-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.about-card,
.contact-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-width: 700px;
  width: 100%;
}
.about-card p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 10px;
}
.about-card p:last-child { margin-bottom: 0; }

.contact-header {
  text-align: center;
  margin-bottom: 12px;
}
.contact-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}
.contact-header p {
  color: var(--text-dim);
  font-size: 12px;
}
.contact-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.contact-item:hover {
  border-color: var(--accent);
}
.contact-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.contact-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}
.contact-link:hover {
  color: var(--accent2);
}
.contact-text {
  color: var(--text-dim);
  font-size: 13px;
}

/* ─── Footer ─── */
footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 12px 0;
  margin-top: 20px;
}
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  text-align: center;
}
.footer-content p {
  color: var(--text-dim);
  font-size: 11px;
  margin-bottom: 4px;
}
.footer-content p:first-child {
  font-weight: 600;
  color: var(--text);
}
.footer-disclaimer {
  margin: 6px auto 0 auto;
  max-width: 700px;
  font-size: 10px;
  color: var(--warn);
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: center;
  line-height: 1.5;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  margin: 4px 0;
}
.footer-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: color 0.15s;
}
.footer-link:hover {
  color: var(--accent2);
  text-decoration: underline;
}
.footer-sep {
  color: var(--text-dim);
  font-size: 11px;
}

/* ─── Cookie Notification ─── */
.cookie-notification {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--accent);
  box-shadow: 0 -2px 16px rgba(137, 180, 250, 0.1);
  padding: 12px;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.cookie-notification.show {
  transform: translateY(0);
}
.cookie-content {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.cookie-icon {
  width: 32px;
  height: 32px;
  background: var(--accent2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.cookie-text {
  flex: 1;
  min-width: 240px;
}
.cookie-text h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--accent);
}
.cookie-text p {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.5;
}
.cookie-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.cookie-actions.modal-actions {
  margin-top: 12px;
}
.cookie-btn {
  padding: 5px 12px;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s;
  font-size: 12px;
  white-space: nowrap;
}
.cookie-btn:hover {
  filter: brightness(1.1);
}
.cookie-btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.cookie-btn-secondary {
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.cookie-btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ─── Cookie Modal ─── */
.cookie-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.cookie-modal.show {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-width: 440px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.cookie-modal.show .modal-content {
  transform: scale(1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.close-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.close-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.preference-group {
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
}
.preference-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.preference-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}
.preference-description {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.4;
}

/* ─── Toggle Switch ─── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 9px;
  transition: background 0.2s ease;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}
.toggle-switch input:focus + .toggle-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}
.toggle-switch.active .toggle-slider {
  background: var(--accent);
}
.toggle-switch.active .toggle-slider::before {
  transform: translateX(18px);
}

/* ─── Status Indicator ─── */
.cookie-status {
  position: fixed;
  top: 12px;
  right: 12px;
  background: var(--accent2);
  color: var(--bg);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  transform: translateX(calc(100% + 12px));
  transition: transform 0.25s ease;
  z-index: 1500;
  box-shadow: 0 2px 8px rgba(166, 227, 161, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.cookie-status.show {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-toggle { display: block; }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .library-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .sort-group {
    justify-content: flex-end;
  }

  .game-image canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
  }

  .cookie-content {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  .cookie-actions {
    width: 100%;
    justify-content: center;
  }
  .cookie-btn {
    flex: 1;
    min-width: 80px;
  }

  .game-actions {
    flex-direction: column;
  }
  .btn { width: 100%; }

  .about-card, .contact-card {
    margin: 0 4px;
  }
  .contact-item {
    flex-direction: column;
    text-align: center;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
  .game-card {
    padding: 8px;
  }
  .cookie-notification {
    padding: 8px;
  }
}

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

/* ─── Focus States ─── */
.btn:focus,
.cookie-btn:focus,
.toggle-switch:focus,
.close-btn:focus,
.mobile-menu-toggle:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Fade-in Animation ─── */
.fade-in {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Scrollbars ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
