/* =========================================================
   HomeFinder Nigeria — beginner-friendly stylesheet
   Colours: navy blue, white, and a tasteful green accent
   ========================================================= */

:root {
  --navy: #0b1f3a;
  --navy-dark: #071528;
  --navy-soft: #163056;
  --white: #ffffff;
  --off-white: #f4f7fb;
  --green: #1f7a4d;
  --green-dark: #165c39;
  --text: #1c2430;
  --muted: #5b6777;
  --border: #d7e0ea;
  --shadow: 0 12px 32px rgba(11, 31, 58, 0.12);
  --radius: 14px;
  --max-width: 1120px;
}

/* Reset a few browser defaults so spacing is predictable */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--green-dark);
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -40px;
  background: var(--green);
  color: var(--white);
  padding: 0.5rem 0.8rem;
  z-index: 1000;
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---------- Header / navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--white);
  text-decoration: none;
}

.logo small {
  display: block;
  color: #c9d6e8;
  font-size: 0.75rem;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--green);
  font-weight: 700;
}

.site-nav ul {
  display: flex;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--white);
  text-decoration: none;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  display: inline-block;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: var(--navy-soft);
}

.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
}

/* ---------- Buttons and form fields ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--green);
  color: var(--white);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--green-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--border);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-weight: 600;
  font-size: 0.92rem;
}

.field input,
.field select,
.field textarea {
  font: inherit;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.required {
  color: var(--muted);
  font-weight: 500;
}

.helper-text,
.form-feedback {
  font-size: 0.95rem;
}

.form-feedback {
  min-height: 1.4em;
  margin: 0.4rem 0 0;
}

.form-feedback.error {
  color: #9b1c1c;
}

.form-feedback.success {
  color: var(--green-dark);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 86vh;
  color: var(--white);
}

.hero-photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0b1f3a;
}

/* Stack every slideshow photo in the same space, then fade with opacity.
   max-width: none stops the global img rule from shrinking these photos. */
#hero-slideshow .hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 1.2s ease-in-out;
}

#hero-slideshow .hero-slide.is-active {
  opacity: 1;
  z-index: 1;
}

/* If JavaScript is slow or blocked, CSS still rotates the 3 photos every 5 seconds. */
#hero-slideshow:not(.js-ready) .hero-slide:nth-child(1) {
  animation: heroFadeFirst 15s infinite;
}

#hero-slideshow:not(.js-ready) .hero-slide:nth-child(2) {
  animation: heroFade 15s infinite 5s;
}

#hero-slideshow:not(.js-ready) .hero-slide:nth-child(3) {
  animation: heroFade 15s infinite 10s;
}

@keyframes heroFadeFirst {
  0%,
  30% { opacity: 1; }
  38%,
  96% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes heroFade {
  0% { opacity: 0; }
  8%,
  30% { opacity: 1; }
  38%,
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #hero-slideshow .hero-slide {
    animation: none !important;
    transition: none;
  }

  #hero-slideshow .hero-slide:first-child {
    opacity: 1;
  }
}

.hero-overlay {
  position: relative;
  min-height: 86vh;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, rgba(7, 21, 40, 0.88) 0%, rgba(7, 21, 40, 0.45) 70%, rgba(7, 21, 40, 0.2) 100%);
  padding: 4.5rem 0 3rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  color: #9fe0bd;
  margin: 0 0 0.6rem;
}

.hero h1,
.section h2 {
  line-height: 1.2;
  margin: 0 0 0.8rem;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  max-width: 16ch;
}

.lead {
  max-width: 62ch;
  color: #e6edf6;
}

.search-card {
  margin-top: 1.6rem;
  background: var(--white);
  color: var(--text);
  padding: 1.1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

.search-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

#search-feedback {
  grid-column: 1 / -1;
}

.notice-bar {
  background: #eef7f1;
  border-top: 3px solid var(--green);
  border-bottom: 1px solid var(--border);
}

.notice-bar p {
  margin: 0.9rem 0;
}

/* ---------- Listings ---------- */
.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--off-white);
}

.section-heading {
  max-width: 70ch;
  margin-bottom: 1.5rem;
}

.results-count {
  color: var(--muted);
  margin-bottom: 1rem;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.property-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  width: 100%;
}

.property-card:hover,
.property-card:focus-visible {
  outline: 2px solid var(--green);
  transform: translateY(-2px);
}

.property-card img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  background: #dbe4ee;
}

.card-body {
  padding: 1rem 1.05rem 1.15rem;
}

.price {
  margin: 0;
  color: var(--navy);
  font-size: 1.2rem;
}

.card-body h3 {
  margin: 0.3rem 0 0.2rem;
}

.meta {
  color: var(--muted);
  margin: 0.2rem 0 0.8rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  background: #e8f5ee;
  color: var(--green-dark);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.empty-state {
  background: var(--off-white);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* ---------- Sell and contact ---------- */
.sell-grid,
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: start;
}

.checklist,
.info-card ul {
  padding-left: 1.2rem;
}

.info-card,
.contact-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
}

.contact-card {
  display: grid;
  gap: 0.9rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-dark);
  color: #d5deea;
  padding: 1.6rem 0;
}

.footer-inner p {
  margin: 0.25rem 0;
}

/* ---------- Modal ---------- */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 21, 40, 0.72);
}

.modal-dialog {
  position: relative;
  z-index: 51;
  width: min(92vw, 720px);
  max-height: 90vh;
  overflow: auto;
  margin: 5vh auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  border: 0;
  background: var(--navy);
  color: var(--white);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-photo {
  width: 100%;
  height: 280px;
  object-fit: cover;
  background: #dbe4ee;
}

.modal-content {
  padding: 1.2rem 1.4rem 1.6rem;
}

.modal-content .sample-note {
  background: #eef7f1;
  border-left: 4px solid var(--green);
  padding: 0.7rem 0.85rem;
}

/* ---------- Responsive layouts ---------- */
@media (max-width: 960px) {
  .search-card,
  .listings-grid,
  .sell-grid,
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .nav-toggle-label {
    display: block;
    width: 28px;
    cursor: pointer;
  }

  .nav-toggle-label span,
  .nav-toggle-label span::before,
  .nav-toggle-label span::after {
    display: block;
    height: 2px;
    background: var(--white);
    position: relative;
  }

  .nav-toggle-label span::before,
  .nav-toggle-label span::after {
    content: "";
    position: absolute;
    width: 100%;
  }

  .nav-toggle-label span::before {
    top: -8px;
  }

  .nav-toggle-label span::after {
    top: 8px;
  }

  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 72px;
    background: var(--navy-dark);
    padding: 0.8rem 1rem 1.1rem;
  }

  .site-nav ul {
    flex-direction: column;
  }

  .nav-toggle:checked ~ .site-nav {
    display: block;
  }

  .search-card,
  .listings-grid,
  .sell-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: none;
  }

  .modal-photo {
    height: 200px;
  }
}
