/* ============================================
   Gyldenkule - Main Stylesheet
   Premium Norwegian Style - Gold & Obsidian
   ============================================ */

/* Import Google Fonts (Inter + Outfit for headers) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;700;800&display=swap');

/* ============================================
   CSS Variables - Color System & Metrics
   ============================================ */
:root {
  /* Background Colors */
  --bg-primary: #0A0A0B;
  --bg-secondary: #141416;
  --bg-tertiary: #1C1C1F;
  --bg-darker: #050506;
  --overlay-dark: rgba(0, 0, 0, 0.8);

  /* Accent Colors - Gilded Gold */
  --accent-primary: #D4AF37;
  --accent-hover: #F1D37A;
  --accent-muted: #857449;
  --accent-glow: rgba(212, 175, 55, 0.2);

  /* Text Colors */
  --text-primary: #FFFFFF;
  --text-secondary: #E2E2E2;
  --text-muted: #9A9A9A;

  /* Border & Divider */
  --border-color: #262629;
  --divider-color: #333333;

  /* Fluid Spacing - Calibrated for laptops */
  --spacing-xs: clamp(0.25rem, 1vw, 0.5rem);
  --spacing-sm: clamp(0.75rem, 1.5vw, 1rem);
  --spacing-md: clamp(1rem, 2vw, 1.5rem);
  --spacing-lg: clamp(1.5rem, 2.5vw, 2rem);
  --spacing-xl: clamp(2.5rem, 5vw, 4.5rem);

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.4s cubic-bezier(0.25, 1, 0.5, 1);

  /* Container Width & Constraints */
  --container-max-width: 1440px;
  --content-max-width: 800px;
  /* For readable line lengths on 4K */
}

/* ============================================
   Basic Layout Utilities (Responsive Hardening)
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: clamp(14px, 0.875vw + 10px, 16px);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
}

.container {
  width: min(100% - 2.5rem, var(--container-max-width));
  margin-inline: auto;
}

.columns {
  display: flex;
  flex-wrap: wrap;
  margin: -0.75rem;
}

.column {
  flex: 1 1 300px;
  /* Better default responsiveness */
  padding: 0.75rem;
  min-width: 0;
  /* Prevents flexbox overflow */
}

.column.is-narrow {
  flex: none;
}

/* Precise column control with mobile-first logic */
@media screen and (min-width: 769px) {
  .column.is-3 {
    width: 25%;
    flex: 0 0 25%;
  }

  .column.is-4 {
    width: 33.3333%;
    flex: 0 0 33.3333%;
  }

  .column.is-5 {
    width: 41.6666%;
    flex: 0 0 41.6666%;
  }

  .column.is-6 {
    width: 50%;
    flex: 0 0 50%;
  }
}

.section {
  padding: var(--spacing-xl) 0;
}

/* Laptop-specific section spacing */
@media screen and (min-width: 769px) and (max-width: 1600px) {
  .section {
    padding: clamp(2rem, 4vw, 3.5rem) 0;
  }
}

.is-dark {
  background-color: var(--bg-primary);
}

.is-darker {
  background-color: var(--bg-secondary);
}

.has-text-centered {
  text-align: center;
}

/* ============================================
   Typography (Fluid Scaling)
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6,
.title {
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.1;
  /* Tighter for large screens */
  margin-bottom: var(--spacing-sm);
  text-wrap: balance;
  /* Modern responsive text wrapping */
}

.title.is-1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  letter-spacing: -0.02em;
}

.title.is-2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
}

.title.is-3 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}

.title.is-4 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}

.subtitle {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
  max-width: var(--content-max-width);
  margin-inline: auto;
}

p {
  margin-bottom: 1.25rem;
  max-width: var(--content-max-width);
  /* Prevents line length issues on 4K */
}

.has-text-centered p {
  margin-inline: auto;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

/* ============================================
   Navigation (Hardened Responsive)
   ============================================ */
.navbar {
  background-color: var(--bg-darker);
  border-bottom: 1px solid var(--border-color);
  padding: clamp(0.75rem, 1.5vw, 1rem) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  /* Stabilizes header height */
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  color: #fff;
  flex-shrink: 0;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 2rem);
}

.navbar-end {
  display: flex;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.navbar-item {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  transition: color var(--transition-fast);
}

.navbar-item:hover {
  color: var(--accent-primary);
}

.navbar-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  -webkit-tap-highlight-color: transparent;
  padding: 8px;
}

.navbar-burger span {
  display: block;
  width: 25px;
  height: 2px;
  background-color: var(--text-primary);
  transition: 0.3s;
  margin: 0 auto;
}

@media screen and (max-width: 1023px) {
  .navbar-burger {
    display: flex;
  }

  .navbar-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    background-color: var(--bg-secondary);
    flex-direction: column;
    padding: 0;
    transition: max-height var(--transition-smooth), padding var(--transition-smooth);
    border-bottom: 0 solid var(--border-color);
  }

  .navbar-menu.is-active {
    max-height: 400px;
    padding: 1.5rem;
    border-bottom-width: 1px;
  }

  .navbar-end {
    flex-direction: column;
    width: 100%;
    text-align: center;
    gap: 1.5rem;
  }
}

/* ============================================
   Hero Section (Calibrated for laptops)
   ============================================ */
.hero {
  position: relative;
  min-height: 500px;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-image: url('../images/hero-bg.webp');
  background-size: cover;
  background-position: center;
}

@media screen and (max-width: 768px) {
  .hero {
    background-image: url('../images/hero-bg-mobile.webp');
    min-height: 550px;
    max-height: none;
  }
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--bg-primary) 0%, rgba(10, 10, 11, 0.75) 100%);
  z-index: 1;
}

.hero-body {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: var(--spacing-xl) 0;
}

.hero-content-wrapper {
  max-width: var(--content-max-width);
  margin-inline: auto;
}

/* Laptop-specific hero padding reduction */
@media screen and (min-width: 769px) and (max-width: 1600px) {
  .hero-body {
    padding: clamp(2rem, 4vw, 3rem) 0;
  }
}

/* ============================================
   Buttons
   ============================================ */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  padding: 0 2.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary) !important;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.button.is-primary {
  background-color: var(--accent-primary);
  color: #000 !important;
}

.button.is-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.button.is-outlined {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary) !important;
}

.button.is-outlined:hover {
  background: var(--accent-glow);
  color: var(--accent-primary) !important;
}

.button.is-light {
  background: var(--bg-tertiary);
  color: var(--text-primary) !important;
}

.button.is-small {
  min-height: 2.75rem;
  padding: 0 1.5rem;
  font-size: 0.875rem;
}

.buttons.is-centered {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* ============================================
   Game Cards System (Enhanced Responsive)
   ============================================ */
.games-grid {
  display: grid;
  width: 100%;
  gap: clamp(1rem, 2.5vw, 2rem);
  /* 1 col on mobile, up to 5 cols on 4K */
  grid-template-columns: repeat(auto-fit, minmax(clamp(260px, 20vw, 320px), 1fr));
  justify-content: center;
}

/* Mobile game grid - smaller cards */
@media screen and (max-width: 768px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
  }
}

/* Very small mobile - single column */
@media screen and (max-width: 480px) {
  .games-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    max-width: 400px;
    margin-inline: auto;
  }
}

/* Limit stretch on ultra-wide screens */
@media screen and (min-width: 1921px) {
  .games-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.game-card {
  position: relative;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth);
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
}

.game-card-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  background-color: var(--bg-tertiary);
}

.game-card-image-wrapper img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth);
}

.game-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-smooth);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.game-card:hover .game-card-overlay {
  opacity: 1;
}

.game-card:hover img {
  transform: scale(1.05);
}

/* Mobile - always show overlay button */
@media screen and (max-width: 768px) {
  .game-card-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.4);
  }

  .game-card:hover {
    transform: none;
  }

  .game-card-overlay .button {
    font-size: 0.875rem;
    padding: 0 1.5rem;
    min-height: 3rem;
  }
}

.game-card-footer {
  padding: 1rem;
  text-align: center;
}

.game-card-title {
  font-size: 1.125rem;
  margin: 0;
}

/* Mobile game card adjustments */
@media screen and (max-width: 768px) {
  .game-card-footer {
    padding: 0.75rem;
  }

  .game-card-title {
    font-size: 1rem;
  }

  .game-card-image-wrapper {
    aspect-ratio: 16/10;
  }
}

/* ============================================
   Sections & Components
   ============================================ */
.section-title {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

/* Laptop-specific title spacing */
@media screen and (min-width: 769px) and (max-width: 1600px) {
  .section-title {
    margin-bottom: 2rem;
  }
}

.section-title::after {
  content: '';
  display: block;
  width: 50px;
  height: 3px;
  background: var(--accent-primary);
  margin: 0.75rem auto;
}

.quote-card {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-primary);
  height: 100%;
}

.comparison-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

/* Laptop-specific card padding */
@media screen and (min-width: 769px) and (max-width: 1600px) {
  .comparison-card {
    padding: 2rem;
  }
}

.comparison-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.comparison-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.responsible-box {
  background: var(--bg-secondary);
  padding: 3rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  text-align: center;
  max-width: 900px;
  margin-inline: auto;
}

.responsible-box p {
  margin-inline: auto;
  line-height: 1.7;
}

/* Laptop-specific box padding */
@media screen and (min-width: 769px) and (max-width: 1600px) {
  .responsible-box {
    padding: 2.5rem 2rem;
  }
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background-color: var(--bg-darker);
  padding: var(--spacing-xl) 0;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* Laptop-specific footer spacing */
@media screen and (min-width: 769px) and (max-width: 1600px) {
  .footer {
    padding: clamp(2.5rem, 4vw, 3.5rem) 0;
  }
}

.footer .container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-primary);
}

.footer-links span {
  color: var(--border-color);
  -webkit-user-select: none;
  user-select: none;
}

/* Footer logo grid */
.footer-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.footer-logos img {
  height: 40px;
  transition: opacity var(--transition-fast);
}

.footer-logos a:hover img {
  opacity: 1 !important;
}

/* Laptop-specific footer logo spacing */
@media screen and (min-width: 769px) and (max-width: 1600px) {
  .footer-logos {
    gap: 1.5rem;
    margin: 1.25rem 0;
  }

  .footer-logos img {
    height: 36px;
  }
}

/* ============================================
   Modals (Hardened)
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-background {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--bg-secondary);
  width: min(100%, 500px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--divider-color);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-card-head {
  padding: 1.5rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.modal-card-head .title {
  margin-bottom: 0;
}

.modal-card-body {
  padding: 2rem 1.5rem;
  overflow-y: auto;
}

.modal-card-foot {
  padding: 1.5rem;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 0;
  z-index: 999;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

/* ============================================
   Game Pages (Hardened Iframes)
   ============================================ */
.game-container {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 1000px;
  margin-inline: auto;
}

.game-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 80vh;
  border: none;
  display: block;
}

/* Fullscreen mode styles */
.game-iframe:fullscreen,
.game-iframe:-webkit-full-screen,
.game-iframe:-moz-full-screen,
.game-iframe:-ms-fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  aspect-ratio: auto;
}

/* Ensure iframe container can go fullscreen */
.game-iframe:-webkit-full-screen-ancestor:not(iframe) {
  position: static !important;
}

/* Game Controls */
.game-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-darker);
  flex-wrap: wrap;
}

.game-controls .button {
  min-width: 120px;
  min-height: 44px;
}

/* Small screens */
@media screen and (max-width: 768px) {
  .game-iframe {
    aspect-ratio: 4 / 3;
  }

  .modal-card-foot {
    flex-direction: column;
    gap: 1rem;
  }

  .modal-card-foot .button {
    width: 100%;
  }

  .game-controls .button {
    flex: 1 1 140px;
  }

  .responsible-box {
    padding: 2rem 1.5rem;
  }

  .comparison-card {
    padding: 1.5rem;
  }

  .buttons.is-centered {
    flex-direction: column;
    width: 100%;
  }

  .buttons.is-centered .button {
    width: 100%;
  }
}

/* Very small screens */
@media screen and (max-width: 480px) {
  .navbar-brand a {
    font-size: 1.125rem;
  }

  .navbar-brand img {
    max-height: 32px !important;
  }

  .game-container {
    border-radius: var(--radius-md);
  }

  .hero {
    min-height: 500px;
    max-height: none;
  }
}

/* Large screens - prevent excessive stretching */
@media screen and (min-width: 1920px) {
  .container {
    max-width: 1600px;
  }

  .comparison-card,
  .responsible-box {
    max-width: 1200px;
    margin-inline: auto;
  }

  .hero {
    max-height: 850px;
  }
}

/* Desktop spacing expansion above laptop range */
@media screen and (min-width: 1601px) {
  .section {
    padding: clamp(3rem, 5vw, 4.5rem) 0;
  }

  .hero-body {
    padding: clamp(3rem, 5vw, 4rem) 0;
  }
}