/* ==========================================================================
   Permedjat — pricing pages (/pricing, /en/pricing)
   Loaded after site.css. Reuses the site tokens (--teal, --sand, --rule…)
   so the pricing sections inherit the brand without redefining it.
   All plan data (names, prices, ranges) is rendered by assets/pricing.js
   from the API — nothing numeric is hardcoded here or in the HTML.
   ========================================================================== */

.pricing-hero {
  position: relative;
  background: var(--teal-abyss);
  color: var(--papyrus);
  padding-block: clamp(56px, 9vw, 104px) clamp(56px, 8vw, 88px);
  overflow: hidden;
}

.pricing-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      120% 90% at 50% -10%,
      rgba(110, 79, 203, 0.55) 0%,
      transparent 62%
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0 7px,
      rgba(241, 223, 182, 0.028) 7px 8px
    );
  pointer-events: none;
}

.pricing-hero .shell {
  position: relative;
}

.pricing-hero h1 {
  font-size: clamp(2.2rem, 5.4vw, 3.8rem);
  color: #fff;
  margin-bottom: 18px;
  text-wrap: balance;
  max-width: 24ch;
}
html[lang="en"] .pricing-hero h1 {
  font-weight: 500;
  letter-spacing: -0.025em;
}

.pricing-hero .lede {
  font-size: clamp(1rem, 1.5vw, 1.17rem);
  color: rgba(241, 223, 182, 0.82);
  max-width: 52ch;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Sample-data banner (only shown when the API answers is_sample: true)
   -------------------------------------------------------------------------- */

.sample-banner {
  margin-top: 26px;
  max-width: 62ch;
  background: rgba(201, 138, 43, 0.14);
  border: 1px solid rgba(201, 138, 43, 0.65);
  color: var(--papyrus);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 600;
}
.sample-banner[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   Billing-period switch + currency picker
   -------------------------------------------------------------------------- */

.pricing-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: center;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.billing-toggle {
  display: inline-flex;
  background: var(--sand-deep);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.billing-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0 22px;
  min-height: 44px;
  min-width: 44px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.billing-toggle button[aria-checked="true"] {
  background: var(--teal-deep);
  color: var(--papyrus);
}

.billing-toggle button:hover {
  color: var(--teal-deep);
}
.billing-toggle button[aria-checked="true"]:hover {
  color: var(--papyrus);
}

.currency-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  color: var(--ink-soft);
  font-weight: 600;
}
.currency-picker[hidden] {
  display: none;
}

.currency-picker select {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: var(--sand);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  padding: 0 14px;
  min-height: 44px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Plan cards
   -------------------------------------------------------------------------- */

.plans-section {
  padding-block: clamp(48px, 7vw, 88px);
}

.plans-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .plans-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .plans-grid {
    /* Flexible: one row holds as many cards as fit, up to five. */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.plans-grid[hidden] {
  display: none;
}

.plan-card {
  background: var(--sand);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 28px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.plan-card--free {
  border: 2px solid var(--teal);
  background: #fff;
}

.plan-badge {
  position: absolute;
  inset-block-start: -14px;
  inset-inline-start: 22px;
  background: var(--teal);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.plan-name {
  font-size: 1.35rem;
  color: var(--teal-deep);
  margin-bottom: 6px;
}

.plan-range {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.plan-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 4px;
  direction: ltr;
}
html[dir="rtl"] .plan-price {
  justify-content: flex-end;
}
html[dir="ltr"] .plan-price {
  justify-content: flex-start;
}

.plan-amount {
  font-family: var(--font-mono);
  font-size: clamp(1.7rem, 2.4vw, 2.1rem);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
  direction: ltr;
  unicode-bidi: isolate;
}

.plan-per {
  font-size: 14px;
  color: var(--ink-faint);
}

.plan-currency {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}

.plan-save {
  font-size: 13.5px;
  color: var(--teal-deep);
  font-weight: 600;
  margin-bottom: 4px;
}

.plan-scope {
  font-size: 13.5px;
  color: var(--ink-faint);
  margin-bottom: 22px;
}

.plan-cta {
  margin-top: auto;
  display: flex;
}
.plan-cta .btn {
  width: 100%;
  min-height: 44px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.visually-hidden[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   Loading / error / empty states
   -------------------------------------------------------------------------- */

.plans-status {
  border: 1px dashed var(--rule-strong);
  border-radius: 18px;
  padding: clamp(28px, 5vw, 52px) clamp(20px, 4vw, 44px);
  text-align: center;
  color: var(--ink-soft);
  max-width: 640px;
  margin-inline: auto;
}
.plans-status[hidden] {
  display: none;
}

.plans-status h2 {
  font-size: 1.4rem;
  color: var(--teal-deep);
  margin-bottom: 10px;
}

.plans-status p {
  font-size: 15.5px;
  margin-bottom: 0;
}

.plans-status .btn {
  margin-top: 20px;
  min-height: 44px;
}

.skeleton-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) {
  .skeleton-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1100px) {
  .skeleton-list {
    grid-template-columns: repeat(3, 1fr);
  }
}
.skeleton-list[hidden] {
  display: none;
}

.skeleton-card {
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 28px 24px;
  min-height: 260px;
  background: linear-gradient(
    100deg,
    var(--sand-deep) 40%,
    var(--sand) 50%,
    var(--sand-deep) 60%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
}

@keyframes skeleton-shimmer {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -20% 0;
  }
}

/* --------------------------------------------------------------------------
   Included-features + capacity note (static copy, no prices)
   -------------------------------------------------------------------------- */

.pricing-included {
  background: var(--sand-deep);
  border-block: 1px solid var(--rule);
}

.included-note {
  margin-top: 26px;
  font-size: 15px;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  align-items: baseline;
  max-width: 70ch;
}
.included-note::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  transform: translateY(-2px);
}

.capacity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  max-width: 780px;
}
@media (min-width: 760px) {
  .capacity-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.capacity-list li {
  background: var(--sand);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 20px 20px 18px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.capacity-list li strong {
  display: block;
  color: var(--teal-deep);
  font-size: 1.02rem;
  margin-bottom: 6px;
}

.manual-note {
  margin-top: 26px;
  font-size: 14.5px;
  color: var(--ink-soft);
  max-width: 70ch;
}

/* --------------------------------------------------------------------------
   Pricing FAQ reuses .faq-item from site.css; only the section shell here
   -------------------------------------------------------------------------- */

.pricing-faq .faq-list {
  margin-inline: auto;
}

.pricing-noscript {
  background: var(--sand-deep);
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 24px;
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 640px;
}
.pricing-noscript a {
  color: var(--teal-deep);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Geo-resolved subscription section.
   Rendered by the pricing module in assets/pricing.js from the market
   config (assets/pricing-markets.js) and the versioned local schedule
   for the resolved market — no price is hardcoded here. Accent is the
   brand purple (#6E4FCB, the --teal token value). The calculator is a
   single card centered in the page width (max ~600px).
   -------------------------------------------------------------------------- */

#eg-pricing [hidden] {
  display: none !important;
}

.eg-section {
  padding-block: clamp(48px, 7vw, 88px);
  background: var(--sand);
  border-bottom: 1px solid var(--rule);
}

.eg-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: clamp(22px, 3vw, 32px);
}

.eg-calc {
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
}

.eg-num {
  font-family: var(--font-mono);
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

.eg-note {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-top: 12px;
  margin-bottom: 0;
  max-width: 60ch;
}

.eg-calc h2 {
  font-size: 1.4rem;
  color: var(--teal-deep);
  margin-bottom: 16px;
}

.eg-field label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 8px;
}

.eg-field input {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--ink);
  background: var(--sand);
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  padding: 0 16px;
  min-height: 48px;
  width: 180px;
  max-width: 100%;
}

.eg-field input:focus-visible {
  outline: 3px solid rgba(110, 79, 203, 0.45);
  outline-offset: 2px;
  border-color: var(--teal);
}

.eg-validation {
  font-size: 14.5px;
  font-weight: 600;
  color: #a4262c;
  margin-top: 8px;
  margin-bottom: 0;
}

.eg-quote-loading {
  margin-top: 16px;
  font-size: 15px;
  color: var(--ink-soft);
}

.eg-quote-error {
  margin-top: 16px;
  border: 1px dashed var(--rule-strong);
  border-radius: 14px;
  padding: 16px 18px;
}

.eg-quote-error p {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.eg-total {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 18px;
  margin-bottom: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

/* Neutral loading state: no amount yet, muted skeleton. The "…" and
   the reserved headcount line are set in the resolved type sizes, so
   the skeleton is already the resolved total's height. Reserved
   space below applies ONLY while loading (aria-busy) — the resolved
   card keeps no empty band. */
.eg-total[aria-busy="true"] .eg-total-amount {
  color: var(--ink-faint);
}

.eg-count {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.eg-total-label {
  display: block;
  font-size: 13.5px;
  color: var(--ink-faint);
}

/* Label row: the subscription label with the free-month badge at the
   inline end (left in RTL, right in LTR). The badge is a quiet
   brand-purple pill, clearly secondary to the amount below it. */
.eg-total-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.eg-badge {
  display: inline-block;
  background: rgba(110, 79, 203, 0.12);
  color: var(--teal-deep);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.eg-badge[hidden] {
  display: none;
}

.eg-total-amount {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 7vw, 3.4rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--teal-deep);
  direction: ltr;
  unicode-bidi: isolate;
}

#eg-total-currency,
#eg-total-per {
  font-size: 0.42em;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* USD carries its "$" prefix on the amount, so the currency slot
   collapses instead of leaving a gap before "/ month". */
#eg-total-currency:empty {
  display: none;
}

#eg-total-amount {
  unicode-bidi: isolate;
}

/* In Arabic the amount row reads right to left — digits, currency,
   per-month — so the container follows the page direction and only the
   digits stay LTR-isolated. Currency and per-month text use the regular
   Arabic body face, never the stretched monospace numerals. */
html[lang="ar"] .eg-total-amount {
  direction: rtl;
}

html[lang="ar"] #eg-total-currency,
html[lang="ar"] #eg-total-per {
  font-family: var(--font-body);
  letter-spacing: normal;
}

.eg-how-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--teal-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.eg-how-link:hover {
  color: var(--teal);
}

.eg-custom {
  margin-top: 18px;
  border: 2px solid var(--teal);
  border-radius: 14px;
  padding: 18px 20px;
  background: #fff;
}

.eg-custom h3 {
  font-size: 1.1rem;
  color: var(--teal-deep);
  margin-bottom: 8px;
}

.eg-custom p {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.eg-trial-cta {
  margin-top: 20px;
  min-height: 48px;
}

.eg-cta-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.eg-cta-row .eg-trial-cta {
  margin-top: 0;
  width: 100%;
}

.eg-calc .eg-trial-cta {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-card {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   How-is-the-price-calculated explanation pages
   (/pricing/how-it-works, /en/pricing/how-it-works). Every number in the
   lists below is rendered by assets/pricing.js from the versioned local
   schedule — nothing numeric is hardcoded here or in the HTML.
   -------------------------------------------------------------------------- */

#eg-how[hidden] {
  display: none !important;
}

.how-section .section-head {
  margin-bottom: 14px;
}

.how-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 780px;
}

.how-list li {
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--ink-soft);
  background: var(--sand);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 12px 16px;
  overflow-wrap: anywhere;
}

.how-examples li {
  background: #fff;
}

/* The worked-example formula is a single LTR-isolated run so the bidi
   algorithm never reorders its terms — lines may break between terms
   at the " + ", but never inside one "(n × unit)" term. */
.how-examples .eg-num {
  white-space: normal;
}

.eg-how-f .eg-term {
  white-space: nowrap;
}

/* Worked examples are small stacked blocks: the headcount label, the
   formula terms as a block-level LTR run, then the emphasized result —
   so no LTR run ever shares a wrapping line with RTL text. */
.eg-how-n {
  display: block;
  font-weight: 600;
  color: var(--ink);
}

.eg-how-f {
  display: block;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  margin-top: 6px;
}

html[lang="ar"] .eg-how-f {
  text-align: right;
}

.eg-how-r {
  display: block;
  margin-top: 6px;
  font-weight: 600;
  font-size: 1.06em;
  color: var(--teal-deep);
}

.how-back {
  margin-top: 26px;
}

/* --------------------------------------------------------------------------
   Header without a CTA (pricing pages only).
   site.css pushes .site-nav to the inline end with
   margin-inline-start: auto and keeps .site-nav + .header-actions at
   margin-inline-start: 0 so the switcher sits right after the nav with
   the shell gap. At <=900px the nav is display: none but still adjacent
   in the DOM, so the zero margin sticks and would leave the switcher
   next to the brand. Restore the auto margin there so the language
   switcher stays at the inline end (right in EN, left in AR) at every
   width. Height, centring and gutters still come from site.css.
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .site-header .site-nav + .header-actions {
    margin-inline-start: auto;
  }
}
