/* Base styling */
body {
  margin: 0;
  padding: 0;
  background-color: white;
  color: #616161;
  /* Medium gray for regular text */
  line-height: 1.9;
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
}

/* Headings use a slightly darker gray for emphasis */
h2,
h3,
h4,
h5,
h6 {
  color: #4a4a4a;
  margin: 0 0 16px;
}

/* Container around main content: white background, subtle shadow */
main {
  max-width: 900px;
  margin: 20px auto;
  background-color: #fff;
  padding: 20px;
}

/* Top image in main, fully responsive, rounded corners */
body>img {
  width: 100%;
  display: block;
  height: 33vh;
  object-fit: cover;
}

.formula-as-img{
  max-width: 100%;
  max-height: 5em;
  display: block;
  margin: 0 auto;
}

/* Language & Controls Container: remove background, align to the right */
#controls-container {
  background: none;
  /* No gray background */
  position: relative;
  /* Ensures absolute positioning works inside */
  width: 100%;
  /* Make sure it spans the entire width */
}

/* Language selector: a row of circular badges */
#language-selector {
  position: absolute;
  right: 10px;
  /* Adjust as needed for spacing */
  top: 10px;
  /* Keeps it near the top */
  display: flex;
  gap: 8px;
  /* Space between language buttons */
}

.lang-tile[data-lang="pl"] {
  order: 1;
}
.lang-tile[data-lang="en"] {
  order: 2;
}
.lang-tile[data-lang="ru"] {
  order: 3;
}

/* Circular badges for EN / RU / PL */
.lang-tile {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #9e9e9e;
  /* Default gray border */
  color: #9e9e9e;
  /* Default gray text */
  background-color: #fff;
  font-size: 0.75rem;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

/* Selected language (Pink border + Pink text) */
.lang-tile.selected {
  border-color: #ec407a;
  /* Pink border */
  color: #ec407a;
  /* Pink text */
  background-color: #fff;
  /* Keep background white */
}

/* Title & "Instrukcja" in the same row */
.title-container {
  display: flex;
  flex-wrap: wrap;
  /* Allows elements to wrap when space is insufficient */
  justify-content: space-between;
  /* Keeps elements aligned properly */
  align-items: start;
  /* Centers items vertically */
  word-wrap: break-word;
  /* Ensures long words break */
  overflow-wrap: break-word;
  /* Ensures text wraps within the container */
  max-width: 60%;
  /* Prevents overflowing */
  text-align: start;
  /* Align text properly */
}

.title-container h2 {
  flex: 1;
  /* Makes sure it takes the available space */
  word-break: break-word;
  /* Breaks long words */
  white-space: normal;
  /* Allows automatic line breaks */
  text-align: start;
  /* Centers text */
}


/* "Instrukcja" Button: text + circular icon */
.instrukcja-button {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;

  /* Match text color to icon color */
  font-size: 1rem;
  color: #b23b27;
  /* Reddish tone from the screenshot */
  font-weight: 500;
  text-decoration: none;
  padding: 0;
}

/* Circular icon with white play triangle */
.instrukcja-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #b23b27;
  /* Same color as text */
  margin-right: 8px;
  position: relative;
}

/* White play arrow */
.instrukcja-icon::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 12px;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #fff;
}

/* Hover effect for "Instrukcja" text & icon */
.instrukcja-button:hover {
  color: #9f3322;
  /* Slightly darker on hover */
}

.instrukcja-button:hover .instrukcja-icon {
  background-color: #9f3322;
}

/* Paragraph spacing */
p {
  margin-bottom: 16px;
}

/* Horizontal rule styling (optional) */
hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 24px 0;
}

/* Footer (YouTube embed) matches main width, center it */
footer {
  max-width: 900px;
  margin: 20px auto;
  background: none;
  padding: 0 20px;
  text-align: center;
}

/* Responsive YouTube container for full-width video */
.youtube-container {
  position: relative;
  padding-bottom: 56.25%;
  /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 4px;
}

.youtube-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
  main {
    margin: 10px;
    padding: 16px;
  }

  footer {
    margin: 10px;
    padding: 0 16px;
  }

  .lang-tile {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }

  .instrukcja-icon {
    width: 28px;
    height: 28px;
  }

  .instrukcja-icon::after {
    left: 10px;
    top: 9px;
    border-width: 5px 0 5px 8px;
  }
}

main>img {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

/* Make the YouTube container take full viewport width */
.youtube-container {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}