// Quiet release-notes button — bottom-right, fades to visible on hover.
// Opens a modal listing what shifted in this release.
(function () {
  const { useState } = React;

  const RELEASE = {
    version: 'v0.6',
    date: '2026-06-06',
    title: 'the practitioner’s path',
    notes: [
      {
        heading: 'ten quiet steps',
        body: 'A rank now keeps you, from 初 Novice through to 神 Divine — ten steps along a single path. The kanji of your present rank rests in the right margin like a painting on the page, growing quieter on hover and richer in detail as you climb: a horizon, then mountains, then a sun, cranes, a pine bough, falling petals, a gilded halo. Hover to read its name.',
      },
      {
        heading: 'effort, then character',
        body: 'The first three steps are measured by effort alone — tasks kept and time attended. From 道 Wayfarer onward the path also asks for consistency (a streak of days kept) and commitment (the share of scheduled tasks completed on or before the day you set). Schedule a task, finish it on the day, and the path remembers.',
      },
      {
        heading: 'measured, not announced',
        body: 'The dashboard now carries a "rank, gently kept" card with the next step’s four small bars, and a ladder beside it that shows where you stand among the ten. Nothing flashes when a step is taken; the brush stroke on the page simply deepens.',
      },
    ],
  };

  function ReleaseNotes() {
    const [open, setOpen] = useState(false);

    return React.createElement(React.Fragment, null,
      React.createElement('button', {
        className: 'release-notes-fab',
        onClick: () => setOpen(true),
        title: `Release notes · ${RELEASE.version}`,
        'aria-label': 'release notes',
      },
        React.createElement('span', { className: 'dot' }),
        'release notes'
      ),

      open && React.createElement('div', {
        className: 'release-notes-veil',
        onClick: (e) => { if (e.target.classList.contains('release-notes-veil')) setOpen(false); },
      },
        React.createElement('div', { className: 'release-notes-panel fade-in', role: 'dialog', 'aria-label': 'release notes' },
          React.createElement('div', { className: 'cap' },
            React.createElement('div', null,
              React.createElement('div', { className: 'label' }, `release · ${RELEASE.date}`),
              React.createElement('h3', { className: 'title' },
                RELEASE.title,
                React.createElement('span', { className: 'release-version' }, RELEASE.version),
              ),
            ),
            React.createElement('button', { type: 'button', className: 'btn ghost tiny', onClick: () => setOpen(false) }, 'close'),
          ),
          React.createElement('div', null,
            RELEASE.notes.map((n, i) =>
              React.createElement('div', { key: i, className: 'release-note-item' },
                React.createElement('div', { className: 'heading' },
                  React.createElement('span', { className: 'mark' }),
                  n.heading
                ),
                React.createElement('div', { className: 'body' }, n.body),
              )
            ),
          ),
        )
      )
    );
  }

  window.ReleaseNotes = ReleaseNotes;
})();
