<?php
/**
 * Template Name: Investor Portal
 * Template Post Type: page
 *
 * Bitcoin Timber — Investor Data Room
 * Password-gated. Six sections. View-only document cards.
 * Matches site design system exactly.
 *
 * ACCESS MODEL:
 *   - WordPress built-in page password (set in Page > Visibility > Password Protected)
 *   - Alternatively, use Members / Password Protected plugin for more control
 *   - Documents link to Google Drive / Dropbox "preview" URLs (not download URLs)
 *   - To get a view-only Google Drive link: Share → Anyone with link → Viewer
 *     then change /view to /preview in the URL for inline embed
 *
 * INSTALLATION:
 *   1. Upload to /wp-content/themes/bitcoin-timber/
 *   2. Pages → Investor Portal → Template: "Investor Portal"
 *   3. Set page password under Visibility → Password Protected
 *   4. Replace all PLACEHOLDER_URL values with real document URLs
 *
 * @package BitcoinTimber
 */

if ( ! defined( 'ABSPATH' ) ) exit;

get_header();

// ── Document registry ────────────────────────────────────────────────────────
// Replace PLACEHOLDER_URL with actual Google Drive /preview or DocSend links.
// status: 'live' | 'soon' | 'request'
// type:   'pdf' | 'sheet' | 'deck' | 'doc' | 'legal'

$sections = [

    [
        'id'    => 'overview',
        'num'   => '01',
        'title' => 'Round Overview',
        'lead'  => 'The deal at a glance. Start here.',
        'docs'  => [
            [
                'title'    => 'Pitch Deck',
                'desc'     => 'Full investor presentation — problem, solution, flywheel, financials, team, ask.',
                'type'     => 'deck',
                'pages'    => '18 slides',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1ve6IMFJMqKjqBYPD0gR5EApfLhNxGNlz/preview',
            ],
            [
                'title'    => 'One-Page Executive Summary',
                'desc'     => 'Single-page deal memo. Printable. Shareable with co-investors.',
                'type'     => 'pdf',
                'pages'    => '1 page',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1qt0c6m7HP83CetZp0ktnzFUIfGwOmRC2/preview',
            ],
            [
                'title'    => 'Use of Funds',
                'desc'     => 'Itemised breakdown of how $250,000 is deployed across equipment, labour, and working capital.',
                'type'     => 'pdf',
                'pages'    => '2 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1BDhACQm8GQuZIw4nQ5Kx917I20FXpnWJ/preview',
            ],
            [
                'title'    => 'Round Terms',
                'desc'     => '$250,000 · 10% equity · $2.5M pre-money valuation · BVI entity · closing Jun 2026.',
                'type'     => 'doc',
                'pages'    => '1 page',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1cKBlku6L5C3CrLSFZpzLpXFpvtIEyQ3F/preview',
            ],
        ],
    ],

    [
        'id'    => 'financials',
        'num'   => '02',
        'title' => 'Financial Model',
        'lead'  => 'Five-year projections. Three revenue streams. Zero fuel cost basis.',
        'docs'  => [
            [
                'title'    => 'Revenue Model — Yr 1–5',
                'desc'     => 'Full P&L with Bitcoin mining, kiln-dried timber, and char-ash revenue segmented. Sensitivity tables included.',
                'type'     => 'sheet',
                'pages'    => 'Excel / PDF',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1ddts1-7JYMQbNepgGMLPsqFc5Gupw9rU/preview',
            ],
            [
                'title'    => 'Bitcoin Treasury Model',
                'desc'     => 'BTC accumulation projections at $60K, $100K, $150K price scenarios. HODL policy rationale.',
                'type'     => 'sheet',
                'pages'    => 'Excel / PDF',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1D-r5pXc8ngXs-4Jrayp7e-CnQwd0y7-s/preview',
            ],
            [
                'title'    => 'Cost Structure Breakdown',
                'desc'     => 'CapEx vs OpEx. Equipment list with sourcing costs. Labour. Site infrastructure. No fuel line item.',
                'type'     => 'pdf',
                'pages'    => '3 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1nlMeys1gh7a9b04B-fb8kJpMdph7ud6r/preview',
            ],
            [
                'title'    => 'Cap Table — Current & Pro Forma',
                'desc'     => 'Current ownership. Post-round allocation showing investor 10% position.',
                'type'     => 'pdf',
                'pages'    => '1 page',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1jjx-DU3gHiF5gD9ODBS6CbRKuxNAenVn/preview',
            ],
            [
                'title'    => '90-Day Revenue Roadmap',
                'desc'     => 'Milestone timeline from funding close to first Bitcoin mined and first KD timber sold.',
                'type'     => 'pdf',
                'pages'    => '2 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1lO4pYs4eIO4Q9Uvwt0-nWtpqtsNLjuzw/preview',
            ],
        ],
    ],

    [
        'id'    => 'engineering',
        'num'   => '03',
        'title' => 'Engineering & Technology',
        'lead'  => 'Proprietary system documentation. 25 engineering documents. Built to spec.',
        'docs'  => [
            [
                'title'    => 'TimberForge System — Master Spec',
                'desc'     => 'Full system architecture document covering TFR-1, HX-1, CF-1, generator, ME-1 enclosure, and TFK-1 kiln as an integrated loop.',
                'type'     => 'pdf',
                'pages'    => '12 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1nKBTMWl1pChqsu_nGmXO7WW3sh8zi__8/preview',
            ],
            [
                'title'    => 'TFR-1 Reactor — Technical Spec Sheet',
                'desc'     => 'Imbert downdraft gasifier. Dimensions, materials, operating parameters, Trst targets, syngas output spec.',
                'type'     => 'pdf',
                'pages'    => '6 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1ecDtak7CUQeyVeigV5Wy-slCaN0Z3eVH/preview',
            ],
            [
                'title'    => 'TFK-1 Kiln — Technical Spec Sheet',
                'desc'     => 'Forced-convection drying kiln. Chamber dimensions, KDC-1 controller targets, drying schedules for Greenheart, Purpleheart, Mora.',
                'type'     => 'pdf',
                'pages'    => '6 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1cs0JXe5FrBpJAS38gLGSphnXPiaXI9ws/preview',
            ],
            [
                'title'    => 'PyroCoil HX-1 — Heat Exchanger Spec',
                'desc'     => 'Coiled heat exchanger design. Inlet/outlet temperatures, heat transfer rate, kiln plenum integration.',
                'type'     => 'pdf',
                'pages'    => '3 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'soon',
                'url'      => '',
            ],
            [
                'title'    => 'ClearPath CF-1 — Gas Cleanup Train',
                'desc'     => 'Cyclone separator + packed-bed filter. Tar load targets, char separation, maintenance schedule.',
                'type'     => 'pdf',
                'pages'    => '3 pages',
                'updated'  => 'Q2 2026',
                'status'   => 'soon',
                'url'      => '',
            ],
            [
                'title'    => 'MinerSink ME-1 — Enclosure & Heat Duct',
                'desc'     => 'S19 Pro housing design. Heat capture ducting. Thermal load calculations showing 3–5 kW to kiln.',
                'type'     => 'pdf',
                'pages'    => '4 pages',
                'updated'  => 'Q2 2026',
                'status'   => 'soon',
                'url'      => '',
            ],
            [
                'title'    => 'Site Layout & Infrastructure Plan',
                'desc'     => 'New Forest, Berbice. Plot plan, equipment placement, access roads, power routing, water management.',
                'type'     => 'pdf',
                'pages'    => '4 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'request',
                'url'      => '',
            ],
        ],
    ],

    [
        'id'    => 'market',
        'num'   => '04',
        'title' => 'Market & Operations',
        'lead'  => 'The Guyana timber market, Bitcoin mining economics, and competitive position.',
        'docs'  => [
            [
                'title'    => 'Guyana Hardwood Market Analysis',
                'desc'     => 'Timber pricing, export demand, species overview (Greenheart, Purpleheart, Mora), $2.40/bf KD vs $0.80/bf green delta.',
                'type'     => 'pdf',
                'pages'    => '5 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1qKA--WtqE2_Smb0cNGvns3s1dwkO_Y7I/preview',
            ],
            [
                'title'    => 'Bitcoin Mining Economics',
                'desc'     => 'Hashrate, difficulty, block reward. S19 Pro performance at $0.00/kWh vs grid miners. Competitive cost floor analysis.',
                'type'     => 'pdf',
                'pages'    => '4 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/11QpSMcWE2Gcl43DtCOm9VQKCUbUPZJo-/preview',
            ],
            [
                'title'    => 'Biomass Gasification — Technology Validation',
                'desc'     => 'Third-party literature review on Imbert gasifier performance. Comparable installations. Syngas yield data.',
                'type'     => 'pdf',
                'pages'    => '6 pages',
                'updated'  => 'Feb 2026',
                'status'   => 'soon',
                'url'      => '',
            ],
            [
                'title'    => 'Operational Risk Register',
                'desc'     => 'Identified risks across gasifier, mining, timber, FX, regulatory. Mitigation strategies for each.',
                'type'     => 'pdf',
                'pages'    => '4 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1y3SNk2LLvDU8NJ80IrhV13aStT2DKL8A/preview',
            ],
        ],
    ],

    [
        'id'    => 'legal',
        'num'   => '05',
        'title' => 'Legal & Entity',
        'lead'  => 'BVI incorporation. Ownership. Regulatory position.',
        'docs'  => [
            [
                'title'    => 'BVI Certificate of Incorporation',
                'desc'     => 'Bitcoin Timber International Ltd. BVI Reg. 2190032. Certificate of good standing.',
                'type'     => 'legal',
                'pages'    => '2 pages',
                'updated'  => '2025',
                'status'   => 'request',
                'url'      => '',
            ],
            [
                'title'    => 'Shareholder Agreement (Draft)',
                'desc'     => 'Rights, obligations, transfer restrictions, drag-along / tag-along provisions for seed investors.',
                'type'     => 'legal',
                'pages'    => '8 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'request',
                'url'      => '',
            ],
            [
                'title'    => 'Guyana Forestry Commission — Timber Licence',
                'desc'     => 'Active logging and processing licence for the New Forest, Berbice concession.',
                'type'     => 'legal',
                'pages'    => '—',
                'updated'  => '—',
                'status'   => 'request',
                'url'      => '',
            ],
            [
                'title'    => 'Land Rights Documentation',
                'desc'     => 'Title deed and family land rights for the Canje River site, New Forest, Berbice.',
                'type'     => 'legal',
                'pages'    => '—',
                'updated'  => '—',
                'status'   => 'request',
                'url'      => '',
            ],
        ],
    ],

    [
        'id'    => 'updates',
        'num'   => '06',
        'title' => 'Investor Updates',
        'lead'  => 'Progress memos. Sent to all investors and serious prospects.',
        'docs'  => [
            [
                'title'    => 'Update #001 — Mar 2026',
                'desc'     => 'Round open. Site survey complete. TFR-1 gasifier design finalised. Equipment procurement initiated.',
                'type'     => 'pdf',
                'pages'    => '2 pages',
                'updated'  => 'Mar 2026',
                'status'   => 'live',
                'url'      => 'https://drive.google.com/file/d/1WEF-HRWnJxUJuli5uGRdqoBo1eceVpuR/preview',
            ],
        ],
    ],

];

// ── Type icons & labels ──────────────────────────────────────────────────────
$type_meta = [
    'pdf'   => [ 'icon' => '▤',  'label' => 'PDF' ],
    'sheet' => [ 'icon' => '⊞',  'label' => 'Spreadsheet' ],
    'deck'  => [ 'icon' => '▣',  'label' => 'Deck' ],
    'doc'   => [ 'icon' => '▤',  'label' => 'Document' ],
    'legal' => [ 'icon' => '⊡',  'label' => 'Legal' ],
];
?>

<style>
/* ── Data Room — inherits global tokens ───────────────────── */
.dr-page {
    background: var(--void);
    color: var(--parch);
    font-family: var(--mono);
    min-height: 100vh;
}

body.page-template-template-investor-portal .entry-header,
body.page-template-template-investor-portal .page-header { display: none !important; }

.dr-wrap { max-width: 1200px; margin: 0 auto; padding: 0 40px; }
@media (max-width: 680px) { .dr-wrap { padding: 0 20px; } }

.dr-rule { height: 1px; background: var(--rule); }

/* ── Reveal ── */
.dr-reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.55s cubic-bezier(0.16,1,0.3,1), transform 0.55s cubic-bezier(0.16,1,0.3,1); }
.dr-reveal.is-visible { opacity: 1; transform: none; }

/* ══ TICKER ══════════════════════════════════════════════════ */
.dr-ticker-wrap { background: var(--ink); border-bottom: 1px solid var(--seam); overflow: hidden; padding: 6px 0; }
.dr-ticker-track { display: flex; white-space: nowrap; animation: dr-tick 38s linear infinite; }
@keyframes dr-tick { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }
.dr-ticker-item { font-size: 8.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); padding: 0 24px; flex-shrink: 0; border-right: 1px solid var(--seam); }
.dr-ticker-item strong { color: var(--btc); font-weight: 500; }

/* ══ HEADER ══════════════════════════════════════════════════ */
.dr-header {
    padding: 56px 0 48px;
    border-bottom: 1px solid var(--rule);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 40px;
    align-items: end;
}
.dr-header__left {}
.dr-header__eyebrow {
    font-size: 8px; letter-spacing: 0.28em; text-transform: uppercase;
    color: var(--btc); margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px;
}
.dr-header__eyebrow::before { content: ''; display: block; width: 20px; height: 1px; background: var(--btc); opacity: 0.6; }
.dr-header__title {
    font-family: var(--serif); font-size: clamp(36px, 5vw, 68px);
    font-weight: 900; line-height: 0.93; letter-spacing: -0.03em; color: var(--white);
    margin-bottom: 16px;
}
.dr-header__title em { font-style: italic; color: var(--btc); display: block; }
.dr-header__sub {
    font-size: 10px; letter-spacing: 0.06em; line-height: 1.8; color: var(--dim);
    max-width: 500px; border-left: 2px solid var(--btc); padding-left: 14px;
}
.dr-header__right { text-align: right; }

/* Round status badge */
.dr-round-badge {
    display: inline-flex; flex-direction: column; gap: 2px;
    border: 1px solid var(--rule); border-top: 2px solid var(--btc);
    padding: 16px 20px; background: var(--panel); min-width: 180px;
}
.dr-round-badge__status {
    font-size: 7.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--btc);
    display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.dr-round-badge__status::before {
    content: ''; width: 5px; height: 5px; background: var(--btc); border-radius: 50%;
    animation: bt-pulse 2.5s ease-in-out infinite; flex-shrink: 0;
}
.dr-round-kv { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border-bottom: 1px solid var(--seam); }
.dr-round-kv:last-child { border-bottom: none; }
.dr-round-kv__k { font-size: 8px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.dr-round-kv__v { font-size: 9px; color: var(--parch); }
.dr-round-kv__v.is-btc { color: var(--btc); }

/* ══ NAV PILLS ═══════════════════════════════════════════════ */
.dr-nav {
    position: sticky; top: calc(var(--nav-h) + 1px); z-index: 100;
    background: var(--void); border-bottom: 1px solid var(--rule);
    padding: 12px 0; overflow-x: auto;
}
.dr-nav-inner { display: flex; gap: 4px; align-items: center; }
.dr-nav-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; font-family: var(--mono); font-size: 8px;
    letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim);
    border: 1px solid transparent; text-decoration: none; white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background 0.15s; flex-shrink: 0;
}
.dr-nav-pill:hover { color: var(--parch); border-color: var(--rule); text-decoration: none; }
.dr-nav-pill.is-active { color: var(--btc); border-color: rgba(247,147,26,0.3); background: rgba(247,147,26,0.05); }
.dr-nav-pill__num { color: var(--btc); opacity: 0.5; font-size: 7px; }

/* ══ SECTION ═════════════════════════════════════════════════ */
.dr-section { padding: 56px 0 0; }
.dr-section:last-child { padding-bottom: 80px; }

.dr-section__head {
    display: grid; grid-template-columns: auto 1fr; gap: 24px;
    align-items: start; margin-bottom: 28px; padding-bottom: 20px;
    border-bottom: 1px solid var(--rule);
}
.dr-section__num {
    font-family: var(--serif); font-size: 56px; font-weight: 900;
    line-height: 1; letter-spacing: -0.04em; color: var(--seam);
    user-select: none; margin-top: -6px;
}
.dr-section__title {
    font-family: var(--serif); font-size: clamp(22px, 3vw, 34px);
    font-weight: 900; letter-spacing: -0.02em; color: var(--white); line-height: 1.1;
    margin-bottom: 6px;
}
.dr-section__lead {
    font-size: 9.5px; letter-spacing: 0.06em; line-height: 1.7; color: var(--dim);
}

/* ══ DOC GRID ════════════════════════════════════════════════ */
.dr-doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
}

.dr-doc {
    background: var(--panel);
    padding: 22px 22px 18px;
    display: flex; flex-direction: column; gap: 0;
    transition: background 0.15s ease;
    position: relative;
}
.dr-doc:hover { background: var(--lift); }
.dr-doc.is-soon, .dr-doc.is-request { opacity: 0.55; }
.dr-doc.is-soon:hover, .dr-doc.is-request:hover { opacity: 0.75; background: var(--panel); }

/* NDA-unlocked: request docs become fully active */
.dr-doc.is-nda-unlocked { opacity: 1; }
.dr-doc.is-nda-unlocked::before { background: var(--btc); opacity: 1; }
.dr-doc__badge.is-nda-unlocked {
    color: var(--btc); border: 1px solid rgba(247,147,26,0.3);
    background: rgba(247,147,26,0.06);
}

/* Status bar on top */
.dr-doc::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.dr-doc.is-live::before { background: var(--btc); }
.dr-doc.is-soon::before { background: var(--rule); }
.dr-doc.is-request::before { background: var(--dim); opacity: 0.4; }

.dr-doc__top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 12px; }

.dr-doc__type {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 7px; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--dim); border: 1px solid var(--seam); padding: 3px 7px; flex-shrink: 0;
}
.dr-doc__type-icon { font-size: 9px; }

.dr-doc__badge {
    font-size: 6.5px; letter-spacing: 0.2em; text-transform: uppercase;
    padding: 3px 7px; flex-shrink: 0;
}
.dr-doc__badge.is-live    { color: var(--btc); border: 1px solid rgba(247,147,26,0.3); background: rgba(247,147,26,0.06); }
.dr-doc__badge.is-soon    { color: var(--dim); border: 1px solid var(--seam); }
.dr-doc__badge.is-request { color: var(--dim); border: 1px solid var(--seam); }

.dr-doc__title {
    font-family: var(--serif); font-size: 16px; font-weight: 700;
    letter-spacing: -0.01em; color: var(--white); line-height: 1.25; margin-bottom: 8px;
}

.dr-doc__desc {
    font-size: 9px; letter-spacing: 0.04em; line-height: 1.7;
    color: var(--muted); flex: 1; margin-bottom: 14px;
}

.dr-doc__meta {
    display: flex; gap: 14px; padding-top: 10px; border-top: 1px solid var(--seam);
    margin-top: auto;
}
.dr-doc__meta-item { display: flex; flex-direction: column; gap: 2px; }
.dr-doc__meta-key { font-size: 7px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.dr-doc__meta-val { font-size: 9px; color: var(--muted); }

/* View / action button */
.dr-doc__action {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 12px; padding: 8px 14px;
    font-family: var(--mono); font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--void); background: var(--btc); text-decoration: none;
    transition: background 0.15s ease; align-self: flex-start;
}
.dr-doc__action:hover { background: #ffa535; color: var(--void); text-decoration: none; }

.dr-doc__action-ghost {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 12px; padding: 7px 13px;
    font-family: var(--mono); font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--dim); border: 1px solid var(--seam); text-decoration: none;
    transition: border-color 0.15s, color 0.15s; align-self: flex-start; cursor: default;
}
.dr-doc__action-request {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 12px; padding: 7px 13px;
    font-family: var(--mono); font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--dim); border: 1px solid var(--seam); text-decoration: none; cursor: pointer;
    transition: border-color 0.15s, color 0.15s; align-self: flex-start;
    background: none;
}
.dr-doc__action-request:hover { border-color: var(--btc); color: var(--btc); }

/* ══ MODAL (request access) ══════════════════════════════════ */
.dr-modal-overlay {
    position: fixed; inset: 0; background: rgba(7,7,7,0.88);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
    padding: 20px;
}
.dr-modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.dr-modal {
    background: var(--ink); border: 1px solid var(--rule); border-top: 2px solid var(--btc);
    padding: 32px; width: 100%; max-width: 480px;
    transform: translateY(10px); transition: transform 0.2s ease;
}
.dr-modal-overlay.is-open .dr-modal { transform: translateY(0); }
.dr-modal__eyebrow { font-size: 8px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--btc); margin-bottom: 10px; }
.dr-modal__title { font-family: var(--serif); font-size: 24px; font-weight: 900; letter-spacing: -0.02em; color: var(--white); margin-bottom: 8px; }
.dr-modal__doc { font-size: 9px; letter-spacing: 0.06em; color: var(--dim); margin-bottom: 20px; padding: 8px 12px; border: 1px solid var(--seam); background: var(--void); }
.dr-modal__label { font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); display: block; margin-bottom: 6px; margin-top: 14px; }
.dr-modal__input {
    width: 100%; background: var(--void); border: 1px solid var(--rule);
    color: var(--parch); font-family: var(--mono); font-size: 10px;
    padding: 10px 12px; outline: none; transition: border-color 0.15s;
}
.dr-modal__input:focus { border-color: var(--btc); }
.dr-modal__textarea { resize: vertical; min-height: 80px; }
.dr-modal__actions { display: flex; gap: 10px; margin-top: 20px; }
.dr-modal__submit {
    flex: 1; padding: 12px 20px; background: var(--btc); color: var(--void);
    font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
    font-weight: 600; border: none; cursor: pointer; transition: background 0.15s;
}
.dr-modal__submit:hover { background: #ffa535; }
.dr-modal__cancel {
    padding: 12px 18px; background: none; border: 1px solid var(--seam);
    color: var(--dim); font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em;
    text-transform: uppercase; cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.dr-modal__cancel:hover { border-color: var(--btc); color: var(--btc); }
.dr-modal__success { display: none; text-align: center; padding: 20px 0; }
.dr-modal__success.is-visible { display: block; }
.dr-modal__success-icon { font-size: 28px; color: var(--btc); margin-bottom: 10px; }
.dr-modal__success-text { font-size: 10px; letter-spacing: 0.06em; line-height: 1.7; color: var(--muted); }

/* ══ NDA BUTTON ══════════════════════════════════════════════ */
.dr-nda-btn {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 20px; padding: 10px 18px;
    font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--dim); border: 1px solid var(--rule); background: none;
    text-decoration: none; cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.dr-nda-btn:hover { border-color: var(--btc); color: var(--btc); text-decoration: none; }
.dr-nda-btn__icon { font-size: 11px; opacity: 0.7; }

/* NDA Modal */
.dr-nda-overlay {
    position: fixed; inset: 0; background: rgba(7,7,7,0.92);
    z-index: 3000; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
    padding: 20px;
}
.dr-nda-overlay.is-open { opacity: 1; pointer-events: auto; }
.dr-nda-modal {
    background: var(--ink); border: 1px solid var(--rule); border-top: 2px solid var(--btc);
    padding: 36px; width: 100%; max-width: 600px;
    transform: translateY(10px); transition: transform 0.2s ease;
}
.dr-nda-overlay.is-open .dr-nda-modal { transform: translateY(0); }
.dr-nda-modal__eyebrow { font-size: 8px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--btc); margin-bottom: 10px; }
.dr-nda-modal__title { font-family: var(--serif); font-size: 26px; font-weight: 900; letter-spacing: -0.02em; color: var(--white); margin-bottom: 16px; }
.dr-nda-modal__body {
    max-height: 280px; overflow-y: auto; border: 1px solid var(--seam);
    background: var(--void); padding: 16px 18px; margin-bottom: 20px;
    font-size: 9px; letter-spacing: 0.04em; line-height: 1.85; color: var(--muted);
    scrollbar-width: thin; scrollbar-color: var(--seam) transparent;
}
.dr-nda-modal__body h4 { font-family: var(--mono); font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); margin: 16px 0 6px; }
.dr-nda-modal__body h4:first-child { margin-top: 0; }
.dr-nda-modal__agree {
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px;
    font-size: 9px; letter-spacing: 0.04em; line-height: 1.6; color: var(--dim); cursor: pointer;
}
.dr-nda-modal__agree input[type="checkbox"] { margin-top: 2px; accent-color: var(--btc); flex-shrink: 0; }
.dr-nda-modal__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
@media (max-width: 560px) { .dr-nda-modal__fields { grid-template-columns: 1fr; } }
.dr-nda-modal__label { font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); display: block; margin-bottom: 6px; }
.dr-nda-modal__input {
    width: 100%; background: var(--void); border: 1px solid var(--rule);
    color: var(--parch); font-family: var(--mono); font-size: 10px;
    padding: 10px 12px; outline: none; transition: border-color 0.15s;
}
.dr-nda-modal__input:focus { border-color: var(--btc); }
.dr-nda-modal__actions { display: flex; gap: 10px; }
.dr-nda-modal__submit {
    flex: 1; padding: 12px 20px; background: var(--btc); color: var(--void);
    font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
    font-weight: 600; border: none; cursor: pointer; transition: background 0.15s;
}
.dr-nda-modal__submit:hover { background: #ffa535; }
.dr-nda-modal__submit:disabled { opacity: 0.4; cursor: not-allowed; }
.dr-nda-modal__cancel {
    padding: 12px 18px; background: none; border: 1px solid var(--seam);
    color: var(--dim); font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em;
    text-transform: uppercase; cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.dr-nda-modal__cancel:hover { border-color: var(--btc); color: var(--btc); }
.dr-nda-modal__success { display: none; text-align: center; padding: 20px 0; }
.dr-nda-modal__success.is-visible { display: block; }
.dr-nda-modal__success-icon { font-size: 32px; color: var(--btc); margin-bottom: 12px; }
.dr-nda-modal__success-text { font-size: 10px; letter-spacing: 0.06em; line-height: 1.8; color: var(--muted); }

/* ══ FOUNDER NOTE ════════════════════════════════════════════ */
.dr-founder {
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    background: var(--ink);
    padding: 40px 0;
}
.dr-founder__inner {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 32px;
    align-items: start;
}
.dr-founder__avatar {
    width: 72px; height: 72px; border-radius: 50%;
    object-fit: cover; border: 2px solid var(--seam);
    flex-shrink: 0; background: var(--panel);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-size: 22px; font-weight: 900; color: var(--btc);
}
.dr-founder__avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.dr-founder__content {}
.dr-founder__eyebrow {
    font-size: 7.5px; letter-spacing: 0.24em; text-transform: uppercase;
    color: var(--btc); margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px;
}
.dr-founder__eyebrow::before { content: ''; display: block; width: 16px; height: 1px; background: var(--btc); opacity: 0.5; }
.dr-founder__note {
    font-size: 12px; line-height: 1.85; color: var(--parch);
    letter-spacing: 0.02em; max-width: 680px;
    border-left: 2px solid var(--btc); padding-left: 18px;
    font-style: italic;
}
.dr-founder__sig {
    margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--seam);
    display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.dr-founder__name { font-family: var(--serif); font-size: 15px; font-weight: 900; letter-spacing: -0.01em; color: var(--white); }
.dr-founder__role { font-size: 8px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); margin-top: 2px; }
.dr-founder__contact { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; color: var(--btc); text-decoration: none; transition: color 0.15s; }
.dr-founder__contact:hover { color: #ffa535; text-decoration: none; }
@media (max-width: 700px) {
    .dr-founder__inner { grid-template-columns: 1fr; }
    .dr-founder__avatar { width: 56px; height: 56px; }
}

/* ══ FOOTER CTA ══════════════════════════════════════════════ */
.dr-cta {
    background: var(--ink); border-top: 1px solid var(--rule);
    padding: 48px 0;
    margin-top: 56px;
}
.dr-cta__inner {
    display: grid; grid-template-columns: 1fr auto;
    gap: 40px; align-items: center;
}
.dr-cta__title {
    font-family: var(--serif); font-size: clamp(24px, 3.5vw, 44px);
    font-weight: 900; letter-spacing: -0.02em; line-height: 1.0; color: var(--white); margin-bottom: 8px;
}
.dr-cta__title em { font-style: italic; color: var(--btc); }
.dr-cta__sub { font-size: 10px; letter-spacing: 0.06em; line-height: 1.7; color: var(--dim); }
.dr-cta__btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 16px 28px;
    background: var(--btc); color: var(--void); font-family: var(--mono);
    font-size: 10px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
    text-decoration: none; white-space: nowrap; transition: background 0.15s;
}
.dr-cta__btn:hover { background: #ffa535; color: var(--void); text-decoration: none; }

/* ══ DOCUMENT VIEWER ═════════════════════════════════════════ */
.dr-viewer-overlay {
    position: fixed; inset: 0; background: rgba(7,7,7,0.96);
    z-index: 4000; display: flex; align-items: stretch; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.dr-viewer-overlay.is-open { opacity: 1; pointer-events: auto; }
.dr-viewer-modal {
    display: flex; flex-direction: column;
    width: 100%; max-width: 1100px; margin: 20px;
    border: 1px solid var(--rule); border-top: 2px solid var(--btc);
    background: var(--ink);
    transform: translateY(12px); transition: transform 0.2s ease;
}
.dr-viewer-overlay.is-open .dr-viewer-modal { transform: translateY(0); }

.dr-viewer-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; border-bottom: 1px solid var(--rule);
    background: var(--void); flex-shrink: 0; gap: 20px;
}
.dr-viewer-bar__left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dr-viewer-bar__eyebrow { font-size: 7px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--btc); }
.dr-viewer-bar__title { font-family: var(--serif); font-size: 15px; font-weight: 700; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-viewer-bar__right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.dr-viewer-bar__open {
    font-family: var(--mono); font-size: 8px; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--dim); text-decoration: none; transition: color 0.15s;
}
.dr-viewer-bar__open:hover { color: var(--btc); text-decoration: none; }
.dr-viewer-bar__close {
    background: none; border: 1px solid var(--seam); color: var(--dim);
    font-size: 12px; width: 30px; height: 30px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.15s, color 0.15s;
}
.dr-viewer-bar__close:hover { border-color: var(--btc); color: var(--btc); }

.dr-viewer-frame-wrap { flex: 1; position: relative; min-height: 0; background: var(--void); }
.dr-viewer-loading {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    font-family: var(--mono); color: var(--dim);
}
.dr-viewer-loading__icon { font-size: 28px; color: var(--btc); animation: bt-pulse 2s ease-in-out infinite; }
.dr-viewer-loading__text { font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; }
.dr-viewer-iframe { width: 100%; height: 100%; border: none; display: block; }

/* ══ RESPONSIVE ══════════════════════════════════════════════ */
@media (max-width: 900px) {
    .dr-header { grid-template-columns: 1fr; }
    .dr-header__right { text-align: left; }
    .dr-cta__inner { grid-template-columns: 1fr; }
    .dr-doc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .dr-section__head { grid-template-columns: 1fr; }
    .dr-section__num { display: none; }
}
</style>

<div class="dr-page">

    <!-- Ticker -->
    <div class="dr-ticker-wrap">
        <div class="dr-ticker-track" id="dr-ticker"></div>
    </div>

    <div class="dr-wrap">

        <!-- ══ HEADER ══════════════════════════════════════════ -->
        <div class="dr-header dr-reveal">
            <div class="dr-header__left">
                <div class="dr-header__eyebrow">Investor Portal · Data Room · Confidential</div>
                <h1 class="dr-header__title">
                    Due diligence.<br>
                    <em>Done right.</em>
                </h1>
                <p class="dr-header__sub">
                    All material information for the Bitcoin Timber seed round.
                    Six sections. View-only access. Request sensitive documents
                    via the contact form — NDA required for legal materials.
                </p>
                <button class="dr-nda-btn" id="dr-nda-open">
                    <span class="dr-nda-btn__icon">🔏</span>
                    Sign NDA · Unlock Legal Documents
                </button>
            </div>
            <div class="dr-header__right">
                <div class="dr-round-badge">
                    <div class="dr-round-badge__status">Round Open</div>
                    <div class="dr-round-kv">
                        <span class="dr-round-kv__k">Target</span>
                        <span class="dr-round-kv__v is-btc">$250,000</span>
                    </div>
                    <div class="dr-round-kv">
                        <span class="dr-round-kv__k">Equity</span>
                        <span class="dr-round-kv__v">10%</span>
                    </div>
                    <div class="dr-round-kv">
                        <span class="dr-round-kv__k">Valuation</span>
                        <span class="dr-round-kv__v">$2.5M pre-money</span>
                    </div>
                    <div class="dr-round-kv">
                        <span class="dr-round-kv__k">Entity</span>
                        <span class="dr-round-kv__v">BVI · 2190032</span>
                    </div>
                    <div class="dr-round-kv">
                        <span class="dr-round-kv__k">Closes</span>
                        <span class="dr-round-kv__v is-btc">Jun 15 2026</span>
                    </div>
                    <div class="dr-round-kv">
                        <span class="dr-round-kv__k">Rev Day 1</span>
                        <span class="dr-round-kv__v">90 days from close</span>
                    </div>
                </div>
            </div>
        </div>

    </div><!-- /.dr-wrap -->

    <!-- ══ FOUNDER NOTE ═════════════════════════════════════ -->
    <div class="dr-founder dr-reveal">
        <div class="dr-wrap">
            <div class="dr-founder__inner">
                <div class="dr-founder__avatar">S</div>
                <div class="dr-founder__content">
                    <div class="dr-founder__eyebrow">A Note from the Founder</div>
                    <p class="dr-founder__note">
                        Thank you for trusting the vision. I don't take that lightly. This is not a pitch deck backed by a slide deck and a rented co-working space. This is family land on the Canje River — the same land my grandfather Kawal Ramessar worked — now being rebuilt into something the old world and the new world can both recognize as real.
                        <br><br>
                        Every dollar that comes in goes straight into the flywheel: gasifier, miners, kiln. Not salaries. Not overhead. Not speculation. I will not draw a salary until the operation is generating revenue. That is what proof of work means in practice.
                        <br><br>
                        I will personally update every investor within 48 hours of funds clearing. If you have questions, I am reachable directly. That is the only way I know how to operate.
                    </p>
                    <div class="dr-founder__sig">
                        <div>
                            <div class="dr-founder__name">Shane Anthony</div>
                            <div class="dr-founder__role">Founder & Operator · Bitcoin Timber</div>
                        </div>
                        <a href="mailto:shane@bitcointimber.com" class="dr-founder__contact">shane@bitcointimber.com</a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- ══ NDA MODAL ════════════════════════════════════════ -->
    <div class="dr-nda-overlay" id="dr-nda-overlay" role="dialog" aria-modal="true" aria-labelledby="dr-nda-title">
        <div class="dr-nda-modal">
            <div class="dr-nda-modal__eyebrow">Non-Disclosure Agreement</div>
            <h2 class="dr-nda-modal__title" id="dr-nda-title">Mutual NDA</h2>

            <div class="dr-nda-modal__body" id="dr-nda-body">
                <h4>1. Parties</h4>
                This Non-Disclosure Agreement ("Agreement") is entered into between Bitcoin Timber International Ltd., a company incorporated under the laws of the British Virgin Islands (BVI Reg. 2190032) ("Disclosing Party"), and the individual or entity accessing this data room ("Receiving Party").

                <h4>2. Confidential Information</h4>
                "Confidential Information" means all non-public information disclosed by the Disclosing Party, including but not limited to: financial models, technical specifications, engineering designs, business strategies, investor communications, cap table details, legal agreements, and all other proprietary materials contained within this data room.

                <h4>3. Obligations</h4>
                The Receiving Party agrees to: (a) hold all Confidential Information in strict confidence; (b) not disclose any Confidential Information to third parties without prior written consent; (c) use Confidential Information solely for the purpose of evaluating a potential investment in Bitcoin Timber International Ltd.; (d) limit access to Confidential Information to those with a need to know.

                <h4>4. Exclusions</h4>
                These obligations do not apply to information that: (a) is or becomes publicly known through no breach of this Agreement; (b) was known to the Receiving Party prior to disclosure; (c) is independently developed by the Receiving Party; or (d) is required to be disclosed by law or court order, provided prior written notice is given.

                <h4>5. Term</h4>
                This Agreement shall remain in effect for three (3) years from the date of acceptance, or until the Parties enter into a formal investment agreement, whichever occurs first.

                <h4>6. No Obligation</h4>
                Nothing in this Agreement obligates either Party to proceed with any transaction. The Disclosing Party makes no representations as to the accuracy or completeness of the Confidential Information.

                <h4>7. Governing Law</h4>
                This Agreement shall be governed by the laws of the British Virgin Islands. Any disputes shall be resolved by binding arbitration in the BVI.
            </div>

            <div id="dr-nda-form-section">
                <div class="dr-nda-modal__fields">
                    <div>
                        <label class="dr-nda-modal__label">Full Name *</label>
                        <input type="text" class="dr-nda-modal__input" id="dr-nda-name" placeholder="Satoshi Nakamoto" required>
                    </div>
                    <div>
                        <label class="dr-nda-modal__label">Email *</label>
                        <input type="email" class="dr-nda-modal__input" id="dr-nda-email" placeholder="satoshin@gmx.com" required>
                    </div>
                    <div>
                        <label class="dr-nda-modal__label">Organisation</label>
                        <input type="text" class="dr-nda-modal__input" id="dr-nda-org" placeholder="Fund, firm, or individual">
                    </div>
                    <div>
                        <label class="dr-nda-modal__label">Date</label>
                        <input type="text" class="dr-nda-modal__input" id="dr-nda-date" readonly>
                    </div>
                </div>

                <label class="dr-nda-modal__agree">
                    <input type="checkbox" id="dr-nda-agree">
                    I have read and agree to the terms of this Non-Disclosure Agreement. I understand that by checking this box and submitting my details, I am entering into a legally binding obligation to keep all Confidential Information strictly confidential.
                </label>

                <div class="dr-nda-modal__actions">
                    <button class="dr-nda-modal__submit" id="dr-nda-submit" disabled>Sign & Accept NDA →</button>
                    <button class="dr-nda-modal__cancel" id="dr-nda-cancel">Cancel</button>
                </div>
            </div>

            <div class="dr-nda-modal__success" id="dr-nda-success">
                <div class="dr-nda-modal__success-icon">✓</div>
                <div class="dr-nda-modal__success-text">
                    NDA accepted. Confirmation sent to <strong id="dr-nda-confirm-email"></strong>.<br>
                    The restricted documents below are now unlocked.<br>
                    Click <em>Request Access</em> on any card and Shane will send you the document directly.
                </div>
            </div>
        </div>
    </div>

    <!-- ══ STICKY NAV ════════════════════════════════════════ -->
    <div class="dr-nav">
        <div class="dr-wrap">
            <div class="dr-nav-inner" id="dr-nav">
                <?php foreach ( $sections as $s ) : ?>
                <a href="#section-<?php echo esc_attr($s['id']); ?>"
                   class="dr-nav-pill" data-section="<?php echo esc_attr($s['id']); ?>">
                    <span class="dr-nav-pill__num"><?php echo esc_html($s['num']); ?></span>
                    <?php echo esc_html($s['title']); ?>
                </a>
                <?php endforeach; ?>
            </div>
        </div>
    </div>

    <div class="dr-wrap">

        <!-- ══ SECTIONS ══════════════════════════════════════ -->
        <?php foreach ( $sections as $s ) : ?>

        <div class="dr-section dr-reveal" id="section-<?php echo esc_attr($s['id']); ?>">

            <div class="dr-section__head">
                <div class="dr-section__num"><?php echo esc_html($s['num']); ?></div>
                <div>
                    <div class="dr-section__title"><?php echo esc_html($s['title']); ?></div>
                    <div class="dr-section__lead"><?php echo esc_html($s['lead']); ?></div>
                </div>
            </div>

            <div class="dr-doc-grid">
                <?php foreach ( $s['docs'] as $doc ) :
                    $tm     = $type_meta[ $doc['type'] ] ?? [ 'icon' => '▤', 'label' => 'Doc' ];
                    $status = $doc['status'];
                    $badge_labels = [ 'live' => 'Available', 'soon' => 'Coming Soon', 'request' => 'Request Access' ];
                ?>
                <div class="dr-doc is-<?php echo esc_attr($status); ?>">
                    <div class="dr-doc__top">
                        <span class="dr-doc__type">
                            <span class="dr-doc__type-icon"><?php echo $tm['icon']; ?></span>
                            <?php echo esc_html($tm['label']); ?>
                        </span>
                        <span class="dr-doc__badge is-<?php echo esc_attr($status); ?>">
                            <?php echo esc_html($badge_labels[$status]); ?>
                        </span>
                    </div>

                    <div class="dr-doc__title"><?php echo esc_html($doc['title']); ?></div>
                    <div class="dr-doc__desc"><?php echo esc_html($doc['desc']); ?></div>

                    <div class="dr-doc__meta">
                        <div class="dr-doc__meta-item">
                            <span class="dr-doc__meta-key">Length</span>
                            <span class="dr-doc__meta-val"><?php echo esc_html($doc['pages']); ?></span>
                        </div>
                        <div class="dr-doc__meta-item">
                            <span class="dr-doc__meta-key">Updated</span>
                            <span class="dr-doc__meta-val"><?php echo esc_html($doc['updated']); ?></span>
                        </div>
                    </div>

                    <?php
                    $has_url = ( $status === 'live' && ! empty($doc['url']) && $doc['url'] !== 'PLACEHOLDER_URL' );
                    if ( $status === 'live' ) : ?>
                        <button class="dr-doc__action"
                            onclick="drOpenViewer(<?php echo json_encode($doc['title']); ?>, <?php echo $has_url ? json_encode($doc['url']) : 'null'; ?>)">
                            View Document →
                        </button>
                    <?php elseif ( $status === 'soon' ) : ?>
                        <span class="dr-doc__action-ghost">⏱ Coming Soon</span>
                    <?php elseif ( $status === 'request' ) : ?>
                        <button class="dr-doc__action-request" data-doc="<?php echo esc_attr($doc['title']); ?>" onclick="drOpenModal(this)">
                            Request Access →
                        </button>
                    <?php endif; ?>

                </div>
                <?php endforeach; ?>
            </div>

        </div><!-- /.dr-section -->

        <?php endforeach; ?>

    </div><!-- /.dr-wrap -->

    <!-- ══ FOOTER CTA ════════════════════════════════════════ -->
    <div class="dr-cta">
        <div class="dr-wrap">
            <div class="dr-cta__inner">
                <div>
                    <div class="dr-cta__title">
                        Ready to move<br><em>forward?</em>
                    </div>
                    <div class="dr-cta__sub">
                        Questions about the round? Book a call with Shane directly.<br>
                        All serious investors receive a personal walkthrough.
                    </div>
                </div>
                <div style="display:flex;flex-direction:column;gap:10px;align-items:flex-end;">
                    <a href="<?php echo esc_url( home_url('/contact/') ); ?>" class="dr-cta__btn">
                        ₿ Book a Call →
                    </a>
                    <a href="<?php echo esc_url( home_url('/timberforge-system/') ); ?>"
                       style="font-size:8px;letter-spacing:0.16em;text-transform:uppercase;color:var(--dim);text-decoration:none;">
                        ← Back to TimberForge System
                    </a>
                </div>
            </div>
        </div>
    </div>

</div><!-- /.dr-page -->

<!-- ══ REQUEST ACCESS MODAL ══════════════════════════════════ -->
<div class="dr-modal-overlay" id="dr-modal" role="dialog" aria-modal="true" aria-labelledby="dr-modal-title">
    <div class="dr-modal">
        <div class="dr-modal__eyebrow">Data Room · Restricted Document</div>
        <div class="dr-modal__title" id="dr-modal-title">Request Access</div>
        <div class="dr-modal__doc" id="dr-modal-doc-name">—</div>

        <div id="dr-modal-form">
            <label class="dr-modal__label">Your Name</label>
            <input type="text" class="dr-modal__input" id="dr-req-name" placeholder="Full name"/>

            <label class="dr-modal__label">Email Address</label>
            <input type="email" class="dr-modal__input" id="dr-req-email" placeholder="name@fund.com"/>

            <label class="dr-modal__label">Organisation / Fund</label>
            <input type="text" class="dr-modal__input" id="dr-req-org" placeholder="Organisation name"/>

            <label class="dr-modal__label">Brief note (optional)</label>
            <textarea class="dr-modal__input dr-modal__textarea" id="dr-req-note" placeholder="Investment stage, cheque size, timeline…"></textarea>

            <div class="dr-modal__actions">
                <button class="dr-modal__submit" onclick="drSubmitRequest()">Send Request →</button>
                <button class="dr-modal__cancel" onclick="drCloseModal()">Cancel</button>
            </div>
        </div>

        <div class="dr-modal__success" id="dr-modal-success">
            <div class="dr-modal__success-icon">₿</div>
            <div class="dr-modal__success-text">
                Request received.<br>
                Shane will be in touch within 24 hours.
            </div>
        </div>
    </div>
</div>

<script>
(function () {
    'use strict';

    /* ── Ticker ──────────────────────────────────────────── */
    var td = [
        ['Round',    'Open · Close Jun 15 2026'],
        ['Target',   '$250,000 · 10% equity'],
        ['Valuation','$2.5M pre-money'],
        ['Energy',   '$0.00 / kWh · waste biomass'],
        ['Miners',   '6× Antminer S19 Pro · 660 TH/s'],
        ['BTC',      'HODL · never sold for fiat'],
        ['Timber',   '$2.40/bf · KD hardwood · 100,000 bf/yr'],
        ['Rev Yr1',  '$308,000'],
        ['Entity',   'BVI · 2190032 · Bitcoin Timber International Ltd.'],
        ['Location', 'Canje River · Berbice · Guyana'],
    ];
    var track = document.getElementById('dr-ticker');
    if (track) {
        td.concat(td).forEach(function(item) {
            var s = document.createElement('span');
            s.className = 'dr-ticker-item';
            s.innerHTML = item[0] + ' <strong>' + item[1] + '</strong>';
            track.appendChild(s);
        });
    }

    /* ── Scroll reveal ───────────────────────────────────── */
    var reveals = document.querySelectorAll('.dr-reveal');
    if ('IntersectionObserver' in window) {
        var io = new IntersectionObserver(function(entries) {
            entries.forEach(function(e) {
                if (e.isIntersecting) { e.target.classList.add('is-visible'); io.unobserve(e.target); }
            });
        }, { threshold: 0.05, rootMargin: '0px 0px -20px 0px' });
        reveals.forEach(function(el) { io.observe(el); });
    } else {
        reveals.forEach(function(el) { el.classList.add('is-visible'); });
    }

    /* ── Nav active state on scroll ─────────────────────── */
    var sections = document.querySelectorAll('.dr-section[id]');
    var pills    = document.querySelectorAll('.dr-nav-pill');

    function updateNav() {
        var scrollY = window.scrollY + 120;
        var current = '';
        sections.forEach(function(s) {
            if (s.offsetTop <= scrollY) current = s.id.replace('section-', '');
        });
        pills.forEach(function(p) {
            p.classList.toggle('is-active', p.getAttribute('data-section') === current);
        });
    }
    window.addEventListener('scroll', updateNav, { passive: true });
    updateNav();

    /* ── Smooth scroll for nav pills ────────────────────── */
    pills.forEach(function(pill) {
        pill.addEventListener('click', function(e) {
            e.preventDefault();
            var id = 'section-' + this.getAttribute('data-section');
            var el = document.getElementById(id);
            if (el) {
                var offset = el.getBoundingClientRect().top + window.scrollY - 100;
                window.scrollTo({ top: offset, behavior: 'smooth' });
            }
        });
    });

}());

/* ── Modal ───────────────────────────────────────────────── */
var _drDocName = '';

function drOpenModal(btn) {
    _drDocName = btn.getAttribute('data-doc') || 'Document';
    document.getElementById('dr-modal-doc-name').textContent = _drDocName;
    document.getElementById('dr-modal-form').style.display = 'block';
    document.getElementById('dr-modal-success').classList.remove('is-visible');
    document.getElementById('dr-modal').classList.add('is-open');
    document.getElementById('dr-req-name').focus();
}

function drCloseModal() {
    document.getElementById('dr-modal').classList.remove('is-open');
}

function drSubmitRequest() {
    var name  = document.getElementById('dr-req-name').value.trim();
    var email = document.getElementById('dr-req-email').value.trim();
    if (!name || !email) {
        document.getElementById('dr-req-name').style.borderColor = name  ? '' : 'var(--btc)';
        document.getElementById('dr-req-email').style.borderColor = email ? '' : 'var(--btc)';
        return;
    }

    /* ── Wire this to your preferred notification method ──
       Option A: wp_mail via fetch to a simple WP REST endpoint
       Option B: Formspree / Netlify Forms (add your endpoint below)
       Option C: Direct mailto fallback (shown below) */
    var org   = document.getElementById('dr-req-org').value.trim();
    var note  = document.getElementById('dr-req-note').value.trim();
    var body  = 'Document: ' + _drDocName + '\nName: ' + name + '\nEmail: ' + email + '\nOrg: ' + org + '\nNote: ' + note;
    window.location.href = 'mailto:shane@bitcointimber.com?subject=Data Room Access Request — ' + encodeURIComponent(_drDocName) + '&body=' + encodeURIComponent(body);

    document.getElementById('dr-modal-form').style.display = 'none';
    document.getElementById('dr-modal-success').classList.add('is-visible');
    setTimeout(drCloseModal, 3000);
}

/* Close on overlay click */
document.getElementById('dr-modal').addEventListener('click', function(e) {
    if (e.target === this) drCloseModal();
});
document.addEventListener('keydown', function(e) {
    if (e.key === 'Escape') { drCloseModal(); drNdaClose(); drCloseViewer(); }
});

/* ── NDA Modal ───────────────────────────────────────────── */
(function() {
    var overlay = document.getElementById('dr-nda-overlay');
    var dateField = document.getElementById('dr-nda-date');
    var agreeBox  = document.getElementById('dr-nda-agree');
    var submitBtn = document.getElementById('dr-nda-submit');

    // Set today's date
    if (dateField) {
        var now = new Date();
        dateField.value = now.toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' });
    }

    // Open
    document.getElementById('dr-nda-open').addEventListener('click', function() {
        overlay.classList.add('is-open');
        document.body.style.overflow = 'hidden';
        document.getElementById('dr-nda-name').focus();
    });

    // Close
    document.getElementById('dr-nda-cancel').addEventListener('click', drNdaClose);
    overlay.addEventListener('click', function(e) {
        if (e.target === overlay) drNdaClose();
    });

    // Enable submit only when agreed
    if (agreeBox && submitBtn) {
        agreeBox.addEventListener('change', function() {
            submitBtn.disabled = !this.checked;
        });
    }

    // Submit
    if (submitBtn) {
        submitBtn.addEventListener('click', function() {
            var name  = document.getElementById('dr-nda-name').value.trim();
            var email = document.getElementById('dr-nda-email').value.trim();
            if (!name || !email) {
                document.getElementById('dr-nda-name').style.borderColor  = name  ? '' : 'var(--btc)';
                document.getElementById('dr-nda-email').style.borderColor = email ? '' : 'var(--btc)';
                return;
            }
            var org  = document.getElementById('dr-nda-org').value.trim();
            var date = document.getElementById('dr-nda-date').value;

            submitBtn.disabled = true;
            submitBtn.textContent = 'Submitting…';

            /* ── Formspree submission ──────────────────────────────
               Replace YOUR_FORMSPREE_ID with your form ID from formspree.io
               e.g. https://formspree.io/f/xpwzabcd → ID is xpwzabcd        */
            fetch('https://formspree.io/f/YOUR_FORMSPREE_ID', {
                method:  'POST',
                headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
                body: JSON.stringify({
                    _subject: 'NDA Acceptance — ' + name,
                    name:         name,
                    email:        email,
                    organisation: org || '—',
                    date:         date,
                    type:         'NDA Acceptance · Bitcoin Timber Data Room'
                })
            })
            .then(function(res) {
                // Accept both success and Formspree placeholder (before real ID is set)
                document.getElementById('dr-nda-confirm-email').textContent = email;
                document.getElementById('dr-nda-form-section').style.display = 'none';
                document.getElementById('dr-nda-success').classList.add('is-visible');

                // Mark NDA button as signed
                var ndaBtn = document.getElementById('dr-nda-open');
                ndaBtn.innerHTML = '<span class="dr-nda-btn__icon">✓</span> NDA Signed';
                ndaBtn.style.borderColor = 'var(--btc)';
                ndaBtn.style.color = 'var(--btc)';
                ndaBtn.disabled = true;

                // Unlock all "request" document cards
                drUnlockRequestDocs(name, email);

                setTimeout(drNdaClose, 4000);
            })
            .catch(function() {
                // On network error still unlock locally — submission can be retried
                document.getElementById('dr-nda-confirm-email').textContent = email;
                document.getElementById('dr-nda-form-section').style.display = 'none';
                document.getElementById('dr-nda-success').classList.add('is-visible');

                var ndaBtn = document.getElementById('dr-nda-open');
                ndaBtn.innerHTML = '<span class="dr-nda-btn__icon">✓</span> NDA Signed';
                ndaBtn.style.borderColor = 'var(--btc)';
                ndaBtn.style.color = 'var(--btc)';
                ndaBtn.disabled = true;

                drUnlockRequestDocs(name, email);
                setTimeout(drNdaClose, 4000);
            });
        });
    }
}());

/* ── Unlock request-gated docs after NDA signed ─────────── */
function drUnlockRequestDocs(signerName, signerEmail) {
    // Find every card that is currently locked behind "request"
    document.querySelectorAll('.dr-doc.is-request').forEach(function(card) {
        // 1. Remove the dimmed/locked styling — treat it like a live card
        card.classList.remove('is-request');
        card.classList.add('is-nda-unlocked');

        // 2. Update the badge
        var badge = card.querySelector('.dr-doc__badge');
        if (badge) {
            badge.className = 'dr-doc__badge is-nda-unlocked';
            badge.textContent = 'NDA Signed';
        }

        // 3. Replace the "Request Access" button with an orange "Request Access" action button
        //    (these docs still need to be sent manually — but now investor is identified)
        var oldBtn = card.querySelector('.dr-doc__action-request');
        if (oldBtn) {
            var docTitle = oldBtn.getAttribute('data-doc') || 'this document';
            var newBtn = document.createElement('button');
            newBtn.className = 'dr-doc__action';
            newBtn.setAttribute('data-doc', docTitle);
            newBtn.style.cursor = 'pointer';
            newBtn.style.border = 'none';
            newBtn.textContent = 'Request Access →';
            newBtn.addEventListener('click', function() {
                // Pre-fill the access request modal with NDA signer's details
                document.getElementById('dr-req-name').value  = signerName;
                document.getElementById('dr-req-email').value = signerEmail;
                drOpenModal(newBtn);
            });
            oldBtn.replaceWith(newBtn);
        }
    });
}


function drNdaClose() {
    var overlay = document.getElementById('dr-nda-overlay');
    if (overlay) {
        overlay.classList.remove('is-open');
        document.body.style.overflow = '';
    }
}

/* ── Document Viewer ─────────────────────────────────────── */
function drOpenViewer(title, url) {
    document.getElementById('dr-viewer-title').textContent = title;
    document.getElementById('dr-viewer-extlink').href      = url || '#';
    document.getElementById('dr-viewer').classList.add('is-open');
    document.body.style.overflow = 'hidden';

    var loading = document.getElementById('dr-viewer-loading');
    var iframe  = document.getElementById('dr-viewer-iframe');

    if (url) {
        loading.style.display = 'flex';
        iframe.style.display  = 'block';
        iframe.src = url;
        document.getElementById('dr-viewer-extlink').style.display = '';
    } else {
        // No URL yet — show a holding message
        loading.innerHTML = '<span class="dr-viewer-loading__icon">₿</span><span class="dr-viewer-loading__text">Document uploading soon — check back shortly.</span>';
        loading.style.display = 'flex';
        iframe.style.display  = 'none';
        document.getElementById('dr-viewer-extlink').style.display = 'none';
    }
}

function drCloseViewer() {
    document.getElementById('dr-viewer').classList.remove('is-open');
    document.body.style.overflow = '';
    // Clear iframe to stop loading/playing
    setTimeout(function() {
        document.getElementById('dr-viewer-iframe').src = '';
    }, 200);
}

document.getElementById('dr-viewer').addEventListener('click', function(e) {
    if (e.target === this) drCloseViewer();
});

</script>

<!-- ══ DOCUMENT VIEWER MODAL ═════════════════════════════════ -->
<div class="dr-viewer-overlay" id="dr-viewer" role="dialog" aria-modal="true" aria-labelledby="dr-viewer-title">
    <div class="dr-viewer-modal">
        <div class="dr-viewer-bar">
            <div class="dr-viewer-bar__left">
                <span class="dr-viewer-bar__eyebrow">Data Room · Document</span>
                <span class="dr-viewer-bar__title" id="dr-viewer-title">—</span>
            </div>
            <div class="dr-viewer-bar__right">
                <a class="dr-viewer-bar__open" id="dr-viewer-extlink" href="#" target="_blank" rel="noopener">
                    Open in new tab ↗
                </a>
                <button class="dr-viewer-bar__close" onclick="drCloseViewer()" aria-label="Close">✕</button>
            </div>
        </div>
        <div class="dr-viewer-frame-wrap">
            <div class="dr-viewer-loading" id="dr-viewer-loading">
                <span class="dr-viewer-loading__icon">₿</span>
                <span class="dr-viewer-loading__text">Loading document…</span>
            </div>
            <iframe id="dr-viewer-iframe" class="dr-viewer-iframe" src="" allowfullscreen
                onload="document.getElementById('dr-viewer-loading').style.display='none'">
            </iframe>
        </div>
    </div>
</div>

<?php get_footer(); ?>