<?php
declare(strict_types=1);
require_once __DIR__ . '/includes/bootstrap.php';

$uiLang   = dbnToolsCurrentLanguage();
$isAuthed = dbnToolsIsAuthenticated();
$langPath = '/timeline-guide.php';
$toolsLogin  = 'https://dobetternorge.no/tools-login.php?return=' . urlencode('/timeline.php');
$registerUrl = 'https://dobetternorge.no/register.php';

$_pt = require __DIR__ . '/translations/timeline-guide.php';
$t   = $_pt[$uiLang] ?? $_pt['en'];
?>
<!doctype html>
<html lang="<?= htmlspecialchars($uiLang) ?>">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Timeline User Guide — How to extract dates from Norwegian legal documents</title>
    <meta name="description" content="Step-by-step guide to using Timeline: choose an engine, set focus and confidence filters, upload files, read the timeline output, and interpret the evidence trail.">
    <meta name="robots" content="index, follow">
    <link rel="canonical" href="https://tools.dobetternorge.no/timeline-guide.php">
    <meta property="og:title" content="Timeline User Guide">
    <meta property="og:description" content="How to use Timeline to extract and classify dates from Norwegian case notes, court decisions, and correspondence.">
    <meta name="theme-color" content="#00205B">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap">
    <link rel="stylesheet" href="assets/css/tools.css">
</head>
<body class="kdoc-page">

<header class="lt-nav">
    <a href="https://dobetternorge.no" class="lt-nav__brand">
        <picture>
            <source srcset="assets/images/logo-header.webp" type="image/webp">
            <img class="lt-nav__logo" src="assets/images/logo-header.png" alt="Do Better Norge" width="140" height="36" loading="eager">
        </picture>
        <span class="lt-nav__badge">Legal Tools</span>
    </a>
    <div class="lt-nav__right">
        <nav class="shell-lang-switcher" aria-label="Language">
<?php foreach (dbnToolsSupportedLanguages() as $langCode): ?>
            <a href="<?= htmlspecialchars($langPath . '?lang=' . $langCode) ?>" class="<?= $langCode === $uiLang ? 'is-active' : '' ?>"><?= htmlspecialchars(dbnToolsLanguageLabel($langCode)) ?></a>
<?php endforeach; ?>
        </nav>
<?php if ($isAuthed): ?>
        <a href="/timeline.php" class="lt-nav__cta lt-nav__cta--enter"><?= htmlspecialchars($t['nav_open']) ?></a>
<?php else: ?>
        <a href="<?= htmlspecialchars($toolsLogin) ?>" class="lt-nav__cta"><?= htmlspecialchars($t['nav_signin']) ?></a>
<?php endif; ?>
    </div>
</header>

<nav class="kdoc-doc-nav" aria-label="Timeline documentation">
    <div class="kdoc-doc-nav__inner">
        <a href="/timeline-about.php"><?= htmlspecialchars($t['nav_about']) ?></a>
        <a href="/timeline-guide.php" class="is-active"><?= htmlspecialchars($t['nav_guide']) ?></a>
        <a href="/timeline-tech.php"><?= htmlspecialchars($t['nav_howit']) ?></a>
        <?php if ($isAuthed): ?><a href="/timeline.php"><?= htmlspecialchars($t['nav_opentool']) ?></a><?php endif; ?>
    </div>
</nav>

<!-- Hero -->
<section class="kdoc-hero" style="background: linear-gradient(rgba(0,20,60,0.78),rgba(0,20,60,0.86)), url('assets/images/timeline/hero-guide.png') center/cover no-repeat;">
    <div class="kdoc-hero__inner">
        <p class="kdoc-hero__kicker"><?= htmlspecialchars($t['hero_kicker']) ?></p>
        <h1 class="kdoc-hero__title"><?= htmlspecialchars($t['hero_title']) ?></h1>
        <p class="kdoc-hero__sub"><?= htmlspecialchars($t['hero_sub']) ?></p>
    </div>
</section>

<!-- TOC + content -->
<div class="kdoc-section">

    <div class="kdoc-toc">
        <p class="kdoc-toc__title"><?= htmlspecialchars($t['toc_title']) ?></p>
        <ol>
            <li><a href="#engine"><?= htmlspecialchars($t['toc_1']) ?></a></li>
            <li><a href="#focus"><?= htmlspecialchars($t['toc_2']) ?></a></li>
            <li><a href="#confidence"><?= htmlspecialchars($t['toc_3']) ?></a></li>
            <li><a href="#background"><?= htmlspecialchars($t['toc_4']) ?></a></li>
            <li><a href="#datetypes"><?= htmlspecialchars($t['toc_5']) ?></a></li>
            <li><a href="#upload"><?= htmlspecialchars($t['toc_6']) ?></a></li>
            <li><a href="#paste"><?= htmlspecialchars($t['toc_7']) ?></a></li>
            <li><a href="#reading"><?= htmlspecialchars($t['toc_8']) ?></a></li>
            <li><a href="#evidence"><?= htmlspecialchars($t['toc_9']) ?></a></li>
            <li><a href="#tips"><?= htmlspecialchars($t['toc_10']) ?></a></li>
        </ol>
    </div>

    <!-- Step 1: Engine -->
    <div class="kdoc-guide-step" id="engine">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">1</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step1_title']) ?></h2>
        </div>
        <div class="kdoc-guide-step__body">
            <p><?= htmlspecialchars($t['step1_intro']) ?></p>
        </div>
        <table class="kdoc-table">
            <thead>
                <tr>
                    <th><?= htmlspecialchars($t['th_engine']) ?></th>
                    <th><?= htmlspecialchars($t['th_speed']) ?></th>
                    <th><?= htmlspecialchars($t['th_best']) ?></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Azure gpt-4o-mini &#9733;</td>
                    <td><?= htmlspecialchars($t['eng1_speed']) ?></td>
                    <td><?= htmlspecialchars($t['eng1_best']) ?></td>
                </tr>
                <tr>
                    <td>Azure gpt-4o</td>
                    <td><?= htmlspecialchars($t['eng2_speed']) ?></td>
                    <td><?= htmlspecialchars($t['eng2_best']) ?></td>
                </tr>
                <tr>
                    <td>GPU / cuttlefish</td>
                    <td><?= htmlspecialchars($t['eng3_speed']) ?></td>
                    <td><?= htmlspecialchars($t['eng3_best']) ?></td>
                </tr>
            </tbody>
        </table>
    </div>

    <!-- Step 2: Focus filter -->
    <div class="kdoc-guide-step" id="focus">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">2</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step2_title']) ?></h2>
        </div>
        <div class="kdoc-guide-step__body">
            <p><?= htmlspecialchars($t['step2_intro']) ?></p>
        </div>
        <table class="kdoc-table">
            <thead>
                <tr>
                    <th><?= htmlspecialchars($t['th_mode']) ?></th>
                    <th><?= htmlspecialchars($t['th_extracts']) ?></th>
                    <th><?= htmlspecialchars($t['th_when']) ?></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>All events &#9733;</td>
                    <td><?= htmlspecialchars($t['focus1_extracts']) ?></td>
                    <td><?= htmlspecialchars($t['focus1_when']) ?></td>
                </tr>
                <tr>
                    <td>Legal deadlines</td>
                    <td><?= htmlspecialchars($t['focus2_extracts']) ?></td>
                    <td><?= htmlspecialchars($t['focus2_when']) ?></td>
                </tr>
                <tr>
                    <td>Court hearings</td>
                    <td><?= htmlspecialchars($t['focus3_extracts']) ?></td>
                    <td><?= htmlspecialchars($t['focus3_when']) ?></td>
                </tr>
                <tr>
                    <td>CPS milestones</td>
                    <td><?= htmlspecialchars($t['focus4_extracts']) ?></td>
                    <td><?= htmlspecialchars($t['focus4_when']) ?></td>
                </tr>
            </tbody>
        </table>
    </div>

    <!-- Step 3: Confidence -->
    <div class="kdoc-guide-step" id="confidence">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">3</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step3_title']) ?></h2>
        </div>
        <div class="kdoc-guide-step__body">
            <p><?= htmlspecialchars($t['step3_intro']) ?></p>
        </div>
        <table class="kdoc-table">
            <thead>
                <tr>
                    <th><?= htmlspecialchars($t['th_setting']) ?></th>
                    <th><?= htmlspecialchars($t['th_does']) ?></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Show all events &#9733;</td>
                    <td><?= htmlspecialchars($t['conf1_does']) ?></td>
                </tr>
                <tr>
                    <td>Hide low-confidence</td>
                    <td><?= htmlspecialchars($t['conf2_does']) ?></td>
                </tr>
            </tbody>
        </table>
        <div class="kdoc-guide-step__body" style="margin-top:1rem;">
            <p><?= htmlspecialchars($t['conf_note']) ?></p>
        </div>
    </div>

    <!-- Step 4: Background events -->
    <div class="kdoc-guide-step" id="background">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">4</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step4_title']) ?></h2>
        </div>
        <div class="kdoc-guide-step__body">
            <p><?= $t['step4_p1_html'] ?></p>
            <p style="margin-top:0.8rem;"><?= $t['step4_p2_html'] ?></p>
        </div>
    </div>

    <!-- Step 5: Date types -->
    <div class="kdoc-guide-step" id="datetypes">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">5</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step5_title']) ?></h2>
        </div>
        <div class="kdoc-guide-step__body">
            <p><?= $t['step5_p1_html'] ?></p>
            <p style="margin-top:0.8rem;"><?= $t['step5_p2_html'] ?></p>
        </div>
    </div>

    <!-- Step 6: Upload files -->
    <div class="kdoc-guide-step" id="upload">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">6</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step6_title']) ?></h2>
        </div>
        <div class="kdoc-guide-step__screenshot">
            <img src="assets/images/timeline/form-top.png" alt="Timeline form showing engine selection, advanced settings panel, and file upload zone" class="kdoc-screenshot" style="max-width:700px;" loading="lazy">
        </div>
        <div class="kdoc-guide-step__body">
            <p><?= $t['step6_p1_html'] ?></p>
            <p style="margin-top:0.8rem;"><?= $t['step6_p2_html'] ?></p>
            <p style="margin-top:0.8rem;"><?= htmlspecialchars($t['step6_p3']) ?></p>
            <p style="margin-top:0.8rem;"><?= htmlspecialchars($t['step6_p4']) ?></p>
        </div>
    </div>

    <!-- Step 7: Pasted text + context notes -->
    <div class="kdoc-guide-step" id="paste">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">7</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step7_title']) ?></h2>
        </div>
        <div class="kdoc-guide-step__body">
            <p><?= $t['step7_p1_html'] ?></p>
            <p style="margin-top:0.8rem;"><?= $t['step7_p2_html'] ?></p>
            <ul style="margin-top:0.6rem; padding-left:1.4rem; font-size:0.9rem; line-height:1.8;">
                <li><em><?= htmlspecialchars($t['ctx1']) ?></em></li>
                <li><em><?= htmlspecialchars($t['ctx2']) ?></em></li>
                <li><em><?= htmlspecialchars($t['ctx3']) ?></em></li>
                <li><em><?= htmlspecialchars($t['ctx4']) ?></em></li>
                <li><em><?= htmlspecialchars($t['ctx5']) ?></em></li>
            </ul>
        </div>
    </div>

    <!-- Step 8: Reading the output -->
    <div class="kdoc-guide-step" id="reading">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">8</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step8_title']) ?></h2>
        </div>
        <div class="kdoc-guide-step__screenshot">
            <img src="assets/images/timeline/output-timeline.png" alt="Timeline output showing date cards with ABSOLUTE badge, HIGH confidence, actor names, event descriptions, and source excerpts" class="kdoc-screenshot" style="max-width:800px;" loading="lazy">
        </div>
        <div class="kdoc-guide-step__body">
            <p><?= htmlspecialchars($t['step8_intro']) ?></p>
            <ul style="padding-left:1.4rem; font-size:0.9rem; line-height:1.8; margin-top:0.5rem;">
                <li><?= $t['card1_html'] ?></li>
                <li><?= $t['card2_html'] ?></li>
                <li><?= $t['card3_html'] ?></li>
                <li><?= $t['card4_html'] ?></li>
                <li><?= $t['card5_html'] ?></li>
                <li><?= $t['card6_html'] ?></li>
            </ul>
            <p style="margin-top:0.8rem;"><?= $t['sort_note_html'] ?></p>
            <p style="margin-top:0.6rem;"><?= $t['search_note_html'] ?></p>
        </div>
        <div class="kdoc-guide-step__screenshot" style="margin-top:1rem;">
            <img src="assets/images/timeline/output-detail.png" alt="Detailed timeline events with Barnevernet social workers Judith and Trude, meetings in April and May 2025" class="kdoc-screenshot" style="max-width:800px;" loading="lazy">
        </div>
    </div>

    <!-- Step 9: Evidence trail -->
    <div class="kdoc-guide-step" id="evidence">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">9</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step9_title']) ?></h2>
        </div>
        <div class="kdoc-guide-step__screenshot">
            <img src="assets/images/timeline/evidence-trail.png" alt="Evidence Trail section with three source documents listed, What Remains Uncertain bullet list, and Next Practical Step recommendation" class="kdoc-screenshot" style="max-width:700px;" loading="lazy">
        </div>
        <div class="kdoc-guide-step__body">
            <p><?= htmlspecialchars($t['step9_intro']) ?></p>
            <ul style="padding-left:1.4rem; font-size:0.9rem; line-height:1.9; margin-top:0.5rem;">
                <li><?= $t['ev1_html'] ?></li>
                <li><?= $t['ev2_html'] ?></li>
                <li><?= $t['ev3_html'] ?></li>
            </ul>
            <p style="margin-top:0.8rem;"><?= htmlspecialchars($t['ev_disclaimer']) ?></p>
        </div>
    </div>

    <!-- Tips -->
    <div class="kdoc-guide-step" id="tips">
        <div class="kdoc-guide-step__header">
            <span class="kdoc-guide-step__num">10</span>
            <h2 class="kdoc-guide-step__title"><?= htmlspecialchars($t['step10_title']) ?></h2>
        </div>
        <div class="kdoc-tips">
            <div class="kdoc-tip"><?= $t['tip1_html'] ?></div>
            <div class="kdoc-tip"><?= $t['tip2_html'] ?></div>
            <div class="kdoc-tip"><?= $t['tip3_html'] ?></div>
            <div class="kdoc-tip"><?= $t['tip4_html'] ?></div>
            <div class="kdoc-tip"><?= $t['tip5_html'] ?></div>
            <div class="kdoc-tip"><?= $t['tip6_html'] ?></div>
        </div>
    </div>

</div><!-- /kdoc-section -->

<!-- CTA -->
<section class="kdoc-cta-strip">
    <h2 class="kdoc-cta-strip__title"><?= htmlspecialchars($t['cta_title']) ?></h2>
    <p class="kdoc-cta-strip__sub"><?= htmlspecialchars($t['cta_sub']) ?></p>
    <div class="kdoc-hero__ctas">
<?php if ($isAuthed): ?>
        <a href="/timeline.php" class="kdoc-btn-primary"><?= htmlspecialchars($t['btn_open']) ?></a>
<?php else: ?>
        <a href="<?= htmlspecialchars($toolsLogin) ?>" class="kdoc-btn-primary"><?= htmlspecialchars($t['btn_signin_cta']) ?></a>
        <a href="<?= htmlspecialchars($registerUrl) ?>" class="kdoc-btn-secondary"><?= htmlspecialchars($t['btn_register']) ?></a>
<?php endif; ?>
        <a href="/timeline-tech.php" class="kdoc-btn-secondary"><?= htmlspecialchars($t['btn_techlink']) ?></a>
    </div>
</section>

<?php require_once __DIR__ . '/includes/footer.php'; ?>
<script src="assets/js/tools.js" defer></script>
</body>
</html>
