/* ============================================================
   JOINERY LIMITED — main.css
   Brand design system, variables, typography, base styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=DM+Sans:wght@300;400;500&family=Cormorant+SC:wght@300;400;500&display=swap');

/* ── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  --green:        #1B3A2D;
  --green-dark:   #122A1F;
  --green-light:  #2A5040;
  --gold:         #B8963E;
  --gold-light:   #D4AF6A;
  --gold-dark:    #7A6020;   /* WCAG AA-passing variant for use on cream/cream-dark text */
  --cream:        #F5F3F0;
  --cream-dark:   #EAE7E2;
  --text:         #1A1A1A;
  --text-muted:   #6B6560;
  --white:        #FFFFFF;

  --font-serif:   'Cormorant Garamond', Georgia, serif;
  --font-sc:      'Cormorant SC', Georgia, serif;
  --font-sans:    'DM Sans', system-ui, sans-serif;

  --max-w:        1320px;
  --nav-h:        80px;

  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.45, 0, 0.55, 1);
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul, ol { list-style: none; }

/* ── BASE ────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.7;
  color: var(--text);
  background: var(--cream);
  overflow-x: hidden;
}

/* ── TYPOGRAPHY ─────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.8rem, 6vw, 5.5rem); }
h2 { font-size: clamp(2rem, 4vw, 3.5rem); }
h3 { font-size: clamp(1.4rem, 2.5vw, 2rem); }
h4 { font-size: 1.25rem; }

.eyebrow {
  font-family: var(--font-sc);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  /* Deeper gold for better contrast on cream backgrounds.
     Original --gold (#B8963E) failed WCAG AA (2.54:1 on cream).
     #7A6020 passes AA: 5.38:1 on cream, 4.84:1 on cream-dark. */
  color: #7A6020;
  display: block;
  margin-bottom: 1rem;
}

/* Global focus ring — accessible keyboard navigation.
   Uses :focus-visible so mouse clicks don't trigger the ring. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 1px;
}

.lead {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 300;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ── LAYOUT UTILITIES ───────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: clamp(5rem, 10vw, 9rem) 0;
}

.section--dark {
  background: var(--green);
  color: var(--cream);
}

.section--cream {
  background: var(--cream);
}

.section--white {
  background: var(--white);
}

/* ── NAVIGATION ─────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: background 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.nav.scrolled {
  background: rgba(27, 58, 45, 0.97);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(184, 150, 62, 0.2);
}

.nav__inner {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.nav__logo-name {
  font-family: var(--font-sc);
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--white);
  letter-spacing: 0.12em;
}

.nav__logo-est {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 300;
  color: var(--gold-light);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 2px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.nav__links a {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(245, 243, 240, 0.8);
  transition: color 0.2s;
  position: relative;
}

.nav__links a::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0; right: 0;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}

.nav__links a:hover { color: var(--cream); }
.nav__links a:hover::after { transform: scaleX(1); }

.nav__cta {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green) !important;
  background: var(--gold);
  padding: 0.6rem 1.4rem;
  transition: background 0.2s, color 0.2s !important;
}

.nav__cta:hover {
  background: var(--gold-light) !important;
  color: var(--green) !important;
}

.nav__cta::after { display: none !important; }

/* Mobile nav toggle */
.nav__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}

.nav__burger span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--cream);
  transition: all 0.3s;
}

/* ── HERO ────────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 100svh;
  min-height: 600px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
  animation: heroScale 8s var(--ease-out) forwards;
}

@keyframes heroScale {
  to { transform: scale(1); }
}

.hero__overlay {
  position: absolute;
  inset: 0;
  /* Hourglass overlay: dark at top (for header readability) and bottom (for headline),
     clearest in the middle so the hero photo still reads. */
  background: linear-gradient(
    to top,
    rgba(18, 42, 31, 0.85) 0%,
    rgba(18, 42, 31, 0.35) 30%,
    rgba(18, 42, 31, 0.05) 55%,
    rgba(18, 42, 31, 0.45) 100%
  );
}

.hero__content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem 5rem;
  animation: heroUp 1s 0.3s var(--ease-out) both;
}

@keyframes heroUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero__eyebrow {
  font-family: var(--font-sc);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-light);
  display: block;
  margin-bottom: 1.2rem;
}

.hero__title {
  color: var(--white);
  max-width: 800px;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.hero__title em {
  font-style: normal;
  color: var(--gold-light);
}

.hero__sub {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 1.8vw, 1.3rem);
  color: rgba(245, 243, 240, 0.8);
  max-width: 520px;
  margin-bottom: 2.5rem;
  font-weight: 300;
}

.hero__actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.85rem 2rem;
  transition: all 0.25s var(--ease-out);
  cursor: pointer;
  border: none;
}

.btn--gold {
  background: var(--gold);
  color: var(--green-dark);
}
.btn--gold:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(184, 150, 62, 0.3);
}

.btn--outline {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(245, 243, 240, 0.4);
}
.btn--outline:hover {
  background: rgba(245, 243, 240, 0.1);
  border-color: var(--cream);
}

.btn--outline-dark {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
}
.btn--outline-dark:hover {
  background: var(--green);
  color: var(--cream);
}

.btn--green {
  background: var(--green);
  color: var(--cream);
}
.btn--green:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

.btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}
.btn:hover svg { transform: translateX(3px); }

/* ── SECTION HEADERS ─────────────────────────────────────── */
.section-header {
  margin-bottom: clamp(3rem, 6vw, 5rem);
}

.section-header--center {
  text-align: center;
}

.section-header h2 { margin-bottom: 1rem; }

.section-header p {
  max-width: 600px;
  color: var(--text-muted);
}

.section-header--center p { margin: 0 auto; }

/* ── CARDS ───────────────────────────────────────────────── */
.card-grid {
  display: grid;
  gap: 1.5px;
}

.card-grid--4 { grid-template-columns: repeat(4, 1fr); }
.card-grid--3 { grid-template-columns: repeat(3, 1fr); }
.card-grid--2 { grid-template-columns: repeat(2, 1fr); }

/* ── PORTFOLIO GRID ──────────────────────────────────────── */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
}

.p-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

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

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

.p-item__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(18,42,31,0.85) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: flex-end;
  padding: 1.5rem;
}

.p-item:hover .p-item__overlay { opacity: 1; }

.p-item__label {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--white);
  font-style: italic;
}

.p-item__cat {
  font-family: var(--font-sc);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--gold-light);
  display: block;
  margin-bottom: 0.3rem;
}

/* Grid span helpers */
.col-span-8 { grid-column: span 8; }
.col-span-6 { grid-column: span 6; }
.col-span-4 { grid-column: span 4; }
.col-span-3 { grid-column: span 3; }
.col-span-5 { grid-column: span 5; }
.col-span-7 { grid-column: span 7; }

.p-item--tall { aspect-ratio: 3/4; }
/* 3/2 makes col-span-8 wide items match the height of col-span-4 tall items
   in the same row (math: 8/12 × 2/3 == 4/12 × 4/3). Was 16/9 which created
   an obvious empty band below the wide image. */
.p-item--wide { aspect-ratio: 3/2; }
.p-item--sq   { aspect-ratio: 1; }

/* ── DIVIDER ─────────────────────────────────────────────── */
.gold-rule {
  width: 50px;
  height: 1px;
  background: var(--gold);
  margin: 1.5rem 0;
}

.gold-rule--center { margin: 1.5rem auto; }

/* ── TESTIMONIAL ─────────────────────────────────────────── */
.testimonial {
  border-left: 2px solid var(--gold);
  padding-left: 2rem;
}

.testimonial blockquote {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.5;
  color: var(--cream);
  margin-bottom: 1rem;
}

.testimonial cite {
  font-family: var(--font-sc);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--gold-light);
  font-style: normal;
}

/* ── STATS BAR ───────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.stat {
  padding: 2.5rem 2rem;
  border-right: 1px solid rgba(245,243,240,0.1);
  text-align: center;
}

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

.stat__num {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 300;
  color: var(--gold-light);
  line-height: 1;
  display: block;
}

.stat__label {
  font-family: var(--font-sc);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(245,243,240,0.6);
  margin-top: 0.5rem;
  display: block;
}

/* ── SERVICE CARDS ───────────────────────────────────────── */
.service-card {
  position: relative;
  overflow: hidden;
  background: var(--white);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(27,58,45,0.1);
}

.service-card__img {
  aspect-ratio: 4/3;
  overflow: hidden;
}

.service-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

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

.service-card__body {
  padding: 2rem;
}

.service-card__body h3 {
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
}

.service-card__body p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.service-card__link {
  font-family: var(--font-sc);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: gap 0.2s;
}

.service-card__link:hover { gap: 0.8rem; }

/* ── PROCESS STEPS ───────────────────────────────────────── */
.process-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}

.process-step {
  background: var(--white);
  padding: 2.5rem 1.5rem;
  position: relative;
}

.process-step__num {
  font-family: var(--font-serif);
  font-size: 3rem;
  color: var(--cream-dark);
  line-height: 1;
  margin-bottom: 1rem;
  display: block;
}

.process-step h4 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--green);
}

.process-step p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── FOOTER ──────────────────────────────────────────────── */
.footer {
  background: var(--green-dark);
  color: rgba(245,243,240,0.7);
  padding: 4rem 0 2rem;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer__brand-name {
  font-family: var(--font-sc);
  font-size: 1.2rem;
  color: var(--white);
  letter-spacing: 0.12em;
  margin-bottom: 0.3rem;
}

.footer__brand-est {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--gold-light);
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}

.footer p {
  font-size: 0.85rem;
  line-height: 1.7;
  max-width: 280px;
  margin-bottom: 1.5rem;
}

.footer__col-title {
  font-family: var(--font-sc);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--gold-light);
  margin-bottom: 1.2rem;
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer__links a {
  font-size: 0.85rem;
  color: rgba(245,243,240,0.6);
  transition: color 0.2s;
}

.footer__links a:hover { color: var(--cream); }

.footer__bottom {
  border-top: 1px solid rgba(245,243,240,0.1);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: rgba(245,243,240,0.4);
}

/* ── CONTACT FORM ────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  font-family: var(--font-sc);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--cream-dark);
  background: var(--white);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--gold);
}

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

/* ── LIGHTBOX ────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(18,42,31,0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  color: var(--cream);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s, transform 0.2s;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(245,243,240,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__close {
  top: 2rem; right: 2rem;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  border: none;
  line-height: 1;
}

.lightbox__close:hover,
.lightbox__nav:hover {
  opacity: 1;
  transform: scale(1.05);
}

.lightbox__nav {
  top: 50%;
  margin-top: -28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.75rem;
  line-height: 1;
  user-select: none;
}

.lightbox__nav--prev { left: 1.5rem; }
.lightbox__nav--next { right: 1.5rem; }

.lightbox__caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(245,243,240,0.85);
  font-family: var(--font-sc);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  pointer-events: none;
  max-width: 90vw;
}

.lightbox__counter {
  display: block;
  color: var(--gold-light);
  margin-top: 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
}

@media (max-width: 640px) {
  .lightbox__nav { width: 44px; height: 44px; font-size: 1.4rem; }
  .lightbox__nav--prev { left: 0.5rem; }
  .lightbox__nav--next { right: 0.5rem; }
  .lightbox__close { top: 0.75rem; right: 0.75rem; }
}

/* ── PAGE HERO (inner pages) ─────────────────────────────── */
.page-hero {
  padding-top: calc(var(--nav-h) + 4rem);
  padding-bottom: 4rem;
  background: var(--green);
  color: var(--cream);
}

.page-hero h1 { color: var(--white); margin-bottom: 1rem; }
.page-hero .lead { color: rgba(245,243,240,0.75); }

/* ── ABOUT / CRAFTSMEN GRID ─────────────────────────────── */
/* Make the two craftsman columns equal total height even when their bios
   differ in length. Each column becomes a flex column; the bio card
   grows to absorb any extra vertical space so the portfolio strip
   beneath always sits at the same Y as the sibling column. */
.about-grid--craftsmen { align-items: stretch; }

@media (min-width: 768px) {
  .craftsman-col {
    display: flex;
    flex-direction: column;
  }
  .craftsman-bio {
    flex-grow: 1;
  }
}

/* ── SCROLL ANIMATIONS ───────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ── GOLD ACCENT LINE ────────────────────────────────────── */
.accent-line {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.accent-line::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--gold);
  flex-shrink: 0;
}

/* ── CTA BAND ────────────────────────────────────────────── */
.cta-band {
  background: var(--green);
  padding: 5rem 0;
  text-align: center;
}

.cta-band h2 {
  color: var(--white);
  margin-bottom: 1rem;
  font-style: italic;
}

.cta-band p {
  color: rgba(245,243,240,0.75);
  max-width: 560px;
  margin: 0 auto 2.5rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
}

/* ── ABOUT PORTRAIT ──────────────────────────────────────── */
.portrait-wrap {
  position: relative;
}

.portrait-wrap::after {
  content: '';
  position: absolute;
  bottom: -12px; right: -12px;
  width: 60%;
  height: 60%;
  border: 1px solid var(--gold);
  z-index: -1;
}

.portrait-wrap img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
}
