/* Landing page for قايد (resources/views/landing.blade.php).
 * Layout: a warm, conversational page; each group type gets a band with its pitch beside a live-looking WhatsApp chat */
:root {
  --bg: #FCF6EC;
  --band: #F6EBD9;
  --surface: #FFFFFF;
  --ink: #2A1C0D;
  --muted: #6D5840;
  --line: #E8D9C1;
  --accent: #B5650A;
  --btn: #9A5406;
  --btn-ink: #FFFFFF;
  --chat: #EFE4D2;
  --bubble-in: #FFFFFF;
  --bubble-out: #D7F0CB;
  --bubble-out-ink: #1F3A12;
  --bot: #FFF4DF;
  --danger: #A3261D;
  --display: "Alexandria", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --rise: 14px;
  --pop: 0.97;
}
/* Dark follows the device unless the visitor picked a theme (data-theme, shared with the dashboard) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16110B; --band: #1E170F; --surface: #251C13; --ink: #F5EADB; --muted: #BCA88E; --line: #3A2D1F;
    --accent: #F2A845; --btn: #F2A845; --btn-ink: #1C1207; --chat: #1B150E; --bubble-in: #2C2218;
    --bubble-out: #20402A; --bubble-out-ink: #D6F2DD; --bot: #3A2A14; --danger: #F08A80; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16110B; --band: #1E170F; --surface: #251C13; --ink: #F5EADB; --muted: #BCA88E; --line: #3A2D1F;
  --accent: #F2A845; --btn: #F2A845; --btn-ink: #1C1207; --chat: #1B150E; --bubble-in: #2C2218;
  --bubble-out: #20402A; --bubble-out-ink: #D6F2DD; --bot: #3A2A14; --danger: #F08A80; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.75; }
.page { direction: rtl; }
.wrap { max-width: 1120px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.35; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.3rem, 6vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.15rem; font-weight: 500; }
p { margin: 0; }
a { color: inherit; }
a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .8rem 1.5rem; border-radius: 999px; background: var(--btn); color: var(--btn-ink); font-weight: 600; text-decoration: none; font-family: var(--body); white-space: nowrap; transition: transform 160ms var(--ease-out); }
.btn:active { transform: scale(0.97); }
.link { font-weight: 500; text-decoration: none; color: var(--muted); }
.link:hover { color: var(--ink); }

/* theme toggle: shows the moon in light mode and the sun in dark mode */
.theme-toggle { display: grid; grid-template-areas: "icon"; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; flex-shrink: 0; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.theme-toggle svg { grid-area: icon; width: 20px; height: 20px; transition: opacity 200ms var(--ease-out), transform 300ms var(--ease-out); }
.theme-toggle .sun { opacity: 0; transform: rotate(-90deg) scale(0.6); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { opacity: 1; transform: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { opacity: 0; transform: rotate(90deg) scale(0.6); }
}
:root[data-theme="dark"] .theme-toggle .sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle .moon { opacity: 0; transform: rotate(90deg) scale(0.6); }

/* header */
header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.1rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.brand svg { width: 34px; height: 34px; }
.nav { display: flex; align-items: center; gap: 1rem; }

/* hero */
.hero .wrap { padding-block: 3.5rem 4rem; display: grid; gap: 2.5rem; }
.hero-copy { display: grid; gap: 1rem; max-width: 40rem; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .95rem; }
.lead { color: var(--muted); font-size: 1.15rem; max-width: 36rem; }
.types { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.type { display: grid; gap: .4rem; padding: 1.4rem; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; transition: border-color 200ms ease, transform 200ms var(--ease-out); }
.type:active { transform: scale(0.98); }
.type .ico { width: 46px; height: 46px; border-radius: 14px; background: var(--band); color: var(--accent); display: grid; place-items: center; margin-bottom: .4rem; }
.type .ico svg { width: 24px; height: 24px; }
.type p { color: var(--muted); font-size: .95rem; }
.type .go { color: var(--accent); font-weight: 600; font-size: .9rem; margin-top: .3rem; }

/* group type bands */
.band { background: var(--band); }
.case .wrap { padding-block: 4.5rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: center; }
.case.flip .chat { order: -1; }
.case-copy { display: grid; gap: 1.1rem; min-width: 0; }
.problem { color: var(--muted); font-size: 1.1rem; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.points li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: .6rem; align-items: start; }
.points svg { width: 22px; height: 22px; color: var(--accent); margin-top: .3rem; }

/* WhatsApp-style chat */
.chat { min-width: 0; border-radius: 26px; overflow: hidden; border: 1px solid var(--line); background: var(--chat); font-size: .93rem; line-height: 1.6; }
.chat-head { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--band); color: var(--accent); display: grid; place-items: center; font-family: var(--display); font-weight: 700; flex-shrink: 0; }
.chat-head small { display: block; color: var(--muted); font-size: .8rem; }
.msgs { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; }
.msg { max-width: 85%; padding: .45rem .75rem .3rem; border-radius: 14px; background: var(--bubble-in); align-self: flex-start; transform-origin: bottom right; }
.msg .who { display: block; font-size: .78rem; font-weight: 600; color: var(--accent); }
.msg .time { display: block; text-align: left; font-size: .72rem; color: var(--muted); }
.msg.me { transform-origin: bottom left; align-self: flex-end; background: var(--bubble-out); color: var(--bubble-out-ink); }
.msg.me .time { color: inherit; opacity: .75; }
.msg.bot { background: var(--bot); }
.msg.gone { display: grid; grid-template-areas: "layer"; }
.msg.gone > span { grid-area: layer; }
.msg.gone .spam { opacity: 0; }
.msg.gone .removed-text { font-style: italic; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.msg.gone svg { width: 16px; height: 16px; flex-shrink: 0; }
.strike { color: var(--danger); font-weight: 600; }
.divider { align-self: center; font-size: .78rem; color: var(--muted); background: var(--surface); padding: .15rem .8rem; border-radius: 999px; }
.chat + .chat { margin-top: 1rem; }
.chats { display: grid; gap: 1rem; min-width: 0; }

/* rides demo GIF: it carries its own warm backdrop, so it sits on a card in both themes */
.demo { justify-self: center; width: 100%; max-width: 360px; min-width: 0; }
.demo img { display: block; width: 100%; height: auto; border-radius: 28px; border: 1px solid var(--line); }

/* features */
.features .wrap { padding-block: 5rem; display: grid; gap: 2.5rem; }
.sec-head { display: grid; gap: .6rem; max-width: 40rem; }
.sec-head p { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.feat { background: var(--surface); padding: 1.4rem; display: grid; gap: .35rem; align-content: start; }
.feat p { color: var(--muted); font-size: .93rem; }

/* steps */
.steps .wrap { padding-block: 4.5rem; display: grid; gap: 2.5rem; }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; counter-reset: s; }
.steps li { counter-increment: s; display: grid; gap: .5rem; align-content: start; }
.steps li::before { content: counter(s, arabic-indic); font-family: var(--display); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--accent); }
.steps li p { color: var(--muted); }

/* faq */
.faq .wrap { padding-block: 4.5rem; display: grid; gap: 2rem; max-width: 820px; }
details { border-bottom: 1px solid var(--line); padding-block: 1.1rem; }
summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; line-height: 1; }
details[open] summary::after { content: "−"; }
details p { color: var(--muted); margin-top: .6rem; }

/* closing */
.closing .wrap { padding-block: 5rem; display: grid; justify-items: center; gap: 1.2rem; text-align: center; }
.closing p { color: var(--muted); max-width: 32rem; }
footer .wrap { padding-block: 2rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .9rem; }

@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .case .wrap { grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-block: 3.5rem; }
  .case.flip .chat, .case.flip .chats { order: 0; }
  .nav .link { display: none; }
  .nav .btn { padding: .6rem 1.1rem; }
}
@media (max-width: 380px) {
  header .wrap { gap: .5rem; }
  .brand { font-size: 1rem; gap: .4rem; }
  .brand svg { width: 30px; height: 30px; }
  .nav { gap: .5rem; }
  .nav .btn { padding: .5rem .9rem; font-size: .9rem; }
  .theme-toggle { width: 38px; height: 38px; }
}

/* ---------- motion ---------- */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-1px); }
  .btn:active { transform: scale(0.97); }
  .type:hover { border-color: var(--accent); transform: translateY(-3px); }
}

@keyframes rise { from { opacity: 0; transform: translateY(var(--rise)); } }
@keyframes bubble-in { from { opacity: 0; transform: translateY(calc(var(--rise) * .7)) scale(var(--pop)); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  /* Hero: the question first, then the three answers */
  /* backwards fill only, so the cards' hover lift still works once they've landed */
  .hero-copy > *, .types > .type { animation: rise 700ms var(--ease-out) backwards; }
  .hero-copy > :nth-child(2) { animation-delay: 80ms; }
  .hero-copy > :nth-child(3) { animation-delay: 160ms; }
  .types > .type:nth-child(1) { animation-delay: 260ms; }
  .types > .type:nth-child(2) { animation-delay: 320ms; }
  .types > .type:nth-child(3) { animation-delay: 380ms; }
  details[open] p { animation: rise 300ms var(--ease-out); --rise: -4px; }
}

/* Scroll reveal and chat playback run only once the script has armed them (js-anim),
   so without JavaScript every section is simply visible */
.js-anim :is(.case-copy, .sec-head, .feat, .steps li, .faq details, .closing .wrap > *) {
  opacity: 0;
  transform: translateY(var(--rise));
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
  transition-delay: var(--at, 0ms);
}
.js-anim .is-visible:is(.case-copy, .sec-head, .feat, .steps li, .faq details, .closing .wrap > *) { opacity: 1; transform: none; }

/* Each chat plays as a conversation: bubbles arrive one by one, and the spam turns into "deleted" */
.js-anim .case :is(.msg, .divider) { opacity: 0; }
.js-anim .case.is-playing :is(.msg, .divider) { opacity: 1; animation: bubble-in 450ms var(--ease-out) both; animation-delay: var(--at, 0ms); }
.js-anim .case .msg.gone .spam { opacity: 1; }
.js-anim .case.is-playing .msg.gone .spam { animation: fade-out 250ms var(--ease-out) both; animation-delay: var(--swap, 0ms); }
.js-anim .case.is-playing .msg.gone .removed { animation: fade-in 300ms var(--ease-out) both; animation-delay: var(--swap, 0ms); }

@media (prefers-reduced-motion: reduce) {
  /* Fades only: content still arrives in order, nothing slides or scales */
  :root { --rise: 0px; --pop: 1; }
  .btn, .type, .theme-toggle svg { transition: none; }
  .btn:active, .type:active { transform: none; }
}
