/* === GLOBAL VARIABLES === */
:root {
  --brand-bg: #8A9C91;
  --brand-fg: #D7E6DD;
  --accent: #639372;
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Montserrat', sans-serif;
  --bg-color: #fff;
  --text-color: #333;

  /* Flip card helpers */
  --card-radius: 6px;
  --card-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

html[data-theme="dark"] {
  --brand-bg: #2e3b37;
  --brand-fg: #d7e6dd;
  --accent: #9fc8aa;
  --bg-color: #121212;
  --text-color: #e0e0e0;
}

/* === RESET & LAYOUT === */
html {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

img,
.responsive-img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* === UTILITY === */
section, .build-process, .contact {
  padding: 4rem 0;
}

/* === CONTAINER === */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 0.25rem;
  /* tiny gutter */
}

/* === HEADER === */
header {
  background: var(--brand-bg);
  padding: 0.5rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo img {
  height: 90px;
  width: auto;
}

/* NAV */
.main-nav {
  display: flex;
  align-items: center;
}

.main-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  padding: 0.5rem 0.75rem;
  font-weight: 500;
  color: var(--brand-fg);
  transition: color 0.3s, background 0.3s;
  border-radius: 4px;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: #fff;
  background: rgba(0,0,0,0.1);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  position: relative;
  border: 0;
  background: transparent;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

.nav-toggle .nav-toggle-icon {
  font-size: 22px;
  color: var(--brand-fg);
  line-height: 1;
  pointer-events: none;
}

/* === HERO === */
.hero {
  position: relative;
  min-height: 80vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: 0;
}

.hero .hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem;
  color: var(--brand-fg);
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 3rem);
}

.hero p {
  font-size: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 1rem;
}

/* === BUTTON === */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  background: var(--brand-fg);
  color: var(--brand-bg);
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.3s, color 0.3s;
  cursor: pointer;
  border: none;
}

.btn:hover {
  background: var(--accent);
  color: #fff;
}

.btn:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === BUILD PROCESS (FLIP CARDS) === */
.build-process {
  background: #f4f7f6;
  text-align: center;
}

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

/* Force one row on large desktop */
@media (min-width: 1200px) {
  .process-grid {
    grid-template-columns: repeat(7, 1fr);
    justify-items: center;
    align-items: stretch;
  }
}

.process-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.1;
  perspective: 1000px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s ease;
  transform-style: preserve-3d;
  border-radius: var(--card-radius);
}

.process-card:hover .card-inner,
.process-card.is-flipped .card-inner {
  transform: rotateY(180deg);
}

/* Faces */
.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* FRONT */
.card-face.front {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  padding: 1rem;
  transition: transform 0.3s ease;
}

.card-face.front i {
  font-size: 2rem;
  color: var(--brand-bg);
  margin-bottom: 0.5rem;
}

.card-face.front strong {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.card-face.front span {
  font-size: 0.9rem;
  color: #666;
}

.process-card:hover .card-face.front {
  transform: translateY(-4px);
}

/* BACK */
.card-face.back {
  transform: rotateY(180deg);
  background: #000;
  padding: 0;
}

.card-face.back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 1024px) {
  .process-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .card-face.front i {
    font-size: 1.75rem;
  }
}

/* === ABOUT === */
.about {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

.about-text {
  flex: 1;
}

.about-text p {
  font-size: 1.1rem;
}

.about-img {
  flex: 1;
  max-width: 500px;
  border-radius: 8px;
  overflow: hidden;
}

.about-img img {
  width: 60%;
  border-radius: 8px;
}

/* === SERVICES === */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.service-card {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-top: 4px solid var(--brand-bg);
  border-radius: 6px;
  padding: 1.5rem;
  transition: transform 0.3s;
}

.service-card:hover {
  transform: translateY(-5px);
}

.service-card h3 {
  font-family: var(--font-heading);
  color: var(--brand-bg);
  margin-bottom: 0.5rem;
}

/* === GALLERY === */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* === TESTIMONIALS === */
.testimonials .testimonial-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* === PARTNERS === */
.logo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  align-items: center;
}

.logo-item {
  width: 90px;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-item img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  opacity: 0.9;
  transition: opacity 0.3s, transform 0.3s;
}

.logo-item img:hover {
  opacity: 1;
  transform: scale(1.05);
}

/* === CONTACT === */
.contact .container {
  max-width: 800px;
}

.contact form {
  display: grid;
  gap: 1rem;
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.08);
}

.contact form input[type="text"],
.contact form input[type="email"],
.contact form input[type="tel"],
.contact form select,
.contact form textarea {
  width: 100%;
  padding: 12px 15px;
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-color);
  background-color: #f7f8f7;
  border: 1px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.contact form select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 16px;
}

.contact form input:focus,
.contact form select:focus,
.contact form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 147, 114, 0.2);
}

.contact form ::placeholder {
  color: #999;
  opacity: 1;
}

.contact form textarea {
  min-height: 150px;
  resize: vertical;
}

.contact form .btn {
  width: 100%;
  margin: 0;
  background-color: var(--brand-bg);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  padding: 12px 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.contact form .btn:hover,
.contact form .btn:focus {
  background-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

/* === MEMBER === */
.member-logos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  padding: 20px;
  justify-items: center;
  align-items: center;
  max-width: 100%;
  margin: 0 auto;
}

.member-logos-grid img {
  width: 140px;
  height: auto;
  display: block;
}

/* === FOOTER === */
footer {
  background: var(--brand-bg);
  color: var(--brand-fg);
  text-align: center;
  font-size: 0.9rem;
  padding: 1.5rem 1rem;
  margin-top: auto;
}

footer a {
  color: var(--brand-fg);
  text-decoration: underline;
}

/* === LARGE SCREEN OVERRIDES === */
@media (min-width: 1025px) {
  header .header-inner,
  .build-process.container,
  .testimonials {
    max-width: none;
    padding: 0.5rem;
  }

  .process-grid {
    grid-template-columns: repeat(7, 1fr);
    margin: 0;
    width: 100%;
  }
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .main-nav {
    display: none;
    width: 100%;
  }

  .nav-toggle[aria-expanded="true"] + .main-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--brand-bg);
    padding: 0.5rem;
    border-radius: 6px;
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links a {
    display: block;
  }

  .about {
    flex-direction: column;
    text-align: center;
  }

  .about-img {
    display: flex;
    justify-content: center;
  }

  .about-text {
    padding: 1rem;
  }

  .member-logos-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 16px;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .logo img {
    height: 120px;
  }

  .process-card .card-inner {
    min-height: 220px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .process-card .card-inner {
    transition: none;
  }
}

/* === COOKIE POPUP === */
.cookie-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--brand-bg);
  color: var(--brand-fg);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Hidden state (default) */
.cookie-popup.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

/* Inner container */
.cookie-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Text inside popup */
.cookie-box p {
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.5;
  color: var(--brand-fg);
}

/* Okay button */
.cookie-box .btn {
  align-self: flex-end;
  background: var(--brand-fg);
  color: var(--brand-bg);
  font-weight: 600;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Button hover state */
.cookie-box .btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .cookie-popup {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: unset;
  }
}