/* =====================
   CSS VARIABLES
   ===================== */

:root {
  /* Farver fra designboard */
  --primary-color: #505c38;
  --secondary-color: #492e2e;
  --accent-color: #bf171c;

  /* Tekst */
  --primary-text: #fff6f1;
  --secondary-text: #171717;

  /* Baggrunde */
  --background: #fff6f1;
  --background-card: #505c38;

  /* Effects */
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.16);
  --radius: 0.75rem;
  --transition: 200ms ease;
}

/* =====================
   GLOBAL STYLES
   ===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  background: var(--background);
  color: var(--secondary-text);
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =====================
   LAYOUT (main container)
   ===================== */

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 6rem 1.25rem 2rem;
}

/* =====================
   FILTERBAR (SØG/SORT/FILTER)
   ===================== */
/* Filterområde */
.filterbar {
  background-color: var(--primary-color);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.filter-row-main {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.5rem;
  align-items: end;
}


.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  color: #ffffff;
  font-weight: 600;
}

.filter-group input,
.filter-group select {
  width: 100%;
  min-height: 3.5rem;
  padding: 0.8rem 1rem;
  border: 2px solid transparent;
  border-radius: 0.6rem;
  background-color: var(--background);
  color: var(--secondary-text);
  font: inherit;
}

.filter-group input:focus-visible,
.filter-group select:focus-visible {
  outline: 3px solid var(--primary-text);
  outline-offset: 3px;
}

/* =====================
   HEADER & FOOTER
   ===================== */
header {
  background: var(--primary-color);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  color: var(--primary-text);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.logo img {
  display: block;
  width: auto;
  height: 50px;
}

.logo:focus-visible {
  outline: 3px solid var(--primary-text);
  outline-offset: 4px;
  border-radius: 0.25rem;
}

.book-button {
  background: var(--primary-text);
  color: var(--secondary-text);
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.book-button:hover {
  background-color: #f0e6e1;
}

.book-button:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 3px;
}

/* =====================
   INTRO & OVERSKRIFTER
   ===================== */

.intro {
  padding: 3rem 0 2rem;
}

.intro h1 {
  max-width: 800px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  color: var(--secondary-text);
  margin-bottom: 0.75rem;
}

.intro p {
  max-width: 650px;
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--secondary-text);
}

.games-section h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  color: var(--secondary-text);
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  main {
    padding-top: 6.5rem;
  }
  .logo img {
  height: 40px;
}

  .header-content {
    padding: 0.875rem 1rem;
  }

  .logo {
    font-size: 1.25rem;
  }

  .book-button {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
  }

  .intro {
    padding: 2rem 0 1.5rem;
  }
}

/* =====================
   FOOTER
   ===================== */

.site-footer {
  background-color: var(--primary-color);
  color: var(--primary-text);
  margin-top: 4rem;
  padding: 3rem 5%;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;

  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 3rem;
}

.footer-brand p,
.footer-info p {
  margin: 0;
  line-height: 1.6;
  color: #ffffff;
}

.footer-info h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--primary-text);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;

  border-top: 1px solid rgba(255, 246, 241, 0.4);
  text-align: center;
}

.footer-bottom p {
  margin: 0;
}

/* =====================
   GAME GRID & CARDS
   ===================== */
#game-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  padding: 2rem 0;
  min-height: 500px;
}
@media (min-width: 600px) {
  #game-list {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 992px) {
  #game-list {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
@media (min-width: 1400px) {
  #game-list {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
}

.game-card {
  background: var(--background-card);
  color: var(--primary-text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  border: none;
}
.game-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.game-poster {
  width: 100%;
  height: 400px;
  object-fit: cover;
  background: white;
  transition: var(--transition);
}

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

.game-info {
  padding: 1.5rem;
}

.game-info h3 {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}


.game-genre {
  color: #ffffff;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* Se spil CTA */
.game-button {
  background-color: #991216;
  color: #ffffff;
  border: none;
  border-radius: 0.75rem;
  padding: 0.7rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 200ms ease, transform 200ms ease;
}

.game-button:hover {
  background-color: #7a0e12;
  transform: translateY(-2px);
}

.game-button:active {
  transform: translateY(0);
}

.game-button:focus-visible {
  outline: 3px solid var(--primary-text);
  outline-offset: 3px;
}

/* =====================
   GAME DIALOG
   ===================== */
dialog#game-dialog {
  font-family: inherit;
  font-size: medium;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0;
  max-width: min(95vw, 1000px);
  max-height: 90vh;
  background: var(--primary-color);
  color: var(--primary-text);
  overflow-y: auto;
  position: relative;
  margin: auto;
}

/* slørret baggrund når man klikker på et kort */
dialog#game-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

/* Luk dialog-knap */
#close-dialog {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: black;
  color: var(--primary-text);
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
}

#close-dialog:hover {
  background: var(--accent-color);
  color: white;
  transform: scale(1.1);
}

#dialog-content {
  padding: 2rem;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) 2fr;
  gap: 2rem;
  align-items: start;
  overflow-y: auto;
  max-height: 90vh;
}

@media (max-width: 768px) {
  #dialog-content {
    grid-template-columns: 1fr;
    padding: 1.5rem;
    gap: 1.5rem;
    text-align: center;
  }
}

#dialog-content img.game-poster {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  #dialog-content img.game-poster {
    max-width: 300px;
    margin: 0 auto;
  }
}

.dialog-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#dialog-content h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--primary-text);
  line-height: 1.2;
  margin: 0 0 1rem 0;
}


#dialog-content p {
  color: var(--primary-text);
  line-height: 1.6;
  margin: 0 0 1rem 0;
}

#dialog-content p strong {
  color: var(--primary-text);
  font-weight: 600;
}

#dialog-content .game-genre {
  color: var(--secondary-text);
  font-weight: 500;
  font-size: 1.1rem;
}

.game-description {
  color: var(--primary-text) !important;
  font-size: 1.1rem !important;
  line-height: 1.7 !important;
  margin-top: 1rem !important;
  padding: 1rem;
  background: var(--accent-color);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary-color);
  font-style: italic;
}

.no-results {
  text-align: center;
  color: var(--secondary-text);
  font-size: 1.2rem;
  margin: 2rem 0;
  padding: 2rem;
  background: var(--background);
  border-radius: var(--radius);
}

/* =====================
   RESPONSIVE FILTERBAR
   ===================== */

@media (max-width: 600px) {
  .filterbar {
    padding: 1rem;
  }
}

@media (max-width: 700px) {
  .filterbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-row-main {
    grid-template-columns: 1fr;
    gap: 1rem;
    width: 100%;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-action {
    justify-self: start;
  }
}

/* =====================
   RESPONSIVE & ACCESSIBILITY
   ===================== */
@media (max-width: 480px) {
  #game-list {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .game-card {
    max-width: 350px;
    margin: 0 auto;
  }

}

/* Focus styles for keyboard navigation */
#close-dialog:focus-visible {
  outline: 3px solid var(--primary-text);
  outline-offset: 3px;
}

/* =====================
   BOOKING DIALOG
   ===================== */

#booking-dialog {
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  padding: 0;

  width: min(90vw, 550px);
  max-height: 90vh;

  background-color: var(--primary-color);
  color: var(--primary-text);

  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

/* Mørk baggrund bag booking-vinduet */
#booking-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.55);
}

/* Indholdet inde i dialogen */
.booking-dialog-content {
  position: relative;
  padding: 2.5rem;
}

.booking-dialog-content h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--primary-text);
}

.booking-dialog-content > p {
  margin-top: 0;
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* Formular */
#booking-form {
  display: grid;
  gap: 1.25rem;
}

.booking-field {
  display: grid;
  gap: 0.4rem;
}

.booking-field label {
  font-weight: 600;
}

.booking-field input {
  width: 100%;
  box-sizing: border-box;

  padding: 0.75rem;

  font: inherit;
  color: var(--secondary-text);

  background-color: var(--background);

  border: 2px solid transparent;
  border-radius: 0.5rem;
}

/* Fokus med tastatur */
.booking-field input:focus-visible {
  outline: 3px solid var(--primary-text);
  outline-offset: 3px;
}

/* Rød Book bord-knap */
.booking-submit {
  margin-top: 0.5rem;

  padding: 0.8rem 1.25rem;

  font: inherit;
  font-weight: 600;

  color: var(--primary-text);
  background-color: var(--accent-color);

  border: none;
  border-radius: 0.75rem;

  cursor: pointer;
}

.booking-submit:hover {
  background-color: #991216;
}

.booking-submit:focus-visible {
  outline: 3px solid var(--primary-text);
  outline-offset: 3px;
}

/* Kryds øverst til højre */
.close-booking {
  position: absolute;
  top: 1rem;
  right: 1rem;

  width: 2.5rem;
  height: 2.5rem;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  font-size: 1.25rem;
  line-height: 1;

  color: var(--primary-text);
  background-color: var(--accent-color);

  border: none;
  border-radius: 50%;

  cursor: pointer;
}

.close-booking:hover {
  background-color: #991216;
}

.close-booking:focus-visible {
  outline: 3px solid var(--primary-text);
  outline-offset: 3px;
}

/* Stop siden bag dialogen fra at scrolle */
body:has(#booking-dialog[open]) {
  overflow: hidden;
}

/* Mobil */
@media (max-width: 600px) {
  .booking-dialog-content {
    padding: 2rem 1.25rem 1.5rem;
  }

  #booking-dialog {
    width: calc(100% - 2rem);
  }
}