/* =========================================================
   Truthfarian Declaration Form — Bootstrap override layer
   Uses existing BRICS / Truthfarian tokens from styles.css
   ========================================================= */

#tfl-declaration {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 10px 30px rgba(26, 14, 5, 0.04);
}

#tfl-declaration h4 {
  font-family: var(--f-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 1.25rem !important;
}

#tfl-declaration .form-label,
#tfl-declaration legend.form-label {
  display: block;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 0.55rem;
}

#tfl-declaration .form-text {
  font-family: var(--f-body);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-light);
  margin-top: 0.2rem;
  margin-bottom: 0.75rem;
}

#tfl-declaration .text-danger {
  color: var(--gold) !important;
  font-weight: 700;
}

#tfl-declaration .form-select,
#tfl-declaration .form-control {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.85rem 1rem;
  box-shadow: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#tfl-declaration .form-select {
  font-family: var(--f-body);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.8rem;
}

#tfl-declaration .form-select:focus,
#tfl-declaration .form-control:focus,
#tfl-declaration .form-check-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 0.2rem rgba(200, 120, 10, 0.15);
  outline: none;
}

#tfl-declaration .form-select:hover,
#tfl-declaration .form-control:hover {
  border-color: var(--gold);
  background-color: var(--white);
}

#tfl-declaration fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

#tfl-declaration .form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  transition: border-color 0.18s ease, background 0.18s ease;
}

#tfl-declaration .form-check:hover {
  border-color: var(--gold);
  background: var(--bg-gold);
}

#tfl-declaration .form-check-input {
  margin-top: 0.2rem;
  flex: 0 0 auto;
  border-color: var(--border-dark);
}

#tfl-declaration .form-check-input:checked {
  background-color: var(--gold);
  border-color: var(--gold);
}

#tfl-declaration .form-check-label {
  font-family: var(--f-body);
  font-size: 1rem;
  color: var(--text);
  line-height: 1.45;
  cursor: pointer;
}

#tfl-declaration .row.g-2 {
  --bs-gutter-x: 0.75rem;
  --bs-gutter-y: 0.75rem;
}

#tfl-declaration #wrap-time-single,
#tfl-declaration #wrap-time-range,
#tfl-declaration #wrap-time-ongoing {
  padding: 1rem;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 10px;
}

#tfl-declaration .alert {
  border-radius: 10px;
  padding: 0.95rem 1rem;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1.6;
  border-width: 1px;
  border-style: solid;
  margin: 2rem 0;
}

#tfl-declaration .alert-warning {
  color: #8a5a00;
  background: #fff7e6;
  border-color: #f0d7a6;
}

#tfl-declaration .alert-success {
  color: #215c38;
  background: #edf9f1;
  border-color: #b9dec5;
}

#tfl-declaration .alert-danger {
  color: #7a1f1f;
  background: #fff1f1;
  border-color: #e5bcbc;
}

#tfl-declaration .mb-3:last-of-type {
  margin-bottom: 1rem !important;
}

#tfl-declaration .visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Optional button styling if you add one below the status */
#tfl-declaration .btn-portal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0.95rem 1.4rem;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--gold);
  color: var(--white);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

#tfl-declaration .btn-portal:hover {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
  transform: translateY(-1px);
}

#tfl-declaration .btn-portal:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* Hero usage */

.portal-storyboard{margin: 0 auto;
    width: 90vw;
    padding: 2rem 0;}

@media (max-width: 768px) {
  #tfl-declaration {
    padding: 0;
    border-radius: 10px;border: 0;
  }

  #tfl-declaration h4 {
    font-size: 1.25rem;
  }

  #tfl-declaration .form-label,
  #tfl-declaration legend.form-label {
    font-size: 0.64rem;
  }

  #tfl-declaration .form-select,
  #tfl-declaration .form-control {
    min-height: 48px;
    font-size: 0.95rem;
  }

  #tfl-declaration .row.g-2 > .col {
    flex: 0 0 100%;
    width: 100%;
  }
}
#tfl-declaration .tfl-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  gap: 1.5rem;
  align-items: start;
}

#tfl-declaration .tfl-col {
  min-width: 0;
}

#tfl-declaration .tfl-col-left,
#tfl-declaration .tfl-col-right {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

#tfl-declaration .tfl-col-right {
  background: var(--bg-warm);
}

#tfl-declaration .tfl-actions {
  margin-top: 1.25rem;
}

#tfl-declaration .tfl-continue-wrap {
  display: flex;
  justify-content: center;
}

#tfl-declaration .btn-portal {
  min-width: 220px;margin: 1.5rem 0;
}

#tfl-declaration #wrap-time-single,
#tfl-declaration #wrap-time-range,
#tfl-declaration #wrap-time-ongoing {
  margin-top: 1rem;
}

#tfl-declaration .row.g-2 {
  --bs-gutter-x: 0.75rem;
  --bs-gutter-y: 0.75rem;
}

@media (max-width: 991.98px) {
  #tfl-declaration .tfl-grid {
    grid-template-columns: 1fr;
  }

  #tfl-declaration .tfl-col-left,
  #tfl-declaration .tfl-col-right {
    padding: 1rem;
  }
}

@media (max-width: 767.98px) {
  #tfl-declaration .tfl-continue-wrap {
    justify-content: stretch;
  }

  #tfl-declaration .btn-portal {
    width: 100%;
    min-width: 0;
  }
}
#tfl-declaration-status.d-none,
#tfl-declaration-status:empty {
  display: none !important;
}

#page-status.d-none,
#page-status:empty {
  display: none !important;
}

.tfl-workspace {
  scroll-margin-top: 120px;
}

.tfl-workspace__inner {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  background: var(--white);
}

.tfl-review-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: var(--bg-warm);
}

.tfl-review-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.tfl-review-item strong {
  display: block;
  margin-bottom: 0.2rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#page-status.d-none,
#page-status:empty {
  display: none !important;
}

.tfl-workspace {
  scroll-margin-top: 120px;padding: 2.2rem 0;
}

.tfl-workspace__inner {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  background: var(--white);
}

.tfl-workspace__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.tfl-review-card,
.tfl-output-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--bg-warm);
}

.tfl-review-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.tfl-review-item strong {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tfl-output-textarea {
  height: 100%;
  overflow:auto;width: 100%;
  white-space: pre-wrap;
  resize: vertical;
}

@media (max-width: 768px) {
  .tfl-output-textarea {
    min-height: 320px;
    max-height: 420px;
  }
}

/* =========================================================
   MOBILE / TABLE / OVERFLOW REPAIR
   ADD THIS AT THE VERY END OF THE CSS FILE
   ========================================================= */

/* Prevent hidden horizontal overflow bugs */
html,
body {
  overflow-x: hidden;
}

* {
  min-width: 0;
}



/* Collapse large layout blocks earlier */
@media (max-width: 900px) {
  .juris-header,
  .plain-grid,
  .intro-grid,
  .magna-grid,
  .about-grid,
  .action-inner,
  .tfq-strip .container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .math-card,
  .eq-vis {
    position: static;
    top: auto;
  }

  .domains-grid,
  .open-grid {
    grid-template-columns: 1fr;
  }
}

/* Formula strip was too wide */
@media (max-width: 900px) {
  .formula-strip {
    padding: 1.25rem;
    gap: 1.25rem;
    align-items: flex-start;
  }

  .formula-main {
    width: 100%;
    font-size: 1.5rem;
  }

  .formula-vars {
    width: 100%;
    gap: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .fvar {
    min-width: 0;
  }

  .fvar-sym {
    font-size: 0.95rem;
    overflow-wrap: anywhere;
  }

  .fvar-label {
    font-size: 0.72rem;
    line-height: 1.4;
  }
}

@media (max-width: 560px) {
  .formula-vars {
    grid-template-columns: 1fr;
  }

  .formula-main {
    font-size: 1.3rem;
  }
}

/* Variable tiles */
@media (max-width: 900px) {
  .vars-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .vars-grid {
    grid-template-columns: 1fr;
  }
}

/* Tool cards and disclosure cards */
@media (max-width: 900px) {
  .tools-grid,
  .disclosures-grid,
  .footer-top,
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* Portal storyboard controls can overflow */
@media (max-width: 767.98px) {
  .portal-storyboard__controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .portal-storyboard__dots {
    width: 100%;
  }

  .portal-slide__meta {
    flex-wrap: wrap;
  }
}

/* Tables: make them scroll safely on mobile */
.region-table,
.compare-table {
  min-width: 720px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Better mobile table spacing */
@media (max-width: 767px) {
  .region-table th,
  .region-table td,
  .compare-table th,
  .compare-table td {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
  }
}

/* If you prefer stacked cards instead of horizontal table scroll */
@media (max-width: 640px) {
  .region-table,
  .region-table thead,
  .region-table tbody,
  .region-table tr,
  .region-table th,
  .region-table td {
    display: block;
    width: 100%;
  }

  .region-table {
    min-width: 0;
  }

  .region-table thead {
    display: none;
  }

  .region-table tbody tr {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
  }

  .region-table td {
    padding: 0.35rem 0;
    text-align: left !important;
  }

  .region-table td:first-child {
    width: 100%;
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
  }

  .region-table td:last-child {
    font-size: 0.78rem;
  }
}

/* Long strings and links */
body,
p,
a,
li,
td,
th,
span {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Contact email can overflow on very narrow screens */
@media (max-width: 480px) {
  .contact-email {
    font-size: 1.2rem;
    overflow-wrap: anywhere;
  }

  .hero h1,
  .masthead h1 {
    font-size: 2rem;
  }

  h2.display,
  h2.st,
  .portal-storyboard__title {
    font-size: 1.6rem;
  }
}

