/* قصر الطيب للبرمجيات — الأقسام والمساعد الذكي */
[hidden] { display: none !important; }
#process .wrap { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(30px, 6vw, 100px); align-items: start; }
#process .sec-head { position: sticky; top: 120px; }
@media (max-width: 960px) { #process .wrap { grid-template-columns: minmax(0, 1fr); } #process .sec-head { position: static; } }
.wrap { width: min(100% - 40px, 1280px); margin-inline: auto; }
.sec { position: relative; padding-block: clamp(90px, 12vw, 150px); }
.sec-head { max-width: 720px; margin-bottom: clamp(40px, 6vw, 64px); }
.sec-kicker { margin: 0 0 18px; font-family: var(--mono); font-size: 12px; letter-spacing: .24em; color: var(--gold-hi); direction: ltr; text-align: end; }
html[dir="ltr"] .sec-kicker { text-align: start; }
.sec h2, .secure h2 { margin: 0; font-family: var(--kufi); font-weight: 200; font-size: clamp(32px, 4.6vw, 62px); line-height: 1.35; color: var(--ivory); text-wrap: balance; }
html[lang="en"] .sec h2, html[lang="en"] .secure h2 { font-family: var(--jost); font-weight: 300; line-height: 1.12; letter-spacing: -.01em; }
.sec h2 em, .secure h2 em { font-style: normal; font-weight: 500; background: linear-gradient(100deg, #8f6f2f, var(--gold-hi) 40%, #f3dfae 55%, var(--gold-hi) 75%, #8f6f2f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sec-sub { margin: 18px 0 0; color: var(--ivory-2); font-size: clamp(16px, 1.4vw, 18px); max-width: 36em; }
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* Services accordion */
.petals-acc { display: flex; gap: 14px; min-height: 470px; }
.petal { --mx: 50%; --my: 50%; position: relative; flex: 1 1 0; min-width: 0; border-radius: 26px; overflow: hidden; isolation: isolate;
  background: linear-gradient(170deg, rgba(40, 33, 24, .7), rgba(17, 14, 11, .85)); border: 1px solid var(--line);
  transition: flex-grow .7s var(--ease), border-color .4s, box-shadow .4s; }
.petal::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .4s;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(216, 180, 106, .18), transparent 60%); }
.petal:hover::before { opacity: 1; }
.petal.is-open { flex-grow: 2.6; border-color: rgba(216, 180, 106, .45); box-shadow: 0 30px 70px -40px rgba(216, 180, 106, .45), inset 0 1px 0 rgba(255, 235, 200, .08); }
.petal-head { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 28px 28px 18px; }
.petal-head:focus-visible { outline: 1.5px solid var(--gold-hi); outline-offset: -6px; border-radius: 22px; }
.petal-idx { font-family: var(--mono); font-size: 13px; color: var(--gold-hi); }
.petal-title { font-family: var(--kufi); font-weight: 500; font-size: 22px; line-height: 1.45; color: var(--ivory); }
html[lang="en"] .petal-title { font-family: var(--jost); }
.petal-en { font-family: var(--jost); font-size: 10.5px; letter-spacing: .3em; color: rgba(201, 191, 174, .6); direction: ltr; text-align: end; }
html[dir="ltr"] .petal-en { text-align: start; }
.petal-body { padding: 0 28px 28px; color: var(--ivory-2); opacity: 0; max-height: 0; overflow: hidden; transition: opacity .5s .15s, max-height .7s var(--ease); }
.petal.is-open .petal-body { opacity: 1; max-height: 560px; }
.petal-body p { margin: 0 0 14px; }
.petal-body ul { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; }
.petal-body li { display: flex; gap: 12px; align-items: baseline; color: var(--ivory); }
.petal-body li::before { content: ""; flex: 0 0 6px; height: 6px; transform: rotate(45deg) translateY(-2px); background: var(--gold-hi); }
.petal-code { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: rgba(216, 180, 106, .7); }
.petal:not(.is-open) .petal-title { font-size: 19px; }

/* Manifesto */
.manifesto { padding-block: clamp(80px, 12vw, 160px); border-block: 1px solid var(--line); background: radial-gradient(900px 400px at 50% 50%, #1d1812, transparent 70%); }
.manifesto-text { margin: 0; font-family: var(--kufi); font-weight: 300; font-size: clamp(28px, 4.2vw, 58px); line-height: 1.65; text-align: center; text-wrap: balance; color: rgba(243, 236, 224, .16); }
html[lang="en"] .manifesto-text { font-family: var(--jost); line-height: 1.3; }
.manifesto-text .w { transition: color .5s ease, text-shadow .5s ease; }
.manifesto-text .w.lit { color: var(--ivory); }
.manifesto-text .w.lit.gold { color: var(--gold-hi); text-shadow: 0 0 24px rgba(216, 180, 106, .35); }

/* Work */
.works { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 3vw, 36px); }
.work { display: block; text-decoration: none; perspective: 1000px; }
.works--single { grid-template-columns: minmax(0, 1fr); }
.works--single .work { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 60px); align-items: center; }
.works--single .work-meta { padding: 0; }
.works--single .work-meta h3 { font-size: clamp(24px, 2.6vw, 34px); }
.works--single .work-meta p { font-size: 17px; }
@media (max-width: 960px) { .works--single .work { grid-template-columns: minmax(0, 1fr); } .works--single .work-meta { padding-top: 22px; } }
.work-frame { position: relative; border-radius: 18px; overflow: hidden; background: #0b0a08; border: 1px solid var(--line);
  padding-top: 30px; transition: transform .7s var(--ease), box-shadow .7s var(--ease), border-color .4s; box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .9); }
.work-dots { position: absolute; top: 11px; inset-inline-end: 14px; display: flex; gap: 6px; direction: ltr; }
.work-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(243, 236, 224, .18); }
.work-frame img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; transition: transform 1.2s var(--ease); }
.work:hover .work-frame { transform: rotateX(4deg) translateY(-6px); border-color: rgba(216, 180, 106, .5); box-shadow: 0 50px 80px -40px rgba(216, 180, 106, .35); }
.work:hover .work-frame img { transform: scale(1.04); }
.work-meta { padding: 22px 4px 0; }
.work-tag { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--gold-hi); }
.work-meta h3 { margin: 8px 0 6px; font-family: var(--kufi); font-weight: 500; font-size: 22px; color: var(--ivory); }
html[lang="en"] .work-meta h3 { font-family: var(--jost); }
.work-meta p { margin: 0; color: var(--ivory-2); font-size: 15.5px; }

/* Timeline */
.timeline { --p: 0; position: relative; list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; max-width: 860px; }
.timeline::before, .timeline::after { content: ""; position: absolute; inset-inline-start: 27px; top: 10px; bottom: 10px; width: 1px; }
.timeline::before { background: var(--line); }
.timeline::after { background: linear-gradient(var(--gold-hi), var(--gold)); transform-origin: top; transform: scaleY(var(--p)); box-shadow: 0 0 12px rgba(216, 180, 106, .6); }
.tl-step { position: relative; display: flex; gap: 26px; align-items: flex-start; padding: 6px 0; }
.tl-n { position: relative; z-index: 1; flex: 0 0 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 14px; color: var(--gold-hi);
  background: var(--obsidian); border: 1px solid rgba(216, 180, 106, .45); box-shadow: 0 0 0 6px var(--obsidian); transition: background .5s, color .5s, box-shadow .5s; }
.tl-step.passed .tl-n { background: var(--gold); color: #1a140b; box-shadow: 0 0 0 6px var(--obsidian), 0 0 24px rgba(216, 180, 106, .5); }
.tl-step h3 { margin: 8px 0 4px; font-family: var(--kufi); font-weight: 500; font-size: 21px; color: var(--ivory); }
html[lang="en"] .tl-step h3 { font-family: var(--jost); }
.tl-step p { margin: 0; color: var(--ivory-2); }

/* Secure */
.secure { padding-block: clamp(80px, 10vw, 130px); background: linear-gradient(180deg, transparent, #15120e 30%, #15120e 70%, transparent); }
.secure-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(30px, 5vw, 80px); align-items: center; }
.secure .sec-head { margin-bottom: 0; }
.secure-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.secure-list li { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; border-radius: 18px; border: 1px solid var(--line); background: rgba(243, 236, 224, .025); color: var(--ivory); transition: border-color .3s, background .3s; }
.secure-list li:hover { border-color: rgba(216, 180, 106, .45); background: rgba(216, 180, 106, .05); }
.secure-list span { font-family: var(--mono); font-size: 11.5px; letter-spacing: .18em; color: var(--gold-hi); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(30px, 5vw, 80px); align-items: start; }
.channels { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 12px; }
.channel { display: flex; flex-direction: column; gap: 4px; padding: 18px 22px; border-radius: 18px; border: 1px solid var(--line); text-decoration: none; transition: border-color .3s; }
a.channel:hover { border-color: var(--gold-hi); }
.ch-k { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--gold-hi); }
.ch-v { color: var(--ivory); font-size: 16px; }
.form { display: grid; gap: 18px; padding: clamp(22px, 3vw, 36px); border-radius: 26px; border: 1px solid var(--line);
  background: linear-gradient(170deg, rgba(40, 33, 24, .6), rgba(17, 14, 11, .8)); box-shadow: inset 0 1px 0 rgba(255, 235, 200, .06); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--ivory-2); }
.field input, .field select, .field textarea { font: inherit; font-size: 16px; color: var(--ivory); background: rgba(0, 0, 0, .3); border: 1px solid rgba(243, 236, 224, .16); border-radius: 14px; padding: 13px 16px; min-height: 52px; width: 100%; transition: border-color .2s, box-shadow .2s; }
.field select option { background: #1a160f; }
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold-hi); box-shadow: 0 0 0 3px rgba(216, 180, 106, .15); }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.form-status { min-height: 24px; margin: 0; font-size: 15px; color: var(--gold-hi); }
.form-status.error { color: #e79a8a; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding-block: 56px 96px; }
.foot-grid { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 28px; }
.foot-brand { display: flex; align-items: center; gap: 20px; }
.foot-brand img { width: 84px; height: auto; }
.foot-brand p { margin: 0; color: var(--ivory-2); font-size: 15px; max-width: 18em; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.foot-nav a { text-decoration: none; color: var(--ivory-2); }
.foot-nav a:hover { color: var(--gold-hi); }
.foot-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: rgba(201, 191, 174, .75); }

/* ======================= المساعد الذكي ======================= */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ai { position: fixed; z-index: 150; bottom: max(18px, env(safe-area-inset-bottom)); inset-inline-end: 18px; }
.ai-fab { display: flex; align-items: center; gap: 10px; height: 60px; padding-inline: 14px 22px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 500; color: var(--ivory);
  background: linear-gradient(180deg, rgba(48, 40, 28, .85), rgba(20, 17, 13, .9)); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid rgba(216, 180, 106, .4); animation: fabglow 3.2s infinite; transition: transform .3s var(--ease); }
.ai-fab:hover { transform: translateY(-2px); }
@keyframes fabglow { 0% { box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9), 0 0 0 0 rgba(216, 180, 106, .45); } 70% { box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9), 0 0 0 14px rgba(216, 180, 106, 0); } 100% { box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9), 0 0 0 0 rgba(216, 180, 106, 0); } }
.ai-fab img { animation: aispin 18s linear infinite; }
@keyframes aispin { to { transform: rotate(360deg); } }
.ai.open .ai-fab { display: none; }
.ai-panel { position: absolute; bottom: 0; inset-inline-end: 0; width: min(400px, calc(100vw - 24px)); height: min(600px, calc(100svh - 110px)); display: flex; flex-direction: column; border-radius: 26px; overflow: hidden;
  background: linear-gradient(180deg, rgba(36, 30, 22, .92), rgba(14, 12, 9, .96)); -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid rgba(216, 180, 106, .3); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 235, 200, .1); animation: aiin .45s var(--ease); }
.ai-panel[hidden] { display: none; }
@keyframes aiin { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.ai-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ai-head div { flex: 1; display: flex; flex-direction: column; line-height: 1.4; }
.ai-head strong { font-family: var(--kufi); font-weight: 500; font-size: 16px; }
.ai-head span { font-size: 12.5px; color: var(--ivory-2); display: flex; align-items: center; gap: 6px; }
.ai-live { width: 7px; height: 7px; border-radius: 50%; background: #7fcf9a; box-shadow: 0 0 8px #7fcf9a; }
.ai-close { all: unset; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; color: var(--ivory-2); }
.ai-close:hover { background: rgba(243, 236, 224, .08); color: var(--ivory); }
.ai-close:focus-visible { outline: 1.5px solid var(--gold-hi); }
.ai-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 11px 15px; border-radius: 18px; font-size: 15px; line-height: 1.75; white-space: pre-line; animation: aiin .35s var(--ease); }
.msg.bot { align-self: flex-start; background: rgba(243, 236, 224, .06); border: 1px solid var(--line); border-start-start-radius: 6px; color: var(--ivory); }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: #1a140b; border-start-end-radius: 6px; font-weight: 500; }
.msg.typing { display: flex; gap: 5px; align-items: center; padding: 14px 16px; }
.msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-hi); animation: blink 1.2s infinite; }
.msg.typing i:nth-child(2) { animation-delay: .2s; }
.msg.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.msg-actions a, .msg-actions button { font: inherit; font-size: 13.5px; text-decoration: none; cursor: pointer; padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(216, 180, 106, .5); color: var(--gold-hi); background: transparent; }
.msg-actions a:hover, .msg-actions button:hover { background: rgba(216, 180, 106, .12); }
.ai-chips { display: flex; gap: 8px; padding: 0 18px 12px; overflow-x: auto; scrollbar-width: none; }
.ai-chips[hidden] { display: none; }
.ai-chips button { flex: 0 0 auto; font: inherit; font-size: 13.5px; cursor: pointer; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--ivory); background: rgba(243, 236, 224, .04); }
.ai-chips button:hover { border-color: var(--gold-hi); }
.ai-form { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.ai-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--ivory); background: rgba(0, 0, 0, .35); border: 1px solid rgba(243, 236, 224, .16); border-radius: 999px; padding: 0 18px; height: 48px; }
.ai-form input:focus { outline: none; border-color: var(--gold-hi); }
.ai-send { flex: 0 0 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #1a140b; background: linear-gradient(135deg, var(--gold-hi), var(--gold)); }
.ai-send svg { width: 20px; height: 20px; }
html[dir="ltr"] .ai-send svg { transform: scaleX(-1); }

/* ======================= Responsive ======================= */
@media (max-width: 960px) {
  .petals-acc { flex-direction: column; min-height: 0; }
  .petal, .petal.is-open { flex: none; }
  .works, .secure-grid, .contact-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .form-row, .secure-list { grid-template-columns: minmax(0, 1fr); }
  .ai-fab-label { display: none; }
  .ai-fab { width: 60px; padding: 0; justify-content: center; }
  .ai { inset-inline-end: 12px; }
  .ai-panel { width: calc(100vw - 24px); height: calc(100svh - 96px); }
  .foot-brand { flex-direction: column; align-items: flex-start; }
  .sec-kicker { text-align: start; }
}
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
.still .reveal { opacity: 1; transform: none; }
