/* ===========================
   BOOTSTRAP VERSION (Wersja B)
   Custom styles for 356.pl
   =========================== */

/* ===========================
   GLOBAL RESET & BASE STYLES
   =========================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --white: #ffffff;
  --black: #000000;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --tile-bg: rgba(255, 255, 255, 0.3);
  --tile-shadow: rgba(0, 0, 0, 0.1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  /* Fixed background na body - zawsze widoczny podczas scrollowania */
  background-image: url('../img/356dbg2.png');
  background-size: auto 100%; /* Wysokość 100% - ZAWSZE widoczna GÓRA i DÓŁ */
  background-position: center center;
  background-repeat: no-repeat;
  background-color: #ffffff; /* Fallback color jeśli obraz się nie załaduje */
  background-attachment: fixed; /* Background FIXED - nie scrolluje */
}

/* Hide mobile background on desktop */
.mobile-background {
  display: none;
}

/* Hide mobile email section on desktop */
.email-mobile {
  display: none;
}

/* ===========================
   LAYOUT STRUCTURE
   =========================== */

.page-container {
  width: 100%;
  min-height: 100vh;
  position: relative;
  /* Background przeniesiony na body - aby był widoczny podczas scrollowania */
}

/* Hero Section - with background image */
.hero-section {
  width: 100%;
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: clamp(20px, 2vh, 30px) 0 clamp(60px, 8vh, 100px) 0;
}

.hero-section .container-fluid {
  max-width: 100%;
  padding: 0;
}

/* Hero Content - Title and Email */
.hero-content {
  position: absolute;
  top: clamp(20px, 3vh, 30px);
  left: calc(50% - 70.3125vh + 10.75vh);
  width: calc(129.875vh - 10.75vh);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.site-title {
  font-size: 17px;
  font-weight: 100;
  color: var(--text-secondary);
  margin-bottom: 0;
  line-height: 1.1;
  flex-shrink: 0;
}

.email-link {
  font-size: 17px;
  font-weight: 100;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
  flex-shrink: 0;
}

.email-link:hover {
  color: var(--black);
  text-decoration: underline;
}

/* Language Switcher - Right Top Corner */
.language-switcher-top {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lang-flag {
  font-family: 'Roboto Flex', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.lang-flag:hover {
  color: var(--black);
  border-color: var(--black);
}

.lang-flag.active {
  color: var(--black);
  font-weight: 600;
  border-color: var(--black);
  background-color: rgba(0, 0, 0, 0.05);
}

/* Text Section */
.text-section {
  width: calc(129.875vh - 10.75vh);
  position: absolute;
  top: calc(12px + 228px);
  left: calc(50% - 70.3125vh + 10.75vh);
}

.text-section .container-fluid {
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
}

/* Tiles Section */
.tiles-section {
  width: calc(129.875vh - 10.75vh);
  position: absolute;
  top: clamp(500px, calc(270px + 20vh), 650px); /* Dynamiczne skalowanie */
  left: calc(50% - 70.3125vh + 10.75vh);
}

/* Optymalizacja dla średnich wysokości ekranu (jak 1200x700) */
@media (min-height: 650px) and (max-height: 850px) {
  .tiles-section {
    top: 570px; /* Stałe 570px dla średnich wysokości */
  }
}

.tiles-section .container-fluid {
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
}

/* Header Text */
.main-heading {
  font-family: 'Roboto Flex', system-ui, sans-serif;
  font-size: 56px; /* Zmienione z 57px na parzysty rozmiar dla lepszego renderowania */
  line-height: 64px;
  font-weight: 400; /* Zmienione z 450 na standardowe 400 dla lepszego renderowania */
  letter-spacing: 0;
  color: var(--black);
  margin-bottom: 10px; /* Stały odstęp od podtytułu */
  /* Agresywna optymalizacja renderowania czcionki */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-smooth: always;
  -webkit-font-feature-settings: "kern" 1;
  font-feature-settings: "kern" 1;
  font-kerning: normal;
  /* GPU acceleration dla lepszego renderowania */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
  /* Wymuszenie wysokiej jakości renderowania */
  image-rendering: -webkit-optimize-contrast;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.subheading {
  font-size: 17px;
  font-weight: 100;
  color: var(--text-secondary);
  line-height: 1;
  letter-spacing: 0.7px;
  /*margin-bottom: 80px; !* Zwiększone z 60px - większy buffer dla kafelków *!*/
}

/* ===========================
   TILES SECTION - DESKTOP
   =========================== */

/* Custom gap for tiles */
.g-tiles {
  gap: 3.91vh;
}

.tile-col {
  padding: 0;
}

/* Tile widths matching original */
@media (min-width: 992px) {
  .tile-col:nth-child(1) {
    flex: 0 0 calc((51.69vh - 10.75vh - 3.91vh) / (129.875vh - 10.75vh) * 100%);
    max-width: calc((51.69vh - 10.75vh - 3.91vh) / (129.875vh - 10.75vh) * 100%);
  }

  .tile-col:nth-child(2) {
    flex: 0 0 calc((92.60vh - 51.69vh - 3.91vh) / (129.875vh - 10.75vh) * 100%);
    max-width: calc((92.60vh - 51.69vh - 3.91vh) / (129.875vh - 10.75vh) * 100%);
  }

  .tile-col:nth-child(3) {
    flex: 0 0 calc((129.875vh - 92.60vh) / (129.875vh - 10.75vh) * 100%);
    max-width: calc((129.875vh - 92.60vh) / (129.875vh - 10.75vh) * 100%);
  }
}

.tile {
  background-color: var(--tile-bg);
  border-radius: 20px;
  padding: clamp(20px, 1.5vw, 40px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.5vh, 20px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  min-height: 300px;
  position: relative;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Czarna kropka w linii z tytułem kafelka */
.tile::before {
  content: '';
  position: absolute;
  top: calc(clamp(20px, 1.5vw, 40px) + 5px);
  left: clamp(20px, 1.5vw, 40px);
  width: 29px;
  height: 29px;
  background-color: var(--black);
  border-radius: 50%;
  flex-shrink: 0;
}

.tile:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px var(--tile-shadow);
}

.tile-title {
  font-size: 32px;
  font-weight: 400;
  color: var(--black);
  line-height: 1.2;
  margin-bottom: clamp(8px, 1vh, 12px);
  padding-left: 24px; /* Stała odległość od lewej krawędzi (29px kropka + 15px gap) */
  margin-left: clamp(20px, 1.5vw, 40px); /* Synchronizacja z padding kafelka */
}

.tile-description {
  font-size: 17px;
  font-weight: 100;
  color: var(--text-secondary);
  line-height: 1.6;
  flex-grow: 1;
}

.tile-link {
  font-size: 17px;
  font-weight: 400;
  color: var(--black);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding-bottom: 2px;
  transition: opacity 0.3s ease;
}

.tile-link::before {
  content: '';
  display: inline-block;
  width: 25px;
  height: 25px;
  background-image: url('../img/instagram-icon.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

.tile-link:hover {
  opacity: 0.7;
}

/* QR Code w prawym dolnym rogu kafelka */
.qr-code {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 80px;
  height: 80px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border: none;
  outline: none;
}

.driveandrollQr {
  background-image: url('../img/driveandroll.png');
}

.marcoporscheQr {
  background-image: url('../img/marcoporsche.png');
}

.autoretroQr {
  background-image: url('../img/autoretro.png');
}

/* ===========================
   RESPONSIVE - MOBILE
   =========================== */

/* Mobile mode starts at 991px OR when height is too small for tiles in one row */

@media screen and (max-width: 991px), screen and (max-height: 700px) {
  body {
    background-image: none; /* Ukryj desktop background */
    background-color: transparent;
  }

  /* Language Switcher - adjusted for mobile */
  .language-switcher-top {
    top: 15px;
    right: 15px;
    padding: 6px 10px;
    gap: 8px;
  }

  .lang-flag {
    font-size: 13px;
    padding: 3px 6px;
  }

  .page-container {
    background-image: none;
    background-color: transparent;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    position: relative;
  }

  /* Fixed background element for mobile */
  .mobile-background {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-image: url('../img/356mbg2.png');
    background-size: 100% auto; /* Szerokość 100% (bez marginesów), wysokość auto */
    background-position: top center; /* Góra widoczna, wyśrodkowane poziomo */
    background-repeat: no-repeat;
    z-index: -1;
  }


  /* Ukryj Hero Section (tytuł i email) na mobile */
  .hero-section {
    display: none;
  }

  /* Email link na dole strony w wersji mobilnej */
  .email-mobile {
    display: block;
    text-align: center;
    padding: 30px 25px 40px 25px;
  }

  .email-mobile .email-link {
    font-size: 17px;
    font-weight: 100;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
  }

  .email-mobile .email-link:hover {
    color: var(--black);
    text-decoration: underline;
  }

  /* Text Section - wyłącz absolute positioning */
  .text-section {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    padding: 130px 0 40px 0; /* Zwiększone padding-bottom z 20px na 40px */
  }

  .text-section .container-fluid {
    padding: 0 25px;
  }

  .main-heading {
    font-size: 28px;
    line-height: 34px;
    font-weight: 450;
    margin-bottom: 15px;
  }

  .subheading {
    font-size: 12px;
    font-weight: 100;
    line-height: 1.5;
    letter-spacing: 0.5px;
    margin-bottom: 0; /* Odstęp jest już w padding text-section */
  }

  /* Tiles Section - wyłącz absolute positioning */
  .tiles-section {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    padding: 40px 0 30px 0; /* Padding-top zmniejszone - odstęp jest już w text-section */
  }

  .tiles-section .container-fluid {
    padding: 0 25px;
  }

  /* Mobile: Stack tiles vertically */
  .g-tiles {
    gap: 15px;
  }

  .tile-col {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .tile {
    min-height: auto;
    padding: 20px;
    width: 100%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  /* Kropka w kafelku - synchronizowana z padding */
  .tile::before {
    top: 25px;
    left: 20px;
    width: 29px;
    height: 29px;
  }

  .tile-title {
    font-size: 32px;
    font-weight: 400;
    padding-left: 20px; /* Stała odległość od kropki */
    margin-left: 20px; /* Synchronizacja z padding kafelka */
  }

  .tile-description {
    font-size: 14px;
    font-weight: 100;
    line-height: 1.6;
  }

  .tile-link {
    font-size: 17px;
    font-weight: 400;
  }

  .tile-link::before {
    width: 20px;
    height: 20px;
  }

  /* Ukryj QR kody na mobile */
  .qr-code {
    display: none;
  }

  /* Logo Container - Mobile Version */
  .logo-container {
    top: 15px !important;
    left: 15px !important;
    transform: none !important; /* Usuń wyśrodkowanie na mobile - lewy górny róg */
  }

  .logo-image {
    width: auto; /* Auto width zachowuje proporcje */
    height: 4vh; /* Skalowanie względem wysokości viewportu - zachowuje proporcje */
    max-height: 35px;
    min-height: 20px;
  }
}

/* ===========================
   RESPONSIVE - VERY SMALL SCREENS
   =========================== */

@media screen and (max-width: 480px) {
  .hero-section {
    padding: 12px 0 15px 0;
  }

  .hero-content {
    padding: 0 22px;
    gap: 6px;
  }

  .text-section .container-fluid,
  .tiles-section .container-fluid {
    padding: 0 22px;
  }

  .site-title {
    font-size: 14px;
  }

  .email-link {
    font-size: 11px;
  }

  .main-heading {
    font-size: 28px;
    line-height: 30px;
    margin-bottom: 12px;
  }

  .subheading {
    font-size: 15px;
  }

  .g-tiles {
    gap: 12px;
  }

  .tile {
    padding: 15px;
  }

  .tile::before {
    width: 17px;
    height: 17px;
    left: 15px;
    top: 20px;
  }

  .tile-title {
    font-size: 20px;
    padding-left: 20px; /* Stała odległość od kropki */
    margin-left: 15px; /* Synchronizacja z padding kafelka */
  }

  .tile-description {
    font-size: 15px;
  }

  .tile-link {
    font-size: 17px;
  }

  .tile-link::before {
    width: 18px;
    height: 18px;
  }
}

/* ===========================
   WIDE SCREEN OPTIMIZATION
   =========================== */

@media screen and (min-width: 1920px) {
  .hero-section {
    padding-top: 100px;
  }
}

/* ===========================
   LOGO CONTAINER (Red Dot Position)
   =========================== */

.logo-container {
  position: fixed;
  top: clamp(20px, 3vh, 30px);
  left: 50%;
  transform: translateX(-50%); /* Wyśrodkowanie */
  z-index: 999;
}

.logo-image {
  display: block;
  width: auto;
  height: 15vh; /* Skalowanie względem wysokości viewportu, tak samo jak background */
  max-height: 200px;
  min-height: 80px;
}


/* ===========================
   ASPECT RATIO OPTIMIZATION (16:10)
   =========================== */

@media screen and (aspect-ratio: 16/10) {
  .hero-section {
    min-height: 45vh;
  }
}

/* ===========================
   PRINT STYLES
   =========================== */

@media print {
  .page-container {
    background-image: none;
    background-color: var(--white);
  }

  .tile {
    break-inside: avoid;
  }
}
