/* global React */ const { useState, useMemo, useRef, useEffect } = React; // Five fence profiles. Each maps to one of the 10 source photos. // Multiple alternates are kept around so the Configurator can let the user // swap base photos within a profile. const PROFILES = [ { id: "square-lattice-top", name: "Privacy + Square Lattice", tag: "01", kicker: "Privacy · Modern crown", blurb: "Vertical boards finished with a clean square lattice section at the top. Adds light, airflow, and a detail line — without giving up screening below.", metrics: { screening: 88, airflow: 25, cost: 78, height: "6–8 ft" }, accent: "#9F5D43", photo: "fences/fence-01.png", alternates: ["fences/fence-01.png", "fences/fence-02.png", "fences/fence-07.png"], guide: { construction: [ "6 ft vertical boards on a framed 2×4 structure (top, middle, bottom rails)", "Square lattice panel cut to 2 ft and seated above the top rail", "4×4×8 ft pressure-treated posts, 8 ft on center, set in concrete", "Total finished height: 7–8 ft including lattice", ], pairs: "Transitional and modern homes. Pools, yoga decks, and patios where you want a privacy fence that doesn't feel oppressive.", maintenance: "Sealer or stain every 2–3 yrs to keep the cedar tone. Lattice catches debris in wooded yards — plan a hose-down each fall.", pros: ["Privacy with a finished detail", "Looks designed, not utilitarian", "Lets light through up top"], cons: ["Costs more than a flat-top privacy fence", "Lattice is a wind-load consideration on exposed lots"], }, }, { id: "diamond-lattice-top", name: "Privacy + Diamond Lattice", tag: "02", kicker: "Privacy · Traditional crown", blurb: "Solid privacy boards capped with a diamond-pattern lattice. The classic version — pairs naturally with traditional or transitional homes.", metrics: { screening: 85, airflow: 28, cost: 78, height: "6–8 ft" }, accent: "#6F7A56", photo: "fences/fence-03.png", alternates: ["fences/fence-03.png", "fences/fence-04.png", "fences/fence-08.png"], guide: { construction: [ "6 ft vertical boards on a framed 2×4 structure", "Diamond redwood lattice panel cut to 2 ft and seated above the top rail", "4×4×8 ft pressure-treated posts, 8 ft on center, set in concrete", "Total finished height: 7–8 ft including lattice", ], pairs: "Craftsman, cottage, and traditional homes. Backyards where a touch of pattern feels at home.", maintenance: "Same as the square lattice. Re-stain every 2–3 yrs. Diamond pattern is more forgiving of weathering — the warmer the patina, the better it looks.", pros: ["Most traditional silhouette of the five", "Cheapest lattice top option", "Pattern reads even at a distance"], cons: ["Less light through than square lattice", "Pattern is busier — won't fit every architecture"], }, }, { id: "horizontal-plank", name: "Horizontal Plank", tag: "03", kicker: "Architectural · Wide rails", blurb: "Rails run side-to-side for a contemporary look that matches modern siding, pools, and decks. Engineered for span and a clean horizontal line.", metrics: { screening: 80, airflow: 25, cost: 90, height: "6–7 ft" }, accent: "#4A6580", photo: "fences/fence-05.png", alternates: ["fences/fence-05.png", "fences/fence-06.png"], guide: { construction: [ "Horizontal boards stacked between posts, set 6 ft on center (tighter span = less sag over time)", "Boards installed with a uniform 1/4–3/8 inch reveal between each — gap dictates privacy vs. airflow", "4×4 or 6×6 posts depending on lot wind exposure", "Hidden fasteners on premium installs", ], pairs: "Modern and mid-century homes. Pool surrounds, decks, and contemporary landscaping where vertical board would feel rustic.", maintenance: "Boards bow more than vertical over time — use straight-grained stock and tight post spacing. Stain or seal every 2 yrs to keep the horizontal grain reading clean.", pros: ["Most contemporary look of the five", "Adjustable privacy by changing reveal", "Reads architectural, not utilitarian"], cons: ["Most expensive option per linear foot", "Wind load is harder on horizontal — needs heavier framing", "Boards must be straight; cull culls heavily"], }, }, { id: "capped-stockade", name: "Capped Stockade", tag: "04", kicker: "Solid · Framed & post-capped", blurb: "Tight vertical boards inside a heavy frame, finished with chamfered post caps. Reads solid and finished from both sides — a premium privacy fence.", metrics: { screening: 95, airflow: 10, cost: 82, height: "6–8 ft" }, accent: "#A88142", photo: "fences/fence-stockade.png", alternates: ["fences/fence-stockade.png"], guide: { construction: [ "Tight vertical boards inside a continuous 2×4 frame (top, middle, bottom)", "Decorative top cap rail covers the board ends — finished read on both sides", "Chamfered or pyramid post caps on each 4×4 post", "Posts 8 ft on center, set in concrete with crowned tops to shed water", ], pairs: "Higher-end residential lots where the fence is a visible part of the landscape. Pool and patio surrounds, primary backyards.", maintenance: "The cap rail and post caps protect the end grain — biggest contributor to fence longevity. Stain every 2–3 yrs, check caps annually.", pros: ["Best-presenting of the privacy options", "End grain is protected — lasts longest", "Finished both sides — no \"bad side\""], cons: ["More expensive than a plain privacy fence", "Heavier — needs solid post setting"], }, }, { id: "solid-board-privacy", name: "Solid Board Privacy", tag: "05", kicker: "Solid · Side yards & courtyards", blurb: "Tight vertical boards on a framed structure, sized for residential side yards and courtyards. Built in cedar or redwood — the workhorse: finished, neighborly, affordable.", metrics: { screening: 92, airflow: 15, cost: 60, height: "5–6 ft" }, accent: "#8C6072", photo: "fences/fence-09.png", alternates: ["fences/fence-09.png", "fences/fence-10.png"], guide: { construction: [ "Vertical cedar or redwood boards on a 2-rail or 3-rail frame", "Optional 1×6 cap rail across the top to protect end grain", "4×4×8 ft pressure-treated posts, 8 ft on center", "Typical height: 5–6 ft for residential side yards", ], pairs: "Side yards, courtyards, dog runs, and any place where you want privacy without the cost of the capped stockade.", maintenance: "Sealer every 2–3 yrs. Without a cap rail, the top of the boards is the first to weather — plan to swap a few boards over the lifetime of the fence.", pros: ["Lowest cost privacy fence we build", "Builds quickly", "Easy to repair board-by-board"], cons: ["Less finished read than the capped stockade", "Open end grain at the top weathers faster"], }, }, ]; // All 10 photos with descriptive labels — used by the Configurator base-style picker. const ALL_PHOTOS = [ { src: "fences/fence-01.png", label: "Privacy + sq. lattice top" }, { src: "fences/fence-02.png", label: "Privacy + lattice (angled)" }, { src: "fences/fence-03.png", label: "Privacy + diamond lattice" }, { src: "fences/fence-04.png", label: "Diamond lattice (angled)" }, { src: "fences/fence-05.png", label: "Horizontal modern" }, { src: "fences/fence-06.png", label: "Horizontal (angled)" }, { src: "fences/fence-07.png", label: "Tall vertical privacy" }, { src: "fences/fence-08.png", label: "Mixed-tone privacy" }, { src: "fences/fence-09.png", label: "Low cedar privacy" }, { src: "fences/fence-10.png", label: "Low cedar (warm)" }, ]; const PALETTES = { Muted: ["#9F5D43", "#6F7A56", "#4A6580", "#A88142", "#8C6072"], Heritage: ["#7A3B2B", "#3F5C3C", "#22324F", "#A8732C", "#5B3550"], Stone: ["#5E6A6B", "#83847C", "#8F7D63", "#6F584A", "#A39B85"], Earth: ["#7A4E36", "#56624A", "#4F5B6E", "#90733E", "#6B4F5D"], Mono: ["#2F2A24", "#4A4339", "#675C4E", "#867962", "#A89A82"], }; // ============ FENCE COMPONENT ============ // Real photo — shown as natural wood. Optional very-low-opacity tint is used // only as an identity hint on certain card chrome elements (e.g. project color tags). // The fence photos themselves render natural. function Fence({ src, color, intensity = 0, frame = false, className = "" }) { return (