/* ==========================================================================
   Traders Bridge (TXB) — Base, Typography, Navigation, Forms & Footer
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

@media (pointer: fine) {
  html {
    overscroll-behavior: none;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.nav-open {
  overflow: hidden;
}

/* Browser Surface Craft */
::selection {
  background-color: var(--txb-electric-blue);
  color: var(--txb-white);
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--txb-light-blue);
}

::-webkit-scrollbar-thumb {
  background: #BFD3F2;
  border-radius: 999px;
  border: 2px solid var(--txb-light-blue);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--txb-electric-blue);
}

/* Focus & Accessibility */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: var(--z-skip);
  padding: 12px 18px;
  background: var(--txb-deep-navy);
  color: var(--txb-white);
  font-weight: 700;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease-standard);
}

.skip-link:focus {
  top: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Base Elements */
h1, h2, h3, h4 {
  margin-top: 0;
  color: var(--text-primary);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p {
  margin-top: 0;
  color: var(--text-secondary);
}

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 3px;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

img, svg {
  display: block;
  max-width: 100%;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  width: min(var(--container-max), calc(100% - (var(--gutter) * 2)));
  margin-inline: auto;
}

.measure {
  max-width: 68ch;
}

/* Top Brand Accent Strip */
.txb-topline {
  height: 4px;
  background: linear-gradient(90deg, var(--txb-deep-navy) 0%, var(--txb-electric-blue) 60%, #5BA2FF 100%);
}

/* Original TXB Brand Lockup (Untouched Identity) */
.txb-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
  min-height: 44px;
}

.txb-brandmark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--txb-electric-blue);
  color: var(--txb-white);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: 0 8px 20px rgba(22, 119, 245, 0.24);
  flex-shrink: 0;
}

.txb-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.txb-brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.txb-brand-sub {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  transition: box-shadow var(--dur-base) var(--ease-standard), border-color var(--dur-base) var(--ease-standard);
}

.site-header.is-scrolled {
  box-shadow: var(--shadow-sm);
  border-bottom-color: #D4E1F5;
}

.header-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--txb-electric-blue);
  background-color: var(--txb-light-blue);
}

.nav-link.is-active {
  color: var(--txb-electric-blue);
  font-weight: 700;
}

.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background-color: var(--txb-electric-blue);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 268px;
  padding: 10px;
  background: var(--txb-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out-expo), visibility var(--dur-fast) ease;
  z-index: var(--z-header);
}

.nav-dropdown.is-open .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (hover: hover) {
  .nav-dropdown:hover .nav-dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

.nav-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background-color var(--dur-fast) ease;
}

.nav-dropdown-item:hover {
  background-color: var(--txb-light-blue);
}

.nav-dropdown-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--txb-light-blue);
  color: var(--txb-electric-blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.nav-dropdown-item strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-dropdown-item span {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out-expo),
              background-color var(--dur-fast) ease,
              border-color var(--dur-fast) ease,
              color var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease;
}

.btn-primary {
  background-color: var(--txb-electric-blue);
  color: var(--txb-white);
  box-shadow: var(--shadow-blue);
}

.btn-primary:hover {
  background-color: var(--txb-electric-blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(22, 119, 245, 0.30);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  background-color: var(--txb-white);
  color: var(--txb-deep-navy);
  border-color: var(--border-interactive);
}

.btn-outline:hover {
  background-color: var(--txb-light-blue);
  border-color: var(--txb-electric-blue);
  color: var(--txb-electric-blue);
  transform: translateY(-2px);
}

.btn-navy {
  background-color: var(--txb-deep-navy);
  color: var(--txb-white);
}

.btn-navy:hover {
  background-color: var(--txb-electric-blue);
  transform: translateY(-2px);
}

.btn-white {
  background-color: var(--txb-white);
  color: var(--txb-deep-navy);
}

.btn-white:hover {
  background-color: var(--txb-light-blue);
  transform: translateY(-2px);
}

.btn-outline-inverse {
  background-color: transparent;
  color: var(--txb-white);
  border-color: rgba(255, 255, 255, 0.42);
}

.btn-outline-inverse:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: var(--txb-white);
}

.btn-sm {
  min-height: 44px;
  padding: 10px 16px;
  font-size: 13px;
}

.btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Mobile Menu Toggle & Drawer */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-subtle);
  background: var(--txb-white);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  background: rgba(9, 11, 105, 0.48);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) ease, visibility var(--dur-base) ease;
}

.mobile-drawer.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 90vw);
  background: var(--txb-white);
  padding: 20px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform var(--dur-base) var(--ease-out-expo);
  box-shadow: var(--shadow-lg);
}

.mobile-drawer.is-open .mobile-drawer-panel {
  transform: translateX(0);
}

.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-drawer-close {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--txb-light-blue);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.mobile-nav {
  display: grid;
  gap: 4px;
}

.mobile-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.mobile-nav a.is-active,
.mobile-nav a:hover {
  background: var(--txb-light-blue);
  color: var(--txb-electric-blue);
}

/* Section Shared Structure */
.section {
  padding: var(--section-py) 0;
  position: relative;
}

.section-tint {
  background-color: var(--txb-light-blue);
  border-block: 1px solid var(--border-subtle);
}

.section-navy {
  background-color: var(--txb-deep-navy);
  color: var(--txb-white);
}

.section-navy h2,
.section-navy h3 {
  color: var(--txb-white);
}

.section-navy p {
  color: rgba(255, 255, 255, 0.80);
}

.section-head {
  max-width: 720px;
  margin-bottom: clamp(32px, 4.5vw, 52px);
}

.section-head-centered {
  margin-inline: auto;
  text-align: center;
}

.section-head-centered p {
  margin-inline: auto;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--txb-electric-blue);
  margin-bottom: 12px;
}

.section-label-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--txb-electric-blue);
}

.section-head h2 {
  font-size: var(--text-3xl);
  margin-bottom: 14px;
}

.section-head p {
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 0;
}

/* Forms */
.txb-form-card {
  background: var(--txb-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: clamp(22px, 3.5vw, 38px);
  box-shadow: var(--shadow-md);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.form-label .req {
  color: var(--txb-electric-blue);
}

.form-control {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid #D5E0F0;
  border-radius: var(--radius-sm);
  background-color: var(--txb-white);
  color: var(--text-primary);
  font-size: 16px; /* Prevents iOS zoom */
  line-height: 1.4;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.form-control::placeholder {
  color: #8492A6;
}

.form-control:hover {
  border-color: #AEC5EB;
}

.form-control:focus {
  outline: none;
  border-color: var(--txb-electric-blue);
  box-shadow: 0 0 0 3.5px rgba(22, 119, 245, 0.14);
}

.form-control.is-invalid {
  border-color: var(--txb-danger);
  box-shadow: 0 0 0 3px rgba(201, 53, 53, 0.12);
}

select.form-control {
  height: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

textarea.form-control {
  min-height: 112px;
  resize: vertical;
}

.form-helper {
  font-size: 12px;
  color: var(--text-secondary);
}

.form-error {
  font-size: 12px;
  font-weight: 600;
  color: var(--txb-danger);
  min-height: 16px;
}

.dynamic-group {
  grid-column: 1 / -1;
  background: var(--txb-light-blue);
  border: 1px solid var(--border-interactive);
  border-radius: var(--radius-md);
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.dynamic-group[hidden] {
  display: none;
}

.dynamic-group-title {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 800;
  color: var(--txb-deep-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--txb-light-blue);
  border: 1px solid var(--border-subtle);
  margin: 20px 0 8px;
  cursor: pointer;
}

.consent-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--txb-electric-blue);
  flex-shrink: 0;
  cursor: pointer;
}

.consent-row span {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
}

.form-status-box {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.form-status-box[hidden] {
  display: none;
}

.form-status-box.is-success {
  background: var(--txb-success-bg);
  border: 1px solid #A7F3D0;
  color: #065F46;
}

.form-status-box.is-error {
  background: var(--txb-danger-bg);
  border: 1px solid #FECACA;
  color: #991B1B;
}

.error-summary {
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--txb-danger-bg);
  border: 1px solid #FECACA;
  color: #991B1B;
  font-size: 13px;
}

.error-summary[hidden] {
  display: none;
}

.error-summary ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.error-summary a {
  text-decoration: underline;
  font-weight: 600;
}

/* Footer */
.site-footer {
  background-color: var(--txb-deep-navy);
  color: var(--txb-white);
  padding: clamp(56px, 6vw, 84px) 0 28px;
  position: relative;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr 1fr 1.15fr;
  gap: clamp(28px, 4vw, 48px);
}

.site-footer .txb-brand-name {
  color: var(--txb-white);
}

.site-footer .txb-brand-sub {
  color: #B4C6EE;
}

.footer-summary {
  margin-top: 18px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #C7D4EE;
  max-width: 34ch;
}

.footer-col h3 {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #84B7FF;
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.footer-links a,
.footer-links span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  font-size: 13.5px;
  color: #D9E4FA;
  transition: color var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.footer-links a:hover {
  color: var(--txb-white);
  transform: translateX(3px);
}

.footer-disclaimer {
  margin-top: 44px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12.5px;
  line-height: 1.7;
  color: #C4D2EE;
}

.footer-bottom {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12.5px;
  color: #B7C7E6;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-legal a {
  color: #D4E0F7;
}

.footer-legal a:hover {
  color: var(--txb-white);
  text-decoration: underline;
}

/* Back to Top */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: var(--z-sticky);
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-interactive);
  background: var(--txb-white);
  color: var(--txb-deep-navy);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--dur-base) ease, transform var(--dur-base) var(--ease-out-expo), visibility var(--dur-base) ease, background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

body.input-focused .back-to-top {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.back-to-top:hover {
  background: var(--txb-electric-blue);
  color: var(--txb-white);
  border-color: var(--txb-electric-blue);
}

/* Responsive Breakpoints */
@media (max-width: 1080px) {
  .desktop-nav {
    display: none;
  }
  .header-actions .btn {
    display: none;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .footer-links a,
  .footer-legal a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 680px) {
  .form-grid,
  .dynamic-group {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .site-footer {
    padding-bottom: 84px;
  }
  .back-to-top {
    right: 14px;
    bottom: 14px;
    width: 44px;
    height: 44px;
  }
}
