/* ==========================================================================
   Elmar Builders — Stylesheet
   Design tokens: warm-paper / moss-green architectural portfolio
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------ */
:root {
  /* Colour */
  --paper: #FAFAF9;
  --paper-deep: #F1F1EF;
  --card: #FFFFFF;
  --ink: #17191A;
  --ink-soft: #5F6365;
  --ink-faint: #8A8D8F;
  --moss: #3F5C42;
  --moss-strong: #32492F;
  --moss-deep: #16181A;
  --line: #D9DBDC;
  --line-deep: #3A3D40;

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Type scale (fluid) */
  --step-body: 1rem;
  --step-lg: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --step-h3: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem);
  --step-h2: clamp(2.1rem, 1.6rem + 2vw, 3.1rem);
  --step-h1: clamp(2.6rem, 1.7rem + 4vw, 5.2rem);

  /* Layout */
  --max-width: 1280px;
  --gutter: clamp(1.5rem, 4vw, 4rem);
  --radius-sm: 3px;
  --radius-md: 4px;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 240ms;
  --dur-med: 620ms;
  --dur-slow: 1400ms;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 3px;
}

/* ---- Layout helpers -------------------------------------------------------- */
.wrap {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }
.section--deep { background: var(--moss-deep); color: #F2F3F3; }
.section--alt  { background: var(--paper-deep); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(2.25rem, 5vw, 4rem);
}

.section-head__rule {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--moss);
  margin-right: 0.85rem;
  vertical-align: -0.15em;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-h2);
  line-height: 1.08;
  letter-spacing: -0.01em;
  max-width: 16ch;
}

.section-kicker {
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: 34ch;
  padding-top: 0.4rem;
}
.section--deep .section-kicker { color: #C9CCCD; }

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

.skip-link {
  position: absolute;
  left: 1rem; top: -3rem;
  background: var(--moss-deep);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  z-index: 200;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: 1rem; }

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.95rem 1.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn--primary {
  background: var(--moss);
  color: #F6F7EF;
  border: 1px solid var(--moss);
}
.btn--primary:hover { background: var(--moss-strong); border-color: var(--moss-strong); }

.btn--ghost {
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
}
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.section--deep .btn--ghost:hover { background: #F2F3F3; color: var(--moss-deep); border-color: #F2F3F3; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
  transition: border-color var(--dur-fast) var(--ease), gap var(--dur-fast) var(--ease);
}
.link-arrow:hover { border-color: var(--moss); gap: 0.75rem; }
.section--deep .link-arrow { border-color: #697074; color: #F2F3F3; }
.section--deep .link-arrow:hover { border-color: var(--moss); }

/* ---- Navigation ------------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding-block: 1.5rem;
  transition: padding var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), backdrop-filter var(--dur-fast) var(--ease);
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav.is-scrolled {
  padding-block: 1rem;
  background: rgba(250, 250, 249, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--line);
}

/* Home hero uses a transparent-on-dark nav until scrolled */
.nav[data-on-image="true"]:not(.is-scrolled) { color: var(--ink); }

.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}
.nav__logo img { height: 40px; width: auto; }
.nav__logo-fallback {
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 2.75rem);
}

.nav__links a {
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 4px;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--moss);
  transition: right var(--dur-fast) var(--ease);
}
.nav__links a:hover::after,
.nav__links a[aria-current="page"]::after { right: 0; }

.nav__cta { display: none; }

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
}
.nav__toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 99;
  display: flex;
  flex-direction: column;
  padding: 6rem var(--gutter) 3rem;
  transform: translateY(-100%);
  transition: transform var(--dur-med) var(--ease);
}
.mobile-menu.is-open { transform: translateY(0); }

.mobile-menu__links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 2rem;
}
.mobile-menu__links a {
  font-family: var(--font-display);
  font-size: clamp(2rem, 9vw, 2.75rem);
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.mobile-menu__contact {
  margin-top: auto;
  color: var(--ink-soft);
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* ---- Hero -------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--moss-deep);
}

.hero__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: hero-zoom 1.8s var(--ease) forwards;
}

@keyframes hero-zoom {
  from { transform: scale(1.12); }
  to { transform: scale(1); }
}

.hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(253, 255, 251, 0.932) 0%, rgb(250, 250, 249) 20%, rgba(250, 250, 249, 0.86) 100%);
}

.hero__content {
  position: relative;
  z-index: 2;
  color: var(--ink);
  width: 100%;
  padding-block: clamp(3rem, 8vw, 5rem);
}

.hero__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 3rem;
  flex-wrap: wrap;
}

.hero__statement {
  display: flex;
  gap: 1.25rem;
  max-width: 42rem;
}

.hero__rule {
  flex: none;
  width: 2px;
  background: var(--moss);
  margin-top: 0.4em;
  transform-origin: top;
  animation: hero-rule 900ms var(--ease) both;
}

.hero__headline {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-h1);
  line-height: 0.98;
  letter-spacing: -0.015em;
  animation: hero-rise 900ms var(--ease) 160ms both;
}

.hero__support {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-lg);
  color: var(--ink-soft);
  margin-top: 1.1rem;
  animation: hero-rise 900ms var(--ease) 360ms both;
}

.hero__cta {
  animation: hero-rise 900ms var(--ease) 560ms both;
}

@keyframes hero-rule {
  from { opacity: 0; transform: scaleY(0); }
  to { opacity: 1; transform: scaleY(1); }
}

@keyframes hero-rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero__scroll-cue {
  position: absolute;
  bottom: 1.75rem;
  right: var(--gutter);
  z-index: 2;
  color: var(--ink);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  opacity: 0.85;
}
.hero__scroll-cue::after {
  content: "";
  width: 1px;
  height: 34px;
  background: currentColor;
  animation: cue-travel 2.2s var(--ease) infinite;
}
@keyframes cue-travel {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0.2; }
  50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
  51% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0.2; }
}

/* ---- Reveal-on-scroll ----------------------------------------------------
   Gated behind a `.js` class added by an inline script in <head>, so content
   is fully visible by default and only animates in when JavaScript (and
   therefore the IntersectionObserver driving it) is actually available. */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---- Who we are ------------------------------------------------------------ */
.about {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.about__label {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}
.about__label .section-head__rule { margin-top: 0.35em; }
.about__label h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-h3);
}

.about__body p {
  max-width: 58ch;
  color: #D9DBDC;
  font-size: var(--step-lg);
}
.about__body p + p { margin-top: 1.25rem; }

.about__services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid #697074;
}
.about__services li {
  font-size: 0.88rem;
  color: #F2F3F3;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #697074;
  border-radius: 999px;
  padding: 0.45rem 1rem;
}

.about__more { margin-top: 2rem; }

/* ---- Project cards --------------------------------------------------------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.project-card__frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
}
.project-card__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 900ms var(--ease);
}
.project-card:hover .project-card__frame img,
.project-card:focus-within .project-card__frame img { transform: scale(1.045); }

.project-card__info {
  margin-top: 1.1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.project-card__name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease);
}
.project-card:hover .project-card__name { color: var(--moss); }

.project-card__meta {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 0.3rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  white-space: nowrap;
  padding-top: 0.15rem;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--moss);
}
.status--progress::before { background: #A9762F; }

.projects-foot {
  display: flex;
  justify-content: center;
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

/* ---- Team -------------------------------------------------------------------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  max-width: 36rem;
  margin-inline: auto;
}

.team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.team-card__frame {
  width: min(100%, 19rem);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--paper-deep);
}
.team-card__frame img { width: 100%; height: 100%; object-fit: cover; }

.team-card__name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-top: 1.1rem;
}
.team-card__role {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* ---- Contact ------------------------------------------------------------- */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}

.contact__headline {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-h2);
  line-height: 1.06;
  letter-spacing: -0.01em;
}

.contact__lede {
  color: var(--ink-soft);
  font-size: var(--step-lg);
  margin-top: 1.25rem;
  max-width: 34ch;
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.25rem;
}

.contact__details {
  display: grid;
  gap: 1.75rem;
}

.contact__item dt {
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.contact__item dd {
  margin: 0.3rem 0 0;
  font-size: 1.1rem;
}
.contact__item a:hover { color: var(--moss); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Footer ------------------------------------------------------------------ */
.footer {
  background: var(--moss-deep);
  color: #FFFFFF;
  padding-block: clamp(2.5rem, 5vw, 3.5rem) 2rem;
  border-top: 1px solid var(--line-deep);
}

.footer__top {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  color: #FFFFFF;
  font-size: 1.2rem;
}
.footer__brand img { height: 30px; width: auto; }

.footer__tagline {
  margin-top: 0.9rem;
  max-width: 30ch;
  font-size: 0.92rem;
}

.footer__heading {
  font-size: 0.82rem;
  color: #FFFFFF;
  margin-bottom: 1rem;
}

.footer__links { display: grid; gap: 0.65rem; }
.footer__links a:hover { color: var(--moss); }

.footer__meta {
  display: grid;
  gap: 0.65rem;
  font-size: 0.92rem;
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line-deep);
  font-size: 0.82rem;
  color: #FFFFFF;
}
.footer__legal { display: flex; gap: 1.5rem; }
.footer__legal a:hover { color: var(--moss); }

/* ---- Page header (Projects page) ------------------------------------------ */
.page-header {
  padding-block: clamp(7.5rem, 16vw, 11rem) clamp(3rem, 6vw, 4.5rem);
}
.page-header__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-h1);
  line-height: 0.98;
  letter-spacing: -0.01em;
  max-width: 16ch;
}
.page-header__lede {
  color: var(--ink-soft);
  font-size: var(--step-lg);
  margin-top: 1.25rem;
  max-width: 42ch;
}

.prose {
  max-width: 65ch;
  line-height: 1.8;
}
.prose h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-h3);
  line-height: 1.15;
}
.prose h2:not(:first-child) { margin-top: 2.5rem; }
.prose p { margin-top: 1rem; }
.prose address {
  font-style: normal;
  margin-top: 1rem;
}

.projects-grid--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 1024px) {
  .about { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; }
  .footer__top { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .nav__links, .nav__cta { display: none; }
  .nav__toggle { display: flex; }

  .projects-grid,
  .projects-grid--four,
  .team-grid {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .section-head { flex-direction: column; align-items: flex-start; gap: 0.75rem; }

  .hero__row { flex-direction: column; align-items: flex-start; }
  .hero__statement { gap: 1rem; }

  .footer__top { grid-template-columns: 1fr; gap: 2rem; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }

  .about__services li { font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .wrap { padding-inline: 1.25rem; }
  .hero__rule { display: none; }
}

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

  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__media img,
  .hero__rule,
  .hero__headline,
  .hero__support,
  .hero__cta {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  .project-card__frame img { transition: none; }
  .project-card:hover .project-card__frame img { transform: none; }

  .hero__scroll-cue::after { animation: none; }

  .mobile-menu { transition: none; }
}
