/* eXtremeBIM website: page layout. Colors, type faces and radii come only from tokens.css and components.css.
   Logical properties throughout, so dir="rtl" mirrors the layout. Later pages append their sections here. */

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--xb-text-font, var(--font-sans));
}
a { color: var(--link); }
a:not(.xb-btn):hover { color: var(--action-strong); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
[lang="ar"] { font-family: var(--font-arabic); }

/* Arabic pages: headings in the Arabic face, one weight (IBM Plex Sans Arabic loads 400, 500, 700). */
[dir="rtl"] :is(h1, h2, h3, .display-xl, .display-lg, .heading-1, .heading-2, .heading-3) {
  font-family: var(--font-arabic);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
}

.muted { color: var(--text-muted); }
.measure { max-width: var(--measure); }

/* Containers and sections */
.site-container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 48px);
}
.site-section { padding-block: var(--space-24); }
.site-section--flush-top { padding-block-start: 0; }
.site-band--sunken { background: var(--surface-sunken); border-block: 1px solid var(--line); }
.site-band--inverse { background: var(--surface-inverse); }

.section-stack { display: flex; flex-direction: column; gap: 40px; }
.section-stack--tight { gap: var(--space-8); }
.section-head { display: flex; flex-direction: column; gap: var(--space-4); }
.section-head--tight { gap: var(--space-3); }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

/* Hero */
.hero { border-block-end: 1px solid var(--line); }
.hero__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-12);
  padding-block: var(--space-24);
}
.hero__copy {
  flex: 1 1 500px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.hero__badges { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.hero__title { font-size: 64px; line-height: 68px; }
.hero__lead { max-width: 560px; color: var(--text-muted); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* Example result card */
.hero__result {
  flex: 1 1 480px;
  min-width: 0;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.result__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-block-end: 1px solid var(--line);
}
.result__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result__name { font-size: 16px; line-height: 22px; }
.result__table-wrap { overflow-x: auto; }
.result__table {
  inline-size: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.result__head-row { background: var(--surface-sunken); }
.result__table th,
.result__table td {
  padding: var(--space-3) var(--space-2);
  text-align: start;
  white-space: nowrap;
}
.result__table th { font-weight: 500; }
.result__table th:first-child,
.result__table td:first-child { padding-inline-start: var(--space-4); }
.result__table th:last-child,
.result__table td:last-child { padding-inline-end: var(--space-4); }
.result__table tbody tr { border-block-start: 1px solid var(--line); }
.result__table tbody tr.is-review { background: var(--warning-bg); }
.result__note {
  padding: var(--space-3) var(--space-5);
  border-block-start: 1px dashed var(--line);
  color: var(--text-muted);
}
/* Arabic pages: the note is text in the Arabic face; each formula or clause reference is an isolated run that does not break. */
[dir="rtl"] .result__note { font-family: var(--font-arabic); font-size: 13px; line-height: 20px; }
[dir="rtl"] .result__note bdi,
[dir="rtl"] .clause .data bdi { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }

/* Design codes */
.code-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-block-start: 4px solid var(--brand-blue);
  border-radius: var(--radius-lg);
}

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}
.step {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-block-start: var(--space-5);
  border-block-start: 2px solid var(--brand-blue);
}
.step__num { color: var(--link); }
.step p { color: var(--text-muted); }

/* Clause example: a split of text and a result block */
.split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-12);
}
.split__text {
  flex: 1 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.split__lead { max-width: 520px; color: var(--text-muted); }
.clause {
  flex: 1 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.clause__status { display: flex; gap: var(--space-2); padding-block-start: 6px; }
/* Arabic pages: the clause lines are text in the Arabic face, right-aligned; each formula segment stays on one line. */
[dir="rtl"] .clause .data { font-family: var(--font-arabic); font-size: 15px; line-height: 26px; text-align: start; }

/* Closing band */
.closing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding-block: 80px;
}
.closing__text { display: flex; flex-direction: column; gap: var(--space-3); max-width: 620px; }
.closing__title { color: var(--ink-inverse); }
.closing__lead { color: var(--ink-inverse); opacity: 0.86; }
.closing__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.closing__link { color: var(--ink-inverse); font-weight: 600; }
.closing__link:hover { color: var(--ink-inverse); }

/* Footer */
.site-footer { border-block-start: 1px solid var(--line); }
.site-footer__main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-12);
  padding-block: var(--space-12);
}
.site-footer__brand { display: flex; flex-direction: column; gap: var(--space-3); }
.site-footer__columns { display: flex; flex-wrap: wrap; gap: 64px; }
.site-footer__column { display: flex; flex-direction: column; gap: var(--space-3); }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-5);
  border-block-start: 1px solid var(--line);
}

/* Phones: one column, smaller display type, the table scrolls inside its own box */
@media (max-width: 760px) {
  .site-section { padding-block: var(--space-16); }
  .hero__inner { padding-block: var(--space-8) var(--space-12); }
  .hero__title { font-size: 32px; line-height: 40px; }
  .display-lg { font-size: 36px; line-height: 42px; }
  .grid-cards { grid-template-columns: 1fr; }
  .closing { padding-block: var(--space-12); }
}

/* Pricing page */
.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  align-items: start;
}
/* No price configured yet: a step smaller than a figure, so it does not read as one. */
.xb-price__amount--pending {
  font-family: var(--xb-head-font, var(--font-display));
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Comparison table: the table scrolls inside its own box on phones */
.compare-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.compare {
  inline-size: 100%;
  min-inline-size: 640px;
  border-collapse: collapse;
  font: 400 15px/24px var(--xb-text-font, var(--font-sans));
  color: var(--ink);
}
.compare th,
.compare td { padding: var(--space-3) var(--space-5); text-align: start; }
.compare thead tr { background: var(--surface-sunken); }
.compare thead th { font-weight: 700; font-size: 16px; line-height: 24px; }
.compare tbody tr { border-block-start: 1px solid var(--line); }
.compare tbody th { font-weight: 500; }

/* Licence FAQ */
.faq {
  display: flex;
  flex-direction: column;
  max-inline-size: 820px;
  border-block-start: 1px solid var(--line);
}
.faq__item { padding-block: var(--space-5); border-block-end: 1px solid var(--line); }
.faq__question {
  cursor: pointer;
  font: 700 18px/28px var(--xb-head-font, var(--font-display));
  color: var(--ink);
}
.faq__answer { margin-block-start: var(--space-3); color: var(--text-muted); }

/* Sign-in and sign-up: a split page without the site bar and footer */
.auth {
  display: flex;
  flex-wrap: wrap;
  min-block-size: 100vh;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--xb-text-font, var(--font-sans));
}
.auth__aside {
  flex: 1 1 480px;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: var(--space-12) clamp(16px, 5vw, 72px);
  border-inline-end: 1px solid var(--line);
}
.auth__brand { display: block; inline-size: 180px; }
.auth__brand .xb-logo { block-size: 28px; }
.auth__intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-inline-size: 460px;
  margin-block: auto;
}
.auth__points { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.auth__points li { display: flex; gap: var(--space-3); }
.auth__points li::before {
  content: ""; flex: none; inline-size: 8px; block-size: 8px; margin-block-start: 9px;
  background: var(--brand-blue); transform: rotate(45deg);
}
.auth__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); }
.auth__main {
  flex: 1 1 520px;
  min-inline-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) clamp(16px, 5vw, 72px);
}
.auth__form-wrap { inline-size: 100%; max-inline-size: 440px; display: flex; flex-direction: column; gap: var(--space-6); }
.auth__heading { display: flex; flex-direction: column; gap: var(--space-2); }
.auth__form { display: flex; flex-direction: column; gap: var(--space-6); }
.auth__next { text-align: center; }
/* Sign-in page without Google sign-in configured: a notice in place of the button */
.auth__notice {
  margin: 0;
  padding: var(--space-4);
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: var(--radius-md);
}

@media (max-width: 760px) {
  .auth__aside, .auth__main { padding-block: var(--space-8); }
}

/* Nav when signed in: the name in place of Sign in and Create account, and the Sign out form beside it */
.nav-signed-in {
  font: 500 14px/22px var(--xb-text-font, var(--font-sans));
  color: var(--text-muted);
  white-space: nowrap;
  text-decoration: none;
}
a.nav-signed-in:hover { color: var(--text); text-decoration: underline; }
.nav-signout { margin: 0; }

/* Account page: side menu, licence, last licence check, devices and download. Devices are read-only for now. */
.account {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-8);
  padding-block: var(--space-12) var(--space-24);
}
.account__side { flex: 1 1 200px; min-inline-size: 0; }
.account__menu { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.account__item {
  display: block;
  padding: 10px var(--space-4);
  border-radius: var(--radius-md);
  font: 400 15px/24px var(--xb-text-font, var(--font-sans));
  color: var(--ink);
  text-decoration: none;
}
.account__item[aria-current="page"] { background: var(--tint); font-weight: 700; }
.account__item--muted { color: var(--text-muted); }
.account__main {
  flex: 999 1 560px;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.account__title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.account-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.account-stack { display: flex; flex-direction: column; gap: var(--space-2); min-inline-size: 0; }
.account-stack--tight { gap: 2px; }
.account-sub__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.account-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.account-check { justify-content: flex-start; align-items: flex-start; }
.account-check > svg { flex: none; color: var(--text-muted); margin-block-start: 3px; }
/* Green only once a device has checked the licence. */
.account-check--checked > svg { color: var(--success); }
.account-devices { flex-direction: column; align-items: stretch; gap: 0; padding: 0; overflow: hidden; }
.account-devices__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-block-end: 1px solid var(--line);
}
.account-devices__rule { max-inline-size: 420px; }
.account-meter { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.account-meter__bars { display: flex; gap: var(--space-1); }
.account-meter__bars > span { inline-size: 48px; block-size: 6px; border-radius: 2px; background: var(--line); }
.account-meter__bars > span.is-used { background: var(--action); }
.account-device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
}
.account-device + .account-device { border-block-start: 1px solid var(--line); }
.account-device__info { display: flex; align-items: center; gap: var(--space-4); min-inline-size: 0; }
.account-device__info > svg { flex: none; color: var(--ink); }
.account-device__name { font: 700 16px/24px var(--xb-text-font, var(--font-sans)); color: var(--ink); }
.account-devices__empty { padding: var(--space-5) var(--space-6); }
.account-devices__note { margin: 0; padding: var(--space-4) var(--space-6); }
.account-download { align-items: center; }
.account-download__action { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* Admin page: search, one card per account, and the grant form under the licence */
.admin-search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.admin-search__field { flex: 1 1 280px; max-inline-size: 420px; }
.admin-list { display: flex; flex-direction: column; gap: var(--space-6); }
.admin-account { flex-direction: column; align-items: stretch; justify-content: flex-start; }
.admin-account > .account-stack { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.admin-licence { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.admin-confirm { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--danger); border-radius: var(--radius-md); background: var(--danger-bg); max-inline-size: 560px; }
.admin-confirm > p { margin: 0; }
.admin-grant {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-block-start: var(--space-5);
  border-block-start: 1px dashed var(--line);
}
.admin-grant__title { font-size: 18px; line-height: 24px; }
.admin-grant__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); }
.admin-grant > .xb-btn { align-self: flex-start; }

@media (max-width: 760px) {
  .account { padding-block: var(--space-8) var(--space-12); }
  .account-card { padding: var(--space-5); }
  .account-devices__head, .account-device { padding: var(--space-4) var(--space-5); }
  .account-devices__empty, .account-devices__note { padding: var(--space-4) var(--space-5); }
}
/* Portal additions use the approved site tokens and existing card/button components. */
.portal-message { padding-block: var(--space-4); border-block-end: 1px solid var(--line); }
.account-card.section-stack { align-items: stretch; justify-content: flex-start; flex-wrap: nowrap; gap: var(--space-5); }
.portal-message.section-stack { gap: var(--space-3); }
.portal-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: var(--space-5); }
textarea.xb-input { min-height: 110px; resize: vertical; }
.portal-nav, .portal-pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.portal-nav { padding-block: var(--space-3); border-block-end: 1px solid var(--line); }
.portal-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: var(--space-4); }
.portal-stat { display: flex; flex-direction: column; gap: var(--space-2); text-decoration: none; color: var(--ink); }
.portal-stat:hover { border-color: var(--action); }
.portal-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-6); }
.portal-before-after { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
.portal-event { gap: var(--space-3); }
.portal-notice { padding: var(--space-4); border-inline-start: 4px solid var(--warning); border-radius: var(--radius-md); background: var(--warning-bg); color: var(--ink); }
.portal-notice p { margin-block: var(--space-2); }
.portal-warning { background: var(--warning-bg); color: var(--warning); }
.portal-fit { width: fit-content; max-width: 100%; }
.portal-hash, .portal-preserve { overflow-wrap: anywhere; white-space: pre-wrap; }
.portal-list { padding-inline-start: var(--space-6); display: grid; gap: var(--space-3); }
.portal-document { max-width: 900px; }
.portal-document section { scroll-margin-top: calc(var(--nav-height) + var(--space-4)); }
.portal-facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-3) var(--space-6); }
.portal-facts dd, .portal-stats dd { margin: 0; overflow-wrap: anywhere; }
.portal-pager { justify-content: space-between; }
.admin-search { flex-wrap: wrap; }
.account-device .portal-notice { max-width: 520px; }
@media (max-width: 640px) {
  .portal-before-after, .portal-status-grid { grid-template-columns: 1fr; }
  .portal-facts { grid-template-columns: 1fr; gap: var(--space-2); }
  .portal-facts dd { margin-block-end: var(--space-3); }
  .admin-search > .xb-field { min-width: 0; width: 100%; }
  .portal-document .display-lg { font-size: 32px; line-height: 1.4; }
  .account-device { flex-wrap: wrap; }
}
