<%- include('partials/public-header') %>

<style>
  *, *::before, *::after { box-sizing: border-box; }
  
  #main-content {
    max-width: 940px;
    margin: 0 auto;
    padding: 0 clamp(12px, 3vw, 24px) 64px;
    width: 100%;
  }

  /* ── BREADCRUMBS ── */
  .page-nav { padding: 14px 0 6px; }
  .page-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    padding: 0;
  }
  .page-breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
  }
  .page-breadcrumbs a:hover { color: var(--primary); }
  .page-breadcrumbs .active { color: var(--text); font-weight: 700; }

  /* ── HERO SECTION ── */
  .dynamic-page-hero {
    text-align: center;
    padding: clamp(20px, 4vw, 34px) 0 clamp(18px, 3vw, 28px);
    position: relative;
  }
  .ambient-glow {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, 90vw);
    height: 200px;
    background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.22) 0%, rgba(6, 182, 212, 0.1) 45%, transparent 70%);
    filter: blur(50px);
    z-index: -1;
    pointer-events: none;
  }
  [data-theme="light"] .ambient-glow {
    background: radial-gradient(ellipse at center, rgba(67, 56, 202, 0.12) 0%, rgba(6, 182, 212, 0.05) 45%, transparent 70%);
  }

  .page-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: var(--badge-bg);
    border: 1px solid var(--border);
    color: var(--badge-text);
    border-radius: 30px;
    font-size: 0.76rem;
    font-weight: 700;
    margin-bottom: 12px;
  }

  .dynamic-page-hero h1 {
    font-size: clamp(1.85rem, 5.5vw, 2.75rem);
    font-weight: 900;
    letter-spacing: -0.035em;
    color: var(--text);
    margin: 0 auto 10px;
    line-height: 1.2;
    max-width: 800px;
    text-wrap: balance;
  }
  .dynamic-page-hero h1 span {
    background: linear-gradient(135deg, #60a5fa 0%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline;
  }

  .hero-underline {
    width: 54px;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #06b6d4);
    margin: 12px auto 14px;
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
  }

  .dynamic-page-hero p {
    color: var(--text-muted);
    font-size: clamp(0.9rem, 2vw, 1.02rem);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    text-wrap: balance;
  }

  /* ── MAIN CONTENT CARD ── */
  .page-content-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius);
    padding: clamp(22px, 4.5vw, 40px);
    margin-bottom: 24px;
    line-height: 1.75;
    color: var(--text-muted);
    font-size: 0.94rem;
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.25);
  }

  /* ── HEADINGS WITH STYLISH UNDERLINE ACCENT ── */
  .page-content-card h2 {
    font-size: clamp(1.18rem, 2.8vw, 1.38rem);
    font-weight: 800;
    color: var(--text);
    margin: 32px 0 14px;
    letter-spacing: -0.02em;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    position: relative;
    line-height: 1.3;
  }
  .page-content-card h2:first-child {
    margin-top: 0;
  }
  /* Glowing Gradient Underline Bar */
  .page-content-card h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 48px;
    height: 2.5px;
    background: linear-gradient(90deg, #6366f1, #06b6d4);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
  }

  .page-content-card p {
    margin-bottom: 14px;
    color: var(--text-muted);
  }
  .page-content-card strong {
    color: var(--text);
  }
  .page-content-card ul {
    margin: 10px 0 18px 20px;
    padding: 0;
  }
  .page-content-card li {
    margin-bottom: 8px;
    color: var(--text-muted);
  }
  .page-content-card a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
  }
  .page-content-card a:hover {
    color: var(--primary-hover);
  }

  /* ── HIGHLIGHT NOTICE BOX ── */
  .highlight-box {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: 12px;
    padding: 16px 18px;
    margin: 18px 0 26px;
    color: var(--text);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.92rem;
    line-height: 1.6;
  }
  .highlight-box svg {
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
  }

  /* ── CONTACT FORM ── */
  .contact-box {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
  }
  .form-group {
    margin-bottom: 16px;
  }
  .form-group label {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
  }
  .form-input, .form-textarea {
    width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
    transition: all 0.18s ease;
  }
  .form-input:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
  }
  .form-textarea {
    min-height: 130px;
    resize: vertical;
  }
  .btn-submit {
    background: var(--primary);
    border: none;
    color: #ffffff;
    padding: 12px 26px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.18s ease;
    box-shadow: 0 4px 14px var(--primary-glow);
  }
  .btn-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
  }
</style>

<main id="main-content">

  <!-- BREADCRUMBS -->
  <nav class="page-nav" aria-label="Breadcrumb">
    <ol class="page-breadcrumbs">
      <li>
        <a href="/">
          <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
          <span>Home</span>
        </a>
      </li>
      <li class="crumb-sep">/</li>
      <li class="active" aria-current="page"><%= page.title %></li>
    </ol>
  </nav>

  <!-- HERO SECTION -->
  <section class="dynamic-page-hero">
    <div class="ambient-glow" aria-hidden="true"></div>
    
    <% if (page.badge) { %>
      <div class="page-badge"><%= page.badge %></div>
    <% } %>
    
    <h1><span><%= page.heading %></span></h1>
    <div class="hero-underline"></div>
    
    <% if (page.subtitle) { %>
      <p><%= page.subtitle %></p>
    <% } %>
  </section>

  <!-- CONTENT BODY -->
  <article class="page-content-card">
    <% if (page.content && page.content.trim()) { %>
      <div><%- page.content %></div>
    <% } else { %>
      <div><%- page.defaultHtml %></div>
    <% } %>

    <!-- Contact Form (Auto renders on /contact page) -->
    <% if (page.isContact) { %>
      <div class="contact-box">
        <form onsubmit="handleMsg(event)">
          <div class="form-group">
            <label>Your Name</label>
            <input type="text" class="form-input" placeholder="e.g. Alex Doe" required>
          </div>
          <div class="form-group">
            <label>Your Email</label>
            <input type="email" class="form-input" placeholder="e.g. alex@example.com" required>
          </div>
          <div class="form-group">
            <label>Message / Suggestion</label>
            <textarea class="form-textarea" placeholder="Write your message or tool request here..." required></textarea>
          </div>
          <button type="submit" class="btn-submit" id="msgBtn">
            <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
            <span>Send Message</span>
          </button>
        </form>
      </div>
      <script>
        function handleMsg(e) {
          e.preventDefault();
          const b = document.getElementById('msgBtn');
          b.innerHTML = '<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg><span>Message Sent!</span>';
          b.style.background = '#10b981';
          setTimeout(() => {
            e.target.reset();
            b.innerHTML = '<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg><span>Send Another Message</span>';
            b.style.background = '';
          }, 2500);
        }
      </script>
    <% } %>
  </article>

</main>

<%- include('partials/public-footer') %>