* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: wheat;
  color: #2b1114;
}

header {
  text-align: center;
  color: #2b1114;
  padding-top: 10px;
}

header h1 {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 5px;
}

header h4 {
  margin-bottom: 10px;
}

.logo-container {
  display: inline-block;
  perspective: 1000px;
  width: 160px;
  height: 160px;
  margin: 10px auto;
}

.logo-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s ease;
  transform-origin: center center;
}

.logo-container:hover .logo-inner {
  transform: rotateY(180deg) scale(1.05);
}

.logo-front,
.logo-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 50%;
  overflow: hidden;
  top: 0;
  left: 0;
}

.logo-front {
  transform: rotateY(0deg);
}

.logo-back {
  transform: rotateY(180deg);
}

.logo-front img,
.logo-back img,
.logo-front,
.logo-back {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

nav ul.menu {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-direction: row;
  background: #ca3504;
}

nav ul.menu li {
  position: relative;
  width: auto;
}

nav a {
  display: block;
  color: white;
  padding: 14px 16px;
  text-decoration: none;
  transition: background-color 0.3s;
}

nav a:hover {
  background-color: #d39a1c;
}

.submenu {
  display: none;
  position: absolute;
  top: 100%;
  background: rgba(202, 53, 4, 0.85);
  border-radius: 0 0 8px 8px;
  flex-direction: column;
  min-width: 180px;
  list-style-type: none;
  z-index: 2;
}

.has-submenu:hover .submenu {
  display: flex;
}

.submenu a {
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
}

.submenu-toggle {
  display: block;
  color: white;
  padding: 14px 16px;
  text-decoration: none;
  cursor: pointer;
  background: inherit;
  transition: background-color 0.3s;
}

.submenu-toggle:hover {
  background-color: #d39a1c;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

#courses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  justify-items: center;
  padding: 40px 20px;
  max-width: 1000px;
}

.card {
  width: 200px;
  height: 200px;
  perspective: 1000px;
}

.card-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
  border-radius: 50%;
}

.card:hover .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-front {
  background: #ffefd5;
}

.card-back {
  background: #d39a1c;
  transform: rotateY(180deg);
}

.card-back a {
  color: #2b1114;
  text-decoration: none;
  font-weight: 500;
}

.card-back a:hover {
  text-decoration: underline;
}

footer {
  text-align: center;
  background: #c5ba9a;
  padding: 10px;
  position: relative;
}

footer a {
  color: #2b1114;
  text-decoration: underline;
  transition: color 0.3s;
}

footer a:hover {
  color: #d39a1c;
}

@media (max-width: 900px) {
  #courses {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  #courses {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  nav ul.menu {
    flex-direction: column;
    text-align: center;
  }

  nav ul.menu li {
    width: 100%;
  }

  .submenu {
    position: static;
    background: rgba(202, 53, 4, 0.95);
    width: 100%;
    text-align: center;
    padding: 10px 0;
  }
  .submenu a {
    padding: 18px;
    font-size: 1.1em;
  }

  .has-submenu > .submenu-toggle::after {
    content: " ▾";
    font-size: 1.2em;
  }
  header h1 {
    font-size: 1.2em;
  }

  header h4 {
    font-size: 1em;
  }
}
