/* South West Building & Remodeling — design system
   Palette drawn from the project photos: warm plaster whites, oak and
   walnut casework, and the slate-blue accent wall that shows up across
   the kitchen shots. Fraunces (display) + Inter (text), self-hosted. */

/* ---------- Fonts ---------- */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin.7234ed86.woff2") format("woff2");
  font-weight: 500 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2026;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin.3100e775.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2026;
}

/* ---------- Tokens ---------- */

:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --ink: #241d15;
  --ink-soft: #6b6053;
  --line: #e6dfd3;
  --accent: #44607c;         /* slate blue from the accent walls */
  --accent-ink: #35506b;
  --accent-contrast: #f5f8fb;
  --oak: #b08350;            /* warm oak/walnut secondary */
  --shadow: 0 1px 2px rgb(36 29 21 / 0.06), 0 12px 32px -12px rgb(36 29 21 / 0.18);
  --radius: 10px;
  --font-display: "Fraunces", "Georgia", serif;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --container: 1160px;
  --header-h: 4.25rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171310;
    --surface: #201b16;
    --ink: #ede7dd;
    --ink-soft: #a99c8b;
    --line: #352e26;
    --accent: #94b4d1;
    --accent-ink: #aecbe5;
    --accent-contrast: #14202c;
    --oak: #c99e6b;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 12px 32px -12px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 6.5vw, 4.5rem); font-optical-sizing: auto; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.75rem); }
h3 { font-size: 1.35rem; }

p { margin: 0 0 1em; }

a { color: var(--accent-ink); text-underline-offset: 3px; }

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

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

::selection { background: var(--accent); color: var(--accent-contrast); }

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: top 0.15s ease;
}

.skip-link:focus { top: 1rem; }

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--oak);
  margin-bottom: 1.1rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font: 600 0.95rem/1.2 var(--font-text);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { box-shadow: var(--shadow); }

.btn-outline { border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--bg); }

.btn-ghost { color: inherit; border-color: currentColor; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
}

.brand img { width: 38px; height: auto; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.05;
  display: flex;
  flex-direction: column;
}

.brand-name small {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s ease;
}

.nav-links a:hover { color: var(--ink); }

.nav-links a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.nav-cta {
  border: 1.5px solid var(--accent);
  color: var(--accent-ink) !important;
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-weight: 600 !important;
  white-space: nowrap;
}

.nav-cta:hover { background: var(--accent); color: var(--accent-contrast) !important; }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  color: inherit;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.4rem;
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }

  .site-header .nav {
    position: absolute;
    inset: 100% 0 auto;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: none;
    padding: 0.75rem 0 1.25rem;
  }

  .site-header .nav.open { display: block; }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-inline: clamp(1.25rem, 4vw, 2.5rem);
  }

  .nav-links a {
    display: block;
    padding: 0.8rem 0;
    font-size: 1.05rem;
  }

  .nav-cta { text-align: center; margin-top: 0.75rem; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: min(92vh, 54rem);
  display: flex;
  align-items: flex-end;
  isolation: isolate;
  overflow: hidden;
  color: #f5f2ec;
}

.hero-media,
.hero-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.hero-media { background-size: cover; background-position: center; }

@keyframes kenburns {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.07) translateY(-1.2%); }
}

.hero-media img {
  animation: kenburns 24s ease-out both;
  transform-origin: center 40%;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgb(16 14 12 / 0.78) 0%, rgb(16 14 12 / 0.28) 45%, rgb(16 14 12 / 0.12) 100%);
}

.hero .container {
  width: 100%;
  padding-block: clamp(3rem, 9vh, 6rem);
}

.hero .eyebrow { color: #dcc49a; }

.hero h1 { max-width: 15ch; margin-bottom: 0.35em; }

.hero p {
  max-width: 46ch;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  color: rgb(245 242 236 / 0.88);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.8rem;
}

.hero .btn-primary { background: #f5f2ec; color: #241d15; }
.hero .btn-ghost { color: #f5f2ec; }

.hero-scroll {
  position: absolute;
  right: clamp(1.25rem, 4vw, 2.5rem);
  bottom: 1.5rem;
  color: rgb(245 242 236 / 0.7);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-decoration: none;
}

@media (max-width: 640px) {
  .hero { min-height: 88vh; }
  .hero-scroll { display: none; }
}

/* ---------- Sections ---------- */

.section { padding-block: clamp(3.5rem, 9vw, 6.5rem); }

.section-alt { background: var(--surface); border-block: 1px solid var(--line); }

.section-head { max-width: 56ch; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head p { color: var(--ink-soft); font-size: 1.1rem; margin: 0; }

/* Trust strip */

.trust-strip {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.trust-strip .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.1rem;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.trust-item svg { color: var(--oak); flex: none; }

/* Service cards */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

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

.card .frame { overflow: hidden; }

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.card:hover img { transform: scale(1.045); }

.card-body { padding: 1.4rem 1.5rem 1.6rem; }
.card-body h3 { margin-bottom: 0.4rem; }
.card-body p { color: var(--ink-soft); font-size: 0.98rem; margin-bottom: 0.9rem; }

.card-more {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent-ink);
}

/* About / values split */

.values-content {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.values-image img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  width: 100%;
}

.values-text p { color: var(--ink-soft); }
.values-text p strong { color: var(--ink); }

@media (max-width: 860px) {
  .values-content { grid-template-columns: 1fr; }
  .values-image { max-width: 26rem; }
}

/* Featured strip (home) */

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 1rem;
  margin-bottom: 2.25rem;
}

.preview-grid a {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.preview-grid a:hover img { transform: scale(1.045); }

/* Service rows (services page) */

.service-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  padding-block: clamp(1.75rem, 4vw, 3rem);
}

.service-row + .service-row { border-top: 1px solid var(--line); }

.service-row img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}

.service-row.reverse img { order: 2; }

.service-row .text p { color: var(--ink-soft); }

@media (max-width: 760px) {
  .service-row { grid-template-columns: 1fr; }
  .service-row.reverse img { order: 0; }
}

/* ---------- Gallery ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.filter-btn {
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font: 600 0.92rem/1 var(--font-text);
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-btn:hover { border-color: var(--ink-soft); color: var(--ink); }

.filter-btn[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* Justified rows are laid out by gallery.js using each photo's real
   aspect ratio; before JS runs, items keep their ratio via aspect-ratio. */

.photo-grid { display: flex; flex-wrap: wrap; gap: var(--gap, 10px); }

.photo-item {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  cursor: zoom-in;
  background-size: cover;
  background-position: center;
  flex-grow: 1;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.photo-item img.loaded { opacity: 1; }

.photo-item:hover img,
.photo-item:focus-visible img { transform: scale(1.04); }

.photo-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(16 14 12 / 0.32), transparent 45%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.photo-item:hover::after,
.photo-item:focus-visible::after { opacity: 1; }

/* Entrance reveal (grid items + [data-reveal] sections) */

.js [data-reveal],
.js .photo-item {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js [data-reveal].in-view,
.js .photo-item.in-view {
  opacity: 1;
  transform: none;
}

/* Keep the photo hover transitions after reveal */
.js .photo-item.in-view { transition: opacity 0.6s ease, transform 0.6s ease; }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgb(12 10 8 / 0.93);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lightbox.active { display: flex; }

.lightbox figure {
  margin: 0;
  max-width: min(94vw, 1400px);
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  max-width: min(94vw, 1400px);
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.5);
}

.lightbox-btn {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  border: 0;
  border-radius: 999px;
  background: rgb(245 242 236 / 0.12);
  color: #f5f2ec;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lightbox-btn:hover { background: rgb(245 242 236 / 0.24); }

.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev { left: 1rem; top: 50%; translate: 0 -50%; }
.lightbox-next { right: 1rem; top: 50%; translate: 0 -50%; }

.lightbox-count {
  position: absolute;
  bottom: 1.1rem;
  left: 50%;
  translate: -50% 0;
  color: rgb(245 242 236 / 0.75);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .lightbox-prev, .lightbox-next { display: none; } /* swipe instead */
}

/* ---------- Contact / CTA ---------- */

.contact-section {
  background: var(--accent-contrast);
  border-top: 1px solid var(--line);
  text-align: center;
  padding-block: clamp(3.5rem, 9vw, 6rem);
}

@media (prefers-color-scheme: light) {
  .contact-section {
    background: #2e4257; /* deep slate — anchors the page end */
    border-top: 0;
    color: #f0ede6;
  }
  .contact-section a { color: inherit; }
  .contact-section .btn-primary { background: #f5f2ec; color: #241d15; }
}

.contact-section h2 { max-width: 22ch; margin-inline: auto; }

.contact-section > .container > p {
  max-width: 48ch;
  margin-inline: auto;
  opacity: 0.85;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  margin: 1.75rem 0 1.25rem;
}

.contact-note { font-size: 0.95rem; opacity: 0.8; }

.contact-social {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.8rem;
  font-size: 0.95rem;
  text-decoration: none;
  opacity: 0.85;
}

.contact-social:hover { opacity: 1; text-decoration: underline; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-block: clamp(2.5rem, 6vw, 4rem) 1.5rem;
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-bottom: 2.5rem;
}

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

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
  margin-bottom: 0.9rem;
}

.footer-logo img { width: 36px; height: auto; }

.footer-brand p { color: var(--ink-soft); max-width: 38ch; }

.footer-heading {
  font-family: var(--font-text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
}

.footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.footer-list a {
  color: var(--ink);
  text-decoration: none;
}

.footer-list a:hover { text-decoration: underline; }

.social-link { display: inline-flex; align-items: center; gap: 0.45rem; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.footer-bottom p { margin: 0; }

/* ---------- 404 ---------- */

.error-page {
  min-height: 60vh;
  display: grid;
  place-content: center;
  text-align: center;
  padding-block: 4rem;
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .hero-media img { animation: none; }

  .js [data-reveal],
  .js .photo-item {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .card, .card img, .preview-grid img, .photo-item img, .btn {
    transition-duration: 0.01ms !important;
  }
}
