/* ==========================================================================
   Nimaq.ir — styles
   One stylesheet for every page. Colors, spacing and fonts are CSS variables
   at the top, so you can re-theme the site by editing only the :root block.
   Logical properties (inline-start / inline-end) are used everywhere so the
   same rules work for both right-to-left (Persian) and left-to-right (English).
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Backgrounds (deep navy) */
  --bg-0: #070a1a;
  --bg-1: #0b1030;
  --bg-2: #121a42;
  --surface: rgba(18, 26, 66, 0.55);

  /* Lines */
  --line: rgba(167, 139, 250, 0.18);
  --line-strong: rgba(167, 139, 250, 0.4);

  /* Text */
  --text: #eef0fc;
  --text-soft: #b9bddb;
  --muted: #9aa1c9;

  /* Accents: purple (primary) + blue (secondary) */
  --violet: #b7a1fb;
  --violet-deep: #6a45e0;
  --blue: #86b0ff;
  --blue-deep: #3d62e8;

  --glow-violet: rgba(124, 92, 255, 0.22);
  --glow-blue: rgba(59, 130, 246, 0.16);

  /* Shape and layout */
  --radius: 0.75rem;
  --container: 72rem;
  --gutter: clamp(1.125rem, 4.5vw, 2rem);
  --header-h: 4.25rem;

  /* Fonts: system fonts only (fast, no licensing issues) */
  --font-latin: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-fa: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html[lang="fa"] { --lh: 1.95; }
html[lang="en"] { --lh: 1.65; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg-0);
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  color: var(--text);
  font-family: var(--font-latin);
  font-size: 1rem;
  line-height: var(--lh, 1.7);
}

html[lang="fa"] body { font-family: var(--font-fa); }
/* Latin words inside Persian text use the Latin font stack */
html[lang="fa"] [lang="en"] { font-family: var(--font-latin); }
html[lang="en"] [lang="fa"] { font-family: var(--font-fa); }

/* Soft atmospheric background (static, behind everything) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 90% -10%, var(--glow-violet), transparent 60%),
    radial-gradient(50rem 36rem at 0% 25%, var(--glow-blue), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 75%);
}

main { flex: 1; }

img, svg { max-width: 100%; }
img { height: auto; display: block; }

h1, h2, h3, p, ul, dl, dd { margin-block: 0; }

a {
  color: var(--violet);
  text-underline-offset: 0.2em;
}
a:hover { color: #d8ccff; }

:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
  border-radius: 0.25rem;
}

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -5rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  background: var(--bg-2);
  color: var(--text);
  border: 2px solid var(--violet);
  transition: top 0.15s;
}
.skip-link:focus { top: 1rem; }

/* Placeholders you are supposed to replace */
.placeholder {
  color: var(--text);
  background: rgba(167, 139, 250, 0.12);
  border: 1px dashed var(--line-strong);
  border-radius: 0.35rem;
  padding: 0.05em 0.45em;
  font-style: normal;
}
.placeholder-block {
  border: 1px dashed var(--line-strong);
  background: rgba(167, 139, 250, 0.08);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: var(--text-soft);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 10, 26, 0.84);
  border-block-end: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: var(--bg-0); }
}

.bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  min-height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  min-height: 2.75rem;
}
.wordmark:hover { color: var(--text); }
.wordmark img { border-radius: 0.4rem; }

/* Language switcher (a small pill with two links) */
.lang {
  display: inline-flex;
  margin-inline-start: auto;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lang a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding-inline: 0.85rem;
  border-radius: 999px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.9375rem;
  line-height: 1;
}
.lang a:hover { color: var(--text); }
.lang a[aria-current="true"] {
  background: rgba(167, 139, 250, 0.2);
  color: var(--text);
}

/* Navigation */
.nav-list {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  position: relative;
  display: block;
  padding: 0.55rem 0.85rem;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  color: var(--text-soft);
  text-decoration: none;
}
.nav-list a:hover { color: var(--text); background: rgba(167, 139, 250, 0.1); }
.nav-list a[aria-current="true"] { color: var(--text); }
.nav-list a[aria-current="true"]::after {
  content: "";
  position: absolute;
  inset-inline: 0.85rem;
  inset-block-end: 0.25rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--violet), var(--blue));
}

/* Mobile menu button (shown only when JavaScript is available) */
.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.menu-btn:hover { background: rgba(167, 139, 250, 0.12); }
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 1.15rem;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s var(--ease), background-color 0.2s;
}
.menu-icon { position: relative; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; inset-inline-start: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }
.menu-btn[aria-expanded="true"] .menu-icon { background: transparent; }
.menu-btn[aria-expanded="true"] .menu-icon::before { transform: translateY(6px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-icon::after { transform: translateY(-6px) rotate(-45deg); }

/* Small screens: without JS the links simply wrap under the header row */
.site-nav { order: 3; flex-basis: 100%; padding-block-end: 0.75rem; }
.nav-list { flex-wrap: wrap; }

@media (max-width: 47.99rem) {
  .js .menu-btn { display: inline-flex; }
  .js .site-nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    padding: 0.75rem var(--gutter) 1rem;
    background: rgba(7, 10, 26, 0.98);
    border-block-end: 1px solid var(--line);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-0.5rem);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0s linear 0.2s;
  }
  .js .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s;
  }
  .js .nav-list { flex-direction: column; }
  .js .nav-list a { padding-block: 0.75rem; }
  .js .nav-list a[aria-current="true"]::after { inset-block-end: 0.4rem; inset-inline-end: auto; width: 2rem; }
}

@media (min-width: 48rem) {
  .bar { flex-wrap: nowrap; }
  .site-nav { order: 0; flex-basis: auto; padding: 0; margin-inline-start: auto; }
  /* The switcher sits after the links visually; DOM order keeps the mobile menu logical */
  .lang { order: 2; margin-inline-start: 0.75rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.875rem;
  padding: 0.5rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background-color 0.2s, border-color 0.2s, filter 0.2s;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--violet-deep), var(--blue-deep));
}
.btn-primary:hover { color: #fff; filter: brightness(1.12); transform: translateY(-1px); }
.btn-secondary {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(167, 139, 250, 0.06);
}
.btn-secondary:hover { color: var(--text); background: rgba(167, 139, 250, 0.16); border-color: var(--violet); transform: translateY(-1px); }
.icon { flex: none; }
/* Arrows that point sideways/diagonally are mirrored in right-to-left pages */
[dir="rtl"] .icon-dir { transform: scaleX(-1); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(3.5rem, 9vw, 6.5rem); }
.hero-grid { display: grid; gap: clamp(2.5rem, 7vw, 4rem); align-items: center; }
@media (min-width: 56rem) {
  .hero-grid { grid-template-columns: 1.15fr 0.85fr; }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--violet);
}
html[lang="fa"] .eyebrow { font-family: var(--font-fa); font-size: 0.9375rem; }
html[lang="en"] .eyebrow { text-transform: uppercase; letter-spacing: 0.14em; }
.eyebrow::before { content: ""; width: 1.75rem; height: 1px; background: currentColor; }

.hero h1 { margin-block-start: 0.5rem; line-height: 1.05; }
.h1-main {
  display: block;
  font-size: clamp(3.5rem, 14vw, 7.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  background: linear-gradient(180deg, #ffffff 30%, #c8bbff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #fff; /* fallback */
}
.h1-sub {
  display: block;
  margin-block-start: 0.25rem;
  font-size: clamp(1.25rem, 3.6vw, 1.75rem);
  font-weight: 500;
  color: var(--blue);
}

.hero-name { margin-block-start: 1.25rem; color: var(--text-soft); }
.hero-name .label { color: var(--muted); }
.lead {
  margin-block-start: 1.25rem;
  max-width: 36rem;
  font-size: clamp(1.0625rem, 2.4vw, 1.3rem);
  color: var(--text-soft);
}
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block-start: 2rem; }

/* Hero entrance: plays once, works without JavaScript */
@keyframes rise {
  from { opacity: 0; transform: translateY(0.75rem); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: rise 0.7s var(--ease) both; }
  .hero-copy > :nth-child(2) { animation-delay: 0.07s; }
  .hero-copy > :nth-child(3) { animation-delay: 0.14s; }
  .hero-copy > :nth-child(4) { animation-delay: 0.21s; }
  .hero-copy > :nth-child(5) { animation-delay: 0.28s; }
  .hero-art { animation: rise 0.9s var(--ease) 0.15s both; }
}

/* Artwork frame with small "interface" corner marks (original, abstract) */
.hero-art { position: relative; width: 100%; max-width: 26rem; margin-inline: auto; }
.hero-art::before, .hero-art::after {
  content: "";
  position: absolute;
  width: 1.6rem;
  height: 1.6rem;
  border: 2px solid var(--violet);
  opacity: 0.85;
  pointer-events: none;
}
.hero-art::before { top: -0.6rem; inset-inline-start: -0.6rem; border-inline-end: 0; border-block-end: 0; }
.hero-art::after { bottom: 2.4rem; inset-inline-end: -0.6rem; border-inline-start: 0; border-block-start: 0; }
.frame {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  background: var(--bg-1);
  box-shadow: 0 30px 80px -30px rgba(90, 70, 220, 0.5);
}
.frame img { width: 100%; height: 100%; object-fit: cover; }
.art-caption {
  display: flex;
  justify-content: space-between;
  margin-block-start: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(3.5rem, 9vw, 6rem);
  border-block-start: 1px solid var(--line);
}
.section-head { display: flex; align-items: baseline; gap: 1rem; margin-block-end: 1.5rem; }
.section-index { font-family: var(--font-mono); font-size: 0.9375rem; color: var(--violet); }
html[lang="fa"] .section-index { font-family: var(--font-fa); }
.section h2 { font-size: clamp(1.75rem, 4.5vw, 2.5rem); line-height: 1.25; }
.section-intro { max-width: 40rem; margin-block-end: 2rem; color: var(--text-soft); }

/* About */
.about-grid { display: grid; gap: 2.5rem; }
@media (min-width: 56rem) {
  .about-grid { grid-template-columns: 1.5fr 1fr; gap: 4rem; align-items: start; }
}
.about-text { max-width: 40rem; }
.about-text p + p { margin-block-start: 1.25rem; }
.about-text p:first-child { font-size: 1.125rem; color: var(--text); }
.facts {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.facts > div {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) 1fr;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
}
.facts > div + div { border-block-start: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { color: var(--text); overflow-wrap: anywhere; }

/* Interests */
.interest-list {
  list-style: none;
  padding: 0;
  display: grid;
  border-block-end: 1px solid var(--line);
}
@media (min-width: 44rem) {
  .interest-list { grid-template-columns: 1fr 1fr; column-gap: 3rem; }
}
.interest {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1.25rem;
  padding-block: 1.5rem;
  border-block-start: 1px solid var(--line);
}
.interest-num { padding-block-start: 0.4rem; font-family: var(--font-mono); font-size: 0.875rem; color: var(--violet); }
html[lang="fa"] .interest-num { font-family: var(--font-fa); }
.interest h3 { margin-block-end: 0.3rem; font-size: 1.3rem; line-height: 1.4; }
.interest p { max-width: 34rem; color: var(--text-soft); }

/* Projects */
.project-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}
.project {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.project:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.project-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--bg-2); }
.project-body { display: grid; gap: 0.5rem; padding: 1.1rem 1.25rem 1.3rem; }
.project-body h3 { font-size: 1.2rem; line-height: 1.4; }
.project-body p { color: var(--text-soft); }
.project-link { justify-self: start; font-weight: 600; }
.empty-state {
  grid-column: 1 / -1;
  padding: 2rem 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-soft);
  text-align: center;
}

/* Instagram */
.ig-panel {
  display: grid;
  gap: 1.25rem;
  justify-items: start;
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background:
    linear-gradient(135deg, rgba(106, 69, 224, 0.22), rgba(61, 98, 232, 0.1)),
    var(--surface);
}
.ig-text { max-width: 32rem; color: var(--text-soft); }
.ig-handle {
  font-family: var(--font-latin);
  font-size: clamp(1.75rem, 7vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
  border-block-end: 2px solid var(--line-strong);
  transition: border-color 0.2s, color 0.2s;
}
.ig-handle:hover { color: #fff; border-color: var(--violet); }

/* ---------- Footer ---------- */
.site-footer { margin-block-start: clamp(2rem, 6vw, 4rem); padding-block: 2.5rem 2rem; border-block-start: 1px solid var(--line); }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; }
.footer-brand { font-size: 1.4rem; font-weight: 700; }
.footer-line { color: var(--text-soft); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; padding: 0; margin: 0; }
.footer-links a { display: inline-block; padding-block: 0.6rem; }
.site-footer .lang { margin-inline-start: 0; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-block-start: 2rem;
  padding-block-start: 1.25rem;
  border-block-start: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--muted);
}
.legal { max-width: 38rem; }

/* ---------- 404 page ---------- */
.notfound { display: grid; align-items: center; padding-block: clamp(3rem, 12vw, 8rem); }
.notfound-block { margin-block-start: 1.5rem; }
.notfound h1, .notfound h2 { font-size: clamp(1.75rem, 6vw, 3rem); line-height: 1.3; }
.notfound-block + .notfound-block { margin-block-start: 3rem; padding-block-start: 2rem; border-block-start: 1px solid var(--line); }
.notfound .btn { margin-block-start: 0.5rem; }

/* ---------- Scroll reveal (progressive enhancement) ---------- */
/* Only active once main.js adds "reveal-ready"; without JS everything is visible. */
.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(0.75rem);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal-ready .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .reveal-ready .reveal { opacity: 1; transform: none; }
}

/* ---------- High-contrast / forced colors ---------- */
@media (forced-colors: active) {
  .btn-primary, .btn-secondary { border-color: ButtonText; }
  .h1-main { -webkit-text-fill-color: currentColor; background: none; }
}
