/****************************************************
  Yleiset tyylit
*****************************************************/
body {
  background-color: #2c61c5;
  color: #e5e5e5;
  font-family: 'Montserrat', sans-serif;
  margin: 0;
  padding: 0;
  text-align: center;
}

a {
  color: #69d4e2;
  text-decoration: none;
  transition: color 0.3s ease, text-decoration 0.3s ease;
}

a:hover {
  text-decoration: underline;
}

/****************************************************
  Custom scrollbar & scroll-behavior
*****************************************************/
html {
  scroll-behavior: smooth;
}

/* Scrollbarin yleiset tyylit */
body::-webkit-scrollbar {
  width: 12px;
}

body::-webkit-scrollbar-track {
  background: #2052af;
  border-radius: 10px;
}

body::-webkit-scrollbar-thumb {
  background: linear-gradient(125deg, #4f8cff, #69d4e2);
  border: 2px solid #2052af;
  border-radius: 10px;
}

body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(125deg, #69d4e2, #4f8cff);
}

/****************************************************
  Header & navigaatio
*****************************************************/
header {
  background-color: rgba(44, 97, 197, 0.8);
  padding: 20px 0;
  text-align: center;
  position: relative;
  z-index: 2; /* Pidä header videon yläpuolella */
}

nav ul {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  list-style: none;
  margin: 0 auto;
  padding: 0;
}

nav ul li {
  display: inline-block;
  position: relative;
}

/* Erotin (|) linkkien väliin desktop-näkymässä */
nav ul li:not(:last-child)::after {
  content: '|';
  color: #e5e5e5;
  font-size: 1.2em;
  margin-left: 1.5vh;
}

nav ul li .dropdown li:not(:last-child)::after {
  content: none;
}

nav ul li a {
  color: #e5e5e5;
  font-size: 1.2em;
  font-weight: bold;
  position: relative;
  text-decoration: none;
  transition: color 0.3s ease;
}

/* Hover-efekti: linkin alleviivaus-animaatio */
nav ul li a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -5px;
  height: 2px;
  width: 0;
  background-color: #4f8cff;
  transition: width 0.3s ease;
}

nav ul li a:hover {
  text-decoration: none;
  color: #3eb2ff;
}

nav ul li a:hover::after {
  width: 100%;
}

/* Aktiivisen sivun päälinkki */
nav ul li a.active {
  color: #68bbff;
}

nav ul li a.active::after {
  background-color: #4f8cff;
  width: 100%;
}

/****************************************************
  Desktop: dropdown hover
*****************************************************/
@media (min-width: 769px) {
  nav ul li .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #2c61c5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    list-style: none;
    padding: 10px 0;
    border-radius: 10px;
    opacity: 0;
    transform: translateY(-5px);
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 10;
    display: block;
    text-align: left;
  }

  /* Dropdown näytetään hoverilla */
  nav ul li:hover .dropdown,
  nav ul li .dropdown:hover {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
  }
}

nav ul li .dropdown li {
  padding: 10px 20px;
}

nav ul li .dropdown li a {
  display: block;
  color: #e5e5e5;
  font-size: 1em;
  transition: background-color 0.3s ease, color 0.3s ease;
}

nav ul li .dropdown li a:hover {
  background-color: #4f8cff;
  border-radius: 5px;
  color: #fff;
}

/****************************************************
  Hero-osio ja karuselli
*****************************************************/
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(44, 97, 197, 0.8);
  min-height: 70vh;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.hero-video {
  position: absolute;
  top: -25vh;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  z-index: -2;
}

.hero::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 30%;
  background: linear-gradient(to bottom, rgba(44, 97, 197, 0) 0%, rgba(44, 97, 197, 0.95) 100%);
  z-index: -1;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
}

.hero h1 {
  font-size: 5em;
  margin: 0 0 0.2em 0;
}

.hero hr {
  display: none;
  height: 2px;
  margin: 1em 0;
  background-color: #fff;
  border: none;
  width: 100%;
}

.hero p {
  font-size: 1.8em;
  margin: 0;
}

.scroll-indicator {
  margin-top: 1em;
  animation: bounce 5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

/* Alisivun hero-osion tyylit */
.subpage-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background-color: #2c61c5;
  min-height: 15vh;
  padding: 20px 1em;
}

.subpage-hero h1 {
  margin: 10px 0 0 0;
  font-size: 3.5em;
  color: #e5e5e5;
}

.subpage-hero p {
  margin: 10px 0 0 0;
  font-size: 1.5em;
  color: #e5e5e5;
}

/****************************************************
  Page Map - Tyylit
*****************************************************/
.page-map {
  max-width: 800px;
  margin: 20px auto;
  padding: 15px 20px;
  border-radius: 10px;
  text-align: center;
}

.page-map h2 {
  font-size: 1.5em;
  margin-bottom: 10px;
  color: #e5e5e5;
}

.page-map ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-map ul li {
  display: block;
}

.page-map ul li:not(:last-child)::after {
  content: '';
}

.page-map ul li a {
  background-color: #2c61c5;
  border-radius: 5px;
  color: #69d4e2;
  font-size: 1em;
  font-weight: bold;
  padding: 5px 10px;
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.page-map ul li a:hover {
  background-color: #4f8cff;
  color: #fff;
}

/****************************************************
  Main-osio
*****************************************************/
.intro-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 2em 1em;
  text-align: center;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1.5s ease, transform 1.5s ease;
}

.intro-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.intro-section h2 {
  font-size: 2em;
  margin-bottom: 0.5em;
}

.intro-section p {
  font-size: 1.2em;
  line-height: 1.5;
}

/* Flex-container: yleisasettelu ja sisäisten laatikoiden asettelu */
.flex-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  margin: 2em auto;
  max-width: 1300px;
  padding: 0 1em;
}

/* Flex-containerissa olevien content-osioiden lisäasetukset */
.flex-container .content-section {
  flex: 1 1 calc(50% - 20px);
  min-width: 500px;
  max-width: 44%;
  margin: 0;
  background: linear-gradient(125deg, #2052af, #2c61c5);
  border: 3px solid white;
  border-radius: 15px;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
  color: #fff;
  padding: 1.5em;
  text-align: left;
}

/* Sisäisten laatikoiden tyyli */
.inner-box {
  background: #2052af;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  color: #e5e5e5;
  flex: 1 1 calc(50% - 20px);
  padding: 15px;
  text-align: left;
}

/* Responsiivisuus sisäisissä laatikoissa */
@media (max-width: 768px) {
  .flex-container {
    flex-direction: column;
  }
  .inner-box {
    flex: 1 1 100%;
  }
}

/****************************************************
  Historiaosio
*****************************************************/
.history-section {
  max-width: 800px;
  margin: 2em auto;
  padding: 2em 1.5em;
  background: linear-gradient(125deg, #2052af, #2c61c5);
  border: 3px solid white;
  border-radius: 15px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
  color: #fff;
  text-align: left;
}

.history-section h2 {
  font-size: 2em;
  margin-bottom: 1em;
}

.history-section p {
  font-size: 1.2em;
  line-height: 1.6;
}

.history-section img {
  display: block;
  width: 100%;
  max-width: 600px;
  margin: 1em 0 0 0.8em;
  border: 2px solid white;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.history-section .caption {
  max-width: 600px;
  margin: 0.5em 0 0 1em;
  font-size: 0.9em;
  color: #d3d3d3;
  text-align: left;
}

/****************************************************
  Contentosio
*****************************************************/
.content-section {
  max-width: 800px;
  margin: 2em auto;
  padding: 2em 1.5em;
  background: linear-gradient(125deg, #2052af, #2c61c5);
  border: 3px solid white;
  border-radius: 15px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
  color: #fff;
  text-align: left;
}

.content-section h2 {
  font-size: 2em;
  margin-bottom: 1em;
}

.content-section h3 {
  font-size: 1.3em;
  margin: 0 0 0.5em 0;
}

.content-section p {
  font-size: 1.2em;
  line-height: 1.6;
}

.content-section img {
  display: block;
  width: 100%;
  max-width: 600px;
  margin: 1em 0 0 0.8em;
  border: 2px solid white;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.content-section .caption {
  max-width: 600px;
  margin: 0.5em 0 0 1em;
  font-size: 0.9em;
  color: #d3d3d3;
  text-align: left;
}

/****************************************************
  Korttiosio: card-section
*****************************************************/
.card-section {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5em;
  padding: 2em 1em;
}

.card-section h2 {
  width: 100%;
  text-align: center;
  font-size: 2em;
  margin-bottom: 1em;
}

/****************************************************
  Korttien tyyli
*****************************************************/
.card {
  position: relative;
  max-width: 300px;
  padding: 1.5em;
  background: linear-gradient(125deg, #2052af, #2c61c5);
  border: 2px solid white;
  border-radius: 15px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
  text-align: left;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 0;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 20px rgba(0,0,0,0.3);
}

.card::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 30px;
  height: 30px;
  background: radial-gradient(rgb(255,255,255), rgb(255,255,255) 5%);
  border-bottom-left-radius: 30%;
  border-top-right-radius: 40%;
  z-index: -1;
}

.card::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 100px;
  height: 100px;
  /* Mahdollinen tyhjä tila koristeena */
}

.card h3 {
  margin: 0;
  margin-bottom: 0.5em;
  font-size: 1.4em;
  color: #fff;
}

.card p {
  margin: 0 0 1em;
  font-size: 1.1em;
  line-height: 1.5;
}

.card a {
  color: #62aff7;
  font-weight: bold;
  text-decoration: none;
  transition: color 0.3s ease, text-decoration 0.3s ease;
}

.card a:hover {
  text-decoration: underline;
}

/* Responsiivisuus: useampi kortti vierekkäin */
@media (min-width: 768px) {
  .card {
    flex: 1 1 calc(33.333% - 2em);
    max-width: calc(33.333% - 2em);
  }
  .card-section {
    gap: 2em;
  }
}

/****************************************************
  Pelaajaesittelyt
*****************************************************/
.player-section {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin: 2em auto;
  max-width: 1200px;
  padding: 0 1em;
}

.player-card {
  background: linear-gradient(125deg, #2052af, #2c61c5);
  border: 3px solid white;
  border-radius: 15px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
  color: #fff;
  flex: 1 1 calc(33.333% - 20px);
  max-width: 50%;
  padding: 1.5em;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  align-self: flex-start;
}

.player-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 20px rgba(0,0,0,0.3);
}

.player-image {
  width: 120px;
  height: 120px;
  margin-bottom: 10px;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.player-card h3 {
  margin: 0;
  font-size: 1.5em;
}

.player-card p {
  margin: 1em 0 0;
  font-size: 1em;
  line-height: 1.5;
  text-align: left;
}

.player-status {
  font-size: 0.6em;
  color: #d3d3d3;
}

.social-links {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.social-links a {
  text-decoration: none;
  color: #67a4ff;
  font-size: 1.5em;
  transition: color 0.6s ease, transform 0.6s ease;
}

.social-links a:hover {
  color: #4f8cff;
  transform: scale(1.1);
}

/* Pelaajakorttien responsiivisuus */
@media (max-width: 768px) {
  .player-card {
    flex: 1 1 100%;
    max-width: 100%;
    margin-bottom: 20px;
  }
  .player-image {
    width: 100px;
    height: 100px;
  }
}

/****************************************************
  Records list
*****************************************************/
#records {
  max-width: 80%;
  margin: 1em auto;
  padding: 20px;
  background: linear-gradient(125deg, #2052af, #2c61c5);
  border: 3px solid white;
  border-radius: 15px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
  color: #fff;
}

#records h2 {
  text-align: center;
  font-size: 2em;
  margin-bottom: 1em;
}

#records p {
  text-align: center;
  font-size: 1.2em;
  margin-bottom: 2em;
  color: #e5e5e5;
}

#records-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.category-box {
  width: 100%;
  max-width: 500px;
  height: 400px;
  margin: 0 1em;
  padding: 1em;
  background: linear-gradient(125deg, #2052af, #2c61c5);
  border: 3px solid white;
  border-radius: 15px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
  color: #fff;
  text-align: left;
  overflow: hidden;
}

.category-box h3 {
  text-align: center;
  font-size: 1.5em;
  margin-bottom: 10px;
}

.runs-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Yleiset scrollbar-määrittelyt runs-listille */
.runs-list::-webkit-scrollbar {
  width: 10px;
}

.runs-list::-webkit-scrollbar-thumb {
  background: #4f8cff;
  border-radius: 5px;
}

.submission {
  background: #2c61c5;
  border: 2px solid white;
  border-radius: 8px;
  padding: 0.5em 1em;
  margin-bottom: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  text-align: center;
}

.username {
  font-weight: bold;
  margin-bottom: 0.5em;
}

.category-count {
  text-align: center;
  font-size: 0.9em;
  color: #d3d3d3;
  margin-bottom: 10px;
}

.run_time,
.run_video {
  color: #69d4e2;
  text-decoration: none;
  font-weight: bold;
}

.run_time:hover,
.run_video:hover {
  text-decoration: underline;
}

/* Custom scrollbar tyylit category-boxin runs-listille */
.category-box .runs-list {
  scrollbar-width: thin;
  scrollbar-color: #5599ff #2052af;
}

.category-box .runs-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.category-box .runs-list::-webkit-scrollbar-track {
  background: #2052af;
  border-radius: 10px;
}

.category-box .runs-list::-webkit-scrollbar-thumb {
  background: linear-gradient(125deg, #4f8cff, #69d4e2);
  border: 2px solid #2052af;
  border-radius: 10px;
}

.category-box .runs-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(125deg, #69d4e2, #4f8cff);
}

.category-box .runs-list::-webkit-scrollbar-corner {
  background: #2052af;
}

@media (min-width: 768px) {
  .category-box {
    flex: 1 1 calc(50% - 20px);
  }
}

@media (max-width: 767px) {
  .category-box {
    flex: 1 1 100%;
  }
}

/****************************************************
  Footer
*****************************************************/
footer {
  padding: 20px 0;
  border-top: 2px solid #e5e5e5;
}

footer p {
  margin: 0.5em 0;
}

footer p a {
  color: #e5e5e5;
  text-decoration: underline;
  transition: color 0.3s ease, text-decoration 0.3s ease;
}

/****************************************************
  RESPONSIVE: navigaatio
*****************************************************/
html,
body {
  overflow-x: hidden;
}

#nav-toggle {
  display: none;
}

.hamburger-btn {
  display: none;
}

/****************************************************
  Mobiilinäkymä (max-width: 768px)
*****************************************************/
@media (max-width: 768px) {
  /* Hamburger-nappi mobiilille */
  .hamburger-btn {
    display: block;
    font-size: 1.8em;
    cursor: pointer;
    background-color: #4681f0;
    color: #fff;
    border-radius: 5px;
    width: fit-content;
    padding: 8px 16px;
    margin: 0 auto 10px;
    text-align: center;
    position: absolute;
    right: 2vh;
  }

  header {
    margin-bottom: 8vh;
  }

  header a {
    position: absolute;
    left: 2vh;
    top: 1.8vh;
    font-size: smaller;
  }

  nav .container li {
    left: -3%;
    top: 5vh;
  }

  /* Piilotetaan nav-valikko ja näytetään vain hamburger-nappi */
  nav ul {
    display: none;
    flex-direction: column;
    gap: 10px;
  }

  /* Näytetään nav-valikko, kun checkbox #nav-toggle on valittu */
  #nav-toggle:checked ~ nav ul {
    display: flex;
  }

  nav ul li {
    display: block;
    position: relative;
    margin: 5px 0;
  }

  nav ul li:not(:last-child)::after {
    content: none;
  }

  nav ul li a {
    font-size: 1.5em;
    text-decoration: underline;
    display: block;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 5px;
  }

  ul .dropdown li {
    font-size: small;
    margin: 0 auto;
    left: 0;
    margin-top: -25px;
    top: 3vh;
  }

  .dropdown {
    position: inherit;
    display: inline;
  }

  .dropdown .mobile {
    display: none;
  }

  /* Alavalikon linkkien sisennys */
  .dropdown-menu li a {
    padding-left: 20px;
  }

  /* Sankariosion fonttien pienennykset */
  .hero h1 {
    font-size: 3.5em;
  }
  .hero p {
    font-size: 1.2em;
  }

  /* Piilotetaan tai pienennetään videot taustalla */
  .hero-video {
    display: none;
  }

  .subpage-hero h1 {
    font-size: 2em;
  }
  .subpage-hero p {
    font-size: 1.2em;
  }

  .page-map {
    max-width: 90%;
    padding: 10px;
  }
  .page-map h2 {
    font-size: 1.2em;
  }
  .page-map ul li a {
    font-size: 0.9em;
  }

  .intro-section h2 {
    font-size: 1.5em;
  }
  .intro-section p {
    font-size: 1em;
  }

  /* Flex-container: content-osiot keskitetään */
  .flex-container .content-section {
    max-width: 85%;
    min-width: auto;
    margin: 0 auto;
  }

  /* Suuremmat laatikot */
  .large-box {
    max-width: 95%;
    margin: 10px auto;
  }
  .inner-box {
    flex: 1 1 100%;
  }

  /* Historia- ja content-osiot tehdään kapeammiksi ja fontteja pienennetään */
  .history-section,
  .content-section {
    max-width: 100%;
    padding: 1em;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  .history-section h2,
  .content-section h2 {
    font-size: 1.5em;
  }
  .history-section p,
  .content-section p {
    font-size: 1em;
  }
  .history-section img {
    width: 90%;
  }

  /* Kortit ja pelaajakortit pinotaan sarakkeeseen */
  .card-section,
  .player-section,
  #records-container {
    flex-direction: column;
    align-items: center;
  }
  .card {
    max-width: 90%;
  }
  .player-card {
    max-width: 90%;
    margin-bottom: 20px;
  }
  .category-box {
    max-width: 90%;
    margin: 10px auto;
    height: auto; /* Poistetaan kiinteä korkeus pienillä näytöillä */
  }

  footer p {
    font-size: 0.9em;
  }
}

/****************************************************
  EASTER EGGS (8-bit teema)
*****************************************************/
body.pixel-theme {
  background-color: #001124;
  color: #ffffff;
  font-family: 'Press Start 2P', cursive;
  font-size: 14px;
  text-transform: uppercase;
}

body.pixel-theme a {
  color: #ffcc00;
  text-decoration: none;
}

body.pixel-theme a:hover {
  color: #ff0000;
  text-decoration: underline;
}

/* Pixel-teeman painike */
#bit-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #ffcc00;
  color: #000;
  font-family: 'Press Start 2P', cursive;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.3s;
}

#bit-toggle:hover {
  transform: scale(1.1);
  background: #ff0000;
  color: #fff;
}

body.pixel-theme .history-section {
  background: #003169;
  color: #e5e5e5;
}

body.pixel-theme header {
  background-color: #001124;
  color: #ffcc00;
}

body.pixel-theme .intro-section,
body.pixel-theme main {
  background-color: #001124;
  color: #ffcc00;
}

body.pixel-theme .hero {
  background-color: #001124;
  color: #ffcc00;
}

body.pixel-theme h1,
body.pixel-theme h2,
body.pixel-theme h3 {
  color: #ffcc00;
  text-shadow: 2px 2px #000;
}

body.pixel-theme .card {
  border: 2px solid #ffcc00;
  color: #ffffff;
  font-family: 'Press Start 2P', cursive;
}

body.pixel-theme .card a {
  color: #ffcc00;
}

body.pixel-theme .card a:hover {
  color: #ff0000;
}

/* Custom Scrollbar Pixel-teema */
body.pixel-theme ::-webkit-scrollbar {
  width: 12px;
}

body.pixel-theme ::-webkit-scrollbar-thumb {
  background: #ffcc00;
  border-radius: 10px;
}

body.pixel-theme ::-webkit-scrollbar-thumb:hover {
  background: #ff0000;
}
