/* Apartment Estera — page sections, calendar, form, lightbox. */

/* ---- about ---- */
.about { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2.5rem, 7vw, 6rem); align-items: center; }
.about h2 { margin-bottom: 1.6rem; }
.about__text p { color: #3a4a55; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 2.4rem; padding-top: 2rem; border-top: 1px solid rgba(139, 115, 85, .25); }
.stat__num { font-family: var(--serif); font-size: clamp(2.4rem, 5vw, 3.2rem); line-height: 1; color: var(--blue); }
.stat__label { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--stone); margin-top: .5rem; line-height: 1.4; }
.about__media { position: relative; }
.about__media::before {
  content: ""; position: absolute; z-index: 0; inset: 2rem -1.5rem -1.5rem 2rem;
  background: var(--accent); opacity: .35;
}
/* Framed photos: height:auto is essential — the <img> width/height attributes would otherwise fix the height and
   override aspect-ratio (the tall-narrow-frame bug, D-30). */
.about__media img { position: relative; z-index: 1; display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; max-height: 70vh; object-fit: cover; }

/* ---- gallery ---- */
.gallery__hero { display: block; width: 100%; max-width: 960px; height: auto; aspect-ratio: 4 / 3; margin: 0 auto 1rem; object-fit: cover; cursor: zoom-in; }
/* Row height follows the column width, so tiles stay ~1.2:1 at every screen width (wide photos span 2 columns,
   portrait photos 2 rows — set in render.js). */
.gallery__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: calc((min(100vw, 1200px) - 2 * var(--gutter)) * .2); grid-auto-flow: dense; gap: 1rem; }
.gallery__item { padding: 0; border: 0; background: var(--sand); cursor: zoom-in; overflow: hidden; }
.gallery__item img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.gallery__item:hover img { transform: scale(1.04); }
.gallery__item.is-portrait { grid-row: span 2; }
.gallery__item.is-wide { grid-column: span 2; }
.gallery__hero-btn { display: block; width: 100%; padding: 0; border: 0; background: none; }

/* ---- amenities ---- */
.amenities { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; list-style: none; margin: 0; padding: 0; }
.amenity {
  display: flex; align-items: center; gap: .9rem;
  background: var(--white); padding: 1.15rem 1.25rem; border: 1px solid rgba(139, 115, 85, .15);
}
.amenity__icon { font-size: 1.5rem; line-height: 1; }
.amenity__label { font-size: .92rem; letter-spacing: .02em; }

/* ---- offer ---- */
.offer { background: linear-gradient(120deg, var(--blue), var(--adriatic)); color: var(--white); text-align: center; padding: clamp(3rem, 7vw, 4.5rem) 0; }
.offer .label { color: var(--accent); }
.offer__headline { font-family: var(--serif); font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 300; margin-bottom: .6rem; }
.offer__sub { margin: 0 auto; max-width: 640px; opacity: .92; }
.offer[hidden] { display: none; }

/* ---- calendar ---- */
.cal { max-width: 900px; margin: 0 auto; }
.cal__bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.cal__btn {
  width: 48px; height: 48px; border: 1px solid rgba(139, 115, 85, .35); background: var(--white);
  font-size: 1.3rem; color: var(--dark); cursor: pointer;
}
.cal__btn:hover { border-color: var(--accent); color: var(--accent); }
.cal__months { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); }
.cal__month h3 { font-size: 1.6rem; text-align: center; margin-bottom: .8rem; text-transform: capitalize; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.cal__dow { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--stone); padding: .3rem 0; }
.cal__day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: .9rem; background: var(--white); }
.cal__day.is-booked { background: rgba(42, 100, 150, .16); color: rgba(26, 42, 53, .45); text-decoration: line-through; }
.cal__day.is-past { color: rgba(26, 42, 53, .3); }
.cal__day.is-empty { background: transparent; }
.cal__legend { display: flex; gap: 1.5rem; justify-content: center; margin-top: 1.4rem; font-size: .82rem; color: var(--stone); flex-wrap: wrap; }
.cal__swatch { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: .4rem; border: 1px solid rgba(139, 115, 85, .3); background: var(--white); }
.cal__swatch.is-booked { background: rgba(42, 100, 150, .16); }
.cal__msg { text-align: center; color: var(--stone); font-size: .9rem; margin-top: 1rem; }

/* ---- location ---- */
.location { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2.5rem, 6vw, 5rem); align-items: center; }
.location h2 { margin-bottom: 1.4rem; }
.location__sub { font-size: 1.45rem; font-weight: 400; margin: 1.4rem 0 .5rem; }
.location__sub:first-of-type { margin-top: 0; }
.location img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; max-height: 70vh; object-fit: cover; }
.distances { list-style: none; padding: 0; margin: 1.6rem 0 0; }
.distances li { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid rgba(139, 115, 85, .2); }
.distances span:last-child { font-family: var(--serif); font-size: 1.15rem; color: var(--blue); white-space: nowrap; }

/* ---- contact ---- */
.contact { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(2.5rem, 6vw, 5rem); }
.contact h2 { margin-bottom: 1.4rem; }
.contact__details { list-style: none; padding: 0; margin: 2rem 0; }
.contact__details li { display: flex; gap: 1rem; align-items: flex-start; padding: .7rem 0; }
.contact__icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 1px solid var(--accent); color: var(--accent); font-size: 1rem; }
.contact__k { display: block; font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--stone); }
.contact__details a { color: var(--dark); text-decoration: none; word-break: break-word; }
.contact__details a:hover { color: var(--accent); }
.contact__img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; max-height: 70vh; object-fit: cover; margin-top: 1rem; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.25rem; background: var(--white); padding: clamp(1.5rem, 4vw, 2.5rem); border: 1px solid rgba(139, 115, 85, .15); align-self: start; }
.form__full { grid-column: 1 / -1; }
.form label { display: block; font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--stone); margin-bottom: .35rem; }
.form input, .form select, .form textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--dark); background: var(--sand);
  border: 1px solid transparent; border-bottom-color: rgba(139, 115, 85, .4); padding: .75rem .8rem; border-radius: 0; min-height: 48px;
}
.form textarea { min-height: 130px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); }
.form .is-invalid { border-color: #b4534a; }
.form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__note { font-size: .82rem; color: var(--stone); margin: 0; }
.form__status { font-size: .95rem; margin: 0; }
.form__status.is-ok { color: #2f6b4f; }
.form__status.is-err { color: #b4534a; }
.estimate { background: var(--sand); padding: 1rem 1.2rem; font-size: .92rem; }
.estimate[hidden] { display: none; }
.estimate__total { font-family: var(--serif); font-size: 1.6rem; color: var(--blue); }
.estimate__note { font-size: .78rem; color: var(--stone); margin: .2rem 0 0; }
.estimate__warn { color: #9a5b16; margin: .3rem 0 0; }

/* ---- lightbox ---- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(13, 22, 29, .94); }
.lightbox[hidden] { display: none; }
/* Lightbox: the whole photo, never cropped (contain; natural aspect kept by width/height auto). */
.lightbox__img { width: auto; height: auto; max-width: min(92vw, 1600px); max-height: 84vh; object-fit: contain; box-shadow: 0 10px 60px rgba(0, 0, 0, .4); }
.lightbox__btn {
  position: absolute; z-index: 2; width: 56px; height: 56px; border: 0; background: rgba(253, 252, 249, .08);
  color: var(--white); font-size: 1.8rem; line-height: 1; cursor: pointer; transition: background .2s;
}
.lightbox__btn:hover { background: rgba(253, 252, 249, .2); }
.lightbox__close { top: 1rem; right: 1rem; }
.lightbox__prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox__caption { position: absolute; z-index: 1; bottom: 1.2rem; left: 0; right: 0; text-align: center; color: rgba(253, 252, 249, .8); font-size: .85rem; letter-spacing: .08em; padding: 0 4rem; pointer-events: none; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .about, .location, .contact { grid-template-columns: 1fr; }
  .about__media { order: -1; margin-right: 1.5rem; }
  .gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: calc((100vw - 2 * var(--gutter)) * .4); }
  .gallery__item.is-wide { grid-column: span 2; }
  .cal__months { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 1.6rem; }
  .form { grid-template-columns: 1fr; }
  .gallery__grid { gap: .6rem; }
  /* Narrow screens: one control row at the bottom — ‹ caption › — with the photo centred above it.
     The caption lives strictly between the two 48px buttons, so however it wraps it cannot cover them. */
  .lightbox { padding-bottom: 5.5rem; }
  .lightbox__img { max-height: calc(100vh - 9rem); }
  .lightbox__btn { width: 48px; height: 48px; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 1rem; transform: none; }
  .lightbox__prev { left: .75rem; }
  .lightbox__next { right: .75rem; }
  .lightbox__caption {
    left: calc(.75rem + 48px + .5rem); right: calc(.75rem + 48px + .5rem); bottom: 1rem; padding: 0;
    min-height: 48px; display: flex; align-items: center; justify-content: center;
    font-size: .8rem; letter-spacing: .04em;
  }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
