/* ========== GLOBAL STYLES ========== */
:root {
  --gold: #c9a96e;
  --gold-light: #e0c78a;
  --dark: #1a1a1a;
  --dark-soft: #2a2a2a;
  --white: #f8f5f2;
  --white-soft: #ede8e2;
  --text: #3b3b3b;
  --text-light: #6b6b6b;
  --shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  --shadow-soft: 0 10px 30px rgba(0,0,0,0.15);
  --transition: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --border-radius: 12px;
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Inter', sans-serif;
  --font-accent: 'Cormorant Garamond', serif;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--white);
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* Anchor-scroll offset so sections never end up hidden under the fixed
   navbar, regardless of the navbar's actual rendered height on a given
   device (logo image height can vary slightly with OS font/display scale). */
section {
  scroll-margin-top: 90px;
}

/* ========== NAVBAR ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 1.5rem 0;
  transition: all 0.4s ease;
  background: transparent;
}

.navbar.scrolled {
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(20px);
  padding: 0.8rem 0;
  box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.05em;
  transition: var(--transition);
}
/* Sized in px (not rem) so the navbar's rendered height stays predictable
   even if a device's OS-level font/display scaling differs (e.g. some
   Android phones default to a larger text scale than iPhones), which
   previously made the logo push past the navbar and overlap page content. */
.nav-logo img {
    width: 250px;
    max-height: 120px;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
}
.logo-icon {
  font-size: 2rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2.5rem;
  align-items: center;
}

.nav-link {
  color: var(--white-soft);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  padding: 0.3rem 0;
  transition: color 0.3s;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gold);
  transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--gold);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.hamburger span {
  width: 28px;
  height: 2px;
  background: var(--white);
  transition: all 0.3s ease;
  transform-origin: left;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg);
  width: 30px;
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg);
  width: 30px;
}

/* ========== HERO ========== */
.hero {
  position: relative;
  height: 100vh;
  min-height: 700px;
  background: url("../assets/HeroNalej.png") no-repeat center center/cover;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.35) 60%, rgba(0,0,0,0.2) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 850px;
  padding: 0 2rem;
}

.hero-subtitle {
  font-family: var(--font-accent);
  font-size: 1.6rem;
  font-style: italic;
  color: var(--gold-light);
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}
.hero-title {
  font-family: 'Playfair Display', serif;
  font-style: italic; 
  font-size: clamp(3.5rem, 8vw, 6rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: #D4AF37; 
}

.hero-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.hero-divider span {
  width: 80px;
  height: 1px;
  background: var(--gold);
}
.hero-divider i {
  color: var(--gold);
  font-size: 1.2rem;
}

.hero-description {
  font-size: 1.15rem;
  font-weight: 300;
  margin-bottom: 2.5rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.85);
}

.hero-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 2.2rem;
  border-radius: 50px;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn-primary {
  background: var(--gold);
  color: var(--dark);
  border: 2px solid var(--gold);
}
.btn-primary:hover {
  background: transparent;
  color: var(--gold);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.4);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255,255,255,0.05);
}

.hero-scroll-indicator {
  position: absolute;
  bottom: -5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ========== SECTION SHARED ========== */
section {
  padding: 6rem 2rem;
}
.section-header {
  text-align: center;
  margin-bottom: 4rem;
}
.section-label {
  font-family: var(--font-accent);
  font-style: italic;
  color: var(--gold);
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}
.section-title {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  color: var(--dark);
  margin-bottom: 0.8rem;
}
.section-divider {
  width: 60px;
  height: 2px;
  background: var(--gold);
  margin: 1rem auto;
}
.section-subtitle {
  color: var(--text-light);
  max-width: 500px;
  margin: 0 auto;
}

/* ========== 3D MODEL SECTION ========== */
.model-section {
  background: var(--dark);
  color: var(--white);
}
.model-section .section-title,
.model-section .section-subtitle {
  color: var(--white-soft);
}
.model-container {
  max-width: 900px;
  height: 550px;
  margin: 0 auto;
  background: #222;
  border-radius: var(--border-radius);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
#threeCanvas {
  width: 100%;
  height: 100%;
  display: block;
}
.model-loading, .model-error, .model-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #ccc;
  pointer-events: none;
}
.model-hint {
  bottom: 20px;
  top: auto;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  padding: 0.5rem 1.2rem;
  border-radius: 30px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top: 3px solid var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== GALLERY ========== */
.gallery-section {
  background: var(--white-soft);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 250px;
  gap: 1.2rem;
  max-width: 1400px;
  margin: 0 auto;
}
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.gallery-item:hover img {
  transform: scale(1.05);
}
.gallery-item-tall { grid-row: span 2; }
.gallery-item-wide { grid-column: span 2; }
.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: 0.3s ease;
}
.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}
.gallery-item-overlay i {
  color: white;
  font-size: 2rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.96);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.lightbox.active {
  display: flex;
}
.lightbox-close {
  position: absolute;
  top: 30px;
  right: 30px;
  background: none;
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  z-index: 10;
}
.lightbox-prev, .lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 1.8rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: 0.3s;
}
.lightbox-prev:hover, .lightbox-next:hover { background: var(--gold); }
.lightbox-prev { left: 30px; }
.lightbox-next { right: 30px; }
.lightbox-content img {
  max-height: 85vh;
  max-width: 90vw;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox-counter {
  color: #ccc;
  margin-top: 1rem;
}

/* ========== RESERVATION ========== */
.reservation-section {
  background: var(--white);
}
.reservation-container {
  max-width: 700px;
  margin: 0 auto;
  background: white;
  padding: 3rem;
  border-radius: var(--border-radius);
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.form-group.full-width {
  grid-column: span 2;
}
label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--dark);
}
.required {
  color: #c0392b;
}
input, textarea {
  padding: 1rem 1.2rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: 0.2s;
  background: #fafafa;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: white;
}
.form-error {
  color: #c0392b;
  font-size: 0.8rem;
  display: none;
}
.btn-submit {
  width: 100%;
  background: var(--dark);
  color: white;
  border: 2px solid var(--dark);
  margin-top: 1rem;
  justify-content: center;
}
.btn-submit:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--dark);
}
.form-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 1rem;
}
.reservation-success {
  text-align: center;
  padding: 2rem;
}
.success-icon i {
  font-size: 3rem;
  color: var(--gold);
  margin-bottom: 1rem;
}

/* ========== PDF MODAL ========== */
.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
}
.pdf-modal.active {
  display: flex;
}
.pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
}
.pdf-modal-content {
  position: relative;
  width: 90vw;
  max-width: 1000px;
  height: 90vh;
  background: #1e1e1e;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}
.pdf-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  background: #2a2a2a;
  color: white;
}
.pdf-modal-title i { margin-right: 0.5rem; color: var(--gold); }
.pdf-modal-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.5rem;
  cursor: pointer;
}
.pdf-flipbook-container {
  flex: 1;
  height: 0;
  min-height: 0;
  position: relative;
  background: #2a2a2a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.pdf-book-shadow {
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 100%;
  background: linear-gradient(to right, rgba(0,0,0,0.4), transparent);
  pointer-events: none;
}
.pdf-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #ccc;
}
.pdf-modal-footer {
  padding: 0.8rem 2rem;
  background: #2a2a2a;
  display: flex;
  justify-content: space-between;
  color: #aaa;
  font-size: 0.85rem;
}
.pdf-download-btn {
  color: var(--gold);
}

/* ========== FOOTER ========== */
.footer {
  background: var(--dark);
  color: #bbb;
  padding: 4rem 2rem 2rem;
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
}
.footer-brand .logo-text { font-size: 1.8rem; color: white; }
.footer-bottom {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #333;
}
.footer-brand img{
  width: 12rem;
  height: auto;
  border-radius: 8px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    height: 100vh;
    background: rgba(10,10,10,0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    gap: 2.5rem;
    transition: right 0.4s ease;
  }
  .nav-links.active { right: 0; }
  .hamburger { display: flex; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-item-wide { grid-column: span 2; }
  .form-row { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: span 1; }
  .footer-container { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hero-buttons { flex-direction: column; align-items: center; }
  .model-container { height: 400px; }
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-item-wide, .gallery-item-tall { grid-column: auto; grid-row: auto; }
}

/* ========== FLIPBOOK STYLES ========== */
.flipbook-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #ccc;
}

#flipbook {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  gap: 12px;
}

/* ========== MOBILE FLIPBOOK VERTICAL COMPRESSION ========== */
@media (max-width: 768px) {
  /* Make modal shorter and narrower */
  .pdf-modal-content {
    width: 95vw;
    height: 70vh;  /* reduced from 90vh */
    max-height: 85vh;
  }
  
  /* Reduce header and footer padding */
  .pdf-modal-header {
    padding: 0.7rem 1rem;
  }
  .pdf-modal-title {
    font-size: 0.9rem;
  }
  .pdf-modal-footer {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
  }
  
  /* Flipbook container adjustments */
  .pdf-flipbook-container {
    padding: 0;
  }
  
  /* Flipbook controls smaller */
  .flipbook-controls {
    gap: 12px;
  }
  .flipbook-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }
  .flipbook-page-counter {
    font-size: 11px;
    min-width: 70px;
  }
  
  /* Make page images fill available space without distortion */
  #flipbookSpread .fb-slot img {
    object-fit: contain;
  }
  
  /* Optional: reduce gap between pages and controls */
  #flipbook {
    gap: 6px;
  }
}

/* For very small phones (max-width: 480px) - even more compression */
@media (max-width: 480px) {
  .pdf-modal-content {
    height: 65vh;
    width: 98vw;
  }
  .pdf-modal-header {
    padding: 0.5rem 0.8rem;
  }
  .pdf-modal-footer {
    padding: 0.4rem 0.8rem;
    font-size: 0.65rem;
  }
  .flipbook-btn {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
  .flipbook-page-counter {
    font-size: 10px;
    min-width: 60px;
  }
}

/* Responsive logo for mobile — px-based so it's consistent regardless of
   a device's OS font-scale/accessibility settings. */
@media (max-width: 768px) {
  .navbar {
    padding: 1rem 0;
  }
  .navbar.scrolled {
    padding: 0.6rem 0;
  }
  .nav-logo img {
        width: 170px;
        max-height: 64px;
  }
  section {
    scroll-margin-top: 70px;
  }
}

@media (max-width: 400px) {
  .nav-logo img {
        width: 125px;
        max-height: 48px;
    }
}