@font-face {
  font-family: Mainfarsi;
  src: url("../fonts/irfont.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE80-FEFC;
}

@font-face {
  font-family: Mainenglish;
  src: url("../fonts/enfont.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: Mainenglish;
  src: url("../fonts/englishfont.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  font-family: Mainfarsi, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

:root {
  direction: rtl;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.15);
  --transition-fast: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.8s ease;
  --color-primary: #000;
  --color-secondary: #fff;
  --listiconsize: 40px;
}

body {
  margin: 0;
  padding: 0;
  direction: rtl;
  line-height: 1.6;
  font-weight: 500;
  overflow-x: hidden;
  font-synthesis: none;
  background-size: cover;
  color: var(--color-secondary);
  background: var(--color-primary);
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-family: Mainfarsi, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
@media (hover: hover) and (pointer: fine) {
  html,
  body {
    scroll-behavior: smooth;
  }
}

/* Homepage: keep chrome hidden until critical CSS/JS gate passes (see base.js). */
body.bz-splash-active:not(.bz-splash-ready) > *:not(#loading):not(.loading):not(script):not(style):not(link) {
  visibility: hidden;
}

body.bz-splash-active:not(.bz-splash-ready) #loading,
body.bz-splash-active:not(.bz-splash-ready) .loading {
  visibility: visible;
}

.loading {
  direction: ltr;
  inset: 0;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  contain: layout style paint;
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 9999;
}

.loading[hidden],
.loading[aria-hidden="true"],
#loading.is-dismissed {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Never show splash inside injected blog article dock */
.blog-article-dock #loading,
.blog-article-dock .loading {
  display: none !important;
}

.loading-text {
  text-align: center;
  line-height: 1;
  font-size: clamp(1rem, 4vw, 1.5rem);
}

.loading-text span {
  display: inline-block;
  margin: 0 0.2em;
  color: var(--color-secondary);
  font-family: Mainenglish, system-ui, sans-serif;
  opacity: 0;
  animation: fadeInBlur 1.5s infinite linear alternate;
  animation-fill-mode: both;
  contain: layout style;
}

.loading-text span:nth-child(1) {
  animation-delay: 0.2s;
}

.loading-text span:nth-child(2) {
  animation-delay: 0.4s;
}

.loading-text span:nth-child(3) {
  animation-delay: 0.6s;
}

.loading-text span:nth-child(4) {
  animation-delay: 0.8s;
}

.loading-text span:nth-child(5) {
  animation-delay: 1s;
}

.loading-text span:nth-child(6) {
  animation-delay: 1.2s;
}

.loading-text span:nth-child(7) {
  animation-delay: 1.4s;
}

.loading-text span:nth-child(8) {
  animation-delay: 1.6s;
}

@keyframes fadeInBlur {
  0% {
    opacity: 1;
    filter: blur(0);
  }

  100% {
    opacity: 0.5;
    filter: blur(4px);
  }
}

.topnavbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  padding-inline: clamp(1rem, 4vw, 2rem);
  padding-block: clamp(0.5rem, 2vw, 1rem);
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0);
  transition: background-color var(--transition-slow, 0.3s ease);
  contain: layout style;
}

.topnavbar.transparent {
  background: rgba(0, 0, 0, 0) !important;
}

.topnavbar.blackbg {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.nav-btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  text-decoration: none;
  user-select: none;
  outline: none;
  transition: transform 0.2s ease;
  font-family: Mainenglish, system-ui, sans-serif;
  contain: layout style;
  font-size: 1.1rem;
}

.nav-btn:hover,
.nav-btn:focus-visible {
  transform: scale(1.1);
}

.menu-btn {
  position: static;
}

.menu-btn.active {
  transform: rotate(45deg);
}

.menu-btn .line {
  fill: none;
  stroke: var(--color-secondary);
  stroke-width: 5.5;
  transition: stroke-dasharray 400ms, stroke-dashoffset 400ms;
}

.menu-btn .top {
  stroke-dasharray: 40 139;
}

.menu-btn .bottom {
  stroke-dasharray: 40 180;
}

.menu-btn.active .top {
  stroke-dashoffset: -98px;
}

.menu-btn.active .bottom {
  stroke-dashoffset: -138px;
}

.logo-container {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-inline: clamp(0.5rem, 1vw, 1rem);
  text-decoration: none;
}

.logo {
  max-height: 77px;
  width: auto;
  height: auto;
  display: block;
  transition: transform 0.25s ease, filter 0.25s ease;
  contain: layout style;
}

.logo-container::after {
  content: "بازلیوم کشف نشده، ساخته شده‌است";
  position: absolute;
  bottom: -3rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  color: var(--color-secondary);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px) saturate(180%);
  border-radius: 0.5rem;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.logo-container:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.logo-container:hover .logo {
  transform: scale(1.07);
  filter: drop-shadow(0 8px 4px rgba(255, 255, 255, 0.5));
}

.menu {
  position: fixed;
  display: flex;
  flex-direction: column;
  top: 0;
  right: 0;
  height: 100dvh;
  width: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(10px) saturate(180%);
  border-left: 1px solid var(--glass-border);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  z-index: 900;
  transform: translateX(100%);
  padding: 4rem 4.5rem 0 2rem;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 600ms cubic-bezier(0.25, 0.8, 0.25, 1),
    opacity 400ms ease;
  contain: layout style;
}

.menu.visible {
  pointer-events: auto;
}

.menu.animate-in {
  transform: translateX(0);
  opacity: 1;
}

.menustitle {
  position: absolute;
  top: 0;
  left: 1.5rem;
  font-family: Mainenglish, system-ui, sans-serif;
  font-weight: 900;
  color: var(--color-secondary);
  user-select: none;
  pointer-events: none;
  transform-origin: top right;
  display: inline-block;
}

.menuslogan1 {
  position: absolute;
  top: 25%;
  right: 0;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  color: var(--color-secondary);
  user-select: none;
  pointer-events: none;
  transform-origin: top right;
  display: inline-block;
}

.menuslogan1::after {
  content: "";
  position: absolute;
  top: -20%;
  right: 65%;
  transform: translateX(50%) rotate(90deg);
  width: 66px;
  height: 3px;
  background: currentColor;
  border-radius: 1px;
  opacity: 0.7;
}

.iconlists {
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.listitem {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  min-height: var(--listiconsize);
  position: relative;
  transition: transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 1.5rem;
}

.listicon {
  flex: 0 0 var(--listiconsize);
  width: var(--listiconsize);
  height: var(--listiconsize);
  margin-top: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.textgroup {
  display: flex;
  text-decoration: none;
  color: inherit;
  flex-direction: column;
  min-width: 0;
}

.label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
}

.label.english {
  opacity: 0.9;
  font-size: 1.05rem;
  line-height: 1;
  margin-bottom: 0.3rem;
  font-family: Mainenglish, system-ui, sans-serif;
}

.listitem.active .label.english {
  margin-bottom: 1.5rem;
}

.subitems {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-left: calc(var(--listiconsize) - 20px);
  transition: max-height var(--transition-fast), opacity var(--transition-fast);
}

.listitem.active .subitems {
  max-height: 100px;
  opacity: 1;
  padding-bottom: 0.49rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.subicon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.sublabel {
  font-size: 0.8rem;
  opacity: 0.9;
}

.chevron {
  position: absolute;
  right: 0;
  top: 10px;
  font-size: 1.2rem;
  transition: transform var(--transition-fast);
}

.listitem.active .chevron {
  transform: rotate(90deg);
}

.listitem:hover,
.listitem:focus-within {
  transform: translateX(-12px) scale(1.03);
  outline: none;
}

.menuicons {
  flex-shrink: 0;
  margin-top: auto;
  padding-block: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
  font-size: 1.5rem;
  width: 100%;
  max-width: 90%;
  margin-inline: auto;
}

.menuicons .icon {
  width: 1.4em;
  height: 1.4em;
  stroke: currentColor;
  fill: none;
  padding: .1rem;
  stroke-width: 1.5;
  color: var(--color-secondary);
  transition: transform 200ms ease, opacity 200ms ease;
  pointer-events: none;
}

.menuicons a {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 200ms ease, transform 200ms ease;
}

.menuicons a:hover,
.menuicons a:focus-visible {
  opacity: 1;
  transform: translateY(-5px);
  outline: none;
}

.contact_icon {
  position: fixed;
  bottom: 0.45rem;
  left: 0.45rem;
  width: 60px;
  height: 60px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  text-decoration: none;
  z-index: 1000;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  animation: pulseGlow 10s infinite cubic-bezier(.66, 0, 0, 1);
  transition: transform 220ms ease, border-color 220ms ease;
  background: transparent;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45);
  }

  60% {
    box-shadow: 0 0 0 36px rgba(255, 255, 255, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

.contact_icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 200vmax;
  height: 200vmax;
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  pointer-events: none;
  box-sizing: border-box;
  border: 44px solid rgba(255, 255, 255, 0.6);
  opacity: 0.9;
  animation: borderExpand 10s infinite cubic-bezier(.66, 0, 0, 1);
}

@keyframes borderExpand {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.9;
  }

  65% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.0;
  }

  100% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
}

.contact_icon:hover {
  transform: scale(1.15);
  border-color: rgba(255, 255, 255, 0.85);
}

.contact_icon:hover ~ .contactwindow {
  opacity: 0.85;
  transform: scale(0.9);
}

.contactwindow {
  position: fixed;
  width: 92%;
  height: 78%;
  max-width: 20rem;
  max-height: 35rem;
  bottom: 4.7rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: var(--glass-bg);
  backdrop-filter: blur(9px) saturate(180%);
  border-radius: .5rem;
  pointer-events: none;
  border: 1px solid var(--glass-border);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.08), inset 0 0 60px rgba(255, 255, 255, 0.05);
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 1100;
  contain: layout style paint;
  overflow: hidden;
  transform: translateZ(0);
  -webkit-font-smoothing: antialiased;
}

.contactwindow::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 1.5rem;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.08));
  mix-blend-mode: overlay;
}

.contactwindow.is-visible {
  pointer-events: all;
}

.contactwindow.animate-in {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.contactwindow video {
  position: relative;
  width: 100%;
  height: 15rem;
  object-fit: cover;
  object-position: center;
  contain: layout style paint;
  flex-shrink: 0;
  transform: translateZ(0);
}

.callicons {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 18%;
  padding: 1.1rem 1rem 1.1rem 1rem;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  contain: layout style;
  transform: translateZ(0);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.callicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 6rem;
  height: 7rem;
  text-decoration: none;
  transition-duration: 0.25s;
  padding: 0.8rem;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--color-secondary);
  border-radius: 50%;
  cursor: pointer;
  contain: layout style;
  transform: translateZ(0);
  position: relative;
}

.callicon-text {
  display: none;
}

.callicon svg {
  width: 100%;
  height: 100%;
}

.callicon:hover {
  transform: scale(1.15);
  animation: pulseGlow 2s infinite cubic-bezier(.66, 0, 0, 1);
  transition: transform 220ms ease, border-color 220ms ease;
}

.bazeliumsocials {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--color-primary);
  flex: 1;
  contain: layout style;
  transform: translateZ(0);
}

.bazeliumsocials h4 {
  font-size: 1.4rem;
  margin: 0.8rem 0 0.8rem 0;
}

.bazeliumsocials h5 {
  color: var(--color-secondary);
  text-align: center;
  font-size: 1.4rem;
  line-height: 1.5rem;
  letter-spacing: 0.2em;
  margin: 0 0 1.2rem 0;
  opacity: 0.8;
}

.socialicons {
  display: flex;
  justify-content: center;
  padding-bottom: 1.5rem;
  gap: 8%;
  width: 100%;
}

.socialicon {
  display: inline-flex;
  width: 3rem;
  height: 3rem;
  text-decoration: none;
  outline: 2px solid var(--color-secondary);
  border-radius: 50%;
  transition-property: outline-offset, outline-color, background-color;
  transition-duration: 0.25s;
  padding: 0.7rem;
  color: var(--color-secondary);
  cursor: pointer;
}

.socialicon:hover {
  outline-offset: 4px;
}

.socialicon svg {
  margin: auto;
  width: 31px;
}

.icon-youtube:hover,
.icon-instagram:hover {
  background-color: red;
  outline-color: red;
}

.icon-location:hover {
  background-color: rgb(76, 0, 255);
  outline-color: rgb(76, 0, 255);
}

.icon-in:hover {
  background-color: #0a66c2;
  outline-color: #0a66c2;
}

.socialicon:hover svg {
  animation: shake 0.25s;
}

@keyframes shake {
  10% {
    transform: rotate(15deg);
  }

  20% {
    transform: rotate(-15deg);
  }
}

/* Common Media Queries */
@media (min-width: 768px) {
  .callicons {
    flex-direction: column;
    gap: 0.8rem;
    align-items: flex-end;
    padding: 1rem;
    width: 100%;
  }

  .callicon {
    width: auto;
    height: auto;
    min-height: auto;
    padding: 0.5rem 0.8rem;
    border-radius: 0.5rem;
    flex-direction: row;
    gap: 0.8rem;
    justify-content: flex-start;
  }

  .callicon-text {
    display: inline-block;
    font-size: 0.95rem;
    direction: ltr;
    white-space: nowrap;
    font-family: Mainenglish, system-ui, sans-serif;
    order: 1;
  }

  .callicon svg {
    width: 1.5rem;
    height: 1.5rem;
    order: 2;
    flex-shrink: 0;
  }

  .callicon:hover {
    transform: scale(1.05);
  }
}

@media (max-width: 768px) {
  .topnavbar {
    padding: 0.75rem 1rem;
  }

  .logo {
    max-height: 66px;
  }

  .nav-btn {
    min-width: 40px;
    min-height: 40px;
    font-size: 0.8rem;
  }

  .menu {
    width: 75%;
  }
}

@media (prefers-contrast: high) {
  .nav-btn:focus {
    outline: 3px solid var(--color-secondary);
  }

  .topnavbar {
    background-color: rgba(0, 0, 0, 0.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .menu {
    transition: none;
    transform: scaleX(1);
    opacity: 1;
  }

  .menuicons a,
  .menuicons .icon {
    transition: none;
  }

  .listitem {
    transform: scale(1);
  }
}

@media print {
  body {
    background: var(--color-primary);
    color: var(--color-secondary);
  }

  .menu,
  .contactwindow,
  .contact_icon {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
 * Touch-device scroll performance overrides.
 *
 * The shared chrome (top nav, side menu, contact panel, floating call icon)
 * uses `backdrop-filter: blur(...)` to render the glass look. On desktop GPUs
 * this is fine; on phones each blurred fixed/absolute layer forces an
 * offscreen GPU pass for every scroll frame, which is the main reason finger
 * scrolling feels heavy in some regions of the page. We swap the blurs for
 * solid translucent surfaces of the same color so the look stays close to the
 * original and the GPU only composites cheap bitmaps while the page moves.
 * ------------------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse), (max-width: 1024px) {
  html,
  body {
    scroll-behavior: auto;
    overscroll-behavior-y: contain;
  }

  .topnavbar.blackbg {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(0, 0, 0, 0.92);
  }

  .menu {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(20, 20, 20, 0.97);
  }

  .contactwindow {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(20, 20, 20, 0.97);
  }

  .callicons {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(0, 0, 0, 0.65);
  }

  .logo-container::after {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(0, 0, 0, 0.85);
  }
  body.is-scrolling .contact_icon,
  body.is-scrolling .contact_icon::after {
    animation-play-state: paused;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
