<!-- TACNAHARVEST L.L.C. - 5,626 TREE ORCHARD MATRIX WIDGET FOR SQUARESPACE -->
<div id="th-matrix-widget" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; max-width: 1120px; margin: 20px auto; color: #1c1917; line-height: 1.5;">
<style>
#th-matrix-widget * { box-sizing: border-box; }
.thm-box { background: #ffffff; border: 1px solid #e7e5e4; border-radius: 14px; padding: 18px; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.thm-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.thm-field { display: flex; flex-direction: column; gap: 4px; }
.thm-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #57534e; letter-spacing: 0.04em; }
.thm-select, .thm-input { padding: 9px 12px; border: 1px solid #d6d3d1; border-radius: 8px; font-size: 14px; background: #ffffff; color: #1c1917; }
.thm-btn { background: #7f1d1d; color: #ffffff; border: none; border-radius: 8px; padding: 10px 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.thm-btn:hover { background: #450a0a; }
.thm-btn-outline { background: #ffffff; color: #44403c; border: 1px solid #d6d3d1; border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.thm-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; font-weight: 600; margin-bottom: 12px; color: #44403c; }
.thm-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.thm-basket { background: #fffbeb; border: 2px solid #b45309; border-radius: 12px; padding: 14px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.thm-chip { display: inline-flex; align-items: center; gap: 6px; background: #fef3c7; color: #b45309; border: 1px solid #f59e0b; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; margin: 2px; }
.thm-chip button { border: none; background: none; color: #7f1d1d; font-weight: 800; cursor: pointer; font-size: 14px; padding: 0; }
.thm-scroll { overflow-x: auto; background: #ffffff; padding: 14px; border-radius: 12px; border: 1px solid #e7e5e4; -webkit-overflow-scrolling: touch; }
.thm-board { display: flex; flex-direction: row; gap: 8px; min-width: max-content; }
.thm-col { width: 86px; background: #f5f5f4; border: 1px solid #e7e5e4; border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.thm-col-hdr { text-align: center; font-size: 11px; font-weight: 800; color: #ffffff; background: #1c1917; padding: 5px 4px; border-radius: 5px; margin-bottom: 3px; }
.thm-col-hdr span { display: block; font-size: 9px; font-weight: 500; color: #fde68a; }
.thm-cell { padding: 7px 3px; border-radius: 5px; font-size: 10px; font-weight: 700; text-align: center; cursor: pointer; border: 1px solid transparent; user-select: none; }
.thm-cell.avail { background: #dcfce7; color: #14532d; border-color: #86efac; }
.thm-cell.adopted { background: #fef2f2; color: #7f1d1d; border-color: #fca5a5; }
.thm-cell.selected { background: #fef3c7; color: #b45309; border: 2px solid #b45309; }
.thm-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 9999; align-items: center; justify-content: center; padding: 16px; }
.thm-modal-card { background: #ffffff; border-radius: 16px; max-width: 460px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 22px; }
.thm-fg { margin-bottom: 12px; }
.thm-fg label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 4px; color: #44403c; }
</style>
<div class="thm-box">
<div class="thm-controls">
<div class="thm-field">
<label class="thm-label">Orchard Sector</label>
<select id="thm-sector" class="thm-select" onchange="thmOnSectorChange()">
<option value="A">Sector A — Paños A01 to A06 (2,386 Trees)</option>
<option value="B">Sector B — Paños B01 to B14 (3,240 Trees)</option>
</select>
</div>
<div class="thm-field">
<label class="thm-label">Paño (12 Furrows S01→S12)</label>
<select id="thm-pano" class="thm-select" onchange="thmRenderBoard()"></select>
</div>
<div class="thm-field" style="flex:1; min-width:210px;">
<label class="thm-label">Jump to Tree Code</label>
<div style="display:flex; gap:6px;">
<input type="text" id="thm-jump" class="thm-input" style="flex:1;" placeholder="e.g. A01S12GW29 or B05S01GW10">
<button type="button" class="thm-btn" onclick="thmJump()">Go</button>
</div>
</div>
</div>
</div>
<div class="thm-legend">
<span><i class="thm-dot" style="background:#86efac;border:1px solid #14532d;"></i>Available</span>
<span><i class="thm-dot" style="background:#fca5a5;border:1px solid #7f1d1d;"></i>Adopted</span>
<span><i class="thm-dot" style="background:#fde68a;border:1px solid #b45309;"></i>Selected in Family Basket</span>
<span style="color:#78716c;">← Swipe horizontally to view Furrows S01 through S12 →</span>
</div>
<div class="thm-basket">
<div style="flex:1; min-width:220px;">
<div style="font-size:13px; font-weight:700; margin-bottom:4px;" id="thm-summary">Selected Trees: 0 (Tap green trees in S01–S12 to add)</div>
<div id="thm-chips"></div>
</div>
<div style="display:flex; gap:8px;">
<button type="button" id="thm-clear-btn" class="thm-btn-outline" style="display:none;" onclick="thmClear()">Clear</button>
<button type="button" id="thm-checkout-btn" class="thm-btn" style="display:none;" onclick="thmOpenModal()">Adopt Selected Trees</button>
</div>
</div>
<div class="thm-scroll">
<div id="thm-board" class="thm-board"></div>
</div>
<div id="thm-modal" class="thm-modal">
<div class="thm-modal-card">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;">
<h3 style="font-size:20px; font-weight:700; margin:0;">Complete Family Adoption</h3>
<button type="button" onclick="thmCloseModal()" style="border:none; background:none; font-size:22px; cursor:pointer;">×</button>
</div>
<p style="font-size:13px; color:#57534e; margin-bottom:12px;" id="thm-modal-note"></p>
<form onsubmit="thmConfirm(event)">
<div id="thm-modal-inputs"></div>
<div class="thm-fg">
<label>Family / Sponsor Name & City *</label>
<input type="text" id="thm-owner" class="thm-input" style="width:100%;" required placeholder="e.g. The Miller Family • South Portland, ME">
</div>
<div class="thm-fg">
<label>Email for GPS Certificates & Updates *</label>
<input type="email" id="thm-email" class="thm-input" style="width:100%;" required placeholder="family@email.com">
</div>
<button type="submit" class="thm-btn" style="width:100%;" id="thm-submit-btn">Proceed to Checkout</button>
</form>
</div>
</div>
<script>
const THM_PANOS = {
A: [
{ id: "A01", total: 384, getCount: () => 32 },
{ id: "A02", total: 370, getCount: (s) => (s <= 7 ? 30 : 32) },
{ id: "A03", total: 396, getCount: () => 33 },
{ id: "A04", total: 396, getCount: () => 33 },
{ id: "A05", total: 420, getCount: () => 35 },
{ id: "A06", total: 420, getCount: () => 35 }
],
B: [
{ id: "B01", total: 276, getCount: () => 23 },
{ id: "B02", total: 276, getCount: () => 23 },
{ id: "B03", total: 276, getCount: () => 23 },
{ id: "B04", total: 276, getCount: () => 23 },
{ id: "B05", total: 216, getCount: () => 18 },
{ id: "B06", total: 216, getCount: () => 18 },
{ id: "B07", total: 216, getCount: () => 18 },
{ id: "B08", total: 216, getCount: () => 18 },
{ id: "B09", total: 240, getCount: () => 20 },
{ id: "B10", total: 240, getCount: () => 20 },
{ id: "B11", total: 192, getCount: () => 16 },
{ id: "B12", total: 192, getCount: () => 16 },
{ id: "B13", total: 204, getCount: () => 17 },
{ id: "B14", total: 204, getCount: () => 17 }
]
};
const thmAdopted = {
"A01S12GW29": { name: "The Miller Family Tree", owner: "Sarah M. • South Portland, ME" },
"A02S07GW15": { name: "Atacama Sun", owner: "David R. • Boston, MA" },
"B01S03GW12": { name: "Casco Bay Harvest", owner: "Elena G. • Cape Elizabeth, ME" }
};
let thmSelected = [];
function thmPad(n) { return String(n).padStart(2, '0'); }
function thmOnSectorChange() {
const sec = document.getElementById('thm-sector').value;
const sel = document.getElementById('thm-pano');
sel.innerHTML = '';
THM_PANOS[sec].forEach(p => {
const opt = document.createElement('option');
opt.value = p.id;
opt.textContent = `Paño ${p.id} (${p.total} trees • 12 furrows)`;
sel.appendChild(opt);
});
thmRenderBoard();
}
function thmRenderBoard() {
const sec = document.getElementById('thm-sector').value;
const panoId = document.getElementById('thm-pano').value;
const pano = THM_PANOS[sec].find(p => p.id === panoId) || THM_PANOS[sec];
const board = document.getElementById('thm-board');
board.innerHTML = '';
for (let s = 1; s <= 12; s++) {
const col = document.createElement('div');
col.className = 'thm-col';
const count = pano.getCount(s);
const hdr = document.createElement('div');
hdr.className = 'thm-col-hdr';
hdr.innerHTML = `S${thmPad(s)}<span>${count} plants</span>`;
col.appendChild(hdr);
for (let gw = 1; gw <= count; gw++) {
const code = `${pano.id}S${thmPad(s)}GW${thmPad(gw)}`;