:root{
  --bg1:#F5EBDD; /* Light sand */
  --bg2:#E2D4C7; /* Warm taupe */
  --panel:rgba(255,242,232,0.9); /* Soft clay overlay */
  --text:#3E2717; /* Deep brown */
  --muted:#8D6E63; /* Clay muted brown */
  --accent:#C14802; /* Terra cotta */
  --accent2:#D97C45; /* Burnt sienna */
}
html, body {
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  font-family: Helvetica, sans-serif;
  width: 100%;
  overflow-x: hidden; /* Only prevent horizontal scrolling */
  box-sizing: border-box;
  /* Prevent overscroll behavior and page refresh */
  overscroll-behavior: none !important;
  -webkit-overflow-scrolling: auto;
  /* Safari-specific fixes */
  -webkit-text-size-adjust: 100% !important; /* Prevent text scaling */
  -webkit-tap-highlight-color: transparent !important; /* Remove tap highlights */
}

body {
  background: radial-gradient(120% 120% at 50% 20%, var(--bg1), var(--bg2));
  color: var(--text);
  width: 100vw;
  max-width: 100vw;
  min-width: 100vw;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.05), transparent 60%);
  pointer-events: none;
}

.wrap{ min-height:100%; display:grid; place-items:center; padding:32px; }
.card{ width:min(980px, 92vw); background:var(--panel); border:1px solid var(--accent2); border-radius:16px; padding:28px; box-shadow:0 20px 80px rgba(0,0,0,.35); text-align:center; }
.card h1{ margin:0 0 10px; font-size: clamp(24px, 4vw, 42px); font-weight:900; background: linear-gradient(45deg, var(--accent), var(--accent2)); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.card p{ margin:0 0 18px; color:var(--muted); font-size: clamp(14px, 2.2vw, 18px); }
.image-frame{ position:relative; border:2px dashed var(--accent); border-radius:14px; padding:10px; background: var(--panel); }
.image-frame img{ display:block; width:100%; height:auto; margin:0 auto; border-radius:10px; }
.image-frame.missing{ display:grid; place-items:center; padding:40px; }
.image-frame .missing-note{ display:none; color:#cbd5e1; font-size:14px; }
.image-frame.missing .missing-note{ display:block; }
.hint{ margin-top:12px; color:#9ca3af; font-size:12px; }

.font-1 {
  font-family: Helvetica, sans-serif;
  font-weight: bold;
  font-size: clamp(32px, 6vw, 56px);
  margin-bottom: 16px;
  color: var(--accent2);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.font-2 {
  font-family: Helvetica, sans-serif;
  font-weight: normal;
  font-size: clamp(14px, 2.2vw, 18px);
  color: var(--muted);
}

.card {
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  padding: 40px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.image-frame {
  border: none;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.image-frame img {
  border-radius: 0px;
}

@media (max-width:560px){
  .card{ padding:20px; }
}

/* Mobile optimization - fit screen exactly */
@media (max-width: 768px) {
  * {
    box-sizing: border-box;
  }

  .wrap {
    padding: 0 !important; /* Force no padding */
    margin: 0 !important; /* Force no margin */
    width: 100vw !important; /* Full viewport width */
    min-height: 100vh !important;
    display: flex !important; /* Use flexbox for perfect centering */
    justify-content: center !important; /* Center horizontally */
    align-items: center !important; /* Center vertically */
    box-sizing: border-box;
    position: fixed !important; /* Fixed positioning for perfect fit */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
  }

  .card {
    width: 100vw !important; /* Full viewport width */
    min-height: calc(100vh + 150px) !important; /* Enough height for footer visibility */
    border-radius: 0 !important; /* No border radius for full screen fit */
    padding: 8px !important; /* Very minimal padding */
    margin: 0 !important; /* Force no margin */
    text-align: center !important; /* Center all text */
    box-sizing: border-box;
    position: absolute !important; /* Absolute positioning for perfect fit */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important; /* Full height */
    -webkit-overflow-scrolling: touch !important; /* Smooth touch scrolling */
    padding-bottom: 20px !important; /* Minimal padding for footer spacing */
  }

  .footer {
    margin-top: 40px !important; /* Push footer to bottom of content */
    padding: 20px 12px !important; /* Comfortable padding */
    background-color: #000 !important;
    color: #fff !important;
    text-align: center !important;
    width: 100% !important;
    border-top: 3px solid #666 !important; /* Visual separator */
    font-weight: bold !important; /* Make text prominent */
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.3) !important; /* Inner shadow for depth */
    position: relative !important; /* Natural document flow */
    clear: both !important; /* Clear any floats */
  }

  .welcome-text {
    text-align: center;
    margin-bottom: 16px;
    width: 100%;
  }

  .hero-title {
    font-size: clamp(16px, 5vw, 24px); /* Smaller, responsive font size */
    margin-bottom: 8px; /* Minimal margin */
    text-align: center; /* Explicit center alignment */
    line-height: 1.0; /* Very tight line height */
    width: 100%;
  }

  .image-frame {
    margin: 4px 0; /* Minimal margins */
    text-align: center;
    width: 100%;
  }

  .image-frame img {
    max-width: 100%;
    height: auto;
  }

  .carousel {
    margin-top: 8px; /* Minimal margin */
    text-align: center;
    width: 100%;
  }

  .gallery-grid {
    margin-top: 8px;
    margin-bottom: 16px; /* Add bottom margin before footer */
    gap: 2px; /* Minimal gap */
    text-align: center;
    width: 100%;
  }

  .footer {
    margin-top: 16px !important; /* Bring footer closer to content */
    padding: 20px 12px !important; /* Balanced padding */
    text-align: center !important;
    width: 100% !important;
    background-color: #000 !important;
    color: #fff !important;
    clear: both !important;
    margin-bottom: 20px !important; /* Balanced bottom margin */
    position: relative !important;
    z-index: 10 !important; /* Ensure footer is visible */
  }

  /* Ensure all elements fit within the card */
  .card > * {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }
}


/* Carousel */
.carousel{ position:relative; margin-top:24px; }
.carousel::before,.carousel::after{ content:""; display:block; height:2px; background:var(--accent2); opacity:.6; margin:12px 0; }
.carousel-viewport{ overflow:hidden; width:100%; }
.carousel-track{ display:flex; transition: transform .4s ease; will-change: transform; }
.slide{ flex:0 0 calc(100% / 3); padding:8px; }
.slide img{ width:100%; height:auto; border-radius:10px; box-shadow:0 6px 18px rgba(0,0,0,.2); aspect-ratio:4/3; object-fit:cover; }

.welcome-text {
  text-align: center;
  margin-bottom: 28px;
}

.hero-title {
  font-family: Helvetica, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.2px;
  margin: 0 auto;
  text-align: center;
  max-width: 1100px;
  /* bigger on all screens */
  font-size: clamp(28px, 5.5vw, 64px);
}

.carousel-text {
  text-align: center;
  margin: 30px 0 15px 0;
}

.gallery-text {
  text-align: center;
  margin: 30px 0 15px 0;
}

.carousel-nav{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  background:#fff;
  color:#000;
  border:2px solid #000;
  border-radius:50%;
  width:42px;
  height:42px;
  cursor:pointer;
  box-shadow:0 4px 12px rgba(0,0,0,.25);
  display:grid;
  place-items:center;
  z-index:2;
  transition: all 0.3s ease;
}
.carousel-nav.prev{ left:8px; }
.carousel-nav.next{ right:8px; }
.carousel-nav:hover{
  background:#000;
  color:#fff;
  border:2px solid #fff;
}
.carousel-nav:focus{ outline:2px solid rgba(0,0,0,.6); outline-offset:2px; }

@media (max-width:900px){
  .slide{ flex-basis:50%; }
}
@media (max-width:600px){
  .slide{ flex-basis:100%; }
}

/* 3x3 Gallery Grid */
.gallery-grid{ margin-top:24px; display:grid; grid-template-columns:repeat(3, 1fr); gap:10px; }
.gallery-grid img{
  width:100%;
  height:auto;
  display:block;
  border-radius:10px;
  object-fit:cover;
  aspect-ratio:1/1;
  box-shadow:0 4px 12px rgba(0,0,0,.15);
}

@media (max-width:700px){
  .gallery-grid{ grid-template-columns:repeat(2, 1fr); gap:6px; }
}

/* Footer */
.footer {
  background-color: #000;
  color: #fff;
  padding: 40px 20px;
  margin-top: 60px;
}

.footer-content {
  max-width: 980px;
  margin: 0 auto;
  text-align: center;
}

.footer p {
  margin: 5px 0;
}

/* EMERGENCY MOBILE FIX - Highest specificity possible */
@media (max-width: 768px) {
  html, body, .wrap, .card {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
  }

  .wrap {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: block !important;
  }

  .card {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 80px !important; /* Leave space for fixed footer */
    width: 100% !important;
    height: calc(100vh - 80px) !important; /* Exact height minus footer */
    padding: 8px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important; /* Smooth scrolling on iOS */
    overscroll-behavior: none !important; /* Prevent all overscroll */
    scroll-behavior: smooth !important; /* Smooth scrolling behavior */
  }

  /* Force proper footer positioning */
  .footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    height: 80px !important;
    margin: 0 !important;
    padding: 16px 8px !important;
    background-color: #000 !important;
    color: #fff !important;
    text-align: center !important;
    z-index: 9999 !important;
    border-top: 3px solid #666 !important;
    box-shadow: 0 -4px 8px rgba(0,0,0,0.5) !important;
    font-weight: bold !important;
  }

  /* Force no horizontal gaps */
  body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: -1;
    pointer-events: none;
  }
}

/* Minimal mobile override: unpin footer on mobile only */
@media (max-width: 768px) { .footer { position: static !important; bottom: auto !important; left: auto !important; right: auto !important; width: auto !important; margin-top: 20px !important; } }


/* EMERGENCY MOBILE FOOTER FIX - Highest priority */
@media (max-width: 768px) {
  body .wrap .card .footer {
    position: relative !important;
    bottom: unset !important;
    left: unset !important;
    right: unset !important;
    width: 100% !important;
    margin-top: 30px !important;
    transform: none !important;
  }
}

/* MOBILE FOOTER VISIBILITY FIX */
@media (max-width: 768px) {
  .footer {
    position: static !important;
    display: block !important;
    visibility: visible !important;
    background-color: #000 !important;
    color: #fff !important;
    margin-top: 20px !important;
    padding: 20px 12px !important;
  }
}

/* MOBILE CONTENT & FOOTER COMPLETE FIX */
@media (max-width: 768px) {
  .wrap {
    min-height: auto !important;
    height: auto !important;
    position: static !important;
  }
  .card {
    min-height: auto !important;
    height: auto !important;
    position: static !important;
    overflow: visible !important;
    padding-bottom: 40px !important;
  }
  .footer {
    position: static !important;
    display: block !important;
    background-color: #000 !important;
    color: #fff !important;
    text-align: center !important;
    padding: 20px 12px !important;
    margin-top: 20px !important;
    width: 100% !important;
  }
}

/* FINAL MOBILE FOOTER POLISH */
@media (max-width: 768px) {
  .gallery-grid {
    margin-bottom: 0 !important;
  }
  .footer {
    margin-top: 0 !important;
    box-shadow: none !important;
    border-top: none !important;
    border: none !important;
  }
}

/* ELIMINATE GAP COMPLETELY */
@media (max-width: 768px) {
  .gallery-grid {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
  .gallery-text {
    margin-bottom: 0 !important;
  }
  .card {
    padding-bottom: 0 !important;
  }
  .footer {
    margin-top: 0 !important;
    padding-top: 20px !important;
  }
}

/* AGGRESSIVE GAP ELIMINATION */
@media (max-width: 768px) {
  .footer {
    margin-top: -20px !important;
    transform: translateY(-10px) !important;
  }
}

/* TARGET GALLERY GRID GAPS DIRECTLY */
@media (max-width: 768px) {
  .gallery-grid {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    gap: 2px !important;
    padding: 0 !important;
  }
  .gallery-grid img:last-child {
    margin-bottom: 0 !important;
  }
  .footer {
    margin-top: -30px !important;
    transform: translateY(-15px) !important;
  }
}
