/* ========= Base Reset & Layout ========= */
html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  overflow: auto;
  background: rgb(206, 24, 30) url("/gfx/bakgrunn.png") no-repeat center center;
  background-size: cover;
  /* Ensure content is not hidden behind the fixed footer */
  padding-bottom: 4em; 
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ========= Header ========= */
h1 {
  width: 100%;
  color: white;
  text-align: center;
  margin: 0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  background-color: rgba(206, 24, 30, 0.7);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
  font-size: 2.5em;
  padding: 1em 0;
}

/* ========= Footer (fixed at bottom) ========= */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  background-color: rgba(206, 24, 30, 0.8);
  box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.4);
  font-size: 1em;
  padding: 1em 0;
  z-index: 100;
}

/* ========= Main Grid ========= */
.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 90%;
  max-width: 1200px;
  box-sizing: border-box;
  margin-top: 8em; /* Space for the fixed header */
  margin-bottom: 2em;
}

.grid-item {
  position: relative;
  aspect-ratio: 1; /* Keep cards square */
  perspective: 1000px; /* Enable 3D flipping */
  cursor: pointer;
}

/* If no text => non-clickable */
.non-clickable {
  cursor: default;
  box-shadow: none;
}
/* Non-clickable Cards Styling */
.non-clickable .front {
  border: 1px dashed white;
  background: none;
  color: #ffffff;
  box-shadow: none;
  opacity: 0.6;
}
 
/* Card Flip Styles */
.card {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s ease;
}

.grid-item.flipped .card {
  transform: rotateY(180deg);
}

.front, .back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  box-sizing: border-box;
  padding: 1em;
  text-align: center;
}
/* Advent Cards Front */
.front {
  background: linear-gradient(135deg, #ff6257, #d32f2f, #ca0007);
  color: white;
  font-size: 3em; /* Bigger font for numbers */
}

/* Advent Cards Back */
.back {
  background-color: white;
  color: #333;
  transform: rotateY(180deg);
  font-size: 1.4em;
  cursor: pointer; /* Indicate clickability */
}

/* Double-size Advent Card */
.large-card {
  grid-column: span 2;
  grid-row: span 2;
  aspect-ratio: 1;
}

/* Extra Large Number for Double-size Card */
.large-card .front {
  box-shadow: 0 4px 30px rgba(255, 255, 255, 0.9);
  font-size: 10em; /* Extra large number */
}
.large-card .back {
  font-size: 2.5em; 
}

/* PDF Cards Front - Background Images */
.pdf-card .card .front {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-size: 0; /* Hide any text */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 1);
}
.pdf-card .card .back {
  background: white url('/gfx/newwindow.png') no-repeat top right;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  h1 {
    font-size: 2em;
  }
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  .front {
    font-size: 6em;
  }
  .back {
    font-size: 2.5em;
  }
  .large-card .front {
    font-size: 20em;
  }
  .large-card .back {
    font-size: 3.5em;
  }
  .grid-item.pdf-card {
    display: none;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.2em;
  }
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 8em;
  }
  .front {
    font-size: 3em;
  }
  .back {
    font-size: 1em;
  }
  .large-card .front {
    font-size: 8em;
  }
  .large-card .back {
    font-size: 2em;
  }
  .grid-item.pdf-card {
    display: none;
  }
}