/* Villa Miramar R&Y — Design System */
/* Palette extracted from the actual villa photos (Pugliese masseria) */

:root {
  --stone:      #C4A882;  /* warm sandy stone */
  --terracotta: #607456;  /* sage green — primary accent & dark surfaces */
  --beam:       #7B2525;  /* deep wine / dark accent */
  --plaster:    #EEE0CC;  /* warm cream — main background */
  --olive:      #BA6A4C;  /* terracotta — secondary action buttons */
  --sky:        #4A7A90;  /* Adriatic sea blue — external link buttons */
  --dark:       #7B2525;  /* deep burgundy — body text */
  --stone-light:#DDD0B8;
  --white:      #FAF6EF;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;

  --shadow-sm: 0 1px 4px rgba(45,33,22,.10);
  --shadow-md: 0 4px 16px rgba(45,33,22,.12);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--plaster);
  color: var(--dark);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overscroll-behavior-y: contain;
}

/* Remove tap flash on iOS/Android */
a, button, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.2;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p  { line-height: 1.6; }
a  { color: var(--terracotta); text-decoration: none; }
a:hover { text-decoration: underline; }
.card-link:hover { text-decoration: none; }

/* ── Layout ── */
.page { flex: 1; padding: 1.5rem 1rem 6rem; max-width: 640px; margin: 0 auto; width: 100%; }

/* ── Hero ── */
.hero {
  position: relative;
  background: var(--terracotta);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  min-height: 200px;
  display: flex;
  align-items: flex-end;
}
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .7; }
.hero-content {
  position: relative;
  padding: 1.5rem;
  background: linear-gradient(to top, rgba(45,33,22,.85) 0%, transparent 100%);
  width: 100%;
}
.hero-content h1 { color: var(--white); font-size: 1.75rem; }
.hero-content p  { color: var(--stone-light); font-size: .9rem; margin-top: .25rem; }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: box-shadow .15s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: .1rem; }
.card-body { flex: 1; }
.card-title { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; color: var(--dark); }
.card-desc  { font-size: .85rem; color: #6b5a4a; margin-top: .2rem; line-height: 1.4; }
.card-link  { display: block; text-decoration: none; color: inherit; }
.card-link:hover .card-title { color: var(--terracotta); }

/* ── Quick access grid (home) ── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.quick-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  transition: box-shadow .15s, transform .1s;
}
.quick-card:hover  { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.quick-card:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.quick-card .icon { font-size: 2rem; }
.quick-card .label { font-family: 'Playfair Display', serif; font-size: .95rem; font-weight: 600; }

/* ── Find the Villa banner (home page) ── */
.find-villa-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--terracotta);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  text-decoration: none;
  color: var(--white);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity .15s;
}
.find-villa-banner:hover  { opacity: .9; text-decoration: none; color: var(--white); }
.find-villa-banner:active { opacity: .75; }
.find-villa-icon  { font-size: 1.75rem; flex-shrink: 0; }
.find-villa-title { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; }
.find-villa-sub   { font-size: .8rem; color: var(--stone); margin-top: .1rem; }

/* ── Section heading ── */
.section-heading {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
}
.section-heading h2 { font-size: 1.3rem; }
.section-heading .emoji { font-size: 1.4rem; }

/* ── Info rows (My Stay) ── */
.info-row {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: .85rem 1.25rem;
  margin-bottom: .5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.info-row .label { font-size: .75rem; color: #8a7260; text-transform: uppercase; letter-spacing: .05em; }
.info-row .value { font-size: 1rem; font-weight: 600; color: var(--dark); overflow-wrap: break-word; word-break: break-all; }
.info-row .icon  { font-size: 1.25rem; }

/* ── Contact cards ── */
.contact-type-heading {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #8a7260;
  margin: 1.25rem 0 .5rem;
}
.contact-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: .9rem 1.25rem;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}
.contact-card > div:first-child { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; font-size: .95rem; overflow-wrap: break-word; }
.contact-meta { font-size: .8rem; color: #8a7260; margin-top: .1rem; }
.contact-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.btn-call, .btn-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
}
.btn-call { background: var(--olive); color: white; }
.btn-link { background: var(--sky); color: white; }
.btn-call:hover, .btn-link:hover { opacity: .85; text-decoration: none; }

/* ── Article detail ── */
.article-body { line-height: 1.7; }
.article-body h2, .article-body h3 { margin: 1.25rem 0 .5rem; }
.article-body p  { margin-bottom: .75rem; }
.article-body ul, .article-body ol { padding-left: 1.5rem; margin-bottom: .75rem; }
.article-body li { margin-bottom: .35rem; }
.article-cover { width: 100%; border-radius: var(--radius-md); margin-bottom: 1rem; object-fit: cover; max-height: 220px; }
.article-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.article-icon { font-size: 2rem; flex-shrink: 0; }
.article-header h1 { font-size: clamp(1.3rem, 5vw, 1.75rem); }
.back-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--terracotta); font-size: .9rem; margin-bottom: 1rem; }

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--stone-light);
  display: flex;
  justify-content: space-around;
  padding: .5rem 0 calc(.5rem + env(safe-area-inset-bottom));
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(45,33,22,.08);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  text-decoration: none;
  color: #9A7055;
  font-size: .7rem;
  font-weight: 500;
  padding: .35rem .5rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  transition: color .15s;
  min-width: 3.5rem;
}
.nav-item .nav-icon { font-size: 1.4rem; }
.nav-item.active, .nav-item:hover { color: var(--terracotta); }
.nav-item.active .nav-icon { transform: scale(1.1); }

/* ── PIN access screen ── */
.pin-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
  background: var(--terracotta);
}
@media (max-width: 359px) {
  .pin-screen { padding: 2rem .75rem calc(2rem + env(safe-area-inset-bottom)); }
  .pin-card   { padding: 1.5rem 1rem; }
}
.pin-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.pin-logo h1 { color: var(--white); font-size: 1.75rem; }
.pin-logo p  { color: var(--stone); font-size: .9rem; margin-top: .35rem; }
.pin-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow-md);
}
.pin-card h2 { font-size: 1.2rem; margin-bottom: .5rem; text-align: center; }
.pin-hint { font-size: .85rem; color: #8a7260; text-align: center; margin-bottom: 1.25rem; }
.pin-input-row { display: flex; gap: .5rem; margin-bottom: 1rem; }
.pin-digit {
  flex: 1;
  min-width: 0;          /* kills UA min-width — fixes overflow on small screens */
  height: 3.5rem;
  border: 2px solid var(--stone-light);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 700;
  color: var(--dark);
  background: var(--plaster);
  outline: none;
  transition: border-color .15s;
}
.pin-digit:focus { border-color: var(--terracotta); }
.pin-digit:focus-visible {
  border-color: var(--terracotta);
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}
.btn-primary {
  width: 100%;
  padding: .9rem;
  background: var(--terracotta);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn-primary:hover  { opacity: .9; }
.btn-primary:active { opacity: .75; transform: scale(.98); }
.pin-error { color: #c0392b; font-size: .85rem; text-align: center; margin-bottom: .75rem; }

/* ── Language switcher dropdown ── */
.lang-switcher {
  position: fixed;
  top: calc(.75rem + env(safe-area-inset-top));
  right: .75rem;
  z-index: 200;
}
.lang-trigger {
  list-style: none;
  padding: .3rem .7rem .3rem .55rem;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  background: rgba(250,246,239,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--dark);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  transition: background .15s;
}
.lang-trigger::-webkit-details-marker { display: none; }
.lang-trigger::after {
  content: '▾';
  font-size: .65rem;
  opacity: .6;
  transition: transform .15s;
}
details[open] .lang-trigger::after { transform: rotate(180deg); }
.lang-trigger:hover { background: var(--stone-light); }
.lang-trigger:active { opacity: .8; }
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + .4rem);
  background: rgba(250,246,239,.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-width: 130px;
}
.lang-option {
  display: block;
  padding: .65rem 1rem;
  font-size: .85rem;
  font-weight: 500;
  color: var(--dark);
  text-decoration: none;
  border-bottom: 1px solid var(--stone-light);
  transition: background .1s;
}
.lang-option:last-child { border-bottom: none; }
.lang-option:hover { background: var(--stone-light); text-decoration: none; }
.lang-option.active { color: var(--terracotta); font-weight: 700; }

/* ── Divider ── */
.divider { height: 1px; background: var(--stone-light); margin: 1.25rem 0; }

/* ── Toast messages ── */
.messages { list-style: none; margin-bottom: 1rem; }
.messages li { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; }
.messages .error { background: #fde8e8; color: #c0392b; }
.messages .success { background: #e8f5e9; color: #2e7d32; }

/* ── Offline banner ── */
.offline-banner {
  background: var(--beam);
  color: white;
  text-align: center;
  padding: .5rem;
  font-size: .8rem;
  display: none;
}
body.offline .offline-banner { display: block; }

/* ── Subcategory heading (shared between section.html and around.html) ── */
.subcategory-heading {
  font-size: .75rem;
  color: #8a7260;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── WiFi collapsible card ── */
details.wifi-card { margin-bottom: .75rem; }

.wifi-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--terracotta);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color: var(--white);
  user-select: none;
  transition: opacity .15s;
}
.wifi-summary::-webkit-details-marker { display: none; }
details.wifi-card[open] .wifi-summary { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.wifi-summary:hover  { opacity: .9; }
.wifi-summary:active { opacity: .75; }
.wifi-sum-icon  { font-size: 1.75rem; flex-shrink: 0; }
.wifi-sum-title { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; }
.wifi-sum-sub   { font-size: .8rem; color: var(--stone); margin-top: .1rem; }
.wifi-chevron   { margin-left: auto; color: var(--stone); font-size: 1.2rem; transition: transform .2s; }
details.wifi-card[open] .wifi-chevron { transform: rotate(90deg); }

.wifi-body {
  background: var(--white);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.wifi-info-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--stone-light);
}
.wifi-info-row:last-of-type { border-bottom: none; }
.wifi-info-label { font-size: .7rem; color: #8a7260; text-transform: uppercase; letter-spacing: .05em; width: 5rem; flex-shrink: 0; }
.wifi-info-value { font-weight: 700; flex: 1; overflow-wrap: break-word; word-break: break-all; }

.btn-wifi-copy {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .85rem 1rem;
  background: var(--olive);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity .15s, transform .1s;
}
.btn-wifi-copy:hover  { opacity: .9; text-decoration: none; }
.btn-wifi-copy:active { opacity: .75; transform: scale(.98); }
.btn-wifi-copy.copied { background: #2e7d32; }

.wifi-connect-tip {
  font-size: .78rem;
  color: #8a7260;
  text-align: center;
  line-height: 1.5;
  margin-top: .6rem;
}

.wifi-qr-wrap {
  margin-top: .85rem;
  border-top: 1px solid var(--stone-light);
  padding-top: .85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
}
.wifi-qr-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.wifi-qr-btn:active .wifi-qr-img { opacity: .85; }
.wifi-qr-img {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--stone-light);
  transition: opacity .15s;
}
.wifi-qr-tap-hint {
  font-size: .7rem;
  color: #8a7260;
}
.wifi-qr-hint {
  font-size: .75rem;
  color: #8a7260;
  text-align: center;
  line-height: 1.4;
}

/* ── QR zoom dialog ── */
.qr-zoom-dialog {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  max-width: 90vmin;
}
.qr-zoom-dialog::backdrop {
  background: rgba(45,33,22,.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.qr-zoom-img {
  width: 85vmin;
  height: 85vmin;
  max-width: 480px;
  max-height: 480px;
  border-radius: var(--radius-md);
  display: block;
}
.qr-zoom-hint {
  color: rgba(250,246,239,.7);
  font-size: .8rem;
  text-align: center;
  margin-top: .75rem;
}

/* ── Photo carousel (home page) ── */
.carousel-section {
  position: relative;
  margin: 0 0 1.5rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--stone-light);
}
.carousel-track {
  display: flex;
  height: 100%;
  transition: transform .4s ease;
}
.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
}
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(250,246,239,.75);
  border: none;
  border-radius: 50%;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--beam);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.carousel-prev { left: .6rem; }
.carousel-next { right: .6rem; }
.carousel-btn:hover { background: var(--white); }
.carousel-dots {
  position: absolute;
  bottom: .6rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: .35rem;
  z-index: 2;
}
.carousel-dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: rgba(250,246,239,.5);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background .2s, transform .2s;
}
.carousel-dot.active { background: var(--white); transform: scale(1.3); }
.carousel-gallery-link {
  position: absolute;
  bottom: .5rem;
  right: .75rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--white);
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  z-index: 2;
}

/* ── Gallery grid ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
  margin-top: .5rem;
}
.gallery-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  display: block;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gallery-thumb:hover img, .gallery-thumb:focus img { transform: scale(1.04); }

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,10,5,.92);
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 100%;
  max-height: 80dvh;
  border-radius: var(--radius-md);
  object-fit: contain;
}
.lightbox-caption {
  color: var(--stone-light);
  font-size: .85rem;
  margin-top: .75rem;
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: .5rem;
  line-height: 1;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
