/* General Body Styles */
body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  font-weight: light;
  background-color: #000;
  color: #fff;
  font-family: 'Lexend', sans-serif;
}

/* Language Visibility Rules */
html[lang="en"] .lang-ru {
  display: none;
}

html[lang="ru"] .lang-en {
  display: none;
}

/* Hero Page Styles */
.hero-page {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.video-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.content {
  position: relative;
}

h1 {
  font-size: 96px;
  font-weight: 450;
  z-index: 10;
  text-shadow: 0 0 50px rgb(0, 0, 0);
  position: relative;
}

/* --- Cards Section Styles --- */
.cards-section {
  padding: 50px 20%;
  background-color: #000;
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.card-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* --- Updated Card Styles --- */
.card {
  background-color: #1a1a1a;
  border: 0px solid #333;
  border-radius: 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-radius 0.3s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  border-radius: 16px;
}

.card-visible-content {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  flex-shrink: 0;
}

.card .card-hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: transform 0.3s ease;
  transform: scale(1.05);
}

.card:hover .card-hero-image {
  transform: scale(1.05);
}

.card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  text-align: left;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 20px 25px;
  border-top: 1px solid rgba(145, 145, 145, 0.1);
}

.card-content h2 {
  margin: 0;
  font-size: 2.2em;
  font-weight: normal;
}

.card-extra-content {
  display: none;
  padding: 40px 150px 115px 150px;
  background-color: #111;
  text-align: left;
  color: #ccc;
  line-height: 1.4;
}

.card-extra-content h3 {
  font-size: 2.6em;
  font-weight: normal;
  color: #fff;
  margin-top: 0;
  margin-bottom: 20px;
}

.card-extra-content p {
  font-size: 1.5em;
  font-weight: light;
  color: #fff;
  margin-top: 0;
}

.card-extra-content p {
  margin-bottom: 5px;
  font-weight: light;
}


/* --- Styles for Animation and Cloned Card --- */
.card.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.card-clone {
  position: fixed;
  background-color: #1a1a1a;
  overflow: hidden;
  z-index: 100;
  transition: border-radius 0.05s ease;
  display: flex;
  flex-direction: column;
}

.card-clone .card-hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.card-clone .card-content {
  opacity: 1;
  z-index: 2;
}

body.no-scroll {
  /*overflow: hidden;*/
}

.card-clone.is-open-fully {
  overflow-y: auto;
}

.card-clone.is-open-fully .card-extra-content {
  display: block;
}

.card-clone.is-open-fully {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.card-clone.is-open-fully::-webkit-scrollbar {
  display: none;
}


/* --- REWRITTEN: Contextual Toolbar Styles --- */
.contextual-toolbar {
  position: fixed;
  height: 50px;
  bottom: 30px;
  left: 50%;
  z-index: 101;
  display: flex;
  align-items: center;
  /* MODIFIED: Gap is removed from the default state */
  background-color: #ffbe0b81;
  justify-content: center;
  border-radius: 30px;
  padding: 5px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform-origin: bottom center;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  overflow: hidden;
  /* Closed state styles */
  max-width: 50px;
  min-width: 50px;
  /* Initial hidden state */
  opacity: 0;
  transform: translateX(-50%) translateY(100px);
  pointer-events: none;
}

/* Class to make the toolbar visible */
.contextual-toolbar.toolbar-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Open state styles */
.contextual-toolbar.is-open {
  max-width: 300px;
  padding: 5px 10px;
  gap: 5px;
  background-color: #ffbe0b9d;
  /* MODIFIED: Gap is now applied only when the toolbar is open */
}

/* Class for the initial call-to-action state */
.contextual-toolbar.toolbar-cta {
  background-color: rgba(0, 0, 0, 0.7);
}

.toolbar-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: width 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1), margin-left 0.4s cubic-bezier(0.23, 1, 0.32, 1), border-radius 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.toolbar-toggle-button {
  width: 40px;
  height: 40px;
  position: relative;
}

/* MODIFIED: Centered the icons */
.toolbar-toggle-button img {
  width: 36px;
  height: 36px;
  stroke: white;
  stroke-width: 2.5;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1)
}

/* Icon visibility rules */
.arrow-icon {
  opacity: 0;
}

.hamburger-icon {
  opacity: 1;
}

.toolbar-cta .arrow-icon {
  opacity: 1;
}

.toolbar-cta .hamburger-icon {
  opacity: 0;
}

.back-button,
#lang-switcher-button {
  height: 40px;
  border-radius: 20px;
  background-color: rgba(0, 0, 0, 0.2);
  /* Default closed state */
  width: 0;
  opacity: 0;
  pointer-events: none;
}

.back-button:hover,
#lang-switcher-button:hover {
  border-radius: 10px;
}

/* MODIFIED: Simplified visibility rules */
/* Language switcher is visible when toolbar is open */
.contextual-toolbar.is-open #lang-switcher-button {
  width: 40px;
  opacity: 1;
  pointer-events: auto;
}

/* Back button is visible ONLY when toolbar is open AND a card is active */
.contextual-toolbar.is-open.back-button-active .back-button {
  width: 40px;
  opacity: 1;
  pointer-events: auto;
}

.back-button img {
  width: 32px;
  height: 32px;
  stroke: white;
}

#lang-switcher-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

/* --- REWRITTEN: Kwork Panel Styles --- */
.kwork-panels-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-top: 25px;
}

.kwork-panel {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  /* Make children stretch to full height */
  gap: 20px;
  padding: 20px;
  background-color: #1f1f1f;
  border-radius: 48px;
  height: 60vh;
  /* Limit panel height */
}

.kwork-panel.kwork-panel--mirrored {
  flex-direction: row-reverse;
}

.panel-media {
  flex: 0 0 auto;
  /* Prioritize content size: Don't grow, shrink if needed, size to content */
  display: flex;
  gap: 10px;
  min-width: 0;
  max-width: 70%;
  /* Prevent flexbox overflow */
  border-radius: 24px;
  overflow: hidden;
}

.panel-info {
  flex: 1 1 auto;
  /* Fill remaining space: Grow, shrink, size based on available space */
  display: flex;
  flex-direction: column;
  min-width: 10%;
  /* Prevent text from getting too squished */
}

.panel-media--horizontal {
  flex-direction: row;
}

.panel-media--vertical {
  flex-direction: column;
}

/* Base style for all media to remove forced sizing */
.panel-media img,
.panel-media video {
  object-fit: cover;
  border-radius: 5px;
}

/* Horizontal stacking: full height, auto width */
.panel-media--horizontal>* {
  height: 100%;
  width: auto;
  min-width: 0;
  /* Allow shrinking */
}

/* Vertical stacking: full width, auto height */
/* The flex properties allow them to shrink and grow to fit the container */
.panel-media--vertical>* {
  width: 100%;
  height: auto;
  /* Height is based on aspect ratio */
  min-height: 0;
  /* Crucial for allowing shrinking in flex column */
}

.panel-text-content {
  flex-grow: 1;
}

.panel-text-content h4 {
  margin: 0 0 0px 0;
  font-size: 2.6em;
  font-weight: light;
  color: #fff;
}

.panel-text-content p {
  margin: 0;
  font-size: 1.5em;
  line-height: 1.5;
  font-weight: light;
  color: #ddd;
}

.panel-tools {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 15px;
  height: 32px;
}

.panel-tools img {
  height: 32px;
  width: 32px;
  object-fit: contain;
  border-radius: 8px;
}

.panel-media--vertical-mobileoptimized {
  max-width: 30vw;
  border-radius: 5px 24px 24px 5px;
}

/* --- UPDATED: Community Panel Styles --- */
.community-panels-container {
  display: flex;
  flex-direction: column;
}

.community-panel {
  display: flex;
  flex-wrap: wrap;
  /* Allow buttons to wrap */
  gap: 20px;
  padding: 20px;
  background-color: #1f1f1f;
  border-radius: 48px;
  min-height: 25vh;
  /* Give panel a minimum height */
  align-items: stretch;
  /* Stretch items to fill height */
  justify-content: stretch;
  /* Stretch items to fill width */
  margin-bottom: 30px;
}

/* NEW: Style for vertical stacking */
.community-panel.community-panel--vertical {
  flex-direction: column;
  flex-wrap: nowrap;
}

.community-panel h3 {
  font-size: 4em;
  font-weight: normal;
  color: #fff;
  margin-top: 0;
  margin-bottom: 20px;
  width: auto;
  align-self: center;
  /* Full width to sit above buttons */
}

.community-button {
  flex: 1 1 200px;
  /* Flex properties to grow and shrink, with a base size */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background-color: #2c2c2c;
  border-radius: 200px;
  /* Pill shape */
  padding: 20px;
  text-decoration: none;
  color: #fff;
  font-size: 6em;
  /* UPDATED: Increased font size */
  font-weight: light;
  gap: 20px;
  line-height: 1.1;
  transition: border-radius 0.3s cubic-bezier(0.23, 1, 0.32, 1), background-color 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.community-button:hover {
  border-radius: 48px;
}

.community-button img {
  height: 300px;
  object-fit: contain;
  border-radius: 50%;
  /* Circular logo */
}


/* --- START: Dice Integration --- */
.dice-container {
  display: flex;
  flex-direction: column;
  ;
  align-items: center;
  justify-content: start;
  padding: 20px;
  background-color: #00000000;
  border-radius: 48px;
}

.dice-container p {
  margin-top: 5px;
  color: #999;
  font-size: 1em;
  align-self: center;
  text-align: center;
}

.scene {
  --dice-size: 50vh;
  /* MODIFIED: PC size */
  width: var(--dice-size);
  height: var(--dice-size);
  perspective: calc(var(--dice-size)*10);
  /* MODIFIED: Proportional perspective */
  scale: 85%;
}

.dice-cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 2.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dice-cube .face {
  position: absolute;
  padding: 10px;
  width: var(--dice-size);
  /* MODIFIED: Use variable */
  height: var(--dice-size);
  /* MODIFIED: Use variable */
  background-color: #1f1f1f;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: center;
  overflow: hidden;
  backface-visibility: hidden;
}

.dice-cube .face img {
  width: 100%;
  height: 60%;
  object-fit: cover;
  border-radius: 24px;
}

.dice-cube .face p {
  margin: 5px 0 0;
  font-weight: light;
  color: #fff;
  font-size: 2em;
}

/* MODIFIED: Use variable for translation */
.dice-cube .front {
  transform: rotateY(0deg) translateZ(calc(var(--dice-size) / 2));
}

.dice-cube .back {
  transform: rotateY(180deg) translateZ(calc(var(--dice-size) / 2));
}

.dice-cube .right {
  transform: rotateY(90deg) translateZ(calc(var(--dice-size) / 2));
}

.dice-cube .left {
  transform: rotateY(-90deg) translateZ(calc(var(--dice-size) / 2));
}

.dice-cube .top {
  transform: rotateX(90deg) translateZ(calc(var(--dice-size) / 2));
}

.dice-cube .bottom {
  transform: rotateX(-90deg) translateZ(calc(var(--dice-size) / 2));
}

.roll-button {
  padding: 5px 15px 12px 15px;
  font-size: 2em;
  font-family: "Lexend", sans-serif;
  font-weight: normal;
  cursor: pointer;
  border-radius: 24px;
  border: none;
  background-color: #ffbe0b9d;
  color: #ffffff;
  transition: all 0.3s ease;
}

.roll-button:hover {
  background-color: #ffbe0b9d;
  border-radius: 8px;
}

.roll-button:disabled {
  background-color: #ffbe0b81;
  color: #999;
  cursor: not-allowed;
  border-radius: 12px;
}

/* --- END: Dice Integration --- */

/* --- Mobile Styles --- */
@media (max-width: 768px) {
  .cards-section {
    padding: 40px 20px;
    gap: 20px;
  }

  .card-column {
    gap: 20px;
  }

  .card-content {
    padding: 10px 10px;
  }

  .card-content h2 {
    font-size: 1.5em;
  }

  .card {
    border-radius: 24px;
  }

  .card:hover {
    border-radius: 12px;
  }

  .card-extra-content {
    padding: 40px 5%;
    padding-bottom: 100px;
  }

  .contextual-toolbar {
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    bottom: 20px;
  }

  .contextual-toolbar.toolbar-visible {
    transform: translateX(-50%) translateY(0);
  }

  /* Kwork Panel Mobile Styles */
  .kwork-panel,
  .kwork-panel.kwork-panel--mirrored {
    flex-direction: column;
    height: auto;
    /* Let height be auto on mobile */
    max-height: unset;
  }

  .community-panel {
    flex-direction: column;
    min-height: auto;
    padding: 10px;
  }

  .community-panel h3 {
    font-size: 2.2em;
    text-align: center;
    margin-bottom: 0px;
  }

  .community-button {
    font-size: 1.8em;
    padding: 5px 5px;
    max-height: 100px;
    border-radius: 50px;
  }

  .community-button:hover {
    border-radius: 40px;
  }

  .community-button img {
    height: 100px;
  }

  .panel-info {
    min-width: 100%;
    /* Full width on mobile */
  }

  .panel-media {
    min-height: 200px;
    margin-bottom: 0px;
    max-width: unset;
    /* Space between media and text on mobile */
  }

  /* Stack horizontal images vertically on mobile */
  .panel-media--horizontal {
    flex-direction: column;
  }

  .panel-media--vertical-mobileoptimized {
    max-width: unset;
    border-radius: 5px 5px 24px 24px;
  }

  /* NEW: Dice mobile size override */
  .scene {
    --dice-size: 90vw;
    margin-bottom: 20px;
  }

  .dice-cube .face p {
    font-size: 2em;
  }
}



/* --- Footer --- */
footer {
  background-color: #111;
  color: #aaa;
  text-align: center;
  padding: 30px 20px;
  flex-shrink: 0;
}

footer p {
  cursor: pointer;
  margin-bottom: 85px;
  transition: all 0.3s ease;
}

footer p:hover {
  color: #dda606;
}