/*
 * Ironwood: editorial art direction (2026-10-12), loaded after the shared demo bundle.
 * "The sheet at full scale": the construction drawing becomes the hero. The photo bleeds off the edge, the
 * architect's title block overlaps it as a drawn sheet, and faint blueprint grid paper with edge ticks sits behind.
 * On phones the photo leads and the title block overlaps its bottom edge.
 */

body[data-authored-demo][data-demo="ironwood-contracting"] .hero-construction-sheet {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 0;
  align-items: center;
  min-height: 100svh;
  padding: 82px 0 0 4%;
  border-bottom: 0;
  isolation: isolate;
  /* Blueprint paper: fine and coarse hairline grids. */
  background-color: var(--iw-secondary);
  background-image:
    linear-gradient(#1d1c1a12 1px, transparent 1px),
    linear-gradient(90deg, #1d1c1a12 1px, transparent 1px),
    linear-gradient(#1d1c1a08 1px, transparent 1px),
    linear-gradient(90deg, #1d1c1a08 1px, transparent 1px);
  background-size:
    160px 160px,
    160px 160px,
    32px 32px,
    32px 32px;
  background-position: -1px 81px;
}

/* Edge ticks and a sheet reference, as on a drawing border. */
body[data-authored-demo][data-demo="ironwood-contracting"] .hero-construction-sheet::before {
  content: "SHEET A-101 · SCALE 1:1 · ISSUED FOR CONSTRUCTION";
  position: absolute;
  left: 4%;
  bottom: 22px;
  z-index: 3;
  font: 600 10px/1 var(--iw-mono, monospace);
  letter-spacing: 0.22em;
  color: #1d1c1a99;
}

body[data-authored-demo][data-demo="ironwood-contracting"] .hero-construction-sheet::after {
  content: "";
  position: absolute;
  inset: 82px 0 auto;
  height: 10px;
  z-index: 1;
  pointer-events: none;
  background-image: linear-gradient(90deg, #1d1c1a55 1px, transparent 1px);
  background-size: 32px 10px;
}

/* The photo: no frame, bleeding off the right edge, full height. */
body[data-authored-demo][data-demo="ironwood-contracting"] .hero-image-container {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  min-height: calc(100svh - 82px);
  border: 0;
  z-index: 0;
}

body[data-authored-demo][data-demo="ironwood-contracting"] .hero-image-container img {
  object-position: 40% center;
}

/* The title block: a drawn sheet overlapping the photo's edge. */
body[data-authored-demo][data-demo="ironwood-contracting"] .construction-title-block {
  grid-column: 1 / span 2;
  grid-row: 1;
  justify-self: start;
  width: min(640px, 49vw);
  z-index: 2;
  padding: 34px 34px 28px;
  background: var(--iw-secondary);
  border: 2px solid var(--iw-primary);
  box-shadow: 14px 14px 0 #1d1c1a;
}

body[data-authored-demo][data-demo="ironwood-contracting"] .title-block-statement h1 {
  margin: 6px 0 22px;
  /* Capped at 6.4rem (2026-10-14): the sheet stops widening at 640px, so a 7rem "STRUCTURE," overran it above ~1600px. */
  font-size: clamp(3.4rem, 6.4vw, 6.4rem);
  line-height: 0.88;
  letter-spacing: -0.035em;
}

body[data-authored-demo][data-demo="ironwood-contracting"] .title-block-specs > div {
  border-color: #1d1c1a2e;
}

/* ---- Phones: the photo leads ---- */
@media (max-width: 800px) {
  body[data-authored-demo][data-demo="ironwood-contracting"] .hero-construction-sheet {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 70px 0 56px;
    background-position: -1px 69px;
  }

  body[data-authored-demo][data-demo="ironwood-contracting"] .hero-construction-sheet::after {
    top: 70px;
  }

  body[data-authored-demo][data-demo="ironwood-contracting"] .hero-image-container {
    order: -1;
    min-height: 0;
    height: 46svh;
  }

  body[data-authored-demo][data-demo="ironwood-contracting"] .construction-title-block {
    width: auto;
    margin: -64px 16px 0;
    padding: 22px 20px 20px;
    box-shadow: 8px 8px 0 #1d1c1a;
  }

  body[data-authored-demo][data-demo="ironwood-contracting"] .title-block-statement h1 {
    font-size: clamp(2.6rem, 12vw, 3.6rem);
  }

  body[data-authored-demo][data-demo="ironwood-contracting"] .hero-construction-sheet::before {
    left: 16px;
    bottom: 18px;
    font-size: 9px;
    letter-spacing: 0.16em;
  }
}

/* ---- Scroll: the photo settles into place; numerals rise (supporting browsers, motion allowed) ---- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes iw-settle {
    from {
      transform: scale(1.12);
    }
  }

  @keyframes iw-rise {
    from {
      transform: translateY(35%);
      opacity: 0;
    }
  }

  body[data-demo="ironwood-contracting"] .hero-image-container img {
    animation: iw-settle 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  @supports (animation-timeline: view()) {
    body[data-demo="ironwood-contracting"] .iwStats dd {
      animation: iw-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 90%;
    }
  }
}

/* Depth (2026-10-12). A builder's world is drawings: the title sheet lifts and tilts like a drawing picked up off the table, over the site photo. Pointer devices only; off under reduced motion. */
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  body[data-demo="ironwood-contracting"] .construction-title-block {
    transform: perspective(1400px) rotateY(calc(var(--dx-px, 0) * 5deg)) rotateX(calc(var(--dx-py, 0) * -4deg));
    transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  body[data-demo="ironwood-contracting"] .hero-image-container img {
    translate: calc(var(--dx-px, 0) * -12px) calc(var(--dx-py, 0) * -8px);
    transition: translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
}

/* Touch screens: the site photo drifts on scroll (shared dx-drift-near) alongside the shared settle-in. The shared
   hero-image rule outranks a plain .hero-image-container selector (so iw-settle above never applies), hence the
   heavier selector here. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) and (hover: none) {
    body[data-authored-demo][data-demo="ironwood-contracting"] main .hero-image-container img {
      animation-name: dx-settle, dx-drift-near;
      animation-duration: 2.4s, auto;
      animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1), linear;
      animation-fill-mode: both, both;
      animation-timeline: auto, scroll(root);
      animation-range: normal, 0 100vh;
    }
  }
}

/* The plan becomes the building (2026-10-13). An edge trace of the hero photograph, on drawing paper and registered
   pixel for pixel, covers the photo on load and wipes away once (about 1.6 s), so the house appears out of its
   drawing. Afterwards, on pointer devices, a loupe shows the plan under the cursor. Reduced motion: photo only. */
body[data-authored-demo][data-demo="ironwood-contracting"] .hero-image-container {
  overflow: hidden;
  position: relative;
}
body[data-authored-demo][data-demo="ironwood-contracting"] .hero-image-container > .dx-drawing {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: none;
  z-index: 2;
}
@keyframes iw-plan-away {
  from {
    clip-path: inset(0 0 0 0);
  }
  to {
    clip-path: inset(0 0 0 100%);
  }
}
@media (prefers-reduced-motion: no-preference) {
  body[data-authored-demo][data-demo="ironwood-contracting"] .hero-image-container > .dx-drawing-wipe {
    display: block;
    animation: iw-plan-away 1.6s cubic-bezier(0.65, 0, 0.35, 1) 0.5s both;
  }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  body[data-authored-demo][data-demo="ironwood-contracting"] .hero-image-container > .dx-drawing-lens {
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-mask-image: radial-gradient(circle 120px at var(--lens-x, 50%) var(--lens-y, 50%), #000 92%, transparent);
    mask-image: radial-gradient(circle 120px at var(--lens-x, 50%) var(--lens-y, 50%), #000 92%, transparent);
  }
  body[data-authored-demo][data-demo="ironwood-contracting"] .hero-image-container.is-lens > .dx-drawing-lens {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  body[data-authored-demo][data-demo="ironwood-contracting"] .hero-image-container > img {
    animation: none !important;
    translate: none !important;
  }
}

/* The plan rides on exactly the motion the photo has (settle-in, and the scroll drift on phones), so the two stay
   registered while the plan wipes away. */
@media (prefers-reduced-motion: no-preference) {
  body[data-authored-demo][data-demo="ironwood-contracting"] main .hero-image-container > .dx-drawing-wipe {
    animation:
      dx-settle 2.4s cubic-bezier(0.2, 0.7, 0.2, 1) both,
      iw-plan-away 1.6s cubic-bezier(0.65, 0, 0.35, 1) 0.5s both;
  }
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) and (hover: none) {
    body[data-authored-demo][data-demo="ironwood-contracting"] main .hero-image-container > .dx-drawing-wipe {
      animation-name: dx-settle, dx-drift-near, iw-plan-away;
      animation-duration: 2.4s, auto, 1.6s;
      animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1), linear, cubic-bezier(0.65, 0, 0.35, 1);
      animation-delay: 0s, 0s, 0.5s;
      animation-fill-mode: both;
      animation-timeline: auto, scroll(root), auto;
      animation-range: normal, 0 100vh, normal;
    }
  }
}

/* Header inquiry (2026-10-13): drafting orange on hover, matching the "General Contracting" mark. */
@media (min-width: 801px) {
  body[data-authored-demo][data-demo="ironwood-contracting"] .authored-cta--desktop:hover {
    border-color: #db7842;
    background: #db7842;
    color: #14130f;
  }
}

/* Contrast (2026-10-13): the work page's spec labels were #b4572a on near-black (4.01:1). The brighter drafting
   orange from the header clears 4.5:1. */
body[data-demo="ironwood-contracting"] .projectGrid .iwStory dt {
  color: #db7842;
}
