/* AEDO Engineering brand tokens (from Website-deploy/style.css), light-BG variant */
:root {
  --bg: #f3f6fb; --bg2: #edf1f7; --panel: #ffffff; --panel-2: #f3f6fb;
  --text: #0c1a2a; --muted: #3a5570; --muted2: #7a95aa;
  --border: rgba(12,26,42,0.10);
  --accent: #e86100; --accent2: #ff7a30; --navy: #1a3a5c; --navy2: #24507c;
  --warn-bg: #fff3e0; --warn-border: #e86100; --warn-text: #7a3c00;
  --ok: #1e7e34;
  --shadow: 0 2px 20px rgba(12,26,42,0.08);
  --shadow-lg: 0 12px 32px rgba(12,26,42,0.14);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Inter', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
/* Always light — no dark-mode variant by request. */
* { box-sizing: border-box; }
.hidden { display: none !important; }
body {
  margin: 0; font-family: var(--font);
  background: var(--bg); color: var(--text); line-height: 1.5;
}
.app-header { padding: 24px 32px 12px; background: var(--navy); color: #fff; }
.app-header h1 { margin: 0; font-size: 1.6rem; color: #fff; }
.subtitle { color: #b9c9da; margin: 4px 0 0; font-size: 0.9rem; }
.byline { color: #b9c9da; margin: 2px 0 0; font-size: 0.78rem; font-style: italic; }

.step-nav {
  display: flex; gap: 6px; padding: 14px 32px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); background: var(--panel);
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 4px 16px rgba(12,26,42,0.06);
}
.step-btn {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.step-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 14px rgba(232,97,0,0.28); }
.step-btn:hover:not(.active) { border-color: var(--accent2); color: var(--accent); transform: translateY(-1px); }
.step-btn:active { transform: translateY(0); }

main { padding: 24px 32px 60px; max-width: 1200px; margin: 0 auto; }
.step.hidden { display: none; }
.step { animation: pageIn 0.35s var(--ease); }
.step h2 { margin-top: 0; color: var(--navy); letter-spacing: -0.01em; }
.note { color: var(--muted); font-size: 0.85rem; max-width: 900px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; overflow-x: auto; box-shadow: var(--shadow);
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.card h3 { margin-top: 0; font-size: 1rem; color: var(--navy); }

label { display: block; margin-bottom: 12px; font-size: 0.85rem; color: var(--muted); }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 0.9rem;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s var(--ease);
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,97,0,0.14); }
input:disabled { background: var(--panel-2); color: var(--muted2); cursor: not-allowed; opacity: 0.6; }

.btn-primary {
  background: var(--accent); color: #fff; border: none; padding: 10px 18px;
  border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600; margin-top: 8px;
  transition: background-color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(232,97,0,0.3); }
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-primary:disabled { background: var(--muted2); cursor: not-allowed; opacity: 0.6; transform: none; box-shadow: none; }
.btn-primary:disabled:hover { background: var(--muted2); }

.dropdown {
  position: relative; background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; margin-top: 2px; max-height: 200px; overflow-y: auto;
}
.dropdown:empty { display: none; }
.dropdown-item { padding: 8px 10px; cursor: pointer; font-size: 0.85rem; }
.dropdown-item:hover { background: var(--accent); color: #fff; }
.selected-tag {
  display: inline-block; background: var(--panel-2); border: 1px solid var(--accent);
  color: var(--navy); padding: 4px 10px; border-radius: 6px; font-size: 0.8rem;
  margin-bottom: 10px; min-height: 1em;
}

.derived { font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.derived div { margin-bottom: 4px; }

.summary { font-size: 0.85rem; margin-bottom: 12px; }
.summary div { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--border); animation: rowIn 0.35s var(--ease) backwards; }
.summary .label { color: var(--muted); }

/* Freshly-rendered rows animate in with a soft cascade — every innerHTML
   swap creates new nodes, so this replays automatically on each recompute. */
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}
.summary div:nth-child(n)  { animation-delay: calc(var(--i, 0) * 18ms); }
.summary div:nth-child(1)  { --i: 1; }  .summary div:nth-child(2)  { --i: 2; }
.summary div:nth-child(3)  { --i: 3; }  .summary div:nth-child(4)  { --i: 4; }
.summary div:nth-child(5)  { --i: 5; }  .summary div:nth-child(6)  { --i: 6; }
.summary div:nth-child(7)  { --i: 7; }  .summary div:nth-child(8)  { --i: 8; }
.summary div:nth-child(9)  { --i: 9; }  .summary div:nth-child(10) { --i: 10; }
.summary div:nth-child(11) { --i: 11; } .summary div:nth-child(12) { --i: 12; }
.summary div:nth-child(13) { --i: 13; } .summary div:nth-child(14) { --i: 14; }
.summary div:nth-child(15) { --i: 15; } .summary div:nth-child(16) { --i: 16; }

.result-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 10px; }
.result-table th, .result-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.result-table th { color: var(--muted); font-weight: 600; }
.result-table.hidden { display: none; }
.result-table tbody tr { animation: rowIn 0.3s var(--ease) backwards; }
.result-table tbody tr:nth-child(n)  { animation-delay: calc(var(--i, 0) * 16ms); }
.result-table tbody tr:nth-child(1)  { --i: 1; }  .result-table tbody tr:nth-child(2)  { --i: 2; }
.result-table tbody tr:nth-child(3)  { --i: 3; }  .result-table tbody tr:nth-child(4)  { --i: 4; }
.result-table tbody tr:nth-child(5)  { --i: 5; }  .result-table tbody tr:nth-child(6)  { --i: 6; }
.result-table tbody tr:nth-child(7)  { --i: 7; }  .result-table tbody tr:nth-child(8)  { --i: 8; }
.result-table tbody tr:nth-child(9)  { --i: 9; }  .result-table tbody tr:nth-child(10) { --i: 10; }
.result-table tbody tr:nth-child(11) { --i: 11; } .result-table tbody tr:nth-child(12) { --i: 12; }
.result-table tbody tr:nth-child(13) { --i: 13; } .result-table tbody tr:nth-child(14) { --i: 14; }
.result-table tbody tr:nth-child(15) { --i: 15; } .result-table tbody tr:nth-child(16) { --i: 16; }
.result-table tbody tr:nth-child(17) { --i: 17; } .result-table tbody tr:nth-child(18) { --i: 18; }
/* Sign-based value coloring (green=positive/inward, red=negative/suction) —
   convention ported from the audited buildx_nscp_kit wind calculator. */
.val-pos { color: #1B5E20; font-weight: 600; }
.val-neg { color: #B71C1C; font-weight: 600; }
.result-table tr.zone-end { background: rgba(30, 58, 92, 0.045); }
.zone-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.zone-dot.windward { background: #1B5E20; }
.zone-dot.leeward { background: #B71C1C; }
.zone-dot.side { background: #4A148C; }

.warning {
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text);
  padding: 10px 14px; border-radius: 8px; font-size: 0.82rem; margin-bottom: 12px;
}
.warning.hidden { display: none; }
.warning.critical {
  background: #fdecea; border-color: #c62828; color: #7a1315; font-weight: 600;
}

.app-footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 20px; }

/* ── Diaphragm live-load zones (add/remove rows) ── */
.ll-zone-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 10px;
  animation: rowIn 0.3s var(--ease) backwards;
}
.ll-zone-row select { flex: 2; margin-top: 0; }
.ll-zone-row input.ll-zone-label { flex: 1; margin-top: 0; }
/* Vertical-distribution storey rows reuse .ll-zone-row's flex shell. */
.ll-zone-row input.se-story-level { flex: 2; margin-top: 0; }
.ll-zone-row input.se-story-w,
.ll-zone-row input.se-story-h { flex: 1; margin-top: 0; min-width: 0; }
.ll-zone-row .ll-zone-remove {
  flex-shrink: 0; background: var(--panel-2); color: var(--muted2); border: 1px solid var(--border);
  border-radius: 6px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; line-height: 1;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.ll-zone-row .ll-zone-remove:hover { border-color: #c62828; color: #c62828; }
.ll-zone-row .ll-zone-remove:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── NSCP-Kit-style numbered steps ── */
.inner-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.inner-tab, .inner-tab-seismic {
  background: none; border: none; padding: 10px 16px; cursor: pointer; font-size: 0.9rem;
  font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.inner-tab.active, .inner-tab-seismic.active { color: var(--accent); border-bottom-color: var(--accent); }
.inner-tab:disabled, .inner-tab-seismic:disabled { color: var(--muted2); cursor: not-allowed; }
.inner-tab:hover:not(.active), .inner-tab-seismic:hover:not(.active) { color: var(--accent2); }

.info-banner {
  background: #eaf2fb; border: 1px solid #b9d4f0; color: var(--navy);
  padding: 10px 14px; border-radius: 8px; font-size: 0.82rem; margin-bottom: 20px;
}

.step-block { margin-bottom: 28px; }
.step-block-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff;
  font-size: 0.8rem; font-weight: 700; flex-shrink: 0;
}
.step-block-title h4 { margin: 0; font-size: 1rem; color: var(--navy); }
.step-block-sub { color: var(--muted); font-size: 0.8rem; margin: 0 0 12px 34px; }

.option-cards { display: grid; gap: 10px; margin-left: 34px; }
.option-card {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; cursor: pointer; text-align: left;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.option-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(12,26,42,0.08); }
.option-card.selected { border-color: var(--accent); background: #fff3e0; box-shadow: 0 4px 14px rgba(232,97,0,0.16); }
.option-card .oc-title { font-weight: 700; font-size: 0.9rem; color: var(--navy); }
.option-card .oc-desc { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.option-card .oc-meta { color: var(--accent); font-size: 0.75rem; font-weight: 600; margin-top: 4px; }
.option-card .oc-check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
  flex-shrink: 0; transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.option-card.selected .oc-check { background: var(--accent); border-color: var(--accent); transform: scale(1.08); }

.option-row { display: flex; gap: 10px; margin-left: 34px; flex-wrap: wrap; }
.option-btn {
  flex: 1; min-width: 120px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; cursor: pointer; text-align: center;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.option-btn:hover:not(.selected) { transform: translateY(-1px); border-color: var(--accent2); }
.option-btn.selected { background: var(--navy); color: #fff; border-color: var(--navy); box-shadow: 0 4px 14px rgba(26,58,92,0.28); }
.option-btn .ob-title { font-weight: 700; font-size: 0.9rem; }
.option-btn .ob-sub { font-size: 0.75rem; opacity: 0.8; margin-top: 2px; }

.fields-inline { margin-left: 34px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; margin-bottom: 4px; }
.field-group-label {
  margin-left: 34px; margin-top: 16px; margin-bottom: 8px; font-size: 0.78rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted2);
}
.field-group-label.optional { text-transform: none; font-weight: 600; color: var(--muted); font-style: italic; }
.toggle-row {
  display: flex; justify-content: space-between; align-items: center; margin-left: 34px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px;
  margin-bottom: 10px;
}
.toggle-row .tr-title { font-weight: 600; font-size: 0.85rem; }
.toggle-row .tr-sub { color: var(--muted); font-size: 0.75rem; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 24px;
  transition: 0.15s;
}
.slider:before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.15s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(18px); }

/* ── Carousel ── */
.carousel-progress { display: flex; gap: 6px; margin-bottom: 16px; }
.carousel-progress .prog-dot { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.carousel-progress .prog-dot.done { background: var(--accent2); }
.carousel-progress .prog-dot.current { background: var(--accent); }
.step-block { display: none; }
.step-block.current { display: block; }
.step-block.current.step-anim-in { animation: stepIn 0.4s var(--ease); }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.carousel-nav { display: flex; gap: 10px; margin: 0 0 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.btn-secondary {
  background: var(--panel-2); color: var(--navy); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600;
  transition: border-color 0.2s var(--ease), transform 0.15s var(--ease), background-color 0.2s var(--ease);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--navy); background: #eaf1f8; transform: translateY(-1px); }
.btn-secondary:active:not(:disabled) { transform: translateY(0); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Result cards — live, colored panels (AEDO navy tint + orange accent) ── */
.result-card {
  background: linear-gradient(165deg, #eef4fb 0%, #e3edf7 100%);
  border: 1px solid rgba(26,58,92,0.16);
  border-top: 4px solid var(--accent);
  position: relative;
}
.result-card h3 { display: flex; align-items: center; gap: 8px; }
.result-card h3::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 3px rgba(30,126,52,0.18);
  animation: livePulse 2.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(30,126,52,0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(30,126,52,0.05); }
}
.result-card .summary div, .result-card .result-table td, .result-card .result-table th {
  border-bottom-color: rgba(26,58,92,0.10);
}
.result-card .result-table { background: rgba(255,255,255,0.5); border-radius: 8px; }
/* Flashed briefly every time recomputed values land, so a live update
   reads as a clear, deliberate moment rather than a silent DOM swap. */
.result-card.flash-update { animation: resultFlash 0.6s var(--ease); }
@keyframes resultFlash {
  0%   { box-shadow: 0 0 0 0 rgba(232,97,0,0.35), var(--shadow); }
  35%  { box-shadow: 0 0 0 6px rgba(232,97,0,0.14), var(--shadow-lg); transform: translateY(-2px); }
  100% { box-shadow: 0 0 0 0 rgba(232,97,0,0), var(--shadow); transform: translateY(0); }
}
.result-section { margin-bottom: 16px; padding-left: 10px; border-left: 3px solid var(--border); }
.result-section.hidden { display: none; }
.result-section h4 { margin: 0 0 6px; font-size: 0.9rem; }
#wl_dlSection { border-left-color: #1a3a5c; }
#wl_dlSection h4 { color: #1a3a5c; }
#wl_llSection { border-left-color: #1e7e34; }
#wl_llSection h4 { color: #1e7e34; }
#wl_wlSection { border-left-color: #e86100; }
#wl_wlSection h4 { color: #e86100; }
.val-dl { color: #1a3a5c; font-weight: 600; }
.val-ll { color: #1e7e34; font-weight: 600; }
.val-wl { color: #b25400; font-weight: 600; }
.val-suction { color: #c62828; font-weight: 700; }

/* ── Info popover ── */
.info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--muted2);
  background: var(--panel); color: var(--muted); font-size: 0.7rem; font-weight: 700;
  cursor: pointer; flex-shrink: 0; line-height: 1;
}
.info-btn:hover { border-color: var(--accent); color: var(--accent); }
.info-popover {
  position: fixed; z-index: 100; max-width: 360px; background: var(--panel);
  border: 1px solid var(--accent); border-radius: 10px; padding: 14px 16px;
  box-shadow: var(--shadow); font-size: 0.82rem; color: var(--text); line-height: 1.5;
}
.info-popover .ip-title { font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.info-popover.hidden { display: none; }

/* ── Terrain diagram + animated wind flow ── */
.terrain-svg { width: 100%; height: auto; display: block; margin-bottom: 10px; border-radius: 8px; }
.wind-arrow { animation: windFlow 2.4s linear infinite; }

/* ── License gate (PayMongo paywall) ── */
body:not(.license-unlocked) .app-header,
body:not(.license-unlocked) #stepNav,
body:not(.license-unlocked) #app,
body:not(.license-unlocked) .app-footer { display: none !important; }
.lg-overlay { display: none; }
body:not(.license-unlocked) .lg-overlay {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background: linear-gradient(135deg, var(--navy), #0c2038);
}
.lg-panel {
  width: 100%; max-width: 420px; background: var(--panel); color: var(--text);
  border-radius: 16px; padding: 32px 30px; box-shadow: var(--shadow-lg);
}
.lg-logo { font-size: 1.4rem; font-weight: 800; color: var(--navy); letter-spacing: -0.01em; margin: 0 0 4px; }
.lg-logo span { color: var(--accent); }
.lg-tagline { color: var(--muted); font-size: 0.85rem; margin: 0 0 20px; line-height: 1.5; }
.lg-loading { color: var(--muted); font-size: 0.9rem; margin: 24px 0 0; }
.lg-price {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin: 0 0 20px;
}
.lg-price-amount { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.lg-price-note { font-size: 0.75rem; color: var(--muted); }
.lg-panel label { margin-bottom: 14px; }
.lg-btn-full { width: 100%; text-align: center; }
.lg-status { font-size: 0.8rem; color: var(--muted); min-height: 1.1em; margin: 10px 0 0; text-align: center; }
.lg-error {
  font-size: 0.8rem; color: #b02a1f; background: #fdecea; border: 1px solid #e8a49c;
  border-radius: 8px; padding: 10px 12px; margin: 10px 0 0;
}
.lg-toggle {
  display: block; text-align: center; margin-top: 18px; font-size: 0.8rem;
  color: var(--navy2); text-decoration: none;
}
.lg-toggle:hover { color: var(--accent); text-decoration: underline; }
@keyframes windFlow {
  0%   { transform: translateX(-40px); opacity: 0; }
  10%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateX(300px); opacity: 0; }
}
.wind-arrow-v { animation: windFlowV 2.4s linear infinite; }
@keyframes windFlowV {
  0%   { transform: translateY(-40px); opacity: 0; }
  10%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateY(300px); opacity: 0; }
}
/* Earthquake shockwave rings — expanding, fading circles from an epicenter,
   used by the Seismic Source Type info diagram. */
.eq-pulse {
  fill: none; stroke: #E53935; stroke-width: 2.5;
  r: 6px; opacity: 0.9;
  animation: eqPulse 2.4s ease-out infinite;
}
@keyframes eqPulse {
  0%   { r: 6px; opacity: 0.85; stroke-width: 3px; }
  100% { r: 66px; opacity: 0; stroke-width: 0.5px; }
}
