/* ==========================================================================
   Elegant Windows & Doors — Design System
   Palette, type, and component styles shared across every page.
   Tailwind (CDN) is still used for layout/spacing utilities; this file
   carries the brand-specific visual language Tailwind can't express.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,340;0,9..144,440;0,9..144,500;0,9..144,600;1,9..144,440&family=Archivo:wght@400;500;600;700;800&display=swap');

:root {
  /* ---- Brand palette ---- */
  --near-black: #0b0b0b;
  --graphite: #181818;
  --graphite-soft: #232320;
  --gold: #c9a961;
  --gold-bright: #d4af37;
  --gold-dim: #a98f57;
  --cream: #f5f3ee;
  --cream-deep: #eeebe2;
  --white: #ffffff;

  /* ---- Text ---- */
  --ink: #1b1a17;
  --ink-soft: #58554d;
  --ink-faint: #8b8778;
  --ink-on-dark: #f5f3ee;
  --ink-on-dark-soft: #c8c4b8;

  /* ---- Lines ---- */
  --line: rgba(11, 11, 11, 0.12);
  --line-soft: rgba(11, 11, 11, 0.07);
  --line-on-dark: rgba(245, 243, 238, 0.18);

  /* ---- Type ---- */
  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-body: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --fs-hero: clamp(2.6rem, 5.6vw, 4.75rem);
  --fs-h1: clamp(2.1rem, 4vw, 3.15rem);
  --fs-h2: clamp(1.75rem, 3vw, 2.5rem);
  --fs-h3: clamp(1.3rem, 1.8vw, 1.6rem);
  --fs-eyebrow: 0.75rem;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Base
   ========================================================================== */

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

.font-display { font-family: var(--font-display); }

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.08;
  color: var(--ink);
}

.on-dark, .on-dark h1, .on-dark h2, .on-dark h3, .on-dark p { color: var(--ink-on-dark); }
.on-dark .body-soft { color: var(--ink-on-dark-soft); }

.body-soft { color: var(--ink-soft); }

a { text-decoration: none; }

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

::selection { background: var(--gold); color: var(--near-black); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Type utilities
   ========================================================================== */

.text-hero { font-size: var(--fs-hero); line-height: 1.04; }
.text-h1 { font-size: var(--fs-h1); }
.text-h2 { font-size: var(--fs-h2); }
.text-h3 { font-size: var(--fs-h3); font-family: var(--font-body); font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-dim);
}
.on-dark .eyebrow { color: var(--gold); }

/* Signature motif, generated automatically under every section eyebrow:
   a double hairline echoing a window mullion / frame profile. */
.eyebrow::after {
  content: '';
  display: block;
  margin-top: 10px;
  width: 44px;
  height: 5px;
  background-image: linear-gradient(var(--gold), var(--gold)), linear-gradient(var(--gold), var(--gold));
  background-size: 100% 1px, 58% 1px;
  background-position: top left, bottom left;
  background-repeat: no-repeat;
}
/* Suppressed for small inline tag-style labels inside cards */
.edge-card .eyebrow::after { display: none; }
.edge-card .eyebrow { margin-bottom: 0.5rem; }

/* Signature divider motif: a double hairline, echoing a window mullion /
   frame profile. Used everywhere the old thick single gold bar used to be. */
.motif {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 46px;
  margin: 1.1rem 0;
}
.motif.center { margin-left: auto; margin-right: auto; }
.motif span { display: block; height: 1px; background: var(--gold); }
.motif span:last-child { width: 60%; }
.on-dark .motif span { background: var(--gold); }

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.container-wide { width: 100%; max-width: 1360px; margin-inline: auto; padding-inline: 1.5rem; }
.container-read { width: 100%; max-width: 780px; margin-inline: auto; padding-inline: 1.5rem; }
@media (min-width: 768px) {
  .container-wide { padding-inline: 2.5rem; }
}

.section { padding-block: clamp(3.5rem, 7vw, 6.5rem); }
.section-tight { padding-block: clamp(2.5rem, 5vw, 4rem); }

.bg-cream { background: var(--cream); }
.bg-graphite { background: var(--graphite); }
.bg-near-black { background: var(--near-black); }

hr.line { border: none; border-top: 1px solid var(--line); }
.on-dark hr.line { border-top-color: var(--line-on-dark); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  padding: 0.95rem 1.9rem;
  border-radius: 2px;
  border: 1px solid transparent;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-gold {
  background: var(--gold);
  color: var(--near-black);
  border-color: var(--gold);
}
.btn-gold:hover { background: var(--gold-bright); border-color: var(--gold-bright); }

.btn-line {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-line:hover { background: var(--ink); color: var(--white); }

.on-dark .btn-line { color: var(--ink-on-dark); border-color: rgba(245,243,238,0.45); }
.on-dark .btn-line:hover { background: var(--ink-on-dark); color: var(--near-black); }

.btn-sm { padding: 0.65rem 1.3rem; font-size: 0.85rem; }

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(245, 243, 238, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

/* Homepage-only: floats transparent over the dark hero until the user scrolls */
.site-header.header-float {
  background: transparent;
  border-bottom-color: transparent;
}
.site-header.header-float .site-nav a:not(.btn) { color: var(--ink-on-dark); }
.site-header.header-float .logo-mark { filter: drop-shadow(0 2px 10px rgba(0,0,0,0.35)); }
.site-header.header-float #mobileMenuBtn { color: var(--ink-on-dark); }

.site-header.is-scrolled {
  background: rgba(245, 243, 238, 0.96);
  border-bottom-color: var(--line);
  box-shadow: 0 8px 30px rgba(11,11,11,0.05);
}
.site-header.is-scrolled .logo-mark { height: 2.5rem; }

.logo-mark { height: 3rem; width: auto; transition: height 0.3s var(--ease); border-radius: 3px; }

.site-nav a {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.2s var(--ease);
  position: relative;
  padding-bottom: 2px;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.active { color: var(--ink); }
.site-nav a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--gold);
}

#mobileMenu a { font-family: var(--font-body); font-weight: 600; }

/* ==========================================================================
   Cards / lists — hairline dividers instead of boxed shadow cards
   ========================================================================== */

.edge-card {
  border: 1px solid var(--line);
  background: var(--white);
}

.hairline-list > * + * { border-top: 1px solid var(--line); }
.on-dark .hairline-list > * + * { border-top-color: var(--line-on-dark); }

/* ==========================================================================
   Media
   ========================================================================== */

.media-frame { position: relative; overflow: hidden; background: var(--graphite); }
.media-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }

.img-hover img { transition: transform 0.7s var(--ease); }
.img-hover:hover img { transform: scale(1.045); }

/* ==========================================================================
   Reveal-on-scroll (new; scoped to elements this redesign introduces)
   ========================================================================== */

[data-reveal] {
  opacity: 1;
  transform: none;
}
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.js [data-reveal].is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ==========================================================================
   Trust strip
   ========================================================================== */

.trust-strip {
  background: var(--graphite);
  color: var(--ink-on-dark-soft);
}
.trust-strip .item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.trust-strip .item svg { flex: none; width: 16px; height: 16px; color: var(--gold); }
.trust-strip .sep { width: 1px; align-self: stretch; background: var(--line-on-dark); }

/* ==========================================================================
   Process steps (genuine sequence → numbered is justified here)
   ========================================================================== */

.step-num {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 400;
  color: var(--gold);
  line-height: 1;
}

/* ==========================================================================
   Projects grid + lightbox (namespaced "pg-" to avoid any collision with
   existing script.js selectors from the previous gallery implementation)
   ========================================================================== */

.pg-grid {
  column-gap: 1.25rem;
  column-count: 2;
}
@media (min-width: 768px) { .pg-grid { column-count: 3; } }

.pg-tile {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background: var(--graphite);
  border: none;
  padding: 0;
  display: block;
  width: 100%;
  text-align: left;
  break-inside: avoid;
  margin-bottom: 1.25rem;
}
.pg-tile img { width: 100%; height: auto; display: block; transition: transform 0.6s var(--ease); }
.pg-tile:hover img { transform: scale(1.05); }
.pg-tile .pg-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1rem 1.1rem;
  background: linear-gradient(0deg, rgba(11,11,11,0.78) 0%, rgba(11,11,11,0) 100%);
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.pg-tile:hover .pg-cap, .pg-tile:focus-visible .pg-cap { opacity: 1; transform: translateY(0); }

.pg-filter-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-soft);
  transition: all 0.2s var(--ease);
  cursor: pointer;
}
.pg-filter-btn:hover { border-color: var(--ink); color: var(--ink); }
.pg-filter-btn.active { background: var(--near-black); border-color: var(--near-black); color: var(--white); }

.pg-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(11,11,11,0.96);
}
.pg-lightbox.active { display: flex; align-items: center; justify-content: center; }
.pg-lightbox-content { position: relative; max-width: 92vw; max-height: 88vh; }
.pg-lightbox-content img { max-width: 92vw; max-height: 80vh; width: auto; height: auto; display: block; margin: 0 auto; }
.pg-lightbox-cap { color: var(--ink-on-dark-soft); text-align: center; margin-top: 1rem; font-size: 0.9rem; }
.pg-lb-btn {
  position: absolute;
  color: var(--white);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.pg-lb-btn:hover { background: rgba(255,255,255,0.18); }
.pg-lb-close { top: -56px; right: 0; }
.pg-lb-prev { left: -56px; top: 50%; transform: translateY(-50%); }
.pg-lb-next { right: -56px; top: 50%; transform: translateY(-50%); }
@media (max-width: 768px) {
  .pg-lb-close { top: -50px; right: 0; }
  .pg-lb-prev { left: 4px; }
  .pg-lb-next { right: 4px; }
}

/* Small "related photos" masonry rows (3 mixed-orientation photos, no crop) */
.mini-masonry { column-gap: 1.25rem; column-count: 1; }
@media (min-width: 640px) { .mini-masonry { column-count: 3; } }
.mini-masonry > a { display: block; break-inside: avoid; margin-bottom: 1.25rem; overflow: hidden; background: var(--graphite); }
.mini-masonry > a img { width: 100%; height: auto; display: block; transition: transform 0.6s var(--ease); }
.mini-masonry > a:hover img { transform: scale(1.05); }

/* ==========================================================================
   Form (Contact page) — visual layer only. Field ids/classes below are
   load-bearing for the existing config.js / script.js integration and are
   NOT renamed anywhere in the markup.
   ========================================================================== */

.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.2s var(--ease);
}
.form-input:focus { outline: none; border-color: var(--gold); }
.form-input.error { border-color: #b3413a; }

.error-message { color: #b3413a; font-size: 0.85rem; margin-top: 0.3rem; }

.success-message {
  background-color: var(--graphite);
  color: var(--cream);
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--gold);
  margin-bottom: 1.5rem;
}

#formError {
  background-color: #b3413a;
  color: white;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Technical spec bars (R-value chart on Windows page)
   ========================================================================== */

.spec-row { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 1rem; }
.spec-track { height: 10px; background: var(--line-soft); position: relative; overflow: hidden; }
.spec-fill { height: 100%; background: linear-gradient(90deg, var(--graphite), var(--gold)); }

/* ==========================================================================
   Resource/download list (PDF catalogs)
   ========================================================================== */

.pdf-badge {
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--gold-dim);
  transition: border-color 0.2s var(--ease);
}

.resource-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.5rem;
  text-decoration: none;
}
.resource-row:hover .pdf-badge { border-color: var(--gold); }
.resource-row:hover .resource-title { color: var(--gold-dim); }
.resource-title { color: var(--ink); transition: color 0.2s var(--ease); }

.resource-download {
  flex: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.resource-row:hover .resource-download { color: var(--gold-dim); transform: translateX(2px); }

/* ==========================================================================
   Catalog cards (homepage) — cover-image "shelf" presentation
   ========================================================================== */

.catalog-card { display: block; text-decoration: none; }

.catalog-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--graphite);
  box-shadow: 0 18px 34px -14px rgba(11,11,11,0.32);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.catalog-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.catalog-cover::before {
  /* subtle spine shadow — reinforces the printed-catalog feel */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.32) 0%, rgba(0,0,0,0) 7%);
  z-index: 2;
  pointer-events: none;
}
.catalog-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  z-index: 2;
  pointer-events: none;
}
.catalog-card:hover .catalog-cover { transform: translateY(-6px); box-shadow: 0 26px 44px -14px rgba(11,11,11,0.4); }

.catalog-card h3 {
  margin-top: 1.1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  transition: color 0.2s var(--ease);
}
.catalog-card:hover h3 { color: var(--gold-dim); }
.catalog-card .catalog-meta { font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.3rem; }

.catalog-shelf {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 0.75rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.catalog-shelf::-webkit-scrollbar { height: 6px; }
.catalog-shelf::-webkit-scrollbar-track { background: transparent; }
.catalog-shelf::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.catalog-shelf .catalog-card {
  flex: none;
  width: 200px;
  scroll-snap-align: start;
}
@media (min-width: 640px) { .catalog-shelf .catalog-card { width: 228px; } }
