/* ===================================================================
   Design Contest Platform — landing + public components (v2)
   Self-hosted, no CDN. Logical properties for automatic RTL mirroring.
   =================================================================== */
:root {
  --primary: #4f46e5; --primary-2: #7c3aed; --primary-grad: linear-gradient(135deg, #4f46e5, #7c3aed);
  --surface: #ffffff; --surface-2: #f8fafc; --border: #e2e8f0;
  --text: #0f172a; --muted: #64748b;
  --success: #10b981; --warning: #f59e0b; --danger: #f43f5e; --info: #0ea5e9;
  --radius-card: 1rem; --radius-modal: 1.25rem; --radius-input: 0.5rem;
  --shadow: 0 10px 30px -12px rgba(79, 70, 229, .25);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
.dark {
  --surface: #0b1020; --surface-2: #111827; --border: #1e293b;
  --text: #e2e8f0; --muted: #94a3b8;
  --shadow: 0 12px 34px -14px rgba(124, 58, 237, .55);
}
[dir="rtl"] { --font: "Noto Sans Arabic", "Inter", system-ui, sans-serif; }

* { box-sizing: border-box; }
body { font-family: var(--font); color: var(--text); background: var(--surface-2); margin: 0; }
a { color: inherit; text-decoration: none; }
.container { max-width: 76rem; margin-inline: auto; padding-inline: 1.25rem; }
.section { margin-block: 4rem; }
.section__title { font-size: 1.6rem; font-weight: 800; margin-block: 0 1.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons / inputs / cards ----------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: var(--radius-input); padding: .6rem 1.1rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: transform .15s ease-out, box-shadow .15s ease-out, background .15s; }
.btn:focus-visible { outline: 3px solid rgba(99, 102, 241, .45); outline-offset: 2px; }
.btn--primary { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow); }
.btn--primary:hover { transform: translateY(-1px); }
.btn--secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost { background: transparent; color: var(--primary); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--lg { padding: .85rem 1.6rem; font-size: 1.05rem; border-radius: .75rem; }
.input { width: 100%; padding: .65rem .85rem; border-radius: var(--radius-input);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.input:focus-visible { outline: 3px solid rgba(99,102,241,.35); border-color: var(--primary); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.5rem;
  transition: transform .2s ease-out, box-shadow .2s ease-out; }
.grid { display: grid; gap: 1.25rem; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 56rem) { .cols-3, .cols-2 { grid-template-columns: 1fr; } }

/* Animated background ----------------------------------------------- */
.landing-bg { position: absolute; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.landing-bg__mesh { position: absolute; inset: -20%;
  background:
    radial-gradient(40% 45% at 15% 20%, rgba(79,70,229,.28), transparent 70%),
    radial-gradient(35% 40% at 85% 15%, rgba(124,58,237,.25), transparent 70%),
    radial-gradient(45% 45% at 70% 85%, rgba(14,165,233,.18), transparent 70%);
  filter: blur(28px); animation: mesh-drift 42s ease-in-out infinite alternate; }
.dark .landing-bg__mesh { opacity: .55; }
.landing-bg__noise { position: absolute; inset: 0; opacity: .04;
  background: url("/assets/landing/backgrounds/noise.svg"); }
.blob { position: absolute; width: 14rem; height: 14rem; border-radius: 50%;
  background: var(--primary-grad); opacity: .18; filter: blur(8px); will-change: transform; }
.blob--1 { inset-inline-start: 6%; top: 12%; animation: float-1 26s ease-in-out infinite; }
.blob--2 { inset-inline-end: 8%; top: 30%; animation: float-2 32s ease-in-out infinite; }
.blob--3 { inset-inline-start: 20%; bottom: 6%; animation: float-3 38s ease-in-out infinite; }
.blob--4 { inset-inline-end: 18%; bottom: 14%; animation: float-1 30s ease-in-out infinite reverse; }
.dark .blob { opacity: .3; }
body:has(.landing-bg) { position: relative; isolation: isolate; }

/* Dark mode subtle beams */
.dark .landing-bg::after { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 78px, rgba(99,102,241,.08) 79px 80px);
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent); }

@keyframes mesh-drift { from { transform: translate3d(-2%, -1%, 0) scale(1); } to { transform: translate3d(3%, 2%, 0) scale(1.08); } }
@keyframes float-1 { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(24px,-30px,0); } }
@keyframes float-2 { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(-28px,22px,0); } }
@keyframes float-3 { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(18px,26px,0); } }

/* Hero -------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2.5rem; align-items: center;
  min-height: 32rem; padding-block: 3rem; }
.hero__title { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.12; font-weight: 800; margin: 0 0 1rem;
  background: linear-gradient(120deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__sub { font-size: 1.15rem; color: var(--muted); max-width: 34rem; }
.hero__search { display: flex; gap: .6rem; margin-block: 1.4rem; max-width: 32rem; }
.hero__cta { display: flex; gap: .8rem; flex-wrap: wrap; }
.hero__illu { width: 100%; height: auto; border-radius: 1.5rem; }
@media (max-width: 56rem) { .hero { grid-template-columns: 1fr; } .hero__illu { order: -1; max-width: 26rem; margin-inline: auto; } }

/* Chips ------------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: .6rem; margin-block: 1.5rem; }
.chip { padding: .45rem 1rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-size: .9rem; font-weight: 600; transition: all .15s ease-out; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip--active { background: var(--primary-grad); color: #fff; border-color: transparent; }

/* Steps ------------------------------------------------------------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: step; }
.steps__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 1.5rem; position: relative; overflow: hidden; }
.steps__num { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 999px;
  background: var(--primary-grad); color: #fff; font-weight: 800; margin-block-end: .8rem; }
@media (max-width: 56rem) { .steps { grid-template-columns: 1fr; } }

/* Stats ------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0; }
.stats__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 1.75rem; text-align: center; }
.stats__value { font-size: 2.2rem; font-weight: 800; color: var(--primary); margin: 0; }
.stats__label { color: var(--muted); font-size: .95rem; margin-top: .35rem; }

/* Features ---------------------------------------------------------- */
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature__icon { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: .9rem;
  background: rgba(99,102,241,.12); color: var(--primary); margin-block-end: .9rem; }

/* Carousel ---------------------------------------------------------- */
.carousel { position: relative; overflow: hidden; border-radius: var(--radius-card); }
.carousel__track { display: flex; transition: transform .35s ease-out; }
.carousel__slide { min-width: 100%; padding: 2.25rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-card); margin: 0; }
.carousel__slide blockquote { font-size: 1.1rem; margin: 0 0 1rem; }
.carousel__dots { display: flex; gap: .5rem; justify-content: center; margin-top: 1rem; }
.carousel__dots button { width: .65rem; height: .65rem; border-radius: 999px; border: 0;
  background: var(--border); cursor: pointer; padding: 0; }
.carousel__dots button.is-active { background: var(--primary); width: 1.4rem; }
.stars { color: var(--warning); }

/* Accordion --------------------------------------------------------- */
.accordion__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-input);
  margin-block-end: .6rem; overflow: hidden; }
.accordion__summary { padding: 1rem 1.25rem; font-weight: 700; cursor: pointer; list-style: none; }
.accordion__summary::-webkit-details-marker { display: none; }
.accordion__body { padding: 0 1.25rem 1rem; color: var(--muted); margin: 0; }

/* CTA band ---------------------------------------------------------- */
.cta-band { background: var(--primary-grad); color: #fff; border-radius: 1.5rem; padding: 3rem;
  text-align: center; }
.cta-band h2 { font-size: 1.9rem; margin: 0 0 .5rem; }
.cta-band p { opacity: .9; margin: 0 0 1.4rem; }
.cta-band .btn--primary { background: #fff; color: var(--primary); }

/* Reveal on scroll -------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .5s ease-out, transform .5s ease-out; }
.reveal.is-visible { opacity: 1; transform: none; }

/* Empty state ------------------------------------------------------- */
.empty-state { text-align: center; padding: 3.5rem 1.5rem; border: 2px dashed var(--border);
  border-radius: var(--radius-card); color: var(--muted); }

/* Support chat widget ----------------------------------------------- */
.chat-widget { position: fixed; inset-inline-end: 1.25rem; bottom: 1.25rem; z-index: 60; }
.chat-fab { width: 3.6rem; height: 3.6rem; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--primary-grad); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow); }
.chat-panel { position: absolute; inset-inline-end: 0; bottom: 4.4rem; width: min(24rem, calc(100vw - 2.5rem));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-modal);
  box-shadow: var(--shadow); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem;
  background: var(--primary-grad); color: #fff; }
.chat-head h2 { font-size: 1rem; margin: 0; }
.chat-icon-btn { background: transparent; border: 0; color: inherit; cursor: pointer; font-size: 1.05rem; }
.chat-messages { max-height: 16rem; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.chat-msg { max-width: 85%; padding: .65rem .9rem; border-radius: .9rem; font-size: .9rem; }
.chat-msg--guest, .chat-msg--user { background: var(--surface-2); border: 1px solid var(--border); align-self: flex-start; }
[dir="rtl"] .chat-msg--guest, [dir="rtl"] .chat-msg--user { align-self: flex-end; }
.chat-msg--admin { background: rgba(99,102,241,.12); align-self: flex-end; }
[dir="rtl"] .chat-msg--admin { align-self: flex-start; }
.chat-msg--note { background: rgba(245,158,11,.14); border: 1px dashed var(--warning); }
.chat-form { padding: 1rem; display: grid; gap: .6rem; border-top: 1px solid var(--border); }
.chat-fields { display: grid; gap: .5rem; }
.chat-error { color: var(--danger); font-size: .85rem; margin: 0; }
.chat-submit { background: var(--primary-grad); color: #fff; border: 0; padding: .65rem;
  border-radius: var(--radius-input); font-weight: 700; cursor: pointer; }

/* Reduced motion: kill every animation/transition ------------------- */
@media (prefers-reduced-motion: reduce) {
  .landing-bg__mesh, .blob, .carousel__track, .reveal, .feature, .btn { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
