/* نبرة — the interfaces layer.
 *
 * The identity is Najdi: the gypsum-white and mud-brick of Diriyah, its wall
 * crenellations as section dividers, Saudi green spent only where it means
 * something, and the wordmark in Ruqʿah — the handwriting of Saudi shop signs,
 * because the product is a shop's own voice.
 *
 * Every inline-axis property is logical (margin-inline-start, text-align:
 * start, inset-inline-end...). That is the whole of the RTL strategy: the page
 * is designed right-to-left first, and the English mirror falls out of the
 * same stylesheet with no [dir] overrides to drift out of sync. User content
 * (transcripts) additionally isolates with <bdi>, so a Latin order code inside
 * an Arabic sentence cannot reorder its line.
 */

:root {
  --gypsum: #FAF6EE;  /* warm plaster white — the page */
  --sand:   #EFE6D3;  /* sifted sand — panels */
  --clay:   #8C5A2B;  /* mud brick — borders, secondary text */
  --ink:    #221A10;  /* date-molasses black — text */
  --aqiq:   #175A31;  /* Saudi green — actions and links only */
  --aqiq-d: #0F3D21;  /* pressed state */
  --sadu:   #8E2F2B;  /* sadu red — the handover marker only */
  --line:   #D9CBB0;  /* hairline on sand */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--gypsum);
  color: var(--ink);
  font-family: "Almarai", "Segoe UI", system-ui, sans-serif;
  line-height: 1.65;
  font-size: 17px;
}

.wordmark, .wordmark-big {
  font-family: "Aref Ruqaa", "Almarai", serif;
  color: var(--ink);
  text-decoration: none;
}
.wordmark { font-size: 1.9rem; font-weight: 700; }
.wordmark small { font-family: "Almarai", sans-serif; font-size: .55em; color: var(--clay); }
.wordmark-big { font-size: 4.5rem; margin: 0; }

a { color: var(--aqiq); }
h1, h2, h3 { line-height: 1.3; font-weight: 800; }
code { background: var(--sand); padding: .1em .4em; border-radius: 4px; font-size: .85em; }

/* ------------------------------------------------------------------ chrome */
.bar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .9rem clamp(1rem, 4vw, 3rem);
  border-block-end: 1px solid var(--line);
  background: var(--gypsum);
}
.bar nav { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.bar nav a { color: var(--ink); text-decoration: none; }
.bar nav a:hover { color: var(--aqiq); }
.bar-end { margin-inline-start: auto; display: flex; gap: .8rem; align-items: center; }
.shopname { color: var(--clay); font-weight: 700; }
.lang { text-decoration: none; font-weight: 700; }

.btn {
  display: inline-block; background: var(--aqiq); color: var(--gypsum);
  border: none; border-radius: 8px; padding: .55rem 1.3rem;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--aqiq-d); }
.btn.big { padding: .8rem 2.2rem; font-size: 1.1rem; }
.btn.quiet { background: transparent; color: var(--aqiq); border: 1.5px solid var(--aqiq); }
.btn.quiet:hover { background: var(--sand); }
:focus-visible { outline: 3px solid var(--aqiq); outline-offset: 2px; }

/* -------------------------------------------------------------------- hero */
main { max-width: 1100px; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.hero {
  display: grid; grid-template-columns: 1.15fr .85fr;
  gap: clamp(1.5rem, 5vw, 4rem); align-items: center;
  padding-block: clamp(2.5rem, 8vh, 5.5rem);
}
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3.1rem); margin: 0 0 1rem; white-space: pre-line; }
.hero .sub { font-size: 1.15rem; color: #4a3d2c; max-width: 34rem; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; } }

/* the demo conversation — the product itself is the hero image */
.chat {
  margin: 0; padding: 1.2rem;
  background: var(--sand); border: 1px solid var(--line); border-radius: 14px;
  display: flex; flex-direction: column; gap: .55rem;
}
.chat.wide { max-width: 44rem; }
.msg {
  max-width: 85%; padding: .55rem .9rem; border-radius: 12px;
  position: relative; animation: rise .45s both;
}
.msg.them { background: var(--gypsum); border: 1px solid var(--line); align-self: flex-start; }
.msg.us   { background: var(--aqiq); color: var(--gypsum); align-self: flex-end; }
.msg.us.handover { background: var(--sadu); }
.msg time { display: block; font-size: .7em; opacity: .7; margin-block-start: .15rem; }
.msg .tag { display: inline-block; font-size: .72em; background: var(--gypsum); color: var(--sadu);
            border-radius: 6px; padding: 0 .5em; margin-inline-start: .5em; font-weight: 700; }
.chat figcaption { font-size: .8rem; color: var(--clay); margin-block-start: .4rem; }
.chat .msg:nth-child(1) { animation-delay: .05s } .chat .msg:nth-child(2) { animation-delay: .25s }
.chat .msg:nth-child(3) { animation-delay: .45s } .chat .msg:nth-child(4) { animation-delay: .65s }
.chat .msg:nth-child(5) { animation-delay: .85s } .chat .msg:nth-child(6) { animation-delay: 1.05s }
@keyframes rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1 } }

/* ------------------------------------------------- the crenellation bands */
/* Diriyah wall tops as section dividers: stepped triangles, drawn in CSS so
 * they cost no request. The flip variant points down, closing a section. */
.crenellation, .crenellation.flip {
  height: 22px; margin-block: 1rem;
  background: var(--clay);
  clip-path: polygon(0 100%, 0 55%, 4% 55%, 6% 0, 8% 55%, 12% 55%, 14% 0, 16% 55%,
    20% 55%, 22% 0, 24% 55%, 28% 55%, 30% 0, 32% 55%, 36% 55%, 38% 0, 40% 55%,
    44% 55%, 46% 0, 48% 55%, 52% 55%, 54% 0, 56% 55%, 60% 55%, 62% 0, 64% 55%,
    68% 55%, 70% 0, 72% 55%, 76% 55%, 78% 0, 80% 55%, 84% 55%, 86% 0, 88% 55%,
    92% 55%, 94% 0, 96% 55%, 100% 55%, 100% 100%);
  opacity: .55;
}
.crenellation.flip { transform: scaleY(-1); }

/* ---------------------------------------------------------------- sections */
section { padding-block: clamp(2rem, 6vh, 3.5rem); }
section h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-block-start: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
.grid article { background: var(--sand); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem 1.4rem; }
.grid h3 { margin: 0 0 .4rem; color: var(--aqiq); font-size: 1.1rem; }
.grid p { margin: 0; color: #4a3d2c; }

.steps { counter-reset: step; list-style: none; padding: 0; display: grid;
         grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; }
.steps li { counter-increment: step; border-inline-start: 3px solid var(--clay); padding-inline-start: 1rem; }
.steps h3::before { content: counter(step, arabic-indic) " · "; color: var(--clay); }
html[dir="ltr"] .steps h3::before { content: counter(step) " · "; }
.steps h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.steps p { margin: 0; color: #4a3d2c; }

.trust { background: var(--sand); border-radius: 14px; padding: 2rem; margin-block: 1rem; }
.trust p { max-width: 46rem; margin-block-end: 0; }

.faq details { border-block-end: 1px solid var(--line); padding-block: .8rem; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { color: #4a3d2c; }

.cta-final { text-align: center; padding-block: 3.5rem; }
footer { border-block-start: 1px solid var(--line); padding: 1.2rem; text-align: center; color: var(--clay); font-size: .9rem; }

/* ------------------------------------------------------------ login + app */
body.center { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.card { background: var(--sand); border: 1px solid var(--line); border-radius: 14px;
        padding: 2rem 2.2rem; width: min(26rem, 92vw); }
.card h1 { font-size: 1.3rem; margin-block: .5rem 1rem; }
.card form { display: flex; flex-direction: column; gap: .5rem; }
.card label { font-weight: 700; font-size: .9rem; }
.card input { font: inherit; padding: .55rem .8rem; border: 1px solid var(--clay);
              border-radius: 8px; background: var(--gypsum); }
.card .btn { margin-block-start: .8rem; }
.hint { font-size: .85rem; color: var(--clay); }
.alert { background: #F6E4E3; color: var(--sadu); border-radius: 8px; padding: .6rem .9rem; font-size: .92rem; }
.ok { background: #E2EFE6; color: var(--aqiq-d); border-radius: 8px; padding: .6rem .9rem; font-size: .92rem; }

.board { padding-block: 1.5rem; }
.board.narrow { max-width: 46rem; }
.stats { display: flex; gap: 1rem; flex-wrap: wrap; padding-block: .5rem 1.5rem; }
.stat { background: var(--sand); border: 1px solid var(--line); border-radius: 12px;
        padding: .9rem 1.4rem; min-width: 9rem; }
.stat strong { display: block; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--clay); font-size: .85rem; }

.list { width: 100%; border-collapse: collapse; }
.list td { padding: .55rem .6rem; border-block-end: 1px solid var(--line); vertical-align: middle; }
.list .when { color: var(--clay); font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list .n { font-variant-numeric: tabular-nums; color: var(--clay); }
.list .reason { color: var(--sadu); font-size: .85rem; }
.empty { color: var(--clay); background: var(--sand); border-radius: 10px; padding: 1rem 1.2rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; }
.row input { font: inherit; padding: .5rem .8rem; border: 1px solid var(--clay); border-radius: 8px; background: var(--gypsum); }
