/* ==========================================================================
   style.css — Main stylesheet for Mombasa Apartments static site
   ==========================================================================
   System font stack, white background, 16px base.
   Responsive breakpoints:
     - Desktop:  1920px+
     - Laptop:   1366–1919px
     - Tablet:   768–1365px
     - Mobile:   320–767px
   Alternating apartment layout at 992px+.
   Hamburger menu below 768px.
   Color contrast: ≥4.5:1 normal text, ≥3:1 large text (WCAG 2.1 AA).
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  --color-bg: #ffffff;
  --color-text: #222222;
  --color-text-light: #555555;
  --color-link: #0056b3;
  --color-link-hover: #003d80;
  --color-heading: #111111;
  --color-border: #dddddd;
  --color-overlay: rgba(0, 0, 0, 0.55);
  --color-header-overlay: rgba(0, 0, 0, 0);
  --color-overlay-text: #ffffff;
  --color-btn-bg: #0056b3;
  --color-btn-text: #ffffff;
  --color-btn-hover: #003d80;
  --color-footer-bg: #222222;
  --color-footer-text: #e0e0e0;
  --color-footer-link: #ffffff;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-base: 16px;
  --max-width: 1200px;
}

/* ---------- Reset / Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-link);
  text-decoration: underline;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--color-link-hover);
}

a:focus-visible {
  outline: 3px solid var(--color-link);
  outline-offset: 2px;
}

ul {
  list-style: none;
}

h1, h2, h3, h4 {
  color: var(--color-heading);
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* ---------- Skip-to-Content Link ---------- */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 1000;
  padding: 0.75rem 1.5rem;
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
  top: 0;
  outline: 3px solid var(--color-link);
  outline-offset: 2px;
}

/* ---------- Site Header ---------- */
.site-header {
  width: 100%;
}

.header-banner {
  position: relative;
  width: 100%;
  min-height: 120px;
  overflow: hidden;
}

.header-banner-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  /* Which horizontal band of the source image shows through the letterbox
     crop. 50% = middle (default), 100% = bottom, 75% = three-quarters down.
     Tweak per image as needed. */
  object-position: center 75%;
  display: block;
}

.header-banner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-header-overlay);
  text-align: center;
  padding: 1rem;
}

.site-title {
  color: var(--color-overlay-text);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.site-tagline {
  color: var(--color-overlay-text);
  font-size: 1.25rem;
  font-weight: 300;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ---------- Site Navigation ---------- */
.site-nav {
  background: var(--color-heading);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.nav-links {
  display: flex;
  gap: 0;
  list-style: none;
}

.nav-links li a {
  display: block;
  padding: 0.875rem 1.25rem;
  color: var(--color-overlay-text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.nav-links li a:hover,
.nav-links li a:focus {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--color-overlay-text);
}

.nav-links li a:focus-visible {
  outline: 2px solid var(--color-overlay-text);
  outline-offset: -2px;
}

/* Hamburger menu — hidden on desktop */
.hamburger-menu {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.75rem;
  flex-direction: column;
  gap: 5px;
}

.hamburger-bar {
  display: block;
  width: 24px;
  height: 3px;
  background-color: var(--color-overlay-text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ---------- Welcome Section ---------- */
.welcome-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  text-align: center;
}

.welcome-section h1 {
  margin-bottom: 0.75rem;
}

.welcome-tagline {
  font-size: 1.2rem;
  color: var(--color-text-light);
  margin-bottom: 1rem;
}

.welcome-text {
  max-width: 800px;
  margin: 0 auto;
  color: var(--color-text);
  line-height: 1.8;
}

/* ---------- Apartment Listings (Landing Page) ---------- */
.apartment-listings {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.apartment-listing-item {
  margin-bottom: 3rem;
}

/* Apartment Card */
.apartment-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s ease;
}

.apartment-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.apartment-card-image {
  flex-shrink: 0;
}

.apartment-card-img {
  width: 100%;
  height: auto;
  aspect-ratio: 920 / 650;
  object-fit: cover;
}

.apartment-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.apartment-card-title {
  font-size: 1.4rem;
}

.apartment-card-title a {
  color: var(--color-heading);
  text-decoration: none;
}

.apartment-card-title a:hover,
.apartment-card-title a:focus {
  color: var(--color-link);
  text-decoration: underline;
}

.apartment-card-category {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.apartment-card-description {
  color: var(--color-text);
  line-height: 1.7;
}

.apartment-card-details {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.apartment-card-size::before {
  content: "📐 ";
}

.apartment-card-capacity::before {
  content: "👥 ";
}

.apartment-card-link {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  transition: background-color 0.2s ease;
  align-self: flex-start;
}

.apartment-card-link:hover,
.apartment-card-link:focus {
  background: var(--color-btn-hover);
  color: var(--color-btn-text);
}

/* ---------- Apartment Detail Page ---------- */
.apartment-detail {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.apartment-detail-hero {
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
}

.apartment-detail-img {
  width: 100%;
  max-width: 920px;
  height: auto;
  aspect-ratio: 920 / 650;
  object-fit: cover;
  margin: 0 auto;
}

.apartment-detail-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.apartment-detail-title {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.apartment-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f8f8f8;
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--color-text-light);
}

.apartment-detail-meta li {
  padding: 0.25rem 0.75rem;
  background: var(--color-bg);
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

.apartment-detail-description {
  margin-bottom: 2rem;
}

.apartment-detail-description h2 {
  margin-bottom: 1rem;
}

.apartment-description-text {
  white-space: pre-line;
  line-height: 1.8;
}

.apartment-detail-amenities {
  margin-bottom: 2rem;
}

.apartment-detail-amenities h2 {
  margin-bottom: 1rem;
}

.amenities-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.amenity-item {
  padding: 0.5rem 0.75rem;
  background: #f8f8f8;
  border-radius: 4px;
  font-size: 0.95rem;
}

.amenity-item::before {
  content: "✓ ";
  color: #2e7d32;
  font-weight: 700;
}

.apartment-detail-booking {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #f0f7ff;
  border-radius: 8px;
  border: 1px solid #cce0ff;
}

.apartment-detail-booking h2 {
  margin-bottom: 1rem;
}

.airbnb-link {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: #ff5a5f;
  color: #ffffff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  transition: background-color 0.2s ease;
}

.airbnb-link:hover,
.airbnb-link:focus {
  background: #e04850;
  color: #ffffff;
}

.contact-email {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

/* ---------- Booking Placeholder ---------- */
.booking-placeholder {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  text-align: center;
  background: #fafafa;
  border-top: 1px solid var(--color-border);
}

.booking-placeholder h2 {
  margin-bottom: 0.75rem;
}

/* ---------- Site Footer ---------- */
.site-footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: 3rem 1.5rem 1.5rem;
  margin-top: 3rem;
  position: relative;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.footer-heading {
  color: var(--color-footer-link);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.footer-address {
  font-style: normal;
  line-height: 1.8;
}

.footer-address a {
  color: var(--color-footer-link);
}

.footer-address a:hover,
.footer-address a:focus {
  text-decoration: underline;
}

.footer-nav-links {
  list-style: none;
}

.footer-nav-links li {
  margin-bottom: 0.5rem;
}

.footer-nav-links a {
  color: var(--color-footer-link);
  text-decoration: none;
  font-size: 0.95rem;
}

.footer-nav-links a:hover,
.footer-nav-links a:focus {
  text-decoration: underline;
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  font-size: 0.85rem;
  color: #aaaaaa;
}

/* ---------- Scroll-to-Top Button ---------- */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease, opacity 0.2s ease;
  z-index: 900;
  line-height: 1;
}

.scroll-to-top:hover,
.scroll-to-top:focus {
  background: var(--color-btn-hover);
}

.scroll-to-top:focus-visible {
  outline: 3px solid var(--color-link);
  outline-offset: 2px;
}

.scroll-to-top.visible {
  display: flex;
}

/* ---------- 404 Error Page ---------- */
.error-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
  text-align: center;
}

.error-page h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--color-heading);
}

.error-message {
  font-size: 1.1rem;
  color: var(--color-text-light);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.error-action {
  margin-bottom: 1rem;
}

.error-home-link {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  transition: background-color 0.2s ease;
}

.error-home-link:hover,
.error-home-link:focus {
  background: var(--color-btn-hover);
  color: var(--color-btn-text);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* ---------- Desktop layout: 992px+ — Alternating apartment cards ---------- */
@media (min-width: 992px) {
  .apartment-card {
    flex-direction: row;
  }

  .apartment-card-image {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .apartment-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .apartment-card-content {
    flex: 1;
    padding: 2rem;
    justify-content: center;
  }

  /* Alternating layout: even items swap image and text */
  .apartment-listing-item:nth-child(even) .apartment-card {
    flex-direction: row-reverse;
  }
}

/* ---------- Laptop: 1366px – 1919px ---------- */
@media (min-width: 1366px) and (max-width: 1919px) {
  .header-banner-image {
    height: 180px;
  }

  .site-title {
    font-size: 2.75rem;
  }
}

/* ---------- Desktop: 1920px+ ---------- */
@media (min-width: 1920px) {
  :root {
    --max-width: 1400px;
  }

  .header-banner-image {
    height: 200px;
  }

  .site-title {
    font-size: 3rem;
  }

  .site-tagline {
    font-size: 1.4rem;
  }

  .apartment-card-img {
    max-height: 650px;
  }
}

/* ---------- Tablet: 768px – 1365px ---------- */
@media (min-width: 768px) and (max-width: 1365px) {
  .header-banner-image {
    height: 140px;
  }

  .site-title {
    font-size: 2.25rem;
  }

  .welcome-section {
    padding: 2.5rem 1.5rem;
  }
}

/* ---------- Below 992px: single-column stacked layout ---------- */
@media (max-width: 991px) {
  .apartment-card {
    flex-direction: column;
  }

  .apartment-card-image {
    max-width: 100%;
  }

  .apartment-detail-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .amenities-list {
    grid-template-columns: 1fr;
  }
}

/* ---------- Mobile: below 768px — Hamburger menu ---------- */
@media (max-width: 767px) {
  .site-nav {
    justify-content: flex-end;
  }

  .hamburger-menu {
    display: flex;
    z-index: 100;
  }

  .hamburger-menu:focus-visible {
    outline: 2px solid var(--color-overlay-text);
    outline-offset: 2px;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-heading);
    z-index: 99;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li a {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Hamburger animation when open */
  .hamburger-menu[aria-expanded="true"] .hamburger-bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger-menu[aria-expanded="true"] .hamburger-bar:nth-child(2) {
    opacity: 0;
  }

  .hamburger-menu[aria-expanded="true"] .hamburger-bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .header-banner-image {
    height: 100px;
  }

  .site-title {
    font-size: 1.75rem;
  }

  .site-tagline {
    font-size: 1rem;
  }

  .welcome-section {
    padding: 2rem 1rem;
  }

  .welcome-text {
    font-size: 0.95rem;
  }

  .apartment-listings {
    padding: 0 1rem 2rem;
  }

  .apartment-listing-item {
    margin-bottom: 2rem;
  }

  .apartment-card-content {
    padding: 1.25rem;
  }

  .apartment-card-title {
    font-size: 1.2rem;
  }

  .apartment-card-details {
    flex-direction: column;
    gap: 0.5rem;
  }

  .apartment-detail {
    padding: 0 1rem;
  }

  .apartment-detail-title {
    font-size: 1.5rem;
  }

  .apartment-detail-booking {
    padding: 1rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .error-page {
    padding: 3rem 1rem;
  }

  .error-page h1 {
    font-size: 2rem;
  }

  .scroll-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    font-size: 1.25rem;
  }
}

/* ---------- Small mobile: 320px baseline ---------- */
@media (max-width: 374px) {
  body {
    font-size: 0.9375rem;
  }

  .site-title {
    font-size: 1.5rem;
  }

  .apartment-card-content {
    padding: 1rem;
  }

  .apartment-detail-meta {
    padding: 0.75rem;
  }
}

/* ---------- Content Pages (About, etc.) & Contact Page ---------- */
.content-page,
.contact-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.content-page h1,
.contact-page h1 {
  margin-bottom: 1.5rem;
}

.content-page-body {
  max-width: 800px;
}

.content-page-body p {
  margin-bottom: 1rem;
  line-height: 1.8;
}

.contact-address {
  font-style: normal;
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

.contact-methods {
  list-style: none;
  padding: 0;
}

.contact-methods li {
  margin-bottom: 0.75rem;
}

/* ---------- Content page image gallery ---------- */
/* Content pages now reuse the .gallery / .gallery-grid / .gallery-item styles
   from gallery.css so they get the lightbox behaviour for free. The old
   .content-page-gallery rules were removed in favour of that approach. */

/* Accessibly hidden from sighted users but exposed to screen readers.
   Used on the gallery heading on content pages where a visible
   "Photo Gallery" heading would duplicate the page's H1. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Legal pages (Privacy Policy, Imprint) ---------- */
.legal-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.legal-page h1 {
  margin-bottom: 1.5rem;
}

.legal-page-body {
  max-width: 800px;
  line-height: 1.7;
}

.legal-page-body h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.legal-page-body p,
.legal-page-body ul,
.legal-page-body ol {
  margin-bottom: 1rem;
}

.legal-page-body ul,
.legal-page-body ol {
  padding-left: 1.5rem;
}

.legal-page-body li {
  margin-bottom: 0.35rem;
}

.legal-page-body code {
  background: #f4f4f4;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Draft banner shown on unreviewed legal pages. Remove by flipping the page
   template from "legal-page" to "content-page" once a lawyer has signed off. */
.draft-banner {
  max-width: 800px;
  margin: 0 0 1.75rem;
  padding: 0.9rem 1rem;
  border-left: 4px solid #c08a00;
  background: #fff8e5;
  color: #3a2b00;
  font-size: 0.95rem;
  line-height: 1.5;
  border-radius: 2px;
}

.draft-banner strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* ---------- Footer legal links (Privacy, Imprint) ---------- */
.footer-legal {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem 0;
}

.footer-legal-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
  opacity: 0.85;
}

.footer-legal-links li {
  margin: 0;
}
