/* ==========================================================================
   Forex Strategy Studio: legal / long-form document template
   (privacy.html, terms.html), loaded after site.css.

   Layout: 1200px and up, three columns (sticky section list, text, sticky
   document details); 992-1199px, two columns with the details under the
   text; below 992px, one column with a slim "On this page" bar that sticks
   under the header and opens the section list (toc.js).
   ========================================================================== */

/* ---------- Page top ---------- */

.doc-top {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#0E0D0A, var(--bg));
}

.doc-top__inner {
  padding-top: 24px;
  padding-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
}

.doc-top__heading {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-top__title {
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.doc-top__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 13px;
  color: var(--text-5);
}

.doc-top__meta > span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.doc-top__meta svg {
  width: 14px;
  height: 14px;
  color: var(--gold);
}

.doc-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-switch a {
  height: 36px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  border-radius: 18px;
  color: var(--text-2);
  font-size: 13px;
}

.doc-switch a:hover {
  border-color: var(--gold);
  color: var(--text);
}

.doc-switch a[aria-current="page"] {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg);
  font-weight: 600;
}

@media (min-width: 768px) {
  .doc-top__inner {
    padding-top: 28px;
    padding-bottom: 26px;
  }
}

/* ---------- Shared bits ---------- */

.doc-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-6);
}

.doc-card {
  display: block;
  border: 1px solid rgba(var(--gold-rgb), 0.18);
  border-radius: 12px;
  background: var(--surface);
}

/* ---------- Layout ---------- */

.doc {
  padding-bottom: 72px;
  display: flex;
  flex-direction: column;
}

.doc__body {
  min-width: 0;
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.doc__details {
  margin-top: 40px;
  display: grid;
  gap: 16px;
}

@media (min-width: 768px) {
  .doc__details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (min-width: 992px) {
  .doc {
    padding-top: 44px;
    padding-bottom: 80px;
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    column-gap: 48px;
    align-items: start;
  }

  .doc__toc {
    grid-row: span 2;
  }

  .doc__body {
    margin-top: 0;
  }

  .doc__details {
    grid-column: 2;
  }
}

@media (min-width: 1200px) {
  .doc {
    grid-template-columns: 200px minmax(0, 680px) 224px;
    justify-content: center;
  }

  .doc__toc {
    grid-row: auto;
  }

  .doc__details {
    grid-column: auto;
    position: sticky;
    top: calc(var(--header-h) + 24px);
    margin-top: 0;
    grid-template-columns: none;
  }
}

/* ---------- Section list (toc.js) ---------- */

/* Below 992px: a bar that sticks under the header, naming the current
   section; it opens the list as a panel. */
.doc__toc {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  margin-inline: calc(var(--pad) * -1);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 9, 6, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.toc__toggle {
  width: 100%;
  height: 50px;
  padding: 0 var(--pad);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: start;
}

.toc__toggle-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-6);
}

.toc__current {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  color: var(--gold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc__toggle svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--gold);
  transition: transform 0.2s ease;
}

.doc__toc.is-open .toc__toggle svg {
  transform: rotate(180deg);
}

.toc__panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 10px var(--pad) 18px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg);
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.6);
}

.doc__toc.is-open .toc__panel {
  display: block;
}

.toc__title {
  display: none;
}

.toc__list {
  display: flex;
  flex-direction: column;
  border-inline-start: 1px solid rgba(var(--gold-rgb), 0.16);
}

.toc__list a {
  display: block;
  margin-inline-start: -1px;
  padding: 8px 0;
  padding-inline-start: 14px;
  border-inline-start: 2px solid transparent;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-5);
}

.toc__list a:hover {
  color: var(--text);
}

.toc__list a.is-active {
  border-inline-start-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

.toc__top {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

/* 992px and up: the mockup's sticky list in the left column. */
@media (min-width: 992px) {
  .doc__toc {
    top: calc(var(--header-h) + 24px);
    z-index: auto;
    margin-inline: 0;
    border-bottom: 0;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .toc__toggle {
    display: none;
  }

  .toc__panel,
  .doc__toc.is-open .toc__panel {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - var(--header-h) - 48px);
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .toc__title {
    display: block;
  }

  .toc__list a {
    padding: 6px 0;
    padding-inline-start: 14px;
    font-size: 13px;
  }

  .toc__top {
    margin-top: 6px;
  }
}

/* ---------- Summary ---------- */

.doc-summary {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  border-inline-start: 3px solid var(--gold);
  border-radius: 12px;
  background: rgba(var(--gold-rgb), 0.05);
}

.doc-summary__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-summary__head svg {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

.doc-summary__head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.doc-summary ul {
  gap: 8px;
}

.doc-summary__note {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-6);
}

/* ---------- Prose ---------- */

.doc__body p,
.doc__body li {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-2);
}

.doc__body ul {
  margin: 0;
  padding-inline-start: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doc__body li::marker {
  color: var(--gold);
}

.doc__body p a,
.doc__body li a {
  overflow-wrap: anywhere;
}

.doc-sec {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-margin-top: calc(var(--header-h) + 50px + 20px);
}

/* Old section ids (p1-overview, t1...) kept for existing links; out of the
   flow so they add no gap. */
.doc-sec__alias {
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  scroll-margin-top: calc(var(--header-h) + 50px + 20px);
}

.doc-sec h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: clamp(20px, 5vw, 24px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.doc-sec__n {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
}

.doc-sec__link {
  position: relative;
  align-self: center;
  flex-shrink: 0;
  display: flex;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.doc-sec:hover .doc-sec__link,
.doc-sec__link:focus-visible {
  opacity: 1;
}

.doc-sec__link svg {
  width: 15px;
  height: 15px;
}

/* "Link copied" note under the icon after a click. It only exists while
   shown and extends leftwards, so it never widens the page. */
.doc-sec__link::after {
  content: "Link copied";
  display: none;
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-hi);
  color: var(--gold);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  pointer-events: none;
}

.doc-sec__link.is-copied {
  opacity: 1;
}

.doc-sec__link.is-copied::after {
  display: block;
}

.doc-sec h3 {
  padding-top: 6px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}

.doc__body .doc-caps {
  padding: 16px 18px;
  border: 1px solid rgba(var(--gold-rgb), 0.18);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.8;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

@media (min-width: 992px) {
  .doc-sec,
  .doc-sec__alias {
    scroll-margin-top: calc(var(--header-h) + 24px);
  }
}

/* ---------- Data table ---------- */

.doc-table {
  overflow: hidden;
  border: 1px solid rgba(var(--gold-rgb), 0.18);
  border-radius: 12px;
  background: var(--surface);
}

.doc-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.doc-table thead th {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(var(--gold-rgb), 0.18);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-5);
  text-align: start;
}

.doc-table tbody tr {
  border-bottom: 1px solid rgba(var(--gold-rgb), 0.1);
  background: var(--bg);
}

.doc-table tbody tr:last-child {
  border-bottom: 0;
}

.doc-table tbody th {
  padding: 14px 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  text-align: start;
  vertical-align: top;
}

.doc-table td {
  padding: 14px 16px;
  vertical-align: top;
}

.doc__body .doc-table td p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-3);
}

.doc__body .doc-table td p + p {
  margin-top: 6px;
}

/* Phones: each category sits above its items. */
@media (max-width: 599px) {
  .doc-table thead {
    display: none;
  }

  .doc-table tbody tr,
  .doc-table tbody th,
  .doc-table td {
    display: block;
  }

  .doc-table tbody th {
    padding-bottom: 4px;
  }

  .doc-table td {
    padding-top: 0;
  }
}

@media (min-width: 600px) {
  .doc-table thead th:first-child,
  .doc-table tbody th {
    width: 180px;
  }
}

/* ---------- Next document ---------- */

.doc-next {
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.doc-next .doc-card {
  max-width: 340px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s ease;
}

.doc-next .doc-card:hover {
  border-color: rgba(var(--gold-rgb), 0.5);
}

.doc-next__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.doc-next__title span {
  color: var(--gold);
}

/* ---------- Document details ---------- */

.doc-facts {
  padding: 18px 18px 6px;
}

.doc-facts dl {
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
}

.doc-facts dl > div {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-top: 1px solid rgba(var(--gold-rgb), 0.1);
}

.doc-facts dt {
  font-size: 12px;
  color: var(--text-6);
}

.doc-facts dd {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.doc-facts__email {
  overflow-wrap: anywhere;
}

.doc-facts .doc-facts__email {
  font-size: 13px;
}

.doc-help {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-help p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-4);
}

.doc-help__btn {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--gold-rgb), 0.4);
  border-radius: 19px;
  font-size: 13px;
  font-weight: 500;
}

.doc-help__btn:hover {
  border-color: var(--gold);
}

/* ---------- Arabic ---------- */

:lang(ar) .doc-sec__link::after {
  content: "تم نسخ الرابط";
}

/* Arabic has no capitals to carry the small labels; set them larger. */
:lang(ar) .doc-label {
  font-size: 13px;
}
