/* ═══════════════════════════════════════════
   Ferrous Works — design tokens
   ═══════════════════════════════════════════ */
:root {
  --bg: #0c0c0a;
  --text: #e8e4dc;
  --muted: rgba(232, 228, 220, 0.6);
  --muted-2: rgba(232, 228, 220, 0.55);
  --faint: rgba(232, 228, 220, 0.4);
  --ghost: rgba(232, 228, 220, 0.3);
  --nav-link: rgba(232, 228, 220, 0.7);
  --accent: #c4b99a;
  --accent-hover: #e8e4dc;
  --divider: rgba(232, 228, 220, 0.08);
  --footer-border: rgba(232, 228, 220, 0.06);

  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --max-width: 1280px;
  --pad-x: 48px;
  --pad-y: 120px;
}

/* ═══════════════════════════════════════════
   Base / reset
   ═══════════════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::selection { background: rgba(196, 185, 154, 0.3); }

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--bg);
  padding: 12px 20px;
  font-size: 14px;
  letter-spacing: 0.06em;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  color: var(--bg);
}

/* Shared section label */
.section-label {
  font-size: 13px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
}

/* Divider */
.divider-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}
.divider { height: 1px; background: var(--divider); }

/* ═══════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ═══════════════════════════════════════════
   Hero
   ═══════════════════════════════════════════ */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 700px;
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(12, 12, 10, 0.6) 0%,
    rgba(12, 12, 10, 0.15) 40%,
    rgba(12, 12, 10, 0.15) 60%,
    rgba(12, 12, 10, 0.7) 100%
  );
}

.hero__nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px var(--pad-x);
}
.wordmark {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.03em;
  color: var(--text);
  white-space: nowrap;
}
.wordmark:hover { color: var(--text); }
.hero__nav-links {
  display: flex;
  gap: 36px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hero__nav-links a {
  color: var(--nav-link);
  transition: color 0.3s;
}
.hero__nav-links a:hover { color: var(--text); }

/* Hamburger toggle — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  margin: -10px -10px -10px 0;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle__bar {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hero__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 0 var(--pad-x) 72px;
}
.hero__h1 {
  font-family: var(--serif);
  font-size: 72px;
  font-weight: 400;
  line-height: 1.05;
  margin: 0 0 20px;
  max-width: 800px;
  animation: fadeUp 1.2s ease both;
}
.hero__line {
  width: 48px;
  height: 1px;
  background: var(--accent);
  animation: fadeIn 1.5s ease 0.4s both;
}

/* ═══════════════════════════════════════════
   What We Do
   ═══════════════════════════════════════════ */
.wwd { padding: var(--pad-y) var(--pad-x); }
.wwd .section-label { margin-bottom: 64px; }
.wwd__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 64px;
}
.pillar__title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  margin: 0 0 16px;
  color: var(--text);
}
.pillar__body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
  font-weight: 300;
}

/* ═══════════════════════════════════════════
   Featured Project
   ═══════════════════════════════════════════ */
.fp { padding: var(--pad-y) var(--pad-x) 0; }
.fp .section-label { margin-bottom: 24px; }
.fp__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 64px;
  flex-wrap: wrap;
  gap: 24px;
}
.fp__title {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 400;
  line-height: 1.1;
  margin: 0;
}
.fp__meta {
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--faint);
  font-weight: 300;
}

/* Gallery grid — 2 wide cells then 3 standard cells */
.gallery {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.gallery__cell { min-width: 0; }
.gallery__cell--wide { grid-column: span 3; }
.gallery__cell:not(.gallery__cell--wide) { grid-column: span 2; }

.gallery__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  overflow: hidden;
}
.gallery__cell--wide .gallery__btn picture,
.gallery__cell--wide .gallery__btn img { aspect-ratio: 4 / 3; }
.gallery__cell:not(.gallery__cell--wide) .gallery__btn picture,
.gallery__cell:not(.gallery__cell--wide) .gallery__btn img { aspect-ratio: 3 / 2; }
.gallery__btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.3s ease;
}
.gallery__btn:hover img { transform: scale(1.03); opacity: 0.92; }

/* ═══════════════════════════════════════════
   Project Narrative
   ═══════════════════════════════════════════ */
.fp-narrative { padding: 96px var(--pad-x) var(--pad-y); }
.fp-narrative__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 96px;
  align-items: start;
}
.fp-narrative__lead {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.55;
  font-weight: 400;
  color: var(--text);
}
.fp-narrative__body { padding-top: 8px; }
.fp-narrative__body p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--muted-2);
  margin: 0 0 32px;
  font-weight: 300;
}
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--accent);
  border-bottom: 1px solid rgba(196, 185, 154, 0.3);
  padding-bottom: 4px;
  transition: border-color 0.3s, color 0.3s;
}
.text-link:hover { border-color: var(--accent); }

/* ═══════════════════════════════════════════
   Approach
   ═══════════════════════════════════════════ */
.approach { padding: var(--pad-y) var(--pad-x); }
.approach .section-label { margin-bottom: 64px; }
.approach__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 96px;
  align-items: start;
}
.approach__h2 {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 32px;
}
.approach__text p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--muted-2);
  font-weight: 300;
}
.approach__media img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* ═══════════════════════════════════════════
   Contact
   ═══════════════════════════════════════════ */
.contact {
  padding: 160px var(--pad-x) 80px;
  text-align: center;
}
.contact .section-label { margin-bottom: 32px; }
.contact__h2 {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 40px;
}
.btn {
  display: inline-block;
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  padding: 18px 48px;
  transition: background 0.3s, color 0.3s;
}
.btn:hover { background: var(--accent-hover); color: var(--bg); }

/* ═══════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════ */
.footer {
  padding: 48px;
  text-align: center;
  border-top: 1px solid var(--footer-border);
}
.footer p {
  font-size: 13px;
  color: var(--ghost);
  font-weight: 300;
  letter-spacing: 0.04em;
}
.footer a { color: var(--ghost); transition: color 0.3s; }
.footer a:hover { color: var(--muted); }

/* ═══════════════════════════════════════════
   Lightbox
   ═══════════════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }
.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 10, 0.94);
  animation: fadeIn 0.25s ease both;
}
.lightbox__stage {
  position: relative;
  z-index: 1;
  max-width: min(1100px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.25s ease both;
}
.lightbox__img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.lightbox__caption {
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
}
.lightbox__status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.lightbox__btn {
  position: absolute;
  z-index: 2;
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  transition: color 0.3s, opacity 0.3s;
  opacity: 0.75;
}
.lightbox__btn:hover { opacity: 1; color: var(--accent); }
.lightbox__btn--close {
  top: 24px;
  right: 28px;
  font-size: 40px;
}
.lightbox__btn--prev,
.lightbox__btn--next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 64px;
  padding: 0 24px;
}
.lightbox__btn--prev { left: 8px; }
.lightbox__btn--next { right: 8px; }

/* ═══════════════════════════════════════════
   Mobile (≤768px)
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --pad-x: 24px; --pad-y: 80px; }

  .hero { min-height: 560px; }
  .hero__nav { padding: 20px; }
  .hero__content { padding: 0 20px 40px; }
  .hero__h1 { font-size: 32px; max-width: 100%; }

  /* Show hamburger; collapse links into a dropdown panel */
  .nav-toggle { display: flex; }
  .hero__nav-links {
    position: absolute;
    top: 100%;
    right: 20px;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    padding: 12px 20px 16px;
    font-size: 13px;
    background: rgba(12, 12, 10, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid var(--divider);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }
  .hero__nav-links a { padding: 8px 0; }
  .hero__nav.is-open .hero__nav-links {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  /* Animate bars into an X when open */
  .hero__nav.is-open .nav-toggle__bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .hero__nav.is-open .nav-toggle__bar:nth-child(2) { opacity: 0; }
  .hero__nav.is-open .nav-toggle__bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .wwd__grid { grid-template-columns: 1fr; gap: 40px; }

  .fp__header { flex-direction: column; align-items: flex-start; }
  .fp__title { font-size: 40px; }

  /* Gallery collapses to a single column */
  .gallery { grid-template-columns: 1fr; }
  .gallery__cell--wide,
  .gallery__cell:not(.gallery__cell--wide) { grid-column: 1 / -1; }

  .fp-narrative { padding: 64px 24px 80px; }
  .fp-narrative__grid { grid-template-columns: 1fr; gap: 40px; }
  .fp-narrative__lead { font-size: 24px; }

  .approach__grid { grid-template-columns: 1fr; gap: 48px; }
  .approach__h2 { font-size: 32px; }

  .contact { padding: 100px 24px 60px; }
  .contact__h2 { font-size: 36px; }

  .lightbox__btn--prev, .lightbox__btn--next { font-size: 44px; padding: 0 12px; }
  .lightbox__btn--close { font-size: 34px; top: 16px; right: 16px; }
}

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