/* ===== Raff · رفّ — design tokens & 3D components ===== */
:root {
  --night: #000000;
  --night-2: #0b0b0e;
  --night-3: #16161b;
  --line: rgba(240, 205, 150, 0.15);
  --gold: #e6b97c;
  --gold-hi: #f8dfb4;
  --gold-lo: #9a6a3a;
  --gold-foil: linear-gradient(115deg, #9a6a3a 0%, #f8dfb4 24%, #d89d5e 44%, #fff2d8 58%, #b97c44 76%, #efcb93 100%);
  --cream: #f4ecdc;
  --ink: #1f1a16;
  --ink-soft: #5b4d3e;
  --oxblood: #8a3a26;
  --text: #ece6da;
  --text-dim: #9a9aa4;
  --radius: 16px;
  --ease: cubic-bezier(.22, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --f-display-en: "Space Grotesk", "Manrope", system-ui, sans-serif;
  --f-body-en: "Lora", Georgia, serif;
  --f-ui-en: "Manrope", system-ui, sans-serif;
  --f-caps: "Manrope", system-ui, sans-serif;
  --f-display-ar: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --f-body-ar: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --f-ui-ar: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --f-mono: "JetBrains Mono", "Cairo", ui-monospace, Consolas, monospace;
}
html[lang="ar"] { --f-display: var(--f-display-ar); --f-body: var(--f-body-ar); --f-ui: var(--f-ui-ar); }
html[lang="en"] { --f-display: var(--f-display-en); --f-body: var(--f-body-en); --f-ui: var(--f-ui-en); }

*, *::before, *::after { box-sizing: border-box; }
* { font-variant-numeric: lining-nums; }
html, body { margin: 0; }
body {
  background: var(--night); color: var(--text); font-family: var(--f-ui); font-size: 17px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: rgba(230, 185, 124, .35); }

.grain::after {
  content: ""; position: fixed; inset: -50%; pointer-events: none; z-index: 999;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.55'/></svg>");
  opacity: .05; mix-blend-mode: overlay; animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } 100% { transform: translate(1%, 3%); } }

.foil { background: var(--gold-foil); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: foil 9s ease-in-out infinite alternate; }
@keyframes foil { from { background-position: 0% 0; } to { background-position: 100% 0; } }
.caps { font-family: var(--f-caps); letter-spacing: .28em; text-transform: uppercase; font-size: .72rem; font-weight: 600; color: var(--gold); }
html[lang="ar"] .caps { font-family: var(--f-ui-ar); letter-spacing: .04em; font-size: .82rem; }

/* ---- Floating glass nav ---- */
.nav {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 50; width: min(1180px, calc(100% - 24px)); height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px 0 18px;
  border-radius: 20px; background: rgba(14, 14, 18, .62); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 -2px 0 rgba(0, 0, 0, .35) inset, 0 18px 40px rgba(0, 0, 0, .45);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }
.brand-name { font-family: var(--f-display-ar); font-size: 1.5rem; line-height: 1; color: var(--gold-hi); }
.brand-sub { display: block; font-family: var(--f-ui-en); font-size: .62rem; font-weight: 700; letter-spacing: .38em; color: var(--text-dim); margin-top: 3px; }
.nav-links { display: flex; align-items: center; gap: clamp(8px, 2vw, 22px); font-size: .92rem; }
.nav-links a:not(.btn) { color: var(--text-dim); transition: color .3s; }
.nav-links a:not(.btn):hover { color: var(--gold-hi); }
@media (max-width: 720px) { .nav-links .hide-sm { display: none; } }

/* ---- 3D segmented language switch ---- */
.lang-toggle {
  position: relative; display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; font-family: var(--f-ui-en); font-size: .74rem; font-weight: 700;
  background: linear-gradient(180deg, #050507, #111115); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .07);
}
.lang-toggle button { position: relative; min-width: 36px; padding: 5px 9px; border-radius: 9px; color: var(--text-dim); transition: .35s var(--spring); }
.lang-toggle button:nth-child(1) { font-family: var(--f-ui-ar); font-size: .9rem; line-height: 1.1; }
.lang-toggle button[aria-pressed="true"] { color: #2a1606; background: linear-gradient(180deg, #ffe9c4, #e2b77a 60%, #c58c50); box-shadow: 0 3px 0 #7a4a22, 0 6px 10px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .7); transform: translateY(-2px); }

/* ---- 3D buttons: raised, lift on hover, press on click ---- */
.btn {
  --depth: #070a12; --lift: 6px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 28px; border-radius: 14px; font-family: var(--f-ui); font-size: .98rem; font-weight: 700; white-space: nowrap;
  transform: translateY(0); transition: transform .18s var(--ease), box-shadow .18s var(--ease), filter .2s;
  box-shadow: 0 var(--lift) 0 var(--depth), 0 calc(var(--lift) + 10px) 26px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 0 rgba(0, 0, 0, .18);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 calc(var(--lift) + 2px) 0 var(--depth), 0 calc(var(--lift) + 16px) 32px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -2px 0 rgba(0, 0, 0, .18); }
.btn:active { transform: translateY(calc(var(--lift) - 1px)); box-shadow: 0 1px 0 var(--depth), 0 4px 10px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 2px 6px rgba(0, 0, 0, .2); }
.btn-gold { --depth: #7a4a22; color: #2a1606; background: linear-gradient(180deg, #ffeccc 0%, #ebc187 45%, #cf9356 100%); }
.btn-gold:hover { filter: brightness(1.05) saturate(1.05); }
.btn-ghost { --depth: #000000; color: var(--text); background: linear-gradient(180deg, #2a2a31 0%, #1b1b21 55%, #131317 100%); border: 1px solid rgba(255, 255, 255, .07); box-shadow: 0 6px 0 #000000, 0 16px 26px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn-ghost:hover { color: var(--gold-hi); }
.btn-sm { --lift: 4px; padding: 9px 18px; font-size: .86rem; border-radius: 11px; }

/* 3D round keycap (icon buttons) */
.icon-btn, .nav-btn {
  display: grid; place-items: center; border-radius: 14px; color: var(--gold-hi);
  background: linear-gradient(180deg, #2a2a31, #141418); border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 4px 0 #000000, 0 10px 18px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), color .2s;
}
.icon-btn:hover, .nav-btn:hover { transform: translateY(-2px); }
.icon-btn:active, .nav-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #000000, 0 3px 8px rgba(0, 0, 0, .45), inset 0 2px 5px rgba(0, 0, 0, .35); }
.icon-btn[aria-pressed="true"] { color: #2a1606; background: linear-gradient(180deg, #ffeccc, #e2b77a 60%, #c58c50); box-shadow: 0 4px 0 #7a4a22, 0 10px 18px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .6); }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; visibility: hidden; opacity: 0; transition: opacity .35s, visibility .35s; perspective: 1400px; }
.modal.open { visibility: visible; opacity: 1; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .8); backdrop-filter: blur(8px); }
.modal-card {
  position: relative; width: min(1000px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: radial-gradient(120% 80% at 50% 0%, #1b1b20, #0d1222 70%); border: 1px solid rgba(255, 255, 255, .08); border-radius: 26px;
  padding: clamp(22px, 4vw, 44px); transform: rotateX(14deg) translateY(30px) scale(.96); transform-origin: 50% 100%; transition: transform .6s var(--spring);
  box-shadow: 0 2px 0 rgba(255, 255, 255, .06) inset, 0 50px 120px rgba(0, 0, 0, .7);
}
.modal.small .modal-card { width: min(460px, 100%); }
.modal.open .modal-card { transform: none; }
.modal-close { position: absolute; top: 16px; inset-inline-end: 16px; width: 40px; height: 40px; font-size: 20px; line-height: 1; }

/* ---- Plans: floating 3D cards ---- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; perspective: 1400px; }
@media (max-width: 860px) { .plans { grid-template-columns: 1fr; } }
.plan {
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 32px 28px; border-radius: 24px; transform-style: preserve-3d;
  background: linear-gradient(160deg, #18181d, #101013 60%, #0a0a0c);
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 -3px 0 rgba(0, 0, 0, .35) inset, 0 30px 60px rgba(0, 0, 0, .45);
  transition: transform .5s var(--ease), box-shadow .5s;
}
.plan > * { transform: translateZ(28px); }
.plan.featured { background: linear-gradient(160deg, #3a2c1c, #19161a 55%, #0d0d10); border-color: rgba(230, 185, 124, .45); box-shadow: 0 1px 0 rgba(255, 230, 190, .25) inset, 0 40px 80px rgba(0, 0, 0, .55), 0 0 60px rgba(230, 185, 124, .12); }
.plan-badge { position: absolute; top: -14px; inset-inline-start: 24px; padding: 4px 14px; border-radius: 10px; background: linear-gradient(180deg, #ffeccc, #e2b77a 60%, #c58c50); color: #2a1606; font-size: .75rem; font-weight: 700; box-shadow: 0 3px 0 #7a4a22, 0 8px 14px rgba(0, 0, 0, .4); transform: translateZ(50px); }
.plan-name { font-family: var(--f-display); font-size: 1.55rem; color: var(--gold-hi); line-height: 1.2; margin: 0; }
.plan-price { display: flex; align-items: baseline; gap: 8px; }
.plan-price b { font-family: var(--f-display-en); font-size: 3rem; font-weight: 700; color: #fff; line-height: 1; text-shadow: 0 1px 0 #c9a271, 0 2px 0 #a8834f, 0 3px 0 #7d5f37, 0 8px 14px rgba(0, 0, 0, .5); }
.plan-price span { color: var(--text-dim); font-size: .9rem; }
.plan-desc { color: var(--text-dim); font-size: .95rem; min-height: 3.2em; margin: 0; }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .95rem; }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: .4em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1d6, #e2b77a 45%, #8a5a2c); box-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
.plan .btn { margin-top: auto; transform: translateZ(40px); }

/* ---- Forms ---- */
.field-3d { width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .08); color: var(--text); font: inherit;
  background: linear-gradient(180deg, #050507, #0e0e12); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .65), 0 1px 0 rgba(255, 255, 255, .06); outline: none; }
.field-3d:focus { border-color: rgba(230, 185, 124, .55); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .65), 0 0 0 4px rgba(230, 185, 124, .12); }

/* ---- Account chip ---- */
.account-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 12px; font-size: .82rem; color: var(--text);
  background: linear-gradient(180deg, #212128, #131317); box-shadow: 0 3px 0 #000000, inset 0 1px 0 rgba(255, 255, 255, .1); }
.account-chip i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-style: normal; font-weight: 700; color: #2a1606; background: linear-gradient(180deg, #ffeccc, #d9a668); }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px); z-index: 300; padding: 12px 22px; border-radius: 14px; background: linear-gradient(180deg, #24242b, #141418); color: var(--gold-hi); font-size: .9rem; box-shadow: 0 5px 0 #000000, 0 16px 30px rgba(0, 0, 0, .5); opacity: 0; transition: .4s var(--spring); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Printing the library is disabled ---- */
@media print { body * { visibility: hidden !important; } body::before { content: "Raff · رفّ"; visibility: visible; } }

/* ---- Raff logo: three stacked 3D slabs (red · blue · yellow) ---- */
.brand { gap: 10px; }
.brand-mark { width: 42px; height: 42px; overflow: visible; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6)); }
.brand-mark g { transition: transform .5s cubic-bezier(.2, .9, .2, 1.3); }
.brand:hover .bm-1 { transform: translateY(-5px); }
.brand:hover .bm-2 { transform: translateY(-2px); }
.brand:hover .bm-3 { transform: translateY(1px); }
.brand-txt { display: flex; align-items: baseline; gap: 7px; }
.brand-name { font-family: var(--f-display-ar); font-weight: 700; font-size: 1.55rem; line-height: 1; color: #fff; }
.brand-sub { display: inline; margin: 0; font-family: "Space Grotesk", var(--f-ui-en); font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; color: #8b8b95; text-transform: lowercase; }
