html {
  height: 100%;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  line-height: 1.6;
  background-color: #f5f7fa;
  color: #111;
  transition: background-color 0.5s ease, color 0.5s ease;
  text-align: justify;
}

body.dark-mode {
  background-color: #111;
  color: #eee;
}

.disable-transitions * {
  transition: none !important;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background-color: #333;
  color: #fff;
  border-bottom: 2px solid #000;
  flex-wrap: wrap;
}

.logo {
  width: 105px;
  height: auto;
  object-fit: cover;
  border-radius: 10%;
  cursor: pointer;
  margin-top: 15px;
}

.top-nav {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 20px;
  margin-left: 300px;
}

.top-link {
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  margin: 5px;
  padding: 8px 12px;
  transition: color 0.3s ease, background 0.3s ease, transform 0.3s ease-in-out;
}

.top-link:hover,
.top-link:focus-visible {
  border-bottom: 2px solid #fff;
  background-color: #575757;
  transform: scale(1.05);
}

body.dark-mode .top-link {
  color: #ddd;
}

.toggle-switch {
  position: relative;
  width: 60px;
  height: 30px;
  border-radius: 30px;
  background-color: #f1c40f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  cursor: pointer;
  transition: background-color 0.5s ease;
}

.toggle-switch .icon {
  font-size: 16px;
  z-index: 2;
  transition: opacity 0.3s ease;
}

.toggle-switch .sun {
  opacity: 0.75;
  color: #fff;
}

.toggle-switch .moon {
  opacity: 1;
  color: #f1c40f;
  text-shadow: 0 0 3px #000;
}

.toggle-switch .ball {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #fff;
  transition: left 0.4s ease;
  z-index: 1;
}

body.dark-mode .toggle-switch {
  background-color: #34495e;
}

body.dark-mode .toggle-switch .sun {
  opacity: 1;
  color: #fff;
}

body.dark-mode .toggle-switch .moon {
  opacity: 0.75;
  color: #fff;
}

body.dark-mode .toggle-switch .ball {
  left: 33px;
}

.ball.spin {
  animation: ball-spin 0.5s linear;
}

main {
  padding: 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.main-title {
  font-size: 36px;
  text-align: center;
}

.sub-title {
  font-size: 20px;
  text-align: center;
  margin-bottom: 16px;
}

p, li {
  max-width: 800px;
  margin: 0 auto 16px auto;
  font-size: 18px;
}

.text-image, .image-text {
  max-width: 1100px;
  margin: 0 auto 24px auto;
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.text-image p, .image-text p {
  flex: 1;
  margin: 0;
}

.text-image .img, .image-text .img {
  width: 300px;
  height: auto;
  flex-shrink: 0;
  border-radius: 8px;
}

.text-image > div, .image-text > div {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.credit {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 450;
  color: #666;
  text-decoration: underline;
}

.center-container {
  width: 100%;
  margin: 24px 0;
  text-align: center;
}

.center-container #toCenter {
  display: inline-block;
  max-width: 800px;
  text-align: justify;
}

#dia {
  width: 800px;
  object-fit: cover;
}

abbr {
  text-decoration: none !important;
  border-bottom: none !important;
}

.lang-button {
  display: block;
  width: 45px;
  height: 45px;
  padding: 0;
  color: black;
  background: white;
  border: 2px solid black;
  box-sizing: border-box;
  border-radius: 50%;
  font-size: 20px;
  text-align: center;
  text-decoration: none;
  line-height: 40px;
  transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out, background 0.3s ease-in-out;
  margin-left: 100px;
  margin-top: 5px;
}

.lang-button:hover {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
  transform: scale(1.05);
  transform: translateY(-2px);
}

.lang-button:active {
  opacity: 0.8;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background-color: #333;
  color: #fff;
  border-bottom: 2px solid #000;
  flex-wrap: wrap;
}

.right-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.lang-button {
  margin-left: 0;
}

@keyframes ball-spin {
  from { transform: rotate(0deg) scale(1.32); }
  to { transform: rotate(360deg) scale(1); }
}

body.spin {
  animation: page-spin 1.2s cubic-bezier(0.56, -0.67, 0.25, 1.55);
}

@keyframes page-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .text-image, .image-text {
    flex-direction: column;
  }

  .img {
    width: 100%;
    width: 100%;
    max-width: 280px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
  }

  nav a {
    margin: 8px 0 0 0;
  }
  
  .top-nav {
    margin-left: 0;
    margin-bottom: 50px;
  }
  
  .lang-button {
    margin-left: 10px;
    margin-bottom: 20px;
    margin-top: -4px;
  }
  
  .right-controls {
    display: flex;
    flex-direction: row;
    vertical-align: center;
    justify-content: center;
    align-items: center;
    align-content: center;
    position: absolute;
    top: 200px;
  }
}




@media (max-width: 700px) {
  .header {
    flex-direction: column;
  }
  
  .top-nav {
    flex-direction: column;
    margin-bottom: 30px;
  }
  
  .top-link {
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.85);
  }
  
  .img {
    width: eval(100vw / 110%);
    height: auto;
  }
  
    main {
    padding: 16px;
  }

  .main-title {
    font-size: 26px;
  }

  .sub-title {
    font-size: 18px;
  }

  p, li {
    font-size: 16px;
  }

  .text-image,
  .image-text,
  .fimage-text {
    flex-direction: column;
    gap: 16px;
  }

  .text-image p,
  .image-text p,
  .fimage-text p {
    width: 100%;
  }

  .img {
    width: 100%;
    max-width: 100%;
  }

  #dia {
    width: 100%;
  }

  .header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
  }

  .top-nav {
    justify-content: center;
    margin-bottom: 100px;
  }
  
  .lang-button {
    margin-bottom: 15px;
  }
  
  .right-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    position: absolute;
    top: 10px;
  }
  .right-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    position: absolute;
    top: 370px;
}

@media (max-width: 450px) {
  .top-nav {
    font-size: 16px;
    text-decoration: none;
  }
}

.center-container {
  width: 100%;
  margin: 24px 0;
  text-align: center;
}

.center-container #toCenter {
  display: inline-block;
  max-width: 800px;
  text-align: justify;
}
