{% extends "base.html" %}

{% block title %}{{ t.landing_page_title }}{% endblock %}

{% block head %}
<meta name="description" content="{{ t.landing_meta_desc }}">
<meta property="og:title" content="{{ t.landing_page_title }}">
<meta property="og:description" content="{{ t.landing_og_desc }}">
<meta property="og:type" content="website">
<meta property="og:image" content="{{ url_for('static', filename='images/planner-screenshot.png', _external=True) }}">
<style>
  /* Hero dark section */
  .hero-dark {
    background: #0F172A;
    background-image: radial-gradient(ellipse at 68% 44%, rgba(29,78,216,0.12) 0%, transparent 55%);
    position: relative;
    overflow: hidden;
  }
  .hero-dark::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
    pointer-events: none;
  }
  .hero-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 88px 1.5rem 80px;
    position: relative;
    z-index: 1;
  }
  .hero-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center;
  }
  .hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(22,163,74,0.12); border: 1px solid rgba(22,163,74,0.22);
    border-radius: 999px; padding: 6px 16px; margin-bottom: 24px;
    font-size: 0.75rem; font-weight: 600; color: #4ADE80;
  }
  .hero-title {
    font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
    font-size: clamp(38px, 5.5vw, 60px); font-weight: 800; letter-spacing: -0.035em;
    line-height: 1.06; margin: 0 0 22px; color: #fff;
  }
  .hero-title .accent { color: #60A5FA; }
  .hero-desc {
    font-size: 1.0625rem; color: rgba(255,255,255,0.6); line-height: 1.7;
    margin: 0 0 32px; max-width: 440px;
  }
  .hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
  .btn-hero {
    padding: 14px 28px; font-size: 1rem; font-weight: 700; border-radius: 12px;
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; color: #0F172A; border: none; cursor: pointer;
    box-shadow: 0 4px 20px rgba(255,255,255,0.12);
    transition: transform 0.15s, box-shadow 0.15s; text-decoration: none;
  }
  .btn-hero:hover {
    color: #0F172A; transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(255,255,255,0.18);
  }
  .btn-hero-outline {
    padding: 14px 24px; font-size: 1rem; font-weight: 600; border-radius: 12px;
    display: inline-flex; align-items: center;
    border: 1.5px solid rgba(255,255,255,0.2); color: rgba(255,255,255,0.8);
    background: transparent; cursor: pointer; transition: all 0.15s; text-decoration: none;
  }
  .btn-hero-outline:hover {
    border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.06); color: #fff;
  }
  .hero-bullets { display: flex; gap: 24px; font-size: 0.8125rem; color: rgba(255,255,255,0.4); }
  .hero-check { color: #4ADE80; font-weight: 700; margin-right: 2px; }

  /* ROI Calculator (white card on dark bg) */
  .roi-calc {
    background: #fff; border-radius: 20px; padding: 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.06);
  }
  .roi-calc__title {
    font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
    font-size: 1rem; font-weight: 700; color: #0F172A; margin-bottom: 4px;
  }
  .roi-calc__sub { font-size: 0.75rem; color: #94A3B8; margin-bottom: 24px; }
  .roi-calc__sliders { display: grid; gap: 20px; }
  .roi-calc__row label {
    display: flex; justify-content: space-between; font-size: 0.8125rem;
    font-weight: 500; color: #64748B; margin-bottom: 8px;
  }
  .roi-calc__row label span {
    color: #1D4ED8; font-weight: 700; font-size: 0.875rem;
    font-family: 'Commit Mono', ui-monospace, monospace;
  }
  .roi-calc__row input[type="range"] {
    width: 100%; accent-color: #1D4ED8; cursor: pointer; height: 6px;
  }
  .roi-metrics {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    border-top: 1px solid #E2E8F0; padding-top: 20px; margin-top: 24px;
  }
  .roi-metric__label {
    font-size: 0.6875rem; color: #94A3B8; text-transform: uppercase;
    letter-spacing: 0.06em; font-weight: 500; margin-bottom: 4px;
  }
  .roi-metric__val {
    font-size: 1.25rem; font-weight: 700; color: #0F172A;
    font-family: 'Commit Mono', ui-monospace, monospace;
  }
  .roi-metric__val--green { color: #1D4ED8; }
  .roi-metric__val--red { color: #DC2626; }
  .roi-calc__note { font-size: 0.6875rem; color: #94A3B8; margin-top: 16px; line-height: 1.5; }
  .roi-calc__cta {
    display: block; width: 100%; text-align: center; margin-top: 18px;
    background: #1D4ED8; color: #fff; border-radius: 12px; padding: 13px;
    font-size: 0.875rem; font-weight: 700; text-decoration: none;
    box-shadow: 0 2px 10px rgba(29,78,216,0.25); transition: background 0.15s;
  }
  .roi-calc__cta:hover { background: #1E40AF; color: #fff; }

  /* Proof strip */
  .proof-strip {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 1rem 1.5rem; font-size: 0.8125rem; color: #64748B;
    border-bottom: 1px solid #E2E8F0; flex-wrap: wrap;
  }
  .proof-strip__dot { color: #CBD5E1; }

  /* "Sound familiar?" cards */
  .familiar-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem;
    max-width: 800px; margin: 0 auto;
  }
  .familiar-card {
    background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 14px;
    padding: 1.5rem; position: relative;
  }
  .familiar-card blockquote {
    font-size: 0.9375rem; color: #334155; font-style: italic;
    line-height: 1.6; margin: 0 0 0.75rem; padding: 0;
  }
  .familiar-card p {
    font-size: 0.8125rem; color: #64748B; margin: 0; line-height: 1.5;
  }

  /* "Why Padelnomics" comparison */
  .vs-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
    max-width: 900px; margin: 0 auto;
  }
  .vs-card {
    border: 1px solid #E2E8F0; border-radius: 14px; padding: 1.5rem;
    display: flex; flex-direction: column;
  }
  .vs-card h3 {
    font-size: 1rem; margin-bottom: 1rem; text-align: center;
  }
  .vs-card dl { flex-grow: 1; }
  .vs-card dt {
    font-size: 0.6875rem; color: #94A3B8; text-transform: uppercase;
    letter-spacing: 0.04em; margin-top: 0.75rem;
  }
  .vs-card dt:first-of-type { margin-top: 0; }
  .vs-card dd { font-size: 0.875rem; color: #475569; margin: 0.25rem 0 0; }
  .vs-card--muted { background: #F8FAFC; }
  .vs-card--highlight {
    border-color: #1D4ED8; border-width: 2px;
    box-shadow: 0 4px 16px rgba(29,78,216,0.08);
  }
  .vs-card__bottom {
    font-size: 0.8125rem; color: #94A3B8; font-style: italic;
    text-align: center; margin-top: auto; padding-top: 1rem;
  }
  .vs-card__cta {
    display: block; text-align: center; margin-top: auto; padding-top: 1rem;
    color: #1D4ED8; font-weight: 600; font-size: 0.875rem; text-decoration: none;
  }
  .vs-card__cta:hover { text-decoration: underline; }

  /* Supplier matching */
  .match-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem;
    max-width: 800px; margin: 0 auto;
  }
  .match-step { text-align: center; }
  .match-step__num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    background: rgba(29,78,216,0.06); color: #1D4ED8;
    font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
    font-weight: 800; font-size: 1.375rem; margin-bottom: 1rem;
  }
  .match-step h3 { font-size: 1rem; margin-bottom: 0.375rem; }
  .match-step p { font-size: 0.8125rem; color: #64748B; line-height: 1.5; }

  /* FAQ */
  .faq { max-width: 640px; margin: 0 auto; }
  .faq details { border-bottom: 1px solid #E2E8F0; padding: 1.125rem 0; }
  .faq summary {
    font-weight: 600; cursor: pointer; font-size: 0.9375rem; color: #1E293B;
    list-style: none; display: flex; align-items: center; gap: 10px;
  }
  .faq summary::-webkit-details-marker { display: none; }
  .faq summary::before {
    content: "+"; color: #1D4ED8; font-weight: 700; font-size: 1.125rem;
    font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
    width: 20px; flex-shrink: 0;
  }
  .faq details[open] summary::before { content: "\2212"; }
  .faq p { color: #64748B; font-size: 0.875rem; margin-top: 0.625rem; line-height: 1.65; padding-left: 30px; }

  /* Dark CTA card */
  .cta-card {
    background: #0F172A;
    background-image: radial-gradient(ellipse at 50% 120%, rgba(29,78,216,0.15) 0%, transparent 60%);
    border-radius: 24px; padding: 5rem 2rem; text-align: center;
    position: relative; overflow: hidden;
  }
  .cta-card::after {
    content: ''; position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
  }
  .cta-card h2 { color: #fff; font-size: 2rem; margin-bottom: 0.625rem; position: relative; z-index: 1; }
  .cta-card p { color: rgba(255,255,255,0.55); margin-bottom: 2rem; max-width: 480px; margin-left: auto; margin-right: auto; position: relative; z-index: 1; }
  .cta-card__btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 15px 32px; background: #fff; color: #0F172A; border-radius: 12px;
    font-weight: 700; font-size: 1rem; border: none; cursor: pointer;
    box-shadow: 0 4px 20px rgba(255,255,255,0.1);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative; z-index: 1; text-decoration: none;
  }
  .cta-card__btn:hover {
    color: #0F172A; transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(255,255,255,0.16);
  }

  @media (max-width: 768px) {
    .hero-grid { grid-template-columns: 1fr; gap: 40px; }
    .hero-title { font-size: clamp(32px, 8vw, 44px); }
    .hero-bullets { flex-wrap: wrap; gap: 12px; }
    .roi-metrics { grid-template-columns: 1fr 1fr; }
    .familiar-grid { grid-template-columns: 1fr; }
    .vs-grid { grid-template-columns: 1fr; }
    .match-grid { grid-template-columns: 1fr; }
  }
</style>
{% endblock %}

{% block content %}
<!-- Hero: dark section, full-width -->
<section class="hero-dark">
  <div class="hero-inner">
    <div class="hero-grid">
      <div>
        <div class="hero-badge">&#x1F3BE; {{ t.landing_hero_badge }}</div>
        <h1 class="hero-title">
          {{ t.landing_hero_h1_1 }}<br>
          {{ t.landing_hero_h1_2 }}<br>
          <span class="accent">{{ t.landing_hero_h1_3 }}</span>
        </h1>
        <p class="hero-desc">{{ t.landing_hero_desc }}</p>
        <div class="hero-actions">
          <a href="{{ url_for('planner.index') }}" class="btn-hero">{{ t.landing_hero_btn_primary }}</a>
          <a href="{{ url_for('leads.quote_request') }}" class="btn-hero-outline">{{ t.landing_hero_btn_secondary }}</a>
        </div>
        <div class="hero-bullets">
          <span><span class="hero-check">&#x2713;</span> {{ t.landing_hero_bullet_1 }}</span>
          <span><span class="hero-check">&#x2713;</span> {{ t.landing_hero_bullet_2 }}</span>
          <span><span class="hero-check">&#x2713;</span> {{ t.landing_hero_bullet_3 }}</span>
        </div>
      </div>

      <div class="roi-calc">
        <div class="roi-calc__title">{{ t.landing_roi_title }}</div>
        <div class="roi-calc__sub">{{ t.landing_roi_subtitle }}</div>
        <div class="roi-calc__sliders">
          <div class="roi-calc__row">
            <label>{{ t.landing_roi_courts }} <span id="roiCourtsVal">6</span></label>
            <input type="range" id="roiCourts" min="2" max="20" value="6" step="1">
          </div>
          <div class="roi-calc__row">
            <label>{{ t.landing_roi_rate }} <span id="roiRateVal">&euro;40</span></label>
            <input type="range" id="roiRate" min="20" max="120" value="40" step="5">
          </div>
          <div class="roi-calc__row">
            <label>{{ t.landing_roi_util }} <span id="roiUtilVal">35%</span></label>
            <input type="range" id="roiUtil" min="20" max="80" value="35" step="5">
          </div>
        </div>
        <div class="roi-metrics">
          <div>
            <div class="roi-metric__label">{{ t.landing_roi_investment }}</div>
            <div class="roi-metric__val" id="roiCapex">&euro;330K</div>
          </div>
          <div>
            <div class="roi-metric__label">{{ t.landing_roi_monthly_cf }}</div>
            <div class="roi-metric__val" id="roiCf">&euro;7K</div>
          </div>
          <div>
            <div class="roi-metric__label">{{ t.landing_roi_payback }}</div>
            <div class="roi-metric__val" id="roiPayback">3.9 yr</div>
          </div>
          <div>
            <div class="roi-metric__label">{{ t.landing_roi_annual_roi }}</div>
            <div class="roi-metric__val" id="roiReturn">26%</div>
          </div>
        </div>
        <p class="roi-calc__note">{{ t.landing_roi_note }}</p>
        <a href="{{ url_for('planner.index') }}" class="roi-calc__cta">{{ t.landing_roi_cta }}</a>
      </div>
    </div>
  </div>
</section>

<main class="container-page">
  <!-- Social proof strip -->
  <div class="proof-strip">
    <span>{{ t.landing_proof_plans | tformat(count=calc_requests) }}</span>
    <span class="proof-strip__dot">&middot;</span>
    <span>{{ t.landing_proof_suppliers | tformat(count=total_suppliers, countries=total_countries) }}</span>
    <span class="proof-strip__dot">&middot;</span>
    <span>{{ t.landing_proof_projects | tformat(amount=total_budget_millions) }}</span>
  </div>

  <!-- "Sound familiar?" — struggling moments -->
  <section class="py-12">
    <h2 class="text-2xl text-center mb-8">{{ t.landing_familiar_title }}</h2>
    <div class="familiar-grid">
      <div class="familiar-card">
        <blockquote>&ldquo;{{ t.landing_familiar_1_quote }}&rdquo;</blockquote>
        <p>{{ t.landing_familiar_1_desc }}</p>
      </div>
      <div class="familiar-card">
        <blockquote>&ldquo;{{ t.landing_familiar_2_quote }}&rdquo;</blockquote>
        <p>{{ t.landing_familiar_2_desc }}</p>
      </div>
      <div class="familiar-card">
        <blockquote>&ldquo;{{ t.landing_familiar_3_quote }}&rdquo;</blockquote>
        <p>{{ t.landing_familiar_3_desc }}</p>
      </div>
      <div class="familiar-card">
        <blockquote>&ldquo;{{ t.landing_familiar_4_quote }}&rdquo;</blockquote>
        <p>{{ t.landing_familiar_4_desc }}</p>
      </div>
    </div>
    <p class="text-center text-slate mt-6" style="font-weight:500">{{ t.landing_familiar_cta }}</p>
  </section>

  <!-- Feature Highlights -->
  <section class="py-12">
    <h2 class="text-2xl text-center mb-8">{{ t.landing_features_title }}</h2>
    <div class="grid-3">
      <div class="card border-l-4 border-l-electric">
        <h3 class="text-lg mb-2">&#x1F527; {{ t.landing_feature_1_h3 }}</h3>
        <p class="text-sm text-slate-dark">{{ t.landing_feature_1_body }}</p>
      </div>
      <div class="card border-l-4 border-l-accent">
        <h3 class="text-lg mb-2">&#x1F4CB; {{ t.landing_feature_2_h3 }}</h3>
        <p class="text-sm text-slate-dark">{{ t.landing_feature_2_body }}</p>
      </div>
      <div class="card border-l-4 border-l-warning">
        <h3 class="text-lg mb-2">&#x2600;&#xFE0F; {{ t.landing_feature_3_h3 }}</h3>
        <p class="text-sm text-slate-dark">{{ t.landing_feature_3_body }}</p>
      </div>
    </div>
    <div class="grid-3 mt-0">
      <div class="card border-l-4 border-l-danger">
        <h3 class="text-lg mb-2">&#x1F4C9; {{ t.landing_feature_4_h3 }}</h3>
        <p class="text-sm text-slate-dark">{{ t.landing_feature_4_body }}</p>
      </div>
      <div class="card border-l-4 border-l-electric">
        <h3 class="text-lg mb-2">&#x1F3AF; {{ t.landing_feature_5_h3 }}</h3>
        <p class="text-sm text-slate-dark">{{ t.landing_feature_5_body }}</p>
      </div>
      <div class="card border-l-4 border-l-accent">
        <h3 class="text-lg mb-2">&#x1F4BE; {{ t.landing_feature_6_h3 }}</h3>
        <p class="text-sm text-slate-dark">{{ t.landing_feature_6_body }}</p>
      </div>
    </div>
  </section>

  <!-- "Why Padelnomics" comparison -->
  <section class="py-12">
    <h2 class="text-2xl text-center mb-2">{{ t.landing_vs_title }}</h2>
    <p class="text-center text-slate mb-8">{{ t.landing_vs_sub }}</p>
    <div class="vs-grid">
      <div class="vs-card vs-card--muted">
        <h3>{{ t.landing_vs_col_diy }}</h3>
        <dl>
          <dt>{{ t.landing_vs_row1_label }}</dt><dd>{{ t.landing_vs_row1_diy }}</dd>
          <dt>{{ t.landing_vs_row2_label }}</dt><dd>{{ t.landing_vs_row2_diy }}</dd>
          <dt>{{ t.landing_vs_row3_label }}</dt><dd>{{ t.landing_vs_row3_diy }}</dd>
        </dl>
        <p class="vs-card__bottom">{{ t.landing_vs_diy_cta }}</p>
      </div>
      <div class="vs-card vs-card--muted">
        <h3>{{ t.landing_vs_col_consultant }}</h3>
        <dl>
          <dt>{{ t.landing_vs_row1_label }}</dt><dd>{{ t.landing_vs_row1_consultant }}</dd>
          <dt>{{ t.landing_vs_row2_label }}</dt><dd>{{ t.landing_vs_row2_consultant }}</dd>
          <dt>{{ t.landing_vs_row3_label }}</dt><dd>{{ t.landing_vs_row3_consultant }}</dd>
        </dl>
        <p class="vs-card__bottom">{{ t.landing_vs_consultant_cta }}</p>
      </div>
      <div class="vs-card vs-card--highlight">
        <h3>{{ t.landing_vs_col_us }}</h3>
        <dl>
          <dt>{{ t.landing_vs_row1_label }}</dt><dd>{{ t.landing_vs_row1_us }}</dd>
          <dt>{{ t.landing_vs_row2_label }}</dt><dd>{{ t.landing_vs_row2_us }}</dd>
          <dt>{{ t.landing_vs_row3_label }}</dt><dd>{{ t.landing_vs_row3_us }}</dd>
        </dl>
        <a href="{{ url_for('planner.index') }}" class="vs-card__cta">{{ t.landing_vs_us_cta }}</a>
      </div>
    </div>
  </section>

  <!-- Supplier Matching -->
  <section class="py-12">
    <h2 class="text-2xl text-center mb-2">{{ t.landing_supplier_title }}</h2>
    <p class="text-center text-slate mb-8">{{ t.landing_supplier_sub | tformat(total_suppliers=total_suppliers, total_countries=total_countries) }}</p>
    <div class="match-grid">
      <div class="match-step">
        <div class="match-step__num">1</div>
        <h3>{{ t.landing_supplier_step_1_title }}</h3>
        <p>{{ t.landing_supplier_step_1_body }}</p>
      </div>
      <div class="match-step">
        <div class="match-step__num">2</div>
        <h3>{{ t.landing_supplier_step_2_title }}</h3>
        <p>{{ t.landing_supplier_step_2_body }}</p>
      </div>
      <div class="match-step">
        <div class="match-step__num">3</div>
        <h3>{{ t.landing_supplier_step_3_title }}</h3>
        <p>{{ t.landing_supplier_step_3_body }}</p>
      </div>
    </div>
    <div class="text-center mt-8">
      <a href="{{ url_for('leads.quote_request') }}" class="btn-outline">{{ t.landing_supplier_browse_btn }}</a>
    </div>
  </section>

  <!-- FAQ -->
  <section id="faq" class="py-12">
    <h2 class="text-2xl text-center mb-6">{{ t.landing_faq_title }}</h2>
    <div class="faq">
      <details>
        <summary>{{ t.landing_faq_q1 }}</summary>
        <p>{{ t.landing_faq_a1 }}</p>
      </details>
      <details>
        <summary>{{ t.landing_faq_q2 }}</summary>
        <p>{{ t.landing_faq_a2 }}</p>
      </details>
      <details>
        <summary>{{ t.landing_faq_q3 }}</summary>
        <p>{{ t.landing_faq_a3 }}</p>
      </details>
      <details>
        <summary>{{ t.landing_faq_q4 }}</summary>
        <p>{{ t.landing_faq_a4 }}</p>
      </details>
      <details>
        <summary>{{ t.landing_faq_q5 }}</summary>
        <p>{{ t.landing_faq_a5 }}</p>
      </details>
    </div>
  </section>

  <!-- SEO Content -->
  <section class="py-12 max-w-3xl mx-auto">
    <h2 class="text-2xl mb-4">{{ t.landing_seo_title }}</h2>
    <div class="space-y-4 text-slate-dark leading-relaxed">
      <p>{{ t.landing_seo_p1 }}</p>
      <p>{{ t.landing_seo_p2 }}</p>
    </div>
  </section>

  <!-- Final CTA — dark card -->
  <section style="padding: 2rem 0 4rem">
    <div class="cta-card">
      <h2>{{ t.landing_final_cta_h2 }}</h2>
      <p>{{ t.landing_final_cta_sub }}</p>
      <a href="{{ url_for('planner.index') }}" class="cta-card__btn">{{ t.landing_final_cta_btn }}</a>
    </div>
  </section>
</main>
{% endblock %}

{% block scripts %}
<script>
(function() {
  var courts = document.getElementById('roiCourts');
  var rate = document.getElementById('roiRate');
  var util = document.getElementById('roiUtil');

  function fmt(n) {
    if (n >= 1e6) return '\u20ac' + (n / 1e6).toFixed(1) + 'M';
    if (n >= 1e3) return '\u20ac' + Math.round(n / 1e3) + 'K';
    return '\u20ac' + Math.round(n);
  }

  function update() {
    var c = +courts.value, r = +rate.value, u = +util.value / 100;

    document.getElementById('roiCourtsVal').textContent = c;
    document.getElementById('roiRateVal').innerHTML = '&euro;' + r;
    document.getElementById('roiUtilVal').textContent = u * 100 + '%';

    // Simplified indoor-rent model (realistic costs)
    var costPerCourt = 35000;
    var courtCapex = c * costPerCourt;
    var fitout = 60000 + c * 5000;
    var contingency = 0.10;
    var capex = Math.round((courtCapex + fitout) * (1 + contingency));

    // Revenue: courts * hours/day * days/mo * utilization * avg rate
    var hoursDay = 16, daysMonth = 29;
    var monthlyRev = c * hoursDay * daysMonth * u * r;

    // OpEx: rent + staff + utilities + insurance + maintenance + marketing
    var sqm = c * 300;
    var staff = 2500 * Math.ceil(c / 4) + 3500;
    var monthlyOpex = (sqm * 8) + staff + (c * 600) + 300 + (c * 300) + 350;

    // Debt: 85% LTV, 5% interest, 10yr
    var loan = capex * 0.85;
    var mr = 0.05 / 12;
    var n = 120;
    var debtService = loan * mr * Math.pow(1 + mr, n) / (Math.pow(1 + mr, n) - 1);

    var monthlyCf = monthlyRev - monthlyOpex - debtService;
    var annualCf = monthlyCf * 12;

    // Metrics — payback and ROI based on total investment (not just equity)
    document.getElementById('roiCapex').textContent = fmt(capex);

    var cfEl = document.getElementById('roiCf');
    cfEl.textContent = fmt(Math.abs(monthlyCf)) + '/mo';
    cfEl.className = 'roi-metric__val ' + (monthlyCf >= 0 ? 'roi-metric__val--green' : 'roi-metric__val--red');

    var payback = annualCf > 0 ? capex / annualCf : 99;
    document.getElementById('roiPayback').textContent = payback < 20 ? payback.toFixed(1) + ' yr' : '20+ yr';

    var roi = capex > 0 ? (annualCf / capex) * 100 : 0;
    var roiEl = document.getElementById('roiReturn');
    roiEl.textContent = roi > 0 ? Math.round(roi) + '%' : 'N/A';
    roiEl.className = 'roi-metric__val ' + (roi > 0 ? 'roi-metric__val--green' : 'roi-metric__val--red');
  }

  courts.addEventListener('input', update);
  rate.addEventListener('input', update);
  util.addEventListener('input', update);
  update();
})();
</script>
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "Padelnomics",
  "url": "{{ config.BASE_URL }}",
  "logo": "{{ url_for('static', filename='images/logo.png', _external=True) }}",
  "description": "{{ t.landing_jsonld_org_desc }}"
}
</script>
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "{{ t.landing_faq_q1 }}",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "{{ t.landing_faq_a1 }}"
      }
    },
    {
      "@type": "Question",
      "name": "{{ t.landing_faq_q2 }}",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "{{ t.landing_faq_a2 }}"
      }
    },
    {
      "@type": "Question",
      "name": "{{ t.landing_faq_q3 }}",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "{{ t.landing_faq_a3 }}"
      }
    },
    {
      "@type": "Question",
      "name": "{{ t.landing_faq_q4 }}",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "{{ t.landing_faq_a4 }}"
      }
    },
    {
      "@type": "Question",
      "name": "{{ t.landing_faq_q5 }}",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "{{ t.landing_faq_a5 }}"
      }
    }
  ]
}
</script>
{% endblock %}
