/* ---------- 1. Design tokens ---------- */
:root {
  --black: #121010;
  --charcoal: #2a2521;
  --gold: #c9a24b;
  --gold-dark: #8a6a1f;
  --paper: #f7f1e3;   /* light text and cards, always light */
  --bg: #f7f1e3;      /* page background (changes in dark mode) */
  --text: #1b1613;    /* body text (changes in dark mode) */

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-script: 'Pinyon Script', 'Brush Script MT', cursive;
  --font-body: 'Lora', Georgia, serif;
}

/* ---------- 2. Reset and base ---------- */
* { box-sizing: border-box; margin: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.15; }
h1 { font-size: clamp(2.4rem, 7vw, 4.6rem); font-weight: 800; }
h2 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 700; margin-bottom: 1rem; }
h3 { font-size: 1.35rem; font-weight: 600; margin-bottom: .4rem; }

/* Gold double rule under every h2 */
h2::after {
  content: "";
  display: block;
  width: 90px;
  height: 3px;
  margin-top: .8rem;
  border-block: 2px solid var(--gold-dark);
}

a { color: inherit; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- 3. Header ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: .8rem 5%;
  background: var(--black);
  color: var(--paper);
  border-bottom: 3px solid var(--gold);
}

header > a {
  font-family: var(--font-script);
  font-size: 2rem;
  line-height: 1;
  color: var(--gold);
  text-decoration: none;
}

nav ul { display: flex; flex-wrap: wrap; gap: 1.5rem; list-style: none; padding: 0; }
nav a { text-decoration: none; font-weight: 700; letter-spacing: .04em; }
nav a:hover { color: var(--gold); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

.menu-btn {
  display: none; /* shown on phones, see the media query below */
  font: inherit;
  font-weight: 700;
  padding: .4rem 1rem;
  background: var(--gold);
  color: var(--black);
  border: 2px solid var(--gold);
  border-radius: 2px;
  cursor: pointer;
}

/* ---------- 4. Sections ---------- */
/* Keeps everything lined up on the same left edge, max 1000px wide */
section { padding: 5rem max(5%, calc((100% - 1000px) / 2)); }
section p { max-width: 65ch; margin-bottom: 1rem; }

#what-we-do { background: var(--gold); color: var(--black); }
#what-we-do h2::after { border-color: var(--black); }

#design { background: var(--charcoal); color: var(--paper); }
#design h2::after, #investors h2::after { border-color: var(--gold); }

#mission { background: var(--bg); text-align: center; }
#mission h2::after { margin-inline: auto; }
#mission p {
  font-family: var(--font-script);
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  line-height: 1.3;
  max-width: 28ch;
  margin-inline: auto;
}

#investors { background: var(--black); color: var(--paper); }

/* ---------- 5. Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding-block: 7rem 8rem;
  color: var(--paper);
  background-color: var(--black); /* shows if there is no photo */
  background-image:
    linear-gradient(rgba(10, 8, 6, .72), rgba(10, 8, 6, .84)),
    url('images/house.jpg');
  background-size: cover;
  background-position: center;
}

.hero h1 { max-width: 18ch; margin-inline: auto; text-shadow: 0 2px 14px rgba(0, 0, 0, .6); }
.hero p { max-width: 52ch; margin: 1.5rem auto 2rem; font-size: 1.25rem; }

/* Gold double frame */
.hero::before {
  content: "";
  position: absolute;
  inset: 1.4rem;
  border: 1px solid var(--gold);
  outline: 1px solid rgba(201, 162, 75, .55);
  outline-offset: 5px;
  pointer-events: none;
}

/* Script tagline at the bottom of the hero */
.hero::after {
  content: "Co-living · Bridgwater";
  position: absolute;
  bottom: 2.6rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-script);
  font-size: 1.8rem;
  color: var(--gold);
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-block;
  margin: 0 .8rem .8rem 0;
  padding: .8rem 1.6rem;
  background: var(--gold);
  color: var(--black);
  font: inherit;
  font-weight: 700;
  letter-spacing: .03em;
  text-decoration: none;
  border: 2px solid var(--black);
  border-radius: 2px;
  box-shadow: 0 0 0 2px var(--gold); /* gold outer ring */
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn:hover { background: var(--black); color: var(--gold); }

.btn-alt { background: transparent; color: var(--paper); border-color: var(--paper); box-shadow: none; }
.btn-alt:hover { background: var(--paper); color: var(--black); }

/* ---------- 7. Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.8rem;
  margin-top: 2rem;
}

article {
  background: var(--paper);
  color: var(--black);
  padding: 1.6rem;
  border: 4px double var(--black);
  border-radius: 2px;
}

/* ---------- 8. Contact form ---------- */
form { display: grid; gap: .5rem; max-width: 600px; margin: 1.5rem 0 2rem; }
label { font-weight: 700; margin-top: .6rem; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: .75rem 1rem;
  background: #fff;
  color: #1b1613;
  border: 2px solid var(--black);
  border-radius: 2px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 3px var(--gold);
}

form .btn { justify-self: start; margin-top: 1rem; }

.hp { position: absolute; left: -9999px; }
#form-status { font-weight: 700; margin-top: .5rem; min-height: 1.6rem; }
#form-status.error { color: #b3261e; }

/* ---------- 9. Footer ---------- */
footer {
  padding: 2rem 5%;
  background: var(--black);
  color: var(--paper);
  border-top: 3px solid var(--gold);
  font-size: .95rem;
  text-align: center;
}
footer p { margin: 0 auto; }
footer .credit { margin-top: .5rem; font-size: .85rem; opacity: .8; }

/* ---------- 10. Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}

/* ---------- 11. Phones and small tablets ---------- */
@media (max-width: 700px) {
  section { padding-block: 3.5rem; }

  header { flex-wrap: wrap; justify-content: flex-start; }
  header > a { font-size: 1.7rem; }
  .menu-btn { display: block; }
  nav { display: none; width: 100%; }
  nav.open { display: block; }
  nav ul { flex-direction: column; gap: 1rem; padding: .5rem 0 1rem; }

  .hero { padding-block: 4.5rem 6rem; }
  .hero::before { inset: .9rem; }
  .hero::after { font-size: 1.5rem; bottom: 1.8rem; }

  .btn { display: block; width: 100%; text-align: center; margin-right: 0; }
  form .btn { justify-self: stretch; }
}

/* ---------- 12. Dark mode ---------- */
@media (prefers-color-scheme: dark) {
  :root { --bg: #1a1612; --text: #f3ead6; --gold-dark: #d9b45f; }
  #form-status.error { color: #ff8a80; }
}

/* ---------- 13. Projects gallery ---------- */
#projects { background: var(--bg); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}
.project-grid .empty { grid-column: 1 / -1; font-style: italic; }

.project {
  background: var(--paper);
  color: var(--black);
  border: 4px double var(--black);
}

.project-photo {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: var(--charcoal);
  overflow: hidden;
  cursor: pointer;
}
.project-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.project-photo:hover img { transform: scale(1.05); }

.photo-count {
  position: absolute;
  right: .6rem;
  bottom: .6rem;
  padding: .2rem .7rem;
  background: var(--black);
  color: var(--gold);
  border: 1px solid var(--gold);
  font-size: .85rem;
  font-weight: 700;
}

.project-body { padding: 1.2rem 1.4rem 1.4rem; }
.project-place { font-style: italic; color: var(--charcoal); margin-bottom: .5rem; }

/* Photo viewer */
#lightbox {
  padding: 0;
  max-width: 95vw;
  max-height: 95vh;
  overflow: hidden;
  background: var(--black);
  color: var(--paper);
  border: 4px double var(--gold);
}
#lightbox::backdrop { background: rgba(0, 0, 0, .88); }
#lightbox img {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: 78vh;
  margin: 0 auto;
  object-fit: contain;
}
#lb-caption {
  margin: 0;
  padding: .8rem 1rem;
  text-align: center;
  font-family: var(--font-heading);
}
.lb-close, .lb-nav {
  position: absolute;
  width: 2.8rem;
  height: 2.8rem;
  background: var(--black);
  color: var(--gold);
  border: 2px solid var(--gold);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.lb-close { top: .6rem; right: .6rem; }
.lb-nav { top: 40%; }
.lb-prev { left: .6rem; }
.lb-next { right: .6rem; }
.lb-nav[hidden] { display: none; }

/* ---------- 14. Testimonials ---------- */
[hidden] { display: none !important; }

#testimonials { background: var(--gold); color: var(--black); }
#testimonials h2::after { border-color: var(--black); }

.quote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.quote {
  background: var(--paper);
  color: var(--black);
  border: 4px double var(--black);
  padding: 2rem 1.6rem 1.5rem;
}
.quote::before {
  content: "\201C";
  display: block;
  margin-bottom: .4rem;
  font-family: var(--font-script);
  font-size: 5rem;
  line-height: .6;
  color: #8a6a1f;
}
.quote blockquote { margin: 0 0 1.2rem; font-style: italic; font-size: 1.15rem; }
.quote figcaption { display: grid; gap: .1rem; }
.quote figcaption strong { font-family: var(--font-heading); font-size: 1.1rem; }
.quote figcaption span { color: var(--charcoal); font-size: .95rem; }

/* ---------- 15. Testimonial Read more ---------- */
.quote-grid { align-items: start; }

.quote blockquote.clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
  margin-bottom: .6rem;
}

.read-more {
  margin: 0 0 1.2rem;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.read-more:hover { color: #8a6a1f; }

/* ---------- 16. Privacy notice and policy page ---------- */
.form-note { margin: .6rem 0 0; max-width: none; font-size: .95rem; }
.form-note a { color: inherit; }

footer .footer-link { margin-top: .5rem; }
footer a { color: inherit; }

header > a.back { font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: var(--paper); }
header > a.back:hover { color: var(--gold); }

.legal { background: var(--bg); }
.legal h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: .5rem; }
.legal h2 { font-size: 1.5rem; margin: 2.2rem 0 .5rem; }
.legal h2::after { display: none; }
.legal ul { max-width: 65ch; margin: 0 0 1rem; padding-left: 1.4rem; }
.legal li { margin-bottom: .5rem; }

/* ---------- 17. Fixed photo behind the whole site ---------- */
:root { --glass: .88; } /* 1 = photo fully hidden, lower = more photo shows through */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('images/house.jpg') center / cover no-repeat;
}

/* Hero keeps a dark overlay so the headline stays easy to read */
.hero { background: linear-gradient(rgba(10, 8, 6, .5), rgba(10, 8, 6, .72)); }

/* Sections become translucent panels over the photo */
#about, #projects, #mission, #contact, .legal { background: rgb(247 241 227 / var(--glass)); }
#what-we-do, #testimonials { background: rgb(201 162 75 / var(--glass)); }
#design { background: rgb(42 37 33 / var(--glass)); }
#investors { background: rgb(18 16 16 / var(--glass)); }

@media (prefers-color-scheme: dark) {
  #about, #projects, #mission, #contact, .legal { background: rgb(26 22 18 / var(--glass)); }
}
