/* ===================================
   Home Module Styles
   Stitch Immersive Design
   Based on engadinnow_immersive_home_screen template
   =================================== */

/* Home Section Container */
#home-view {
  background-color: var(--bg-dark-primary);
  min-height: 100vh;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ===== Background Image Grid - 6 images mosaic ===== */
.home-image-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: auto;
  gap: 12px;
  padding: 12px;
  padding-bottom: 100px;
  /* Enable pointer events for clickable cells */
  pointer-events: auto;
  overflow: visible;
}

/* Image Cell - Now a clickable button */
.home-image-cell {
  position: relative;
  border-radius: var(--radius-lg, 8px);
  overflow: hidden;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Hover effect - scale up slightly */
.home-image-cell:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.home-image-cell:active {
  transform: scale(0.98);
}

/* Tall cell - spans 2 rows */
.home-image-cell--tall {
  grid-row: span 2;
}

/* Wide cell - spans 2 columns */
.home-image-cell--wide {
  grid-column: span 2;
}

.home-image-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.3s ease;
  z-index: 0;
}

/* Zoom image on hover */
.home-image-cell:hover .home-image-bg {
  transform: scale(1.05);
}

/* Hover overlay */
.home-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 212, 115, 0);
  transition: background 0.3s ease;
  pointer-events: none;
  z-index: 5;
}

.home-image-cell:hover .home-image-overlay {
  background: rgba(17, 212, 115, 0.1);
}

/* ===== Home Card Labels ===== */
.home-card-label {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 30;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
}

/* Move card - show bottom of image (car) */
.home-image-cell--move .home-image-bg {
  background-position: center 85%;
}

/* ===== Gradient Overlays ===== */
.home-gradient-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 128px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), transparent);
  pointer-events: none;
  z-index: 2;
}

.home-gradient-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 128px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
  pointer-events: none;
  z-index: 2;
}

/* ===== Content Overlay ===== */
.home-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 12px 20px;
  pointer-events: none;
}

/* Allow pointer events on interactive elements */
.home-content > * {
  pointer-events: auto;
}

/* ===== Home Header ===== */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-header-btn {
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 9999px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.home-header-icon {
  width: 20px;
  height: 20px;
  color: rgba(255, 255, 255, 0.9);
}

/* Header Logo Button (left side) */
.home-header-logo-btn {
  padding: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.home-header-logo-btn:hover {
  opacity: 0.8;
}

.home-header-logo-btn:active {
  transform: scale(0.95);
}

.home-header-logo {
  width: 36px;
  height: 36px;
  filter: brightness(0) invert(1) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
  opacity: 0.95;
  display: block;
}

/* ===== Spacer ===== */
.home-spacer {
  flex: 1;
  pointer-events: none;
}

/* ===== Home Bottom Navigation - Stitch Style ===== */
.home-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
}

.home-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  border: none;
  border-radius: 9999px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.home-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.home-nav-btn.active {
  background: rgba(255, 255, 255, 0.15);
}

.home-nav-btn .material-symbols-outlined {
  font-size: 24px;
  font-variation-settings: 'FILL' 0, 'wght' 200, 'opsz' 20;
}

/* ===== Legacy Support - Hero Content (if needed) ===== */
.home-hero {
  text-align: center;
  padding-bottom: calc(var(--space-8, 32px) + 80px);
}

.home-hero-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4, 16px);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.home-hero-title {
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
  font-size: var(--text-2xl, 24px);
  font-weight: 700;
  color: var(--text-dark-primary, #ffffff);
  margin-bottom: var(--space-2, 8px);
  letter-spacing: -0.01em;
}

.home-hero-subtitle {
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
  font-size: var(--text-sm, 14px);
  font-weight: 300;
  color: var(--text-dark-muted, rgba(255, 255, 255, 0.6));
  max-width: 300px;
  margin: 0 auto var(--space-6, 24px);
  line-height: 1.5;
}

.home-hero-cta {
  margin: 0 auto;
}

.home-hero-dots {
  margin-top: var(--space-6, 24px);
}

/* ===== Home Weather Widget ===== */
.home-weather-widget {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg, 8px);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.home-weather-widget:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.home-weather-widget:active {
  transform: scale(0.98);
}

/* Weather Background Image */
.home-weather-widget .weather-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, opacity 0.5s ease;
}

.home-weather-widget:hover .weather-bg {
  transform: scale(1.05);
}

/* Weather Overlay with gradient - centered content */
.home-weather-widget .weather-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-5, 1.25rem);
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.5) 0%,
    rgba(0, 0, 0, 0.2) 50%,
    rgba(0, 0, 0, 0.3) 100%
  );
  pointer-events: none;
}

/* Location label */
.home-weather-widget .weather-location {
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  margin-bottom: var(--space-3, 0.75rem);
}

/* Temperature and icon row */
.home-weather-widget .weather-data {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 0.5rem);
  margin-bottom: var(--space-2, 0.5rem);
}

.home-weather-widget .weather-icon {
  font-size: 1.5rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.home-weather-widget .weather-icon .material-symbols-outlined {
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.95);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'opsz' 24;
}

.home-weather-widget .weather-temp {
  font-family: var(--font-mono, 'Roboto Mono', monospace);
  font-size: 1.75rem;
  font-weight: 300;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  letter-spacing: -0.02em;
}

/* Condition text */
.home-weather-widget .weather-condition {
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Loading state */
.home-weather-widget.loading .weather-bg {
  opacity: 0.5;
}

.home-weather-widget.loading .weather-data {
  opacity: 0.7;
}

/* Pulse animation for loading */
@keyframes weather-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.home-weather-widget.loading .weather-temp {
  animation: weather-pulse 1.5s ease-in-out infinite;
}

/* ===== Weather Widget Expanded State ===== */
.home-weather-widget {
  transition: all 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Background image zoom transition */
.home-weather-widget .weather-bg {
  transition: transform 0.6s cubic-bezier(0.32, 0.72, 0, 1);
}

.home-weather-widget.expanded .weather-bg {
  transform: scale(1.05);
}

/* Expanding animation */
.home-weather-widget.expanding {
  animation: expandWidget 0.5s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

@keyframes expandWidget {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Collapsing animation */
.home-weather-widget.collapsing {
  animation: collapseWidget 0.4s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

@keyframes collapseWidget {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
}

/* Staggered content animations */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.home-weather-widget.expanded .weather-expanded-location {
  animation: fadeInUp 0.4s ease-out 0.1s both;
}

.home-weather-widget.expanded .weather-expanded-temp {
  animation: fadeInUp 0.4s ease-out 0.2s both;
}

.home-weather-widget.expanded .weather-expanded-condition {
  animation: fadeInUp 0.4s ease-out 0.3s both;
}

.home-weather-widget.expanded .weather-forecast-section {
  animation: fadeInUp 0.4s ease-out 0.4s both;
}

.home-weather-widget.expanded .gesture-indicator {
  animation: fadeIn 0.4s ease-out 0.5s both;
}

.home-weather-widget.expanded {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  transform: none !important;
  overflow: visible !important;
}

.home-weather-widget.expanded:hover {
  transform: none;
  box-shadow: none;
}

.home-weather-widget.expanded .weather-bg {
  transform: none;
}

/* Hide collapsed overlay when expanded */
.home-weather-widget.expanded .weather-overlay {
  display: none;
}

/* Expanded Content Container */
.weather-expanded-content {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  padding: 20px;
  padding-top: calc(env(safe-area-inset-top, 20px) + 20px);
  padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 40px);
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0.2) 30%,
    rgba(0, 0, 0, 0.5) 70%,
    rgba(0, 0, 0, 0.7) 100%
  );
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.home-weather-widget.expanded .weather-expanded-content {
  display: flex;
}

/* Expanded Logo */
.weather-expanded-logo {
  position: absolute;
  top: calc(env(safe-area-inset-top, 16px) + 20px);
  right: 16px;
  width: 36px;
  height: 36px;
  filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  opacity: 0.9;
  z-index: 20;
}

/* Expanded Main Content */
.weather-expanded-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  padding-top: 60px;
}

.weather-expanded-location {
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  margin-bottom: 12px;
}

.weather-expanded-temp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.weather-expanded-icon {
  font-size: 3.5rem;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  font-variation-settings: 'FILL' 0, 'wght' 200, 'opsz' 48;
}

.weather-expanded-degrees {
  font-family: var(--font-mono, 'Roboto Mono', monospace);
  font-size: 4.5rem;
  font-weight: 300;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  letter-spacing: -0.03em;
}

.weather-expanded-condition {
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
  font-size: 1rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  margin-top: 12px;
}

/* Forecast Section */
.weather-forecast-section {
  padding: 24px 0;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.weather-forecast-title {
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin: 0 0 16px 0;
}

.weather-forecast-days {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.forecast-day {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 16px 20px;
  text-align: center;
  color: white;
  min-width: 85px;
  transition: background 0.2s ease;
}

.forecast-day:hover {
  background: rgba(255, 255, 255, 0.15);
}

.forecast-day-name {
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
}

.forecast-day-icon {
  font-size: 1.75rem;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 8px;
  display: block;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'opsz' 24;
}

.forecast-day-temps {
  font-family: var(--font-mono, 'Roboto Mono', monospace);
  font-size: 0.875rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: -0.02em;
}

/* Gesture Indicator */
.gesture-indicator {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 20px) + 20px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.gesture-pill {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 2px;
}

.gesture-hint {
  font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  line-height: 1.4;
  padding: 0 20px;
}
