:root {
  --color-primary: #b3b3b3;
  --color-text: #fff;
  --color-black: #000;
  --transition-base: 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Work Sans", sans-serif;
  font-size: clamp(16px, 0.25vw + 1rem, 24px);
  line-height: 1.6;
  color: var(--color-text);
  background-image: url("./assets/images/main-bg_mb.avif");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: top;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.container {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  padding-right: 0.9rem;
  padding-left: 0.9rem;
  padding-top: 28vh;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

/* Social Media Links */
.social-links {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2em;
  margin-bottom: 2em;
}

.social-link {
  width: 55px;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  border-radius: 50%;
  transition: all var(--transition-base);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.social-link::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--color-primary);
  transform: translate(-50%, -50%);
  transition: width var(--transition-base), height var(--transition-base);
}

.social-link:hover,
.social-link:focus {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 5px 5px rgba(210, 205, 197, 0.4);
  outline: none;
}

.social-link:hover::before,
.social-link:focus::before {
  width: 100%;
  height: 100%;
}

.social-link:hover svg,
.social-link:focus svg {
  position: relative;
  z-index: 1;
  filter: invert(1);
}

.social-link svg {
  width: 38px;
  height: 38px;
  transition: filter var(--transition-base);
  fill: var(--color-black);
}

/* Description */
.description {
  text-align: center;
  margin: 0 auto 4em;
}

/* Contact Section */
.contact-section {
  text-align: center;
}

.contact-title {
  font-weight: 600;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.contact-section a {
  color: var(--color-text);
  text-decoration: none;
  transition: all 0.2s ease;
  margin-top: 10px;
}

.contact-section a:hover {
  border-bottom: 1px solid currentColor;
}

/* Footer Credits */
.footer-credits {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: clamp(12px, 0.2vw + 0.75rem, 16px);
  margin: 0;
  padding: 0 0.75rem;
  white-space: nowrap;
  z-index: 10;
}

/* ==========================================
   IN-APP BROWSER DETECTION (CSS Only)
   ========================================== */

/* Method 1: Safe Area Inset + Constrained Height */
/* In-app browsers often handle safe areas differently AND have constrained viewport */
/* Combine safe-area support with height constraints to avoid matching Safari */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (orientation: portrait) 
    and (max-width: 480px) 
    and (max-height: 700px)
    and (min-height: 500px) {
    .container {
      padding-top: clamp(180px, 32vh, 410px);
    }
  }
}

/* Method 2: Display Mode Detection */
/* Some in-app browsers trigger standalone display mode */
@media (display-mode: standalone) {
  .container {
    padding-top: clamp(200px, 36vh, 450px);
  }
}

/* Method 3: Screen Height Sniffing - Most Specific */
/* In-app browsers have unique dimensions due to browser UI */
/* Target specific height ranges that are common for in-app browsers */
/* but unlikely for standard Safari (which typically has > 800px height) */
@media screen 
  and (orientation: portrait) 
  and (max-device-width: 480px) 
  and (max-height: 650px)
  and (min-height: 550px) {
   .container {
     padding-top: clamp(180px, 32vh, 410px);
   }
}

/* Tablet and larger mobile devices */
@media (min-width: 476px) {
  .social-links {
    gap: 2.2em;
    margin-bottom: 2.5em;
  }

  .description {
    margin-bottom: 2.5em;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

/* Medium devices (tablets, 768px and up) - Portrait */
@media (min-width: 768px) and (orientation: portrait) {
  body {
    background-image: url("./assets/images/main-bg.avif");
  }

  .container {
    max-width: 720px;
    padding-top: 48vh;
  }

  .social-links {
    gap: 2.5em;
    margin-bottom: 3em;
  }

  .social-link {
    width: 64px;
    height: 64px;
  }

  .social-link svg {
    width: 44px;
    height: 44px;
  }

  .description {
    margin-bottom: 3em;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .container {
    max-width: 960px;
    padding-top: 74vh;
  }

  body {
    background-image: url("./assets/images/main-bg.avif");
  }

  .social-links {
    gap: 2.5em;
  }

  .social-link {
    width: 68px;
    height: 68px;
  }

  .social-link svg {
    width: 47px;
    height: 47px;
  }

  .description {
    max-width: 850px;
  }

  .footer-credits {
    left: auto;
    right: 1.5rem;
    transform: none;
    text-align: right;
  }
}

/* Laptop sizes (992px to 1400px) - Increase padding */
@media (min-width: 992px) and (max-width: 1399px) {
  .container {
    padding-top: 78vh;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Extra extra large devices (larger desktops, 1400px and up) */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
}

/* Ultra-wide desktops (1920px and up) - Bigger social icons */
@media (min-width: 1920px) {
  .social-links {
    gap: 3em;
  }

  .social-link {
    width: 72px;
    height: 72px;
  }

  .social-link svg {
    width: 50px;
    height: 50px;
  }
}

/* Extra ultra-wide desktops (2000px and up) - Increase padding */
@media (min-width: 2000px) {
  .container {
    padding-top: clamp(55vh, 62vh, 65vh);
  }
}

/* ==========================================
   LANDSCAPE ORIENTATION
   ========================================== */

/* Landscape phones (height 390-600px) */
@media (orientation: landscape) and (max-height: 600px) {
  .container {
    padding-top: clamp(165px, calc(41vh + (100vh - 390px) * 0.035), 200px);
  }

  .social-links {
    margin-bottom: 1.5em;
    gap: 2em;
  }

  .social-link {
    width: clamp(55px, 4vw, 68px);
    height: clamp(55px, 4vw, 68px);
  }

  .social-link svg {
    width: clamp(38px, 2.76vw, 47px);
    height: clamp(38px, 2.76vw, 47px);
  }

  .description {
    margin-bottom: 1.5em;
  }
}

/* Landscape tablets and small desktops (height 600-1024px) */
@media (orientation: landscape) and (min-width: 768px) and (max-height: 1024px) {
  body {
    background-image: url("./assets/images/main-bg.avif");
  }

  .container {
    padding-top: clamp(260px, calc(52vh + (100vh - 600px) * 0.019), 520px);
  }

  .social-links {
    gap: 2.5em;
    margin-bottom: 2.5em;
  }

  .social-link {
    width: clamp(64px, 4vw, 72px);
    height: clamp(64px, 4vw, 72px);
  }

  .social-link svg {
    width: clamp(44px, 2.76vw, 50px);
    height: clamp(44px, 2.76vw, 50px);
  }

  .description {
    margin-bottom: 2.5em;
  }
}

/* Landscape large tablets and desktops (height > 1024px, width < 2000px) */
@media (orientation: landscape) and (min-height: 1025px) and (max-width: 1999px) {
  body {
    background-image: url("./assets/images/main-bg.avif");
  }

  .container {
    padding-top: 48vh;
  }
}

/* ==========================================
   ACCESSIBILITY & PRINT
   ========================================== */

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .social-link {
    transition: none;
  }

  .social-link::before {
    transition: none;
  }

  .social-link svg {
    transition: none;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: #333;
  }

  .social-links {
    display: none;
  }
}
