/* ==========================================================================
   XTM.RO - Design System & Styles
   Version: 1.0
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Colors - Cool blue-black tinted dark mode */
  --bg-primary: #0d0d12;
  --bg-secondary: #14141a;
  --bg-elevated: #1a1a22;
  --text-primary: #ffffff;
  --text-secondary: #888899;
  --text-muted: #555566;

  /* Skeleton loader colors */
  --skeleton-base: #1a1a22;
  --skeleton-pulse: #242430;

  /* Spacing scale (8px base) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;

  /* Typography */
  --font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;

  /* Header */
  --header-height: 64px;
  --header-padding: var(--space-3);

  /* Animation */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 200ms;
  --duration-normal: 400ms;
  --duration-slow: 600ms;

  /* Z-index layers */
  --z-content: 1;
  --z-header: 100;
  --z-gdpr: 200;
  --z-overlay: 300;
}

/* Mobile adjustments */
@media (max-width: 767px) {
  :root {
    --header-padding: var(--space-2);
    --header-height: 56px;
  }
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Remove default link styles */
a {
  color: inherit;
  text-decoration: none;
}

/* Remove button styles */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* Hide elements */
[hidden],
#fallback[hidden],
.fallback[hidden] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  padding: 0 var(--header-padding);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(13, 13, 18, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: var(--z-header);

  /* Entrance animation */
  animation: headerFadeIn var(--duration-slow) var(--ease-out-expo) forwards;
  opacity: 0;
  transform: translateY(-10px);
}

@keyframes headerFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Logo */
.header__logo {
  display: flex;
  align-items: center;
}

.logo-text {
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

@media (max-width: 767px) {
  .logo-text {
    font-size: var(--font-size-sm);
  }
}

/* Navigation */
.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

@media (min-width: 768px) {
  .header__nav {
    gap: var(--space-3);
  }
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--text-primary);
  transition: opacity var(--duration-fast) var(--ease-in-out),
              transform var(--duration-fast) var(--ease-in-out);
}

.nav-icon:hover {
  opacity: 0.7;
}

.nav-icon:active {
  transform: scale(0.95);
}

.nav-icon svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 767px) {
  .nav-icon svg {
    width: 18px;
    height: 18px;
  }
}

/* --------------------------------------------------------------------------
   Main Feed
   -------------------------------------------------------------------------- */
.feed {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  z-index: var(--z-content);
}

/* Hide scrollbar but keep functionality */
.feed::-webkit-scrollbar {
  display: none;
}

.feed {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.feed__container {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --------------------------------------------------------------------------
   Skeleton Loader
   -------------------------------------------------------------------------- */
.skeleton {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity var(--duration-normal) var(--ease-out-expo);
  pointer-events: none;
}

.skeleton.is-hidden,
#skeleton:empty {
  opacity: 0;
  visibility: hidden;
  display: none !important;
}

.skeleton__pulse {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    110deg,
    var(--skeleton-base) 0%,
    var(--skeleton-base) 40%,
    var(--skeleton-pulse) 50%,
    var(--skeleton-base) 60%,
    var(--skeleton-base) 100%
  );
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* --------------------------------------------------------------------------
   Behold Feed Overrides
   -------------------------------------------------------------------------- */

/* Container */
[data-behold-id] {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-primary);
}

.feed__container {
  position: relative;
  z-index: 10;
}

/* --------------------------------------------------------------------------
   Fallback State
   -------------------------------------------------------------------------- */
.fallback {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-primary);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-content);
}

.fallback[hidden] {
  display: none !important;
}

.fallback.is-visible {
  display: flex;
}

.fallback__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
  padding: var(--space-3);
}

.fallback__logo {
  font-size: 48px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-primary);
}

.fallback__link {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--text-muted);
  border-radius: 8px;
  transition: all var(--duration-fast) var(--ease-in-out);
}

.fallback__link:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-1) var(--space-2);
  background: rgba(13, 13, 18, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
  z-index: var(--z-header);
}

.footer__sep {
  opacity: 0.4;
}

.footer__contact {
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-in-out);
}

.footer__contact:hover {
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .footer {
    font-size: 9px;
    padding: 6px var(--space-1);
    gap: 4px;
  }

  .footer__sep:nth-of-type(n+3) {
    display: none;
  }

  .footer span:nth-of-type(n+4) {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   GDPR Consent Bar
   -------------------------------------------------------------------------- */
.gdpr {
  position: fixed;
  bottom: 32px; /* Above footer */
  left: 0;
  right: 0;
  padding: var(--space-2) var(--space-3);
  background: rgba(13, 13, 18, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  z-index: var(--z-gdpr);

  /* Entrance animation */
  animation: gdprSlideUp var(--duration-normal) var(--ease-out-expo) forwards;
  transform: translateY(100%);
}

@keyframes gdprSlideUp {
  to {
    transform: translateY(0);
  }
}

.gdpr__text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.gdpr__accept {
  padding: var(--space-1) var(--space-2);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: 4px;
  transition: opacity var(--duration-fast) var(--ease-in-out),
              transform var(--duration-fast) var(--ease-in-out);
}

.gdpr__accept:hover {
  opacity: 0.9;
}

.gdpr__accept:active {
  transform: scale(0.97);
}

/* Mobile stack layout for GDPR */
@media (max-width: 400px) {
  .gdpr {
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2);
  }
}

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

  .feed {
    scroll-behavior: auto;
  }

  .skeleton__pulse {
    animation: none;
    background: var(--skeleton-base);
  }

  .header,
  .gdpr {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Safe Area Insets (for notched devices)
   -------------------------------------------------------------------------- */
@supports (padding: env(safe-area-inset-top)) {
  .header {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--header-height) + env(safe-area-inset-top));
  }

  .gdpr {
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
  }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  .header,
  .gdpr,
  .skeleton {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }
}
