/* Shared by every site page (home, about, contact, login, sign up). Colours come from theme.css. */

/* Home page ( / ). Colours come from theme.css; this file only adds layout and the chemistry + AI artwork. */

:root {
  --grad: linear-gradient(115deg, var(--accent), var(--ai));
  --card-glass: color-mix(in srgb, var(--surface) 86%, transparent);
  /* Buttons need text that stays readable on the gradient in both themes. */
  --btn-grad: linear-gradient(115deg, #c2501a, #6a45d6);
  --on-grad: #ffffff;
  --el-n: #4f7cf0;
  --el-o: #e5564a;
}
:root[data-theme="dark"] { --btn-grad: linear-gradient(115deg, #e8794a, #a78bfa); --on-grad: #1b1a18; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --btn-grad: linear-gradient(115deg, #e8794a, #a78bfa); --on-grad: #1b1a18; }
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  font-family: "Vazirmatn", Tahoma, system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.75; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 3px; border-radius: 8px; }
/* Latin letter-spacing breaks the joined Arabic/Persian letters. */
html[dir="rtl"] * { letter-spacing: 0 !important; }

.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .arrow { transform: scaleX(-1); }

/* ------------------------------------------------------------------ header */
.nav { position: sticky; top: 0; z-index: 50; transition: background .25s, border-color .25s, box-shadow .25s; border-bottom: 1px solid transparent; }
.nav.scrolled, .nav.open {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom-color: var(--border);
}
.nav__in { display: flex; align-items: center; gap: 14px; height: 68px; }
/* On wide screens the menu's children sit directly in the bar; "order" lays them out. */
.nav__menu { display: contents; }

.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; font-size: 18px; }
.brand__mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: var(--on-grad);
  background: var(--btn-grad); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 32%, transparent);
}
.brand__mark .i { width: 21px; height: 21px; }

.nav__links { order: 1; display: flex; gap: 2px; margin-inline-start: 10px; }
.nav__links a { padding: 7px 14px; border-radius: 999px; font-size: 14.5px; color: var(--muted); transition: color .2s, background .2s; }
.nav__links a:hover { color: var(--text); background: var(--hover); }
.nav__links a[aria-current="page"] { color: var(--text); background: var(--hover); font-weight: 600; }

.nav__tools { order: 2; margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.nav__auth { order: 3; display: flex; align-items: center; gap: 10px; }
.icon-btn.nav__toggle { display: none; }

select.lang {
  height: 40px; padding: 0 12px; border-radius: 12px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); max-width: 130px;
}
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); transition: transform .2s, border-color .2s;
}
.icon-btn:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

.user-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; max-width: 190px; padding-inline: 6px 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; font-weight: 600;
}
.user-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; font-size: 13px; font-weight: 700; color: var(--on-grad); background: var(--btn-grad); }

/* The server marks <html data-auth="user|guest">, so the right buttons show from the first paint. */
[data-auth="user"] [data-only="guest"], [data-auth="guest"] [data-only="user"] { display: none !important; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 50px; padding: 0 26px;
  border-radius: 999px; font-weight: 600; font-size: 15.5px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .2s, box-shadow .25s, border-color .2s, filter .2s;
}
.btn:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.btn--primary {
  color: var(--on-grad); border-color: transparent; background: var(--btn-grad);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 34%, transparent);
}
.btn--primary:hover { border-color: transparent; filter: brightness(1.06); box-shadow: 0 14px 36px color-mix(in srgb, var(--accent) 44%, transparent); }
.btn--ghost { background: transparent; }
.btn--sm { height: 40px; padding: 0 18px; font-size: 14px; }
.btn--lg { height: 58px; padding: 0 34px; font-size: 17px; }

/* ---------------------------------------------------------------- backdrop */
.hex-bg {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 38%, #000 10%, transparent 72%);
  mask-image: radial-gradient(ellipse 75% 70% at 50% 38%, #000 10%, transparent 72%);
}
.hex-bg::before, .cta__hex::before {
  content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--text) 14%, transparent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M0 16.17L28 0l28 16.17M0 16.17v32.33M56 16.17v32.33M0 48.5l28 16.17L56 48.5M28 64.67V97' fill='none' stroke='%23000' stroke-width='1.2'/%3E%3C/svg%3E") 0 0 / 56px 97px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M0 16.17L28 0l28 16.17M0 16.17v32.33M56 16.17v32.33M0 48.5l28 16.17L56 48.5M28 64.67V97' fill='none' stroke='%23000' stroke-width='1.2'/%3E%3C/svg%3E") 0 0 / 56px 97px;
}

.orb { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; animation: drift 18s ease-in-out infinite alternate; }
.orb--a { width: 620px; height: 620px; top: -220px; inset-inline-start: -160px; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 26%, transparent), transparent); }
.orb--b { width: 700px; height: 700px; top: -120px; inset-inline-end: -240px; background: radial-gradient(closest-side, color-mix(in srgb, var(--ai) 24%, transparent), transparent); animation-delay: -9s; }

/* Floating atoms: pure decoration, pushed to the edges so they never sit under text. */
.atom {
  position: absolute; z-index: -1; left: var(--x); top: var(--y); width: var(--s); height: var(--s);
  display: grid; place-items: center; border-radius: 50%; font-weight: 700; font-size: calc(var(--s) * .38);
  color: var(--c); border: 1.5px solid color-mix(in srgb, var(--c) 50%, var(--border));
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--c) 22%, var(--surface)), var(--surface) 72%);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--c) 14%, transparent);
  animation: float 9s ease-in-out infinite; animation-delay: var(--d); user-select: none;
}
.atom--c, .atom--h { --c: var(--muted); }
.atom--n { --c: var(--el-n); }
.atom--o { --c: var(--el-o); }

/* ---------------------------------------------------------------- sections */
section { padding: 96px 0; }
section.tint { background: color-mix(in srgb, var(--text) 3.2%, var(--bg)); border-block: 1px solid var(--border); }

.sec-head { text-align: center; max-width: 740px; margin: 0 auto 54px; }
.kicker { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.sec-head h2 { margin-top: 10px; font-size: clamp(28px, 3.7vw, 46px); line-height: 1.25; font-weight: 700; letter-spacing: -.015em; }
html[dir="rtl"] .sec-head h2 { line-height: 1.45; }
.sec-head p:not(.kicker) { margin-top: 14px; color: var(--muted); font-size: clamp(16px, 1.5vw, 18px); }

.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.card {
  position: relative; padding: 28px; border-radius: 26px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .3s, border-color .3s;
}
.card > * { position: relative; }
/* Soft light that follows the pointer (main.js sets --mx / --my). */
.card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .35s; pointer-events: none;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 15%, transparent), transparent 62%);
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); }
.card:hover::before { opacity: 1; }
.card h3 { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; }

.ico { display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 20px; border-radius: 16px; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.ico.ai { color: var(--ai); background: color-mix(in srgb, var(--ai) 14%, transparent); }
.ico .i { width: 25px; height: 25px; }
.snippet { display: block; margin-top: 16px; padding: 9px 12px; border-radius: 12px; background: var(--hover); font: 500 12.5px ui-monospace, Consolas, monospace; color: var(--text); overflow-x: auto; white-space: nowrap; }

/* reveal on scroll (only when scripting is available) */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--r, 0) * 90ms); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal.card.in:hover { transform: translateY(-4px); transition-delay: 0s; }

/* --------------------------------------------------------------------- CTA */
.cta-sec { padding-top: 24px; }
.cta {
  position: relative; overflow: hidden; isolation: isolate; text-align: center; padding: clamp(44px, 7vw, 84px) 24px; border-radius: 36px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), color-mix(in srgb, var(--ai) 16%, var(--surface)));
}
.cta__hex { position: absolute; inset: 0; z-index: -1; -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 0%, transparent 78%); mask-image: radial-gradient(ellipse at 50% 50%, #000 0%, transparent 78%); }
.cta h2 { font-size: clamp(26px, 3.6vw, 44px); line-height: 1.3; font-weight: 700; max-width: 22ch; margin-inline: auto; }
.cta p { margin: 14px auto 30px; max-width: 48ch; color: var(--muted); font-size: 17px; }

.foot { padding: 44px 0 48px; border-top: 1px solid var(--border); }
.foot__in { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 26px 48px; align-items: start; }
.foot__about p { margin-top: 14px; max-width: 54ch; font-size: 13px; color: var(--muted); }
.foot__links { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: flex-end; }
.foot__links a { font-size: 14.5px; color: var(--muted); transition: color .2s; }
.foot__links a:hover { color: var(--text); }


/* --------------------------------------------------------------- animation */
@keyframes float { 50% { transform: translateY(-14px) rotate(4deg); } }
@keyframes drift { to { transform: translate(40px, 30px) scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ----------------------------------------------------------------- responsive */
@media (max-width: 1060px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atom { opacity: .55; }
}
@media (max-width: 900px) {
  section { padding: 72px 0; }
  .grid3 { grid-template-columns: 1fr; }
  .foot__in { grid-template-columns: 1fr; }
  .foot__links { justify-content: flex-start; }

  .icon-btn.nav__toggle { display: grid; }
  .nav__menu {
    display: none; position: absolute; top: 100%; inset-inline: 0; flex-direction: column; align-items: stretch; gap: 14px;
    padding: 14px 20px 20px; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .nav.open .nav__menu { display: flex; }
  .nav__links { flex-direction: column; margin: 0; gap: 2px; }
  .nav__links a { padding: 11px 14px; font-size: 16px; border-radius: 14px; }
  .nav__auth { flex-wrap: wrap; }
  .nav__auth .btn { flex: 1 1 140px; }
}
@media (max-width: 640px) {
  .wrap { width: min(1180px, 100% - 32px); }
  .grid4 { grid-template-columns: 1fr; }
  .btn { height: 48px; padding: 0 22px; }
  .card { padding: 22px; border-radius: 22px; }
  .nav__menu { padding-inline: 16px; }
}

/* ------------------------------------------------------------------- small */
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .08em; }
.link { color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
