/* ========================================
   Mobile Link Hub - Dark/Light Theme
   Brand Color: #a98f71
======================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&display=swap');

:root {
  --brand: #a98f71;
  --brand-light: #c4ad91;
  --brand-dark: #8a7259;
  --brand-glow: rgba(169, 143, 113, 0.4);
  
  /* Dark theme (default) */
  --bg-primary: #121110;
  --bg-secondary: #1a1815;
  --bg-card: rgba(169, 143, 113, 0.08);
  --bg-card-hover: rgba(169, 143, 113, 0.15);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --border-color: rgba(169, 143, 113, 0.15);
  --shadow-color: rgba(0, 0, 0, 0.3);
  --toggle-bg: rgba(255, 255, 255, 0.1);
  
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-blur: 10px;
  
  --radius: 16px;
  --radius-tile: 20px;
  
  --font-main: 'Outfit', -apple-system, sans-serif;
}

/* Light theme */
[data-theme="light"] {
  --bg-primary: #f8f6f3;
  --bg-secondary: #ffffff;
  --bg-card: rgba(169, 143, 113, 0.12);
  --bg-card-hover: rgba(169, 143, 113, 0.22);
  --text-primary: #1a1815;
  --text-secondary: rgba(26, 24, 21, 0.6);
  --border-color: rgba(169, 143, 113, 0.25);
  --shadow-color: rgba(0, 0, 0, 0.1);
  --toggle-bg: rgba(0, 0, 0, 0.08);
  --brand-glow: rgba(169, 143, 113, 0.3);
}

.glass {
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

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

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

body {
  font-family: var(--font-main);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 50% 0%, var(--brand-glow) 0%, transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(169, 143, 113, 0.08) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.3s ease;
}

/* Header with controls */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  z-index: 50;
  background: transparent;
}

/* Language Selector - Sliding */
.lang-selector {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--toggle-bg);
  padding: 4px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.lang-toggle {
  width: 40px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-main);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.lang-toggle:hover {
  background: var(--brand-light);
}

.lang-options {
  display: flex;
  gap: 4px;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.lang-selector.open .lang-options {
  max-width: 120px;
  opacity: 1;
  margin-left: 4px;
}

.lang-btn {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-main);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.lang-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.lang-btn.active {
  background: var(--brand);
  color: #fff;
}

/* Theme Toggle */
.theme-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--toggle-bg);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
}

.theme-toggle svg {
  width: 22px;
  height: 22px;
  color: var(--text-primary);
  transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
  transform: rotate(15deg);
}

.icon-sun, .icon-moon {
  display: none;
}

/* Dark theme: show sun icon */
:root .icon-sun { display: block; }
:root .icon-moon { display: none; }

/* Light theme: show moon icon */
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 420px;
  margin: 0 auto;
  padding: 72px 16px 32px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Logo */
.logo-block {
  text-align: center;
  margin-bottom: 20px;
  opacity: 0;
  animation: revealUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

.logo {
  max-width: 120px;
  width: 100%;
  height: auto;
  border-radius: 24px;
  filter: drop-shadow(0 8px 24px var(--brand-glow));
}

/* Title */
.title-block {
  text-align: center;
  margin-bottom: 28px;
  opacity: 0;
  animation: revealUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}

.brand-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.brand-description {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-secondary);
}

/* Tiles Grid */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* Single Tile */
.tile {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-tile);
  text-decoration: none;
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  
  opacity: 0;
  transform: scale(0.8) rotateX(20deg);
  transform-origin: center bottom;
}

/* Tile animations */
.tile:nth-child(1) { animation: tileFlip 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards; }
.tile:nth-child(2) { animation: tileFlip 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.4s forwards; }
.tile:nth-child(3) { animation: tileFlip 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.5s forwards; }
.tile:nth-child(4) { animation: tileFlip 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards; }
.tile:nth-child(5) { animation: tileFlip 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.7s forwards; }
.tile:nth-child(6) { animation: tileFlip 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.8s forwards; }
.tile:nth-child(7) { animation: tileFlip 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.9s forwards; }

@keyframes tileFlip {
  0% {
    opacity: 0;
    transform: scale(0.8) rotateX(20deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateX(0deg);
  }
}

@keyframes revealUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tile glow */
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, var(--brand-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tile:hover::before,
.tile:active::before {
  opacity: 1;
}

.tile:hover {
  transform: scale(1.05);
  border-color: var(--brand);
  background: var(--bg-card-hover);
  box-shadow: 
    0 20px 40px var(--shadow-color),
    0 0 0 1px var(--brand);
}

.tile:active {
  transform: scale(1.03);
  transition-duration: 0.1s;
}

.tile:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Tile icon */
.tile-icon {
  width: 36px;
  height: 36px;
  color: var(--brand-light);
  transition: all 0.4s ease;
  position: relative;
  z-index: 1;
}

[data-theme="light"] .tile-icon {
  color: var(--brand);
}

.tile:hover .tile-icon {
  transform: scale(1.15);
  color: var(--brand);
}

[data-theme="light"] .tile:hover .tile-icon {
  color: var(--brand-dark);
}

/* Tile label */
.tile-label {
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.01em;
  position: relative;
  z-index: 1;
  transition: color 0.3s ease;
}

/* Wide tile */
.tile--wide {
  grid-column: span 2;
  aspect-ratio: auto;
  min-height: 72px;
  flex-direction: row;
  justify-content: center;
  gap: 14px;
  padding: 20px 24px;
}

.tile--wide .tile-icon {
  width: 28px;
  height: 28px;
}

.tile--wide .tile-label {
  font-size: 1rem;
}

/* Button tile reset */
button.tile {
  font-family: var(--font-main);
  cursor: pointer;
}

/* Footer */
.footer {
  margin-top: auto;
  padding-top: 36px;
  text-align: center;
  opacity: 0;
  animation: revealUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.9s forwards;
}

.footer-line {
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  margin: 0 auto 14px;
  border-radius: 2px;
}

.footer-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Phone Button */
.phone-btn {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  background: var(--brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 100;
  box-shadow: 0 4px 20px var(--brand-glow);
  transition: all 0.3s ease;
  
  opacity: 0;
  transform: scale(0);
  animation: phoneAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 1s forwards;
}

@keyframes phoneAppear {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.phone-btn:hover {
  transform: scale(1.1);
  background: var(--brand-light);
  box-shadow: 0 6px 28px var(--brand-glow);
}

.phone-btn:active {
  transform: scale(1.05);
}

.phone-icon {
  width: 24px;
  height: 24px;
  color: #fff;
  position: relative;
  z-index: 2;
  animation: phoneShake 4s ease-in-out infinite;
}

@keyframes phoneShake {
  0%, 100% { transform: rotate(0deg); }
  2% { transform: rotate(15deg); }
  4% { transform: rotate(-15deg); }
  6% { transform: rotate(15deg); }
  8% { transform: rotate(-15deg); }
  10% { transform: rotate(0deg); }
}

.phone-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--brand);
  border-radius: 50%;
  animation: phoneRing 2s ease-out infinite;
}

.phone-ring--delay {
  animation-delay: 0.5s;
}

@keyframes phoneRing {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* Desktop */
@media (min-width: 768px) {
  .container {
    padding: 80px 24px 48px;
  }
  
  .logo {
    max-width: 140px;
  }
  
  .brand-title {
    font-size: 2rem;
  }
  
  .tiles-grid {
    gap: 16px;
  }
  
  .tile:hover {
    transform: scale(1.08) translateY(-4px);
  }
}

/* Safe areas */
@supports (padding: max(0px)) {
  .header {
    padding-top: max(12px, env(safe-area-inset-top) + 8px);
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  
  .container {
    padding-top: max(72px, env(safe-area-inset-top) + 60px);
    padding-bottom: max(32px, env(safe-area-inset-bottom) + 16px);
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  
  .phone-btn {
    left: max(20px, env(safe-area-inset-left) + 12px);
    bottom: max(20px, env(safe-area-inset-bottom) + 12px);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  
  .logo-block, .title-block, .tile, .footer, .phone-btn {
    opacity: 1;
    transform: none;
  }
}

/* Scroll reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.scroll-reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 2px; }

/* ========================================
   Modal for Virtual Tours
======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
}

.modal-content {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  background: var(--bg-secondary);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-secondary);
  background: var(--toggle-bg);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.modal-list {
  padding: 12px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.modal-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.modal-item:last-child {
  margin-bottom: 0;
}

.modal-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand);
  transform: translateX(4px);
}

.modal-item:active {
  transform: scale(0.98);
}

.modal-item-icon {
  width: 22px;
  height: 22px;
  color: var(--brand);
  flex-shrink: 0;
}

.modal-item span {
  flex: 1;
}

.modal-item-arrow {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateX(-8px);
  transition: all 0.2s ease;
}

.modal-item:hover .modal-item-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Desktop modal */
@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }
  
  .modal-content {
    border-radius: 24px;
    max-height: 70vh;
  }
  
  .modal-overlay.active .modal-content {
    transform: translateY(0);
  }
}
