/* ============================================
   KALMAR BUILDING SERVICES
   Professional, Clean, Modern Design
   ============================================ */

:root {
  --color-primary: #0f172a;
  --color-secondary: #ffffff;
  --color-accent: #c9a87c;
  --color-accent-dark: #a8875f;
  --color-accent-light: rgba(201, 168, 124, 0.12);
  --color-bg: #f8f6f3;
  --color-border: #e8e4df;
  --color-text: #1a1a2e;
  --color-text-light: #6b6b7a;
  --color-navy-mid: #1e2d4a;

  --font-display: "Playfair Display", serif;
  --font-body: "Raleway", sans-serif;
  --font-mono: "Montserrat", sans-serif;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 600ms;
  --easing: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.16);
}

/* ============================================
   RESET & BASE
   ============================================ */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-secondary);
  color: var(--color-text);
  line-height: 1.6;
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--duration-normal) var(--easing);
}

a:hover {
  color: var(--color-accent-dark);
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.noscroll {
  overflow: hidden;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

h1 { font-size: clamp(2.8rem, 7vw, 5.5rem); }
h2 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
h3 { font-size: 1.35rem; font-family: var(--font-body); font-weight: 600; letter-spacing: 0; }
h4 { font-size: 1.1rem; font-weight: 600; font-family: var(--font-body); }

p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text-light);
  margin-bottom: var(--space-md);
}

/* ============================================
   BUTTONS
   ============================================ */

button {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  transition: all var(--duration-normal) var(--easing);
  padding: 0.9rem 2rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  background-color: var(--color-accent);
  color: var(--color-primary);
}

button:hover {
  background-color: var(--color-accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(201, 168, 124, 0.35);
}

button:active {
  transform: translateY(0);
}

button.btn-secondary {
  background-color: transparent;
  color: var(--color-secondary);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
}

button.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: white;
  box-shadow: none;
}

button.btn-dark {
  background-color: var(--color-primary);
  color: var(--color-secondary);
}

button.btn-dark:hover {
  background-color: var(--color-navy-mid);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.3);
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
}

.section-header h2 {
  margin-bottom: var(--space-md);
}

.section-header p {
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-light); }

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(2.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn var(--duration-slow) var(--easing) both; }
.fade-in-up { animation: fadeInUp var(--duration-slow) var(--easing) both; }

.reveal {
  opacity: 0;
  transform: translateY(2rem);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--duration-slow) var(--easing),
              transform var(--duration-slow) var(--easing);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  transition: background-color var(--duration-normal) var(--easing),
              box-shadow var(--duration-normal) var(--easing);
}

header.scrolled {
  background-color: #fff;
  box-shadow: 0 1px 0 var(--color-border), var(--shadow-sm);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  max-width: 1240px;
  margin: 0 auto;
}

.logo { flex-shrink: 0; }

.logo img {
  height: 46px;
  width: auto;
  transition: opacity var(--duration-normal) var(--easing);
}

.logo img:hover { opacity: 0.8; }

/* White logo over hero, normal logo when scrolled */
.logo-light {
  display: block;
  filter: brightness(0) invert(1);
}
.logo-dark { display: none; }

header.scrolled .logo-light { display: none; }
header.scrolled .logo-dark { display: block; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

.nav-menu a {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: relative;
  transition: color var(--duration-normal) var(--easing);
}

.nav-menu a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background-color: var(--color-accent);
  transition: width var(--duration-normal) var(--easing);
}

.nav-menu a:hover { color: var(--color-accent); }
.nav-menu a:hover::after { width: 100%; }

header.scrolled .nav-menu a {
  color: var(--color-text);
}

header.scrolled .nav-menu a:hover {
  color: var(--color-accent);
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: var(--space-xs);
  cursor: pointer;
  box-shadow: none;
  touch-action: manipulation;
}

.mobile-menu-btn:hover {
  background: none;
  transform: none;
  box-shadow: none;
}

.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 3px;
  flex-shrink: 0;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 1.5px;
  transition: all var(--duration-normal) var(--easing);
}

header.scrolled .mobile-menu-btn:not(.active) span {
  background-color: var(--color-text);
}
.mobile-menu-btn.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.mobile-menu-btn.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 768px) {
  nav { padding: var(--space-md); }

  .logo img { height: 38px; }

  .nav-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-xl);
    background-color: var(--color-primary);
    padding: var(--space-3xl) var(--space-lg);
    z-index: 9998;
  }

  .nav-menu.active { display: flex; }

  .nav-menu a,
  header.scrolled .nav-menu a {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.85);
  }

  header.scrolled .nav-menu a:hover {
    color: var(--color-accent);
  }

  .nav-menu a::after { display: none; }

  .mobile-menu-btn {
    display: flex;
    position: relative;
    z-index: 10000;
  }
}

/* ============================================
   HERO SECTION — full-screen background
   ============================================ */

.hero {
  position: relative;
  height: 100vh;
  min-height: 640px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-carousel {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.carousel-item {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s var(--easing);
}

.carousel-item.active { opacity: 1; }

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    105deg,
    rgba(10, 16, 30, 0.82) 0%,
    rgba(10, 16, 30, 0.55) 55%,
    rgba(10, 16, 30, 0.25) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
}

.hero-text {
  max-width: 680px;
}

.hero-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
  opacity: 0;
  animation: fadeInUp 0.7s var(--easing) 0.2s both;
}

.hero-text h1 {
  color: white;
  margin-bottom: var(--space-lg);
  line-height: 1.08;
  opacity: 0;
  animation: fadeInUp 0.7s var(--easing) 0.4s both;
}

.hero-text p {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.75);
  max-width: 520px;
  margin-bottom: var(--space-lg);
  opacity: 0;
  animation: fadeInUp 0.7s var(--easing) 0.55s both;
}

.hero-cta {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  opacity: 0;
  animation: fadeInUp 0.7s var(--easing) 0.7s both;
}

.hero-scroll {
  position: absolute;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  animation: fadeIn 1s var(--easing) 1.2s both;
}

.hero-scroll span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.hero-scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.5), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(0.6); }
}

@media (max-width: 768px) {
  .hero { min-height: 100svh; }

  .hero-text h1 { font-size: clamp(2.2rem, 10vw, 3.2rem); }
  .hero-text p { font-size: 0.95rem; }

  .hero-cta {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .hero-cta button { width: 100%; }
  .hero-scroll { display: none; }
}

/* ============================================
   STATS BAR
   ============================================ */

.stats {
  background-color: var(--color-primary);
  padding: var(--space-2xl) var(--space-lg);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  max-width: 1240px;
  margin: 0 auto;
}

.stat {
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.stat:last-child { border-right: none; }

.stat-number {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3rem);
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }

  .stat {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .stat:nth-child(2n), .stat:last-child { border-right: none; }
  .stat:nth-last-child(-n+2) { border-bottom: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   SERVICES SECTION
   ============================================ */

.services {
  padding: var(--space-3xl) var(--space-lg);
  background-color: var(--color-secondary);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: var(--space-xl);
  max-width: 1240px;
  margin: 0 auto;
}

.service-card {
  background: var(--color-bg);
  border-radius: 2px;
  overflow: hidden;
  transition: all var(--duration-normal) var(--easing);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  color: inherit;
  text-decoration: none;
}

.service-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--color-accent);
  transform: scaleX(0);
  transition: transform var(--duration-normal) var(--easing);
  transform-origin: left;
}

.service-card:hover::after { transform: scaleX(1); }

.service-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.service-card-image {
  width: 100%;
  height: 240px;
  overflow: hidden;
  background-color: var(--color-border);
}

.service-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--easing);
}

.service-card:hover .service-card-image img {
  transform: scale(1.06);
}

.service-card-content {
  padding: var(--space-xl) var(--space-xl) var(--space-xl);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.service-card-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.service-card h3 {
  margin-bottom: var(--space-md);
  font-size: 1.2rem;
  color: var(--color-text);
}

.service-card p {
  flex-grow: 1;
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* ============================================
   GALLERY PREVIEW (homepage)
   ============================================ */

.gallery-preview {
  padding: var(--space-3xl) var(--space-lg);
  background-color: var(--color-bg);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 280px);
  gap: 12px;
  max-width: 1240px;
  margin: 0 auto var(--space-2xl);
}

.preview-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background-color: var(--color-border);
  color: inherit;
  text-decoration: none;
  display: block;
}

.preview-item.featured {
  grid-column: span 2;
  grid-row: span 1;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--easing);
}

.preview-item:hover img {
  transform: scale(1.05);
}

.preview-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 16, 30, 0.65) 0%, transparent 50%);
  display: flex;
  align-items: flex-end;
  padding: var(--space-md);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing);
}

.preview-item:hover .preview-overlay { opacity: 1; }

.preview-overlay span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: white;
}

.preview-cta {
  text-align: center;
}

@media (max-width: 768px) {
  .preview-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 220px);
  }

  .preview-item.featured {
    grid-column: span 2;
  }
}

@media (max-width: 480px) {
  .preview-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 200px 200px 200px;
  }
}

/* ============================================
   TESTIMONIALS SECTION
   ============================================ */

.testimonials {
  padding: var(--space-3xl) var(--space-lg);
  background-color: var(--color-primary);
  color: var(--color-secondary);
}

.testimonials .section-header h2 {
  color: var(--color-secondary);
}

.testimonials .section-header p {
  color: rgba(255, 255, 255, 0.55);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-xl);
  max-width: 1240px;
  margin: 0 auto;
}

.testimonial {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: var(--space-xl);
  border-radius: 2px;
  transition: all var(--duration-normal) var(--easing);
  position: relative;
}

.testimonial::before {
  content: '\201C';
  position: absolute;
  top: var(--space-md);
  left: var(--space-xl);
  font-family: var(--font-display);
  font-size: 5rem;
  line-height: 1;
  color: var(--color-accent);
  opacity: 0.25;
  pointer-events: none;
}

.testimonial:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-4px);
  border-color: rgba(201, 168, 124, 0.2);
}

.testimonial-stars {
  display: flex;
  gap: 3px;
  margin-bottom: var(--space-md);
}

.testimonial-stars span {
  color: var(--color-accent);
  font-size: 0.9rem;
}

.testimonial-text {
  font-style: italic;
  font-size: 0.97rem;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-lg);
}

.testimonial-author {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
}

/* ============================================
   CTA SECTION
   ============================================ */

.cta {
  padding: var(--space-3xl) var(--space-lg);
  background: linear-gradient(135deg, var(--color-navy-mid) 0%, var(--color-primary) 100%);
  color: var(--color-secondary);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(201, 168, 124, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.cta h2 {
  color: var(--color-secondary);
  margin-bottom: var(--space-lg);
}

.cta p {
  color: rgba(255, 255, 255, 0.65);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto var(--space-xl);
}

/* ============================================
   CONTACT SECTION
   ============================================ */

.contact {
  padding: var(--space-3xl) var(--space-lg);
  background-color: var(--color-secondary);
}

.contact-content {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: var(--space-3xl);
  max-width: 1240px;
  margin: 0 auto;
  align-items: start;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

.contact-item h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
}

.contact-item p,
.contact-item a {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  margin: 0;
}

.contact-item a:hover { color: var(--color-accent); }

.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

label {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-light);
}

input, textarea {
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 1rem;
  background-color: var(--color-bg);
  color: var(--color-text);
  transition: all var(--duration-normal) var(--easing);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  background-color: var(--color-secondary);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

textarea {
  resize: vertical;
  min-height: 140px;
}

.form-submit {
  align-self: flex-start;
  background-color: var(--color-primary);
  color: var(--color-secondary);
}

.form-submit:hover {
  background-color: var(--color-navy-mid);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.3);
}

@media (max-width: 768px) {
  .contact-content {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  .form-group.grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   FOOTER
   ============================================ */

footer {
  background-color: var(--color-primary);
  color: var(--color-secondary);
  padding: var(--space-3xl) var(--space-lg) var(--space-xl);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-content {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.footer-logo {
  height: 40px;
  width: auto;
  margin-bottom: var(--space-lg);
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.footer-section p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  line-height: 1.75;
  margin-bottom: 0;
}

.footer-section h4 {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: var(--space-md);
}

.footer-section a {
  display: block;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
  transition: color var(--duration-normal) var(--easing);
}

.footer-section a:hover { color: var(--color-accent); }

.footer-bottom {
  max-width: 1240px;
  margin: 0 auto;
  padding-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.82rem;
  margin: 0;
}

@media (max-width: 1024px) {
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .footer-content {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   PORTFOLIO PAGE — gallery section
   ============================================ */

.portfolio-hero {
  position: relative;
  padding: calc(var(--space-3xl) + 80px) var(--space-lg) var(--space-3xl);
  background-color: var(--color-primary);
  text-align: center;
  overflow: hidden;
}

.portfolio-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 80%, rgba(201, 168, 124, 0.1) 0%, transparent 65%);
  pointer-events: none;
}

.portfolio-hero h1 {
  color: white;
  margin-bottom: var(--space-md);
}

.portfolio-hero p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.05rem;
  margin: 0 auto;
  max-width: 480px;
}

.gallery {
  padding: var(--space-3xl) var(--space-lg);
  background: var(--color-secondary);
}

.gallery-controls {
  display: flex;
  gap: var(--space-xs);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3xl);
}

.gallery-filter {
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--color-border);
  background: var(--color-secondary);
  color: var(--color-text-light);
  border-radius: 2px;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all var(--duration-normal) var(--easing);
  box-shadow: none;
}

.gallery-filter:hover,
.gallery-filter.active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background-color: var(--color-accent-light);
  transform: none;
  box-shadow: none;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  max-width: 1240px;
  margin: 0 auto;
}

/* Gallery tiles are <button> elements for keyboard access, so they have to
   opt out of the global button styling. */
.gallery-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background-color: var(--color-border);
  transition: transform var(--duration-normal) var(--easing),
              box-shadow var(--duration-normal) var(--easing);
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  font: inherit;
  text-align: inherit;
  appearance: none;
}

.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
  background-color: var(--color-border);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--easing);
}

.gallery-item:hover img { transform: scale(1.08); }

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 30, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing);
}

.gallery-item:hover .gallery-overlay { opacity: 1; }

.gallery-overlay span {
  color: var(--color-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn var(--duration-normal) var(--easing);
}

.lightbox.active { display: flex; }

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-image {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
}

/* Caption + counter strip beneath the lightbox image. */
.lightbox-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.lightbox-caption { color: var(--color-accent); }
.lightbox-counter { color: rgba(255, 255, 255, 0.45); font-variant-numeric: tabular-nums; }

.lightbox-close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
}

.lightbox-close:hover {
  color: white;
  transform: none;
  background: transparent;
  box-shadow: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: calc(100% + 100px);
  left: -50px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.lightbox-btn {
  pointer-events: all;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--duration-normal) var(--easing);
  padding: 0;
  box-shadow: none;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: white;
  transform: none;
  box-shadow: none;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
  }

  .lightbox-nav {
    width: 100%;
    left: 0;
    top: auto;
    bottom: -56px;
    transform: none;
    justify-content: center;
    gap: var(--space-md);
  }
}

/* ============================================
   RESPONSIVE — GENERAL
   ============================================ */

@media (max-width: 480px) {
  :root {
    --space-lg: 1.25rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   REFINEMENTS
   ============================================ */

/* --- Touch devices ---------------------------------------------------------
   The category labels on the homepage preview grid and the "View" hint on the
   portfolio tiles were revealed on :hover only, so on a phone — where most
   clients will open this — they never appeared at all. Gate the hover
   behaviour behind a real pointer and show a permanent, subtler treatment
   everywhere else. */

@media (hover: none) {
  .preview-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(10, 16, 30, 0.75) 0%, rgba(10, 16, 30, 0.15) 45%, transparent 70%);
  }

  .gallery-overlay { opacity: 0; }
}

/* Keep the lift-on-hover effects from sticking after a tap. */
@media (hover: none) {
  .service-card:hover,
  .gallery-item:hover,
  .preview-item:hover img,
  .service-card:hover .service-card-image img {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
}

/* --- Resilience ------------------------------------------------------------
   .reveal starts at opacity 0 and is switched on by IntersectionObserver. If
   the script fails to load, every section below the hero would stay invisible,
   so make motion-reduced users and no-JS visitors opt out of the hidden state
   rather than the animation only. */

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* --- Focus -----------------------------------------------------------------
   Tiles are interactive but had no visible keyboard affordance of their own. */

.gallery-item:focus-visible,
.preview-item:focus-visible,
.service-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

/* --- Typography ------------------------------------------------------------
   Tighten the display face at large sizes; Playfair's default tracking reads
   loose above ~3rem. */

.hero-text h1 {
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.section-header h2 {
  text-wrap: balance;
}

.section-header p,
.hero-text p {
  text-wrap: pretty;
}

/* Stop long email addresses forcing horizontal scroll on narrow screens. */
.contact-item a,
.footer-section a {
  overflow-wrap: anywhere;
}

/* --- Portfolio reference numbers -------------------------------------------
   Every tile carries a permanent number so clients can quote a photo ("can you
   do something like 47?"). It sits above the hover overlay and stays legible
   over both bright and dark images, hence the scrim rather than a flat colour. */

.gallery-ref {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  /* Deep top padding gives the scrim room to fade out, so the number sits on a
     soft wash rather than a hard-edged chip. */
  padding: 2.25rem 0.75rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(to top, rgba(10, 16, 30, 0.62) 0%, rgba(10, 16, 30, 0.28) 45%, transparent 100%);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  transition: color var(--duration-normal) var(--easing);
}

.gallery-item:hover .gallery-ref {
  color: var(--color-accent);
}

/* Hint that the numbers are there to be quoted. */
.gallery-note {
  max-width: 640px;
  margin: 0 auto var(--space-xl);
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.gallery-note strong {
  color: var(--color-text);
  font-weight: 600;
}

/* --- Lightbox close --------------------------------------------------------
   The close control was an unfilled glyph sitting 48px above the image, which
   put it off-screen on short viewports and read as decoration rather than a
   button. Pin it to the viewport as a solid, obvious target. */

.lightbox-close {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  z-index: 10;
  transition: background-color var(--duration-normal) var(--easing),
              border-color var(--duration-normal) var(--easing);
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-primary);
  transform: none;
}

/* Keep the image clear of the close button on small screens. */
@media (max-width: 600px) {
  .lightbox-close {
    top: var(--space-sm);
    right: var(--space-sm);
    width: 44px;
    height: 44px;
  }

  .lightbox-image { max-height: 70vh; }
}

/* --- Stats bar on mobile ---------------------------------------------------
   A two-column grid left "UK" stranded alone on a second row with borders that
   did not line up. The three values are short, so keep them on one row and
   scale the type down instead. */

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
  }

  .stat {
    padding: var(--space-md) 0.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: none;
  }

  .stat:last-child { border-right: none; }

  .stat-number { font-size: clamp(1.6rem, 7vw, 2.2rem); }

  .stat-label {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    line-height: 1.4;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-label { font-size: 0.54rem; letter-spacing: 0.06em; }
}

/* --- Portfolio filter spacing ----------------------------------------------
   The filters carried a 6rem bottom margin from when they sat directly above
   the grid; with the note between them that gap read as a break in the page. */

.gallery-controls { margin-bottom: var(--space-lg); }

/* The fixed header (9999) and the mobile menu button (10000) were painting
   over the lightbox, which hid the close button behind the nav bar. The
   lightbox is a modal, so it has to outrank both. */
.lightbox { z-index: 10001; }
