/* Merlyn — the invitations, the core, privacy, questions, the demo window, and phone fixes. */

/* ---------- the invitations ---------- */
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 30px; }
.cta-row .btn { margin: 0; }
.btn-demo { box-shadow: 0 0 0 1px rgba(255, 255, 255, .35), 0 10px 44px -12px rgba(143, 155, 255, .8); }
.btn-demo span[aria-hidden] { transition: transform .4s var(--expo, ease); }
.btn-demo:hover span[aria-hidden] { transform: translateX(4px); }
[dir="rtl"] .btn-demo:hover span[aria-hidden] { transform: scaleX(-1) translateX(4px); }
.btn-try { position: relative; display: inline-flex; align-items: center; gap: 12px; padding: 15px 24px 15px 18px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: 16px; font-weight: 500; isolation: isolate; transition: transform .42s var(--expo, ease), box-shadow .4s; }
.btn-try::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(110deg, var(--a1), var(--a2) 45%, var(--a3)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; z-index: -1; }
.btn-try::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(143, 155, 255, .07); z-index: -2; transition: background .4s; }
.btn-try:hover { transform: translateY(-2px); box-shadow: 0 10px 44px -14px rgba(134, 227, 255, .7); }
.btn-try:hover::after { background: rgba(143, 155, 255, .16); }
.btn-try:active { transform: scale(.96); }
/* a small orb that breathes: the assistant is awake */
.btn-try i { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--a1) 35%, var(--a2) 70%, transparent 72%); box-shadow: 0 0 14px 2px rgba(134, 227, 255, .55); animation: orb 2.6s ease-in-out infinite; flex: none; }
@keyframes orb { 50% { transform: scale(.78); box-shadow: 0 0 6px 1px rgba(134, 227, 255, .35); } }
.hero .cta-row { margin-top: 32px; }
.hero .scroll-hint { margin-top: 26px; }
.ready .hero .cta-row { opacity: 1; transform: none; }
.hero .cta-row { opacity: 0; transform: translateY(18px); transition: opacity 1s var(--expo, ease) .45s, transform 1s var(--expo, ease) .45s; }

/* ---------- the closing: the words, and the core beside them ---------- */
.closing-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: center; gap: clamp(20px, 4vw, 64px); }
.closing-text h2 { margin-bottom: 22px; }
.closing-sub { font-size: clamp(17px, 1.45vw, 20px); color: var(--ink-2); max-width: 32em; margin: 0; }
.closing .cta-row { margin-top: 36px; }
.core-stage { position: relative; height: clamp(380px, 56vh, 600px); cursor: grab; touch-action: pan-y; opacity: 0; transition: opacity 1.4s var(--expo, ease); }
.core-stage.on { opacity: 1; } .core-stage.grab { cursor: grabbing; }
.core-stage.no3d { display: none; }
.core-stage canvas { width: 100%; height: 100%; display: block; }
.core-stage::before { content: ""; position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(closest-side, rgba(143, 155, 255, .22), transparent 70%); filter: blur(34px); pointer-events: none; }
.core-hint { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); font: 500 11.5px var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; pointer-events: none; transition: opacity .6s; }
.core-stage.touched .core-hint { opacity: 0; }
:root[lang="ar"] .core-hint { letter-spacing: 0; font-size: 13px; }

/* ---------- privacy ---------- */
.priv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.priv { position: relative; border-radius: 18px; padding: 26px 24px 24px; background: linear-gradient(180deg, rgba(220, 225, 255, .05), rgba(220, 225, 255, .012)); border: 1px solid var(--line); overflow: hidden; transition-delay: calc(var(--i, 0) * 80ms); }
.priv::after { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, var(--a2), transparent); opacity: .6; }
.priv-n { font: 400 15px var(--serif); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.priv h3 { font-size: 22px; line-height: 1.15; margin: 14px 0 10px; }
.priv p { font-size: 15px; color: var(--ink-2); margin: 0; }
.priv-link { display: inline-flex; gap: 8px; margin-top: 26px; color: var(--a1); text-decoration: none; font-size: 15.5px; border-bottom: 1px solid rgba(134, 227, 255, .3); padding-bottom: 3px; }
.priv-link:hover { border-bottom-color: var(--a1); }
[dir="rtl"] .priv-link span[aria-hidden] { transform: scaleX(-1); display: inline-block; }

/* ---------- questions ---------- */
.faq-list { border-top: 1px solid var(--line-2); max-width: 980px; }
.faq-item { border-bottom: 1px solid var(--line); transition-delay: calc(var(--i, 0) * 50ms); }
.faq-item summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 0; cursor: pointer; font: 400 clamp(19px, 1.7vw, 24px)/1.25 var(--serif); color: var(--ink); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: #fff; }
.faq-item summary i { position: relative; width: 28px; height: 28px; flex: none; border-radius: 50%; border: 1px solid var(--line-2); transition: transform .45s var(--expo, ease), border-color .3s, background .3s; }
.faq-item summary i::before, .faq-item summary i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 1.5px; background: var(--ink-2); transform: translate(-50%, -50%); transition: transform .45s var(--expo, ease); }
.faq-item summary i::after { transform: translate(-50%, -50%) rotate(90deg); }
.faq-item[open] summary i { transform: rotate(180deg); border-color: var(--a2); background: rgba(143, 155, 255, .12); }
.faq-item[open] summary i::after { transform: translate(-50%, -50%) rotate(0deg); }
.faq-a p { margin: 0; padding: 0 56px 26px 0; font-size: clamp(16px, 1.3vw, 18px); color: var(--ink-2); max-width: 46em; animation: faqIn .5s var(--expo, ease); }
[dir="rtl"] .faq-a p { padding: 0 0 26px 56px; }
@keyframes faqIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.faq-item summary:focus-visible { outline: 2px solid var(--a2); outline-offset: 4px; border-radius: 6px; }

/* ---------- footer ---------- */
.foot-link { color: var(--ink-3); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.foot-link:hover { color: var(--ink); }

/* ---------- the demo window ---------- */
.modal-on, .modal-on body { overflow: hidden; }
.demo-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(4, 5, 10, .62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; transition: opacity .3s; }
.demo-modal[hidden] { display: none; }
.demo-modal.open { opacity: 1; }
.demo-box { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 40px); overflow: auto; border-radius: 22px; padding: 32px 28px 24px; background: linear-gradient(180deg, #121526, #0a0c16); border: 1px solid var(--line-2); box-shadow: 0 30px 90px -20px rgba(80, 90, 255, .45); transform: translateY(16px) scale(.98); transition: transform .4s var(--expo, ease); }
.demo-modal.open .demo-box { transform: none; }
.demo-box h3 { font-size: clamp(26px, 3vw, 34px); margin: 0 0 8px; }
.demo-p { color: var(--ink-2); margin: 0 0 20px; font-size: 15.5px; }
.demo-box label { display: block; margin-bottom: 12px; }
.demo-box label span { display: block; font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.demo-box input, .demo-box textarea { width: 100%; box-sizing: border-box; font: 16px var(--sans); color: var(--ink); background: rgba(220, 225, 255, .05); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: none; transition: border-color .25s, box-shadow .25s; resize: vertical; }
.demo-box input:focus, .demo-box textarea:focus { border-color: var(--a2); box-shadow: 0 0 0 4px rgba(143, 155, 255, .14); }
.demo-box [aria-invalid="true"] { border-color: #ff8f9c; }
.demo-box small { display: block; color: #ff9aa6; font-size: 12.5px; margin-top: 5px; }
.demo-box small[hidden], .cta-row[hidden] { display: none; }
.demo-box .btn { margin-top: 8px; width: 100%; justify-content: center; border: 0; cursor: pointer; font: 500 16px var(--sans); }
.demo-honey { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.demo-status { min-height: 0; margin: 12px 0 0; font-size: 14.5px; color: var(--ink-2); }
.demo-status:empty { display: none; }
.demo-status.ok { color: #9cf0cb; }
.demo-status.no { color: #ffb0ba; }
.demo-status a { color: var(--a1); }
.demo-box .btn[disabled] { opacity: .6; cursor: wait; }
.demo-note { font-size: 12.5px; color: var(--ink-3); margin: 14px 0 0; }
.demo-x { position: absolute; top: 12px; inset-inline-end: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: 22px; line-height: 1; cursor: pointer; }
.demo-x:hover { color: var(--ink); border-color: var(--line-2); }

/* ---------- laptop: tighter screens ---------- */
@media (max-width: 1180px) { .priv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- phone ---------- */
@media (max-width: 900px) {
  /* the title first, then the model: the message reads before the picture */
  .hero-grid.has3d .stage-slot { order: 2; height: min(74vw, 320px); margin: 18px calc(var(--pad) * -1) 0; }
  .hero .cta-row { margin-top: 26px; }
  .cta-row { gap: 10px; }
  .cta-row .btn, .cta-row .btn-try { flex: 1 1 auto; justify-content: center; }
  .closing-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .core-stage { order: -1; height: min(86vw, 360px); margin: -40px calc(var(--pad) * -1) 8px; }
  .closing .cta-row { margin-top: 28px; }
  .priv-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .priv { padding: 22px 20px 20px; }
  .faq-item summary { padding: 20px 0; font-size: 19px; }
  .faq-a p { padding: 0 0 22px; }
  [dir="rtl"] .faq-a p { padding: 0 0 22px; }
  .demo-box { padding: 28px 20px 20px; border-radius: 20px; }
  footer { flex-direction: column; align-items: flex-start; gap: 10px; }
}
@media (max-width: 380px) { .cta-row .btn, .cta-row .btn-try { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .btn-try i { animation: none; } .hero .cta-row { opacity: 1; transform: none; } .faq-a p { animation: none; } }
