This is a complex request for a climate analytics platform focused on coastal insurance underwriting. Let me break down what needs to be built:
Let me create this comprehensive platform.
This is a sophisticated analytics platform featuring interactive hazard projections, exposure mapping, financial risk modeling, and regulatory compliance tracking for coastal insurance underwriting.
html Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AquaMetrics | Coastal Climate Risk Analytics</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600&family=Space+Grotesk:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #0a0f14;
--bg-elevated: #111920;
--bg-card: #151d26;
--fg: #e4eaf1;
--fg-muted: #6b7f8f;
--accent: #00d4aa;
--accent-glow: rgba(0, 212, 170, 0.3);
--warning: #ff6b4a;
--warning-glow: rgba(255, 107, 74, 0.3);
--info: #4a9eff;
--border: #1e2a36;
--gradient-ocean: linear-gradient(135deg, #0a1628 0%, #0d2137 50%, #0a1a2e 100%);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Space Grotesk', sans-serif;
background: var(--bg);
color: var(--fg);
min-height: 100vh;
overflow-x: hidden;
}
.font-mono {
font-family: 'JetBrains Mono', monospace;
}
/* Background atmosphere */
.atmosphere {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 0;
background:
radial-gradient(ellipse 80% 60% at 10% 90%, rgba(0, 212, 170, 0.08) 0%, transparent 50%),
radial-gradient(ellipse 60% 50% at 90% 20%, rgba(74, 158, 255, 0.06) 0%, transparent 50%),
var(--gradient-ocean);
}
.grid-pattern {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 0;
opacity: 0.03;
background-image:
linear-gradient(var(--accent) 1px, transparent 1px),
linear-gradient(90deg, var(--accent) 1px, transparent 1px);
background-size: 60px 60px;
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: var(--bg);
}
::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--accent);
}
/* Card styles */
.card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
backdrop-filter: blur(10px);
}
.card-glow {
box-shadow: 0 0 40px rgba(0, 212, 170, 0.05);
}
/* Button styles */
.btn-primary {
background: linear-gradient(135deg, var(--accent), #00b894);
color: var(--bg);
font-weight: 600;
padding: 12px 24px;
border-radius: 8px;
border: none;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 8px 24px var(--accent-glow);
}
.btn-primary:active {
transform: translateY(0);
}
.btn-secondary {
background: transparent;
color: var(--fg);
border: 1px solid var(--border);
padding: 10px 20px;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-secondary:hover {
border-color: var(--accent);
color: var(--accent);
}
/* Tab styles */
.tab {
padding: 12px 20px;
cursor: pointer;
border-bottom: 2px solid transparent;
color: var(--fg-muted);
transition: all 0.2s ease;
white-space: nowrap;
}
.tab:hover {
color: var(--fg);
}
.tab.active {
color: var(--accent);
border-bottom-color: var(--accent);
}
/* Risk meter */
.risk-meter {
height: 8px;
background: var(--border);
border-radius: 4px;
overflow: hidden;
}
.risk-meter-fill {
height: 100%;
border-radius: 4px;
transition: width 0.8s ease-out;
}
/* Map visualization */
.map-container {
position: relative;
background: linear-gradient(180deg, #0d1f30 0%, #0a1520 100%);
border-radius: 12px;
overflow: hidden;
}
.map-grid {
position: absolute;
inset: 0;
opacity: 0.1;
}
/* Pulse animation for hazard points */
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 0.8; }
50% { transform: scale(1.2); opacity: 1; }
}
.hazard-point {
animation: pulse 2s ease-in-out infinite;
}
/* Entrance animations */
@keyframes fadeSlideUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeSlideRight {
from {
opacity: 0;
transform: translateX(-30px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
.animate-in {
animation: fadeSlideUp 0.6s ease-out forwards;
opacity: 0;
}
.animate-in-right {
animation: fadeSlideRight 0.6s ease-out forwards;
opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
.animate-in, .animate-in-right, .hazard-point {
animation: none;
opacity: 1;
transform: none;
}
}
/* Focus states */
button:focus-visible, input:focus-visible, select:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
/* Status indicators */
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
.status-compliant { background: var(--accent); }
.status-warning { background: #ffc107; }
.status-violation { background: var(--warning); }
/* Progress ring */
.progress-ring {
transform: rotate(-90deg);
}
.progress-ring-circle {
transition: stroke-dashoffset 0.8s ease-out;
}
/* Slider styles */
input[type="range"] {
-webkit-appearance: none;
background: var(--border);
height: 6px;
border-radius: 3px;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 18px;
height: 18px;
background: var(--accent);
border-radius: 50%;
cursor: pointer;
box-shadow: 0 0 10px var(--accent-glow);
}
/* Hide sections by default */
.section-panel {
display: none;
}
.section-panel.active {
display: block;
}
</style>
</head>
<body>
<div class="atmosphere"></div>
<div class="grid-pattern"></div>
<!-- Header -->
<header class="relative z-10 border-b border-[var(--border)] bg-[var(--bg-elevated)]/80 backdrop-blur-md">
<div class="max-w-[1600px] mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-lg bg-gradient-to-br from-[var(--accent)] to-[#00b894] flex items-center justify-center">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="text-[var(--bg)]">
<path d="M2 12h2M20 12h2M6.34 6.34l1.42 1.42M16.24 16.24l1.42 1.42M6.34 17.66l1.42-1.42M16.24 7.76l1.42-1.42M12 2v2M12 20v2"/>
<circle cx="12" cy="12" r="4"/>
</svg>
</div>
<div>
<h1 class="text-lg font-semibold tracking-tight">AquaMetrics</h1>
<p class="text-xs text-[var(--fg-muted)] font-mono">Coastal Risk Analytics v2.4</p>
</div>
</div>
<div class="flex items-center gap-4">
<div class="hidden sm:flex items-center gap-2 px-3 py-1.5 rounded-full bg-[var(--bg-card)] border border-[var(--border)]">
<span class="status-dot status-compliant"></span>
<span class="text-xs font-mono text-[var(--fg-muted)]">LIVE DATA</span>
</div>
<button class="btn-secondary text-sm" id="exportBtn">
<span class="flex items-center gap-2">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"/>
</svg>
Export
</span>
</button>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="relative z-10 max-w-[1600px] mx-auto px-4 sm:px-6 lg:px-8 py-6">
<!-- Navigation Tabs -->
<nav class="flex gap-1 overflow-x-auto pb-4 border-b border-[var(--border)] mb-6 animate-in" role="tablist">
<button class="tab active" data-tab="hazards" role="tab" aria-selected="true">
<span class="flex items-center gap-2">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2v10M12 12l4-4M12 12L8 8M2 12a10 10 0 1 0 20 0"/>
</svg>
Hazard Projections
</span>
</button>
<button class="tab" data-tab="exposure" role="tab" aria-selected="false">
<span class="flex items-center gap-2">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polygon points="1 6 1 22 8 18 16 22 23 18 23 2 16 6 8 2 1 6"/>
<line x1="8" y1="2" x2="8" y2="18"/>
<line x1="16" y1="6" x2="16" y2="22"/>
</svg>
Exposure Mapping
</span>
</button>
<button class="tab" data-tab="financial" role="tab" aria-selected="false">
<span class="flex items-center gap-2">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="1" x2="12" y2="23"/>
<path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>
</svg>
Financial Modeling
</span>
</button>
<button class="tab" data-tab="compliance" role="tab" aria-selected="false">
<span class="flex items-center gap-2">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
<polyline points="9 12 11 14 15 10"/>
</svg>
Compliance
</span>
</button>
</nav>
<!-- Hazard Projections Section -->
<section id="hazards-section" class="section-panel active">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Hazard Map -->
<div class="lg:col-span-2 card card-glow p-0 overflow-hidden animate-in" style="animation-delay: 0.1s">
<div class="p-4 border-b border-[var(--border)] flex flex-wrap items-center justify-between gap-4">
<div>
<h2 class="text-lg font-semibold">Coastal Hazard Visualization</h2>
<p class="text-sm text-[var(--fg-muted)]">Sea level rise & storm surge projections</p>
</div>
<div class="flex items-center gap-3">
<select id="scenarioSelect" class="bg-[var(--bg)] border border-[var(--border)] rounded-lg px-3 py-2 text-sm" aria-label="Climate Scenario">
<option value="rcp45">RCP 4.5 (Moderate)</option>
<option value="rcp85" selected>RCP 8.5 (High)</option>
<option value="ssp245">SSP 2-4.5</option>
<option value="ssp585">SSP 5-8.5</option>
</select>
</div>
</div>
<div class="map-container h-[400px] relative" id="hazardMap">
<canvas id="mapCanvas" class="absolute inset-0 w-full h-full"></canvas>
<div class="absolute bottom-4 left-4 bg-[var(--bg-card)]/90 backdrop-blur rounded-lg p-3 text-xs font-mono">
<div class="flex items-center gap-4">
<span class="flex items-center gap-2">
<span class="w-3 h-3 rounded-full bg-[#00d4aa]"></span>
Low Risk
</span>
<span class="flex items-center gap-2">
<span class="w-3 h-3 rounded-full bg-[#ffc107]"></span>
Medium
</span>
<span class="flex items-center gap-2">
<span class="w-3 h-3 rounded-full bg-[#ff6b4a]"></span>
High Risk
</span>
</div>
</div>
<div class="absolute top-4 right-4 bg-[var(--bg-card)]/90 backdrop-blur rounded-lg p-3">
<label class="text-xs text-[var(--fg-muted)] block mb-2">Projection Year</label>
<input type="range" id="yearSlider" min="2024" max="2100" value="2024" class="w-32">
<div class="text-center font-mono text-sm mt-1" id="yearDisplay">2024</div>
</div>
</div>
<div class="p-4 border-t border-[var(--border)]">
<div class="flex flex-wrap gap-6">
<div>
<span class="text-xs text-[var(--fg-muted)]">Sea Level Rise</span>
<div class="text-xl font-semibold font-mono" id="seaLevelValue">+0.0m</div>
</div>
<div>
<span class="text-xs text-[var(--fg-muted)]">Storm Surge Height</span>
<div class="text-xl font-semibold font-mono" id="stormSurgeValue">2.4m</div>
</div>
<div>
<span class="text-xs text-[var(--fg-muted)]">Flood Probability</span>
<div class="text-xl font-semibold font-mono text-[var(--warning)]" id="floodProbValue">12%</div>
</div>
<div>
<span class="text-xs text-[var(--fg-muted)]">High-Risk Properties</span>
<div class="text-xl font-semibold font-mono" id="highRiskCount">847</div>
</div>
</div>
</div>
</div>
<!-- Hazard Metrics Panel -->
<div class="space-y-4 animate-in" style="animation-delay: 0.2s">
<div class="card p-4">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Hazard Severity Index</h3>
<div class="flex justify-center mb-4">
<svg width="120" height="120" viewBox="0 0 120 120" class="progress-ring">
<circle cx="60" cy="60" r="52" stroke="var(--border)" stroke-width="8" fill="none"/>
<circle cx="60" cy="60" r="52" stroke="url(#riskGradient)" stroke-width="8" fill="none"
stroke-dasharray="327" stroke-dashoffset="98" stroke-linecap="round" class="progress-ring-circle" id="hazardRing"/>
<defs>
<linearGradient id="riskGradient" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#00d4aa"/>
<stop offset="100%" stop-color="#ff6b4a"/>
</linearGradient>
</defs>
</svg>
<div class="absolute flex items-center justify-center w-[120px] h-[120px]">
<div class="text-center">
<div class="text-2xl font-bold font-mono" id="hazardScore">70</div>
<div class="text-xs text-[var(--fg-muted)]">/ 100</div>
</div>
</div>
</div>
<div class="space-y-3">
<div>
<div class="flex justify-between text-sm mb-1">
<span>Sea Level Rise</span>
<span class="font-mono">78%</span>
</div>
<div class="risk-meter">
<div class="risk-meter-fill bg-[var(--warning)]" style="width: 78%"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span>Storm Frequency</span>
<span class="font-mono">45%</span>
</div>
<div class="risk-meter">
<div class="risk-meter-fill bg-[var(--accent)]" style="width: 45%"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span>Coastal Erosion</span>
<span class="font-mono">62%</span>
</div>
<div class="risk-meter">
<div class="risk-meter-fill bg-[#ffc107]" style="width: 62%"></div>
</div>
</div>
</div>
</div>
<div class="card p-4">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Regional Breakdown</h3>
<div class="space-y-2" id="regionList">
<!-- Populated by JS -->
</div>
</div>
</div>
</div>
</section>
<!-- Exposure Mapping Section -->
<section id="exposure-section" class="section-panel">
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
<!-- Portfolio Summary -->
<div class="lg:col-span-3">
<div class="card card-glow p-0 overflow-hidden animate-in-right">
<div class="p-4 border-b border-[var(--border)]">
<h2 class="text-lg font-semibold">Portfolio Exposure Analysis</h2>
<p class="text-sm text-[var(--fg-muted)]">Geographic distribution of insured assets</p>
</div>
<div class="p-4">
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
<div class="bg-[var(--bg-elevated)] rounded-lg p-4">
<span class="text-xs text-[var(--fg-muted)]">Total Properties</span>
<div class="text-2xl font-bold font-mono mt-1">12,847</div>
<div class="text-xs text-[var(--accent)]">+234 this quarter</div>
</div>
<div class="bg-[var(--bg-elevated)] rounded-lg p-4">
<span class="text-xs text-[var(--fg-muted)]">Total Insured Value</span>
<div class="text-2xl font-bold font-mono mt-1">$4.2B</div>
<div class="text-xs text-[var(--fg-muted)]">Aggregate TIV</div>
</div>
<div class="bg-[var(--bg-elevated)] rounded-lg p-4">
<span class="text-xs text-[var(--fg-muted)]">Avg. Risk Score</span>
<div class="text-2xl font-bold font-mono mt-1 text-[#ffc107]">58</div>
<div class="text-xs text-[var(--fg-muted)]">Medium-High</div>
</div>
<div class="bg-[var(--bg-elevated)] rounded-lg p-4">
<span class="text-xs text-[var(--fg-muted)]">Probable Max Loss</span>
<div class="text-2xl font-bold font-mono mt-1 text-[var(--warning)]">$847M</div>
<div class="text-xs text-[var(--fg-muted)]">1-in-250 year</div>
</div>
</div>
<!-- Property Table -->
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="text-left text-[var(--fg-muted)] border-b border-[var(--border)]">
<th class="pb-3 font-medium">Property ID</th>
<th class="pb-3 font-medium">Location</th>
<th class="pb-3 font-medium">TIV</th>
<th class="pb-3 font-medium">Risk Zone</th>
<th class="pb-3 font-medium">Risk Score</th>
<th class="pb-3 font-medium">Premium</th>
</tr>
</thead>
<tbody id="propertyTable">
<!-- Populated by JS -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Exposure Filters -->
<div class="space-y-4 animate-in-right" style="animation-delay: 0.1s">
<div class="card p-4">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Filter Portfolio</h3>
<div class="space-y-4">
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Risk Zone</label>
<select class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-3 py-2 text-sm">
<option>All Zones</option>
<option>Zone A (High)</option>
<option>Zone B (Medium)</option>
<option>Zone C (Low)</option>
</select>
</div>
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Property Type</label>
<select class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-3 py-2 text-sm">
<option>All Types</option>
<option>Residential</option>
<option>Commercial</option>
<option>Industrial</option>
<option>Mixed Use</option>
</select>
</div>
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">TIV Range</label>
<div class="flex gap-2">
<input type="text" placeholder="Min" class="w-1/2 bg-[var(--bg)] border border-[var(--border)] rounded-lg px-3 py-2 text-sm">
<input type="text" placeholder="Max" class="w-1/2 bg-[var(--bg)] border border-[var(--border)] rounded-lg px-3 py-2 text-sm">
</div>
</div>
<button class="btn-primary w-full text-sm">Apply Filters</button>
</div>
</div>
<div class="card p-4">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Exposure by Zone</h3>
<div class="space-y-3" id="zoneExposure">
<!-- Populated by JS -->
</div>
</div>
</div>
</div>
</section>
<!-- Financial Modeling Section -->
<section id="financial-section" class="section-panel">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Premium Calculator -->
<div class="lg:col-span-2 card card-glow animate-in" style="animation-delay: 0.1s">
<div class="p-4 border-b border-[var(--border)]">
<h2 class="text-lg font-semibold">Risk-Adjusted Premium Modeler</h2>
<p class="text-sm text-[var(--fg-muted)]">Calculate premiums based on climate risk factors</p>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div class="space-y-4">
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Total Insured Value</label>
<input type="text" id="tivInput" value="2500000" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3 text-lg font-mono">
</div>
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Property Type</label>
<select id="propertyType" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3">
<option value="residential">Residential</option>
<option value="commercial">Commercial</option>
<option value="industrial">Industrial</option>
</select>
</div>
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Risk Zone</label>
<select id="riskZoneSelect" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3">
<option value="A">Zone A (High Risk)</option>
<option value="B">Zone B (Medium Risk)</option>
<option value="C">Zone C (Low Risk)</option>
</select>
</div>
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Deductible</label>
<select id="deductibleSelect" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3">
<option value="1000">$1,000</option>
<option value="2500">$2,500</option>
<option value="5000">$5,000</option>
<option value="10000">$10,000</option>
</select>
</div>
</div>
<div class="space-y-4">
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Climate Scenario Adjustment</label>
<div class="flex gap-2">
<button class="flex-1 btn-secondary text-sm scenario-btn active" data-scenario="baseline">Baseline</button>
<button class="flex-1 btn-secondary text-sm scenario-btn" data-scenario="moderate">+1.5°C</button>
<button class="flex-1 btn-secondary text-sm scenario-btn" data-scenario="severe">+2.0°C</button>
</div>
</div>
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Coverage Type</label>
<select id="coverageType" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3">
<option value="named">Named Perils</option>
<option value="all">All-Risk</option>
<option value="flood">Flood Only</option>
</select>
</div>
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Construction Year</label>
<input type="number" id="constructionYear" value="1985" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3">
</div>
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Elevation (ft)</label>
<input type="number" id="elevationInput" value="8" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3">
</div>
</div>
</div>
<button class="btn-primary w-full text-base" id="calculatePremium">Calculate Premium</button>
</div>
</div>
<!-- Premium Results -->
<div class="space-y-4 animate-in" style="animation-delay: 0.2s">
<div class="card p-4" id="premiumResult">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Premium Breakdown</h3>
<div class="space-y-3">
<div class="flex justify-between items-center">
<span class="text-sm">Base Premium</span>
<span class="font-mono" id="basePremium">$8,750</span>
</div>
<div class="flex justify-between items-center">
<span class="text-sm">Climate Risk Load</span>
<span class="font-mono text-[var(--warning)]" id="climateLoad">+$2,188</span>
</div>
<div class="flex justify-between items-center">
<span class="text-sm">Zone Surcharge</span>
<span class="font-mono" id="zoneSurcharge">+$1,313</span>
</div>
<div class="flex justify-between items-center">
<span class="text-sm">Mitigation Credit</span>
<span class="font-mono text-[var(--accent)]" id="mitigationCredit">-$438</span>
</div>
<hr class="border-[var(--border)]">
<div class="flex justify-between items-center">
<span class="font-semibold">Annual Premium</span>
<span class="text-xl font-bold font-mono text-[var(--accent)]" id="totalPremium">$11,813</span>
</div>
<div class="text-xs text-[var(--fg-muted)] text-right" id="premiumRate">Rate: $4.73 per $1,000 TIV</div>
</div>
</div>
<div class="card p-4">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Loss Projections</h3>
<div class="space-y-3" id="lossProjections">
<div class="flex justify-between">
<span class="text-sm">Expected Annual Loss</span>
<span class="font-mono">$18,750</span>
</div>
<div class="flex justify-between">
<span class="text-sm">1-in-100 Year Loss</span>
<span class="font-mono">$425,000</span>
</div>
<div class="flex justify-between">
<span class="text-sm">1-in-250 Year Loss</span>
<span class="font-mono text-[var(--warning)]">$687,500</span>
</div>
</div>
</div>
<div class="card p-4">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Risk Multipliers</h3>
<div class="space-y-2" id="riskMultipliers">
<!-- Populated by JS -->
</div>
</div>
</div>
</div>
</section>
<!-- Compliance Section -->
<section id="compliance-section" class="section-panel">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Compliance Dashboard -->
<div class="lg:col-span-2">
<div class="card card-glow animate-in">
<div class="p-4 border-b border-[var(--border)] flex flex-wrap items-center justify-between gap-4">
<div>
<h2 class="text-lg font-semibold">Regulatory Compliance Status</h2>
<p class="text-sm text-[var(--fg-muted)]">FEMA, State, and Climate Disclosure Requirements</p>
</div>
<div class="flex items-center gap-2 px-3 py-1.5 rounded-full bg-[var(--accent)]/10 border border-[var(--accent)]/30">
<span class="status-dot status-compliant"></span>
<span class="text-xs font-mono text-[var(--accent)]">92% COMPLIANT</span>
</div>
</div>
<div class="p-4">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
<div class="bg-[var(--bg-elevated)] rounded-lg p-4 text-center">
<div class="text-3xl font-bold text-[var(--accent)]">24</div>
<div class="text-xs text-[var(--fg-muted)]">Requirements Met</div>
</div>
<div class="bg-[var(--bg-elevated)] rounded-lg p-4 text-center">
<div class="text-3xl font-bold text-[#ffc107]">2</div>
<div class="text-xs text-[var(--fg-muted)]">Pending Review</div>
</div>
<div class="bg-[var(--bg-elevated)] rounded-lg p-4 text-center">
<div class="text-3xl font-bold text-[var(--warning)]">0</div>
<div class="text-xs text-[var(--fg-muted)]">Violations</div>
</div>
</div>
<!-- Compliance Table -->
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="text-left text-[var(--fg-muted)] border-b border-[var(--border)]">
<th class="pb-3 font-medium">Regulation</th>
<th class="pb-3 font-medium">Authority</th>
<th class="pb-3 font-medium">Due Date</th>
<th class="pb-3 font-medium">Status</th>
<th class="pb-3 font-medium">Action</th>
</tr>
</thead>
<tbody id="complianceTable">
<!-- Populated by JS -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Compliance Actions -->
<div class="space-y-4 animate-in" style="animation-delay: 0.1s">
<div class="card p-4">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Upcoming Deadlines</h3>
<div class="space-y-3" id="upcomingDeadlines">
<!-- Populated by JS -->
</div>
</div>
<div class="card p-4">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Quick Actions</h3>
<div class="space-y-2">
<button class="btn-secondary w-full text-sm text-left flex items-center gap-2">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="16" y1="13" x2="8" y2="13"/>
<line x1="16" y1="17" x2="8" y2="17"/>
</svg>
Generate Compliance Report
</button>
<button class="btn-secondary w-full text-sm text-left flex items-center gap-2">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="7 10 12 15 17 10"/>
<line x1="12" y1="15" x2="12" y2="3"/>
</svg>
Export Filing Documents
</button>
<button class="btn-secondary w-full text-sm text-left flex items-center gap-2">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<polyline points="12 6 12 12 16 14"/>
</svg>
Schedule Audit Review
</button>
</div>
</div>
<div class="card p-4">
<h3 class="text-sm font-semibold text-[var(--fg-muted)] mb-4">Climate Disclosure Score</h3>
<div class="flex items-center justify-center mb-4">
<svg width="100" height="100" viewBox="0 0 100 100" class="progress-ring">
<circle cx="50" cy="50" r="42" stroke="var(--border)" stroke-width="6" fill="none"/>
<circle cx="50" cy="50" r="42" stroke="var(--accent)" stroke-width="6" fill="none"
stroke-dasharray="264" stroke-dashoffset="21" stroke-linecap="round" class="progress-ring-circle"/>
</svg>
<div class="absolute flex items-center justify-center w-[100px] h-[100px]">
<div class="text-center">
<div class="text-xl font-bold font-mono">92%</div>
</div>
</div>
</div>
<div class="text-center text-xs text-[var(--fg-muted)]">
TCFD Aligned
</div>
</div>
</div>
</div>
</section>
</main>
<!-- Export Modal -->
<div id="exportModal" class="fixed inset-0 z-50 hidden items-center justify-center bg-black/60 backdrop-blur-sm">
<div class="card p-6 max-w-md w-full mx-4 animate-in">
<h3 class="text-lg font-semibold mb-4">Export Report</h3>
<div class="space-y-4">
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Report Type</label>
<select class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-3 py-2">
<option>Full Risk Assessment</option>
<option>Hazard Projections Only</option>
<option>Exposure Summary</option>
<option>Compliance Report</option>
</select>
</div>
<div>
<label class="text-xs text-[var(--fg-muted)] block mb-2">Format</label>
<div class="flex gap-2">
<button class="flex-1 btn-secondary text-sm">PDF</button>
<button class="flex-1 btn-primary text-sm">Excel</button>
<button class="flex-1 btn-secondary text-sm">JSON</button>
</div>
</div>
<div class="flex gap-2 mt-6">
<button class="flex-1 btn-secondary" id="closeModal">Cancel</button>
<button class="flex-1 btn-primary">Download</button>
</div>
</div>
</div>
</div>
<script>
// ==================== Data Definitions ====================
const regions = [
{ name: 'Miami-Dade Coast', risk: 82, properties: 3421, value: '$1.2B' },
{ name: 'Galveston Bay', risk: 75, properties: 2156, value: '$890M' },
{ name: 'Tampa Bay Area', risk: 68, properties: 2847, value: '$1.1B' },
{ name: 'Charleston Harbor', risk: 71, properties: 1245, value: '$520M' },
{ name: 'Norfolk-Hampton', risk: 65, properties: 3178, value: '$490M' }
];
const properties = [
{ id: 'CST-2024-0847', location: 'Miami Beach, FL', tiv: '$3,250,000', zone: 'A', score: 82, premium: '$28,450' },
{ id: 'CST-2024-1234', location: 'Galveston, TX', tiv: '$1,850,000', zone: 'A', score: 78, premium: '$15,230' },
{ id: 'CST-2024-2156', location: 'Tampa, FL', tiv: '$2,100,000', zone: 'B', score: 62, premium: '$11,340' },
{ id: 'CST-2024-3012', location: 'Charleston, SC', tiv: '$1,450,000', zone: 'B', score: 58, premium: '$7,890' },
{ id: 'CST-2024-4089', location: 'Norfolk, VA', tiv: '$980,000', zone: 'C', score: 45, premium: '$4,120' },
{ id: 'CST-2024-5023', location: 'Savannah, GA', tiv: '$1,675,000', zone: 'B', score: 55, premium: '$9,180' }
];
const zoneExposure = [
{ zone: 'Zone A (High)', count: 3421, value: '$1.8B', pct: 27, color: '#ff6b4a' },
{ zone: 'Zone B (Medium)', count: 5834, value: '$1.6B', pct: 45, color: '#ffc107' },
{ zone: 'Zone C (Low)', count: 3592, value: '$0.8B', pct: 28, color: '#00d4aa' }
];
const complianceItems = [
{ reg: 'FEMA NFIP Participation', authority: 'Federal', due: '2024-12-31', status: 'compliant' },
{ reg: 'State Wind Pool Filing', authority: 'State', due: '2024-09-30', status: 'compliant' },
{ reg: 'Climate Risk Disclosure', authority: 'SEC', due: '2024-11-15', status: 'pending' },
{ reg: 'BCAR Rating Submission', authority: 'State', due: '2024-10-01', status: 'compliant' },
{ reg: 'Cat Model Validation', authority: 'Internal', due: '2024-08-31', status: 'pending' },
{ reg: 'Solvency II Reporting', authority: 'EU', due: '2024-12-15', status: 'compliant' }
];
const riskMultipliers = [
{ factor: 'Sea Level Rise', value: 1.25 },
{ factor: 'Storm Frequency', value: 1.15 },
{ factor: 'Construction Age', value: 1.10 },
{ factor: 'Elevation Credit', value: 0.92 }
];
// ==================== State ====================
let currentTab = 'hazards';
let currentScenario = 'rcp85';
let projectionYear = 2024;
let climateScenario = 'baseline';
// ==================== DOM Elements ====================
const tabButtons = document.querySelectorAll('.tab');
const sectionPanels = document.querySelectorAll('.section-panel');
const yearSlider = document.getElementById('yearSlider');
const yearDisplay = document.getElementById('yearDisplay');
const scenarioSelect = document.getElementById('scenarioSelect');
const exportBtn = document.getElementById('exportBtn');
const exportModal = document.getElementById('exportModal');
const closeModal = document.getElementById('closeModal');
const calculatePremiumBtn = document.getElementById('calculatePremium');
const scenarioButtons = document.querySelectorAll('.scenario-btn');
const mapCanvas = document.getElementById('mapCanvas');
let mapCtx = null;
// ==================== Initialization ====================
function init() {
// Initialize canvas context
if (mapCanvas) {
mapCtx = mapCanvas.getContext('2d');
resizeCanvas();
window.addEventListener('resize', resizeCanvas);
}
renderRegionList();
renderPropertyTable();
renderZoneExposure();
renderComplianceTable();
renderUpcomingDeadlines();
renderRiskMultipliers();
setupEventListeners();
updateHazardProjections();
animateMap();
}
// ==================== Canvas Map ====================
function resizeCanvas() {
if (!mapCanvas) return;
const container = mapCanvas.parentElement;
mapCanvas.width = container.offsetWidth;
mapCanvas.height = container.offsetHeight;
drawMap();
}
function drawMap() {
if (!mapCtx) return;
const w = mapCanvas.width;
const h = mapCanvas.height;
if (w <= 0 || h <= 0) return;
// Clear canvas
mapCtx.fillStyle = '#0d1f30';
mapCtx.fillRect(0, 0, w, h);
// Draw grid
mapCtx.strokeStyle = 'rgba(0, 212, 170, 0.05)';
mapCtx.lineWidth = 1;
const gridSize = 40;
for (let x = 0; x < w; x += gridSize) {
mapCtx.beginPath();
mapCtx.moveTo(x, 0);
mapCtx.lineTo(x, h);
mapCtx.stroke();
}
for (let y = 0; y < h; y += gridSize) {
mapCtx.beginPath();
mapCtx.moveTo(0, y);
mapCtx.lineTo(w, y);
mapCtx.stroke();
}
// Draw coastline
mapCtx.beginPath();
mapCtx.moveTo(0, h * 0.3);
for (let x = 0; x <= w; x += 10) {
const y = h * 0.3 + Math.sin(x * 0.01) * 30 + Math.sin(x * 0.03) * 15;
mapCtx.lineTo(x, y);
}
mapCtx.lineTo(w, 0);
mapCtx.lineTo(0, 0);
mapCtx.closePath();
const landGradient = mapCtx.createLinearGradient(0, 0, 0, h * 0.4);
landGradient.addColorStop(0, '#162028');
landGradient.addColorStop(1, '#1a2830');
mapCtx.fillStyle = landGradient;
mapCtx.fill();
// Draw ocean
mapCtx.beginPath();
mapCtx.moveTo(0, h * 0.3);
for (let x = 0; x <= w; x += 10) {
const y = h * 0.3 + Math.sin(x * 0.01) * 30 + Math.sin(x * 0.03) * 15;
mapCtx.lineTo(x, y);
}
mapCtx.lineTo(w, h);
mapCtx.lineTo(0, h);
mapCtx.closePath();
const oceanGradient = mapCtx.createLinearGradient(0, h * 0.3, 0, h);
oceanGradient.addColorStop(0, '#0a1520');
oceanGradient.addColorStop(1, '#051015');
mapCtx.fillStyle = oceanGradient;
mapCtx.fill();
// Draw flood zones based on year
const floodExpansion = Math.max(0, (projectionYear - 2024) * 0.5);
mapCtx.beginPath();
mapCtx.moveTo(0, h * 0.35 + floodExpansion);
for (let x = 0; x <= w; x += 10) {
const y = h * 0.35 + Math.sin(x * 0.01) * 25 + Math.sin(x * 0.025) * 20 + floodExpansion;
mapCtx.lineTo(x, y);
}
mapCtx.lineTo(w, h * 0.6);
mapCtx.lineTo(0, h * 0.6);
mapCtx.closePath();
const floodGradient = mapCtx.createLinearGradient(0, h * 0.35, 0, h * 0.6);
floodGradient.addColorStop(0, 'rgba(255, 107, 74, 0.3)');
floodGradient.addColorStop(1, 'rgba(255, 107, 74, 0.05)');
mapCtx.fillStyle = floodGradient;
mapCtx.fill();
// Draw hazard points
const hazardPoints = [
{ x: 0.2, y: 0.45, risk: 'high' },
{ x: 0.35, y: 0.42, risk: 'high' },
{ x: 0.5, y: 0.48, risk: 'medium' },
{ x: 0.65, y: 0.44, risk: 'high' },
{ x: 0.8, y: 0.46, risk: 'medium' },
{ x: 0.25, y: 0.52, risk: 'medium' },
{ x: 0.55, y: 0.55, risk: 'low' },
{ x: 0.75, y: 0.5, risk: 'medium' }
];
const time = Date.now() * 0.002;
hazardPoints.forEach((point, i) => {
const x = point.x * w;
const y = point.y * h;
const pulse = Math.sin(time + i) * 0.3 + 1;
const radius = Math.max(1, (point.risk === 'high' ? 8 : point.risk === 'medium' ? 6 : 4) * pulse);
mapCtx.beginPath();
mapCtx.arc(x, y, radius, 0, Math.PI * 2);
let color;
if (point.risk === 'high') {
color = '#ff6b4a';
} else if (point.risk === 'medium') {
color = '#ffc107';
} else {
color = '#00d4aa';
}
mapCtx.fillStyle = color;
mapCtx.fill();
// Glow effect
const glowRadius = Math.max(1, radius * 2);
const glow = mapCtx.createRadialGradient(x, y, 0, x, y, glowRadius);
glow.addColorStop(0, color);
glow.addColorStop(1, 'rgba(0, 0, 0, 0)');
mapCtx.beginPath();
mapCtx.arc(x, y, glowRadius, 0, Math.PI * 2);
mapCtx.fillStyle = glow;
mapCtx.globalAlpha = 0.3;
mapCtx.fill();
mapCtx.globalAlpha = 1;
});
}
let animationId = null;
function animateMap() {
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
drawMap();
return;
}
drawMap();
animationId = requestAnimationFrame(animateMap);
}
// ==================== Render Functions ====================
function renderRegionList() {
const container = document.getElementById('regionList');
if (!container) return;
container.innerHTML = regions.map(region => `
<div class="flex items-center justify-between py-2 border-b border-[var(--border)] last:border-0">
<div>
<div class="text-sm font-medium">${region.name}</div>
<div class="text-xs text-[var(--fg-muted)]">${region.properties.toLocaleString()} properties</div>
</div>
<div class="text-right">
<div class="text-sm font-mono ${region.risk >= 70 ? 'text-[var(--warning)]' : region.risk >= 50 ? 'text-[#ffc107]' : 'text-[var(--accent)]'}">${region.risk}%</div>
<div class="text-xs text-[var(--fg-muted)]">${region.value}</div>
</div>
</div>
`).join('');
}
function renderPropertyTable() {
const container = document.getElementById('propertyTable');
if (!container) return;
container.innerHTML = properties.map(prop => `
<tr class="border-b border-[var(--border)] hover:bg-[var(--bg-elevated)] transition-colors">
<td class="py-3 font-mono text-[var(--accent)]">${prop.id}</td>
<td class="py-3">${prop.location}</td>
<td class="py-3 font-mono">${prop.tiv}</td>
<td class="py-3">
<span class="px-2 py-1 rounded text-xs ${prop.zone === 'A' ? 'bg-[var(--warning)]/20 text-[var(--warning)]' : prop.zone === 'B' ? 'bg-[#ffc107]/20 text-[#ffc107]' : 'bg-[var(--accent)]/20 text-[var(--accent)]'}">
Zone ${prop.zone}
</span>
</td>
<td class="py-3">
<span class="font-mono ${prop.score >= 70 ? 'text-[var(--warning)]' : prop.score >= 50 ? 'text-[#ffc107]' : 'text-[var(--accent)]'}">${prop.score}</span>
</td>
<td class="py-3 font-mono">${prop.premium}</td>
</tr>
`).join('');
}
function renderZoneExposure() {
const container = document.getElementById('zoneExposure');
if (!container) return;
container.innerHTML = zoneExposure.map(zone => `
<div>
<div class="flex justify-between text-sm mb-1">
<span>${zone.zone}</span>
<span class="font-mono">${zone.value}</span>
</div>
<div class="risk-meter">
<div class="risk-meter-fill" style="width: ${zone.pct}%; background: ${zone.color}"></div>
</div>
<div class="text-xs text-[var(--fg-muted)] mt-1">${zone.count.toLocaleString()} properties</div>
</div>
`).join('');
}
function renderComplianceTable() {
const container = document.getElementById('complianceTable');
if (!container) return;
container.innerHTML = complianceItems.map(item => `
<tr class="border-b border-[var(--border)]">
<td class="py-3">${item.reg}</td>
<td class="py-3 text-[var(--fg-muted)]">${item.authority}</td>
<td class="py-3 font-mono text-sm">${item.due}</td>
<td class="py-3">
<span class="flex items-center gap-2">
<span class="status-dot status-${item.status}"></span>
<span class="capitalize ${item.status === 'compliant' ? 'text-[var(--accent)]' : 'text-[#ffc107]'}">${item.status}</span>
</span>
</td>
<td class="py-3">
<button class="btn-secondary text-xs px-2 py-1">View</button>
</td>
</tr>
`).join('');
}
function renderUpcomingDeadlines() {
const container = document.getElementById('upcomingDeadlines');
if (!container) return;
const deadlines = [
{ title: 'Climate Risk Disclosure', date: 'Nov 15, 2024', days: 28 },
{ title: 'Cat Model Validation', date: 'Aug 31, 2024', days: 14 },
{ title: 'State Wind Pool Filing', date: 'Sep 30, 2024', days: 43 }
];
container.innerHTML = deadlines.map(d => `
<div class="flex items-center justify-between py-2 border-b border-[var(--border)] last:border-0">
<div>
<div class="text-sm">${d.title}</div>
<div class="text-xs text-[var(--fg-muted)]">${d.date}</div>
</div>
<div class="text-xs font-mono ${d.days <= 30 ? 'text-[var(--warning)]' : 'text-[var(--fg-muted)]'}">${d.days}d</div>
</div>
`).join('');
}
function renderRiskMultipliers() {
const container = document.getElementById('riskMultipliers');
if (!container) return;
container.innerHTML = riskMultipliers.map(m => `
<div class="flex justify-between items-center">
<span class="text-sm">${m.factor}</span>
<span class="font-mono text-sm ${m.value > 1 ? 'text-[var(--warning)]' : 'text-[var(--accent)]'}">${m.value.toFixed(2)}x</span>
</div>
`).join('');
}
// ==================== Calculations ====================
function updateHazardProjections() {
const yearDiff = projectionYear - 2024;
const scenarioMultiplier = currentScenario === 'rcp85' ? 1.5 : 1.0;
const seaLevelRise = (yearDiff * 0.0034 * scenarioMultiplier).toFixed(2);
const stormSurge = (2.4 + yearDiff * 0.015 * scenarioMultiplier).toFixed(1);
const floodProb = Math.min(99, Math.round(12 + yearDiff * 0.5 * scenarioMultiplier));
const highRisk = Math.round(847 + yearDiff * 15 * scenarioMultiplier);
const seaLevelEl = document.getElementById('seaLevelValue');
const stormSurgeEl = document.getElementById('stormSurgeValue');
const floodProbEl = document.getElementById('floodProbValue');
const highRiskEl = document.getElementById('highRiskCount');
if (seaLevelEl) seaLevelEl.textContent = `+${seaLevelRise}m`;
if (stormSurgeEl) stormSurgeEl.textContent = `${stormSurge}m`;
if (floodProbEl) {
floodProbEl.textContent = `${floodProb}%`;
floodProbEl.className = `text-xl font-semibold font-mono ${floodProb > 30 ? 'text-[var(--warning)]' : floodProb > 20 ? 'text-[#ffc107]' : ''}`;
}
if (highRiskEl) highRiskEl.textContent = highRisk.toLocaleString();
// Update hazard score
const hazardScore = Math.min(100, Math.round(50 + yearDiff * 0.5 * scenarioMultiplier));
const hazardScoreEl = document.getElementById('hazardScore');
if (hazardScoreEl) hazardScoreEl.textContent = hazardScore;
// Update progress ring
const hazardRing = document.getElementById('hazardRing');
if (hazardRing) {
const circumference = 327;
const offset = circumference - (hazardScore / 100) * circumference;
hazardRing.style.strokeDashoffset = offset;
}
}
function calculatePremium() {
const tivInput = document.getElementById('tivInput');
const riskZoneSelect = document.getElementById('riskZoneSelect');
const deductibleSelect = document.getElementById('deductibleSelect');
const tiv = parseFloat(tivInput ? tivInput.value : 2500000) || 2500000;
const zone = riskZoneSelect ? riskZoneSelect.value : 'A';
const deductible = parseFloat(deductibleSelect ? deductibleSelect.value : 1000) || 1000;
// Base rates per $1000
const baseRates = { A: 3.5, B: 2.2, C: 1.4 };
const climateLoads = { baseline: 1.0, moderate: 1.15, severe: 1.30 };
const baseRate = baseRates[zone] || 2.2;
const climateMultiplier = climateLoads[climateScenario] || 1.0;
const basePremium = (tiv / 1000) * baseRate;
const climateLoad = basePremium * 0.25 * climateMultiplier;
const zoneSurcharge = zone === 'A' ? basePremium * 0.15 : zone === 'B' ? basePremium * 0.08 : 0;
const mitigationCredit = deductible >= 5000 ? basePremium * 0.05 : 0;
const total = basePremium + climateLoad + zoneSurcharge - mitigationCredit;
const rate = (total / tiv * 1000).toFixed(2);
const basePremiumEl = document.getElementById('basePremium');
const climateLoadEl = document.getElementById('climateLoad');
const zoneSurchargeEl = document.getElementById('zoneSurcharge');
const mitigationCreditEl = document.getElementById('mitigationCredit');
const totalPremiumEl = document.getElementById('totalPremium');
const premiumRateEl = document.getElementById('premiumRate');
if (basePremiumEl) basePremiumEl.textContent = `$${Math.round(basePremium).toLocaleString()}`;
if (climateLoadEl) climateLoadEl.textContent = `+$${Math.round(climateLoad).toLocaleString()}`;
if (zoneSurchargeEl) zoneSurchargeEl.textContent = `+$${Math.round(zoneSurcharge).toLocaleString()}`;
if (mitigationCreditEl) mitigationCreditEl.textContent = `-$${Math.round(mitigationCredit).toLocaleString()}`;
if (totalPremiumEl) totalPremiumEl.textContent = `$${Math.round(total).toLocaleString()}`;
if (premiumRateEl) premiumRateEl.textContent = `Rate: $${rate} per $1,000 TIV`;
// Update loss projections
const expectedLoss = tiv * 0.0075;
const loss100 = tiv * 0.17;
const loss250 = tiv * 0.275;
const lossProjections = document.getElementById('lossProjections');
if (lossProjections) {
lossProjections.innerHTML = `
<div class="flex justify-between">
<span class="text-sm">Expected Annual Loss</span>
<span class="font-mono">$${Math.round(expectedLoss).toLocaleString()}</span>
</div>
<div class="flex justify-between">
<span class="text-sm">1-in-100 Year Loss</span>
<span class="font-mono">$${Math.round(loss100).toLocaleString()}</span>
</div>
<div class="flex justify-between">
<span class="text-sm">1-in-250 Year Loss</span>
<span class="font-mono text-[var(--warning)]">$${Math.round(loss250).toLocaleString()}</span>
</div>
`;
}
}
// ==================== Event Listeners ====================
function setupEventListeners() {
// Tab navigation
tabButtons.forEach(btn => {
btn.addEventListener('click', () => {
const tab = btn.dataset.tab;
tabButtons.forEach(b => {
b.classList.remove('active');
b.setAttribute('aria-selected', 'false');
});
btn.classList.add('active');
btn.setAttribute('aria-selected', 'true');
sectionPanels.forEach(panel => {
panel.classList.remove('active');
});
const targetSection = document.getElementById(`${tab}-section`);
if (targetSection) {
targetSection.classList.add('active');
}
currentTab = tab;
});
});
// Year slider
if (yearSlider) {
yearSlider.addEventListener('input', (e) => {
projectionYear = parseInt(e.target.value);
if (yearDisplay) yearDisplay.textContent = projectionYear;
updateHazardProjections();
drawMap();
});
}
// Scenario select
if (scenarioSelect) {
scenarioSelect.addEventListener('change', (e) => {
currentScenario = e.target.value;
updateHazardProjections();
drawMap();
});
}
// Scenario buttons
scenarioButtons.forEach(btn => {
btn.addEventListener('click', () => {
scenarioButtons.forEach(b => b.classList.remove('active'));
btn.classList.add('active');
climateScenario = btn.dataset.scenario;
calculatePremium();
});
});
// Calculate premium button
if (calculatePremiumBtn) {
calculatePremiumBtn.addEventListener('click', calculatePremium);
}
// Export modal
if (exportBtn) {
exportBtn.addEventListener('click', () => {
if (exportModal) exportModal.classList.remove('hidden');
if (exportModal) exportModal.classList.add('flex');
});
}
if (closeModal) {
closeModal.addEventListener('click', () => {
if (exportModal) exportModal.classList.add('hidden');
if (exportModal) exportModal.classList.remove('flex');
});
}
if (exportModal) {
exportModal.addEventListener('click', (e) => {
if (e.target === exportModal) {
exportModal.classList.add('hidden');
exportModal.classList.remove('flex');
}
});
}
// Keyboard navigation for tabs
tabButtons.forEach((btn, index) => {
btn.addEventListener('keydown', (e) => {
let newIndex = index;
if (e.key === 'ArrowRight') {
newIndex = (index + 1) % tabButtons.length;
} else if (e.key === 'ArrowLeft') {
newIndex = (index - 1 + tabButtons.length) % tabButtons.length;
}
if (newIndex !== index) {
tabButtons[newIndex].focus();
tabButtons[newIndex].click();
}
});
});
}
// Initialize on DOM ready
document.addEventListener('DOMContentLoaded', init);
</script>
</body>
</html>
This climate analytics platform provides four integrated modules for coastal insurance underwriting: