/** Meet AJ public UI refinement. Loaded last; existing brand and topic tokens win.
 * Blur is limited to navigation, hero and floating controls. Repeated cards use
 * translucent fills without blur to keep long libraries inexpensive to render.
 */
:root {
  --radius-panel: 1.25rem;
  --radius-control: 0.875rem;
  --glass-fill: rgba(255, 255, 255, 0.88);
  --glass-fill-hover: rgba(255, 255, 255, 0.96);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-blur: blur(12px) saturate(120%);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
  --glass-shadow-raised: 0 14px 36px rgba(15, 23, 42, 0.11);
  --glass-hero-fill: rgba(255, 255, 255, 0.58);
  --section-y: clamp(3rem, 5vw, 5rem);
}

body.index-page .main {
  background:
    radial-gradient(ellipse at 95% 12%, var(--color-primary-soft), transparent 36rem),
    radial-gradient(ellipse at 5% 45%, rgba(14, 165, 233, 0.08), transparent 32rem),
    var(--color-background);
}

/* Preserve the sidebar architecture and its mobile focus/overlay contract. */
body #header.header.dark-background {
  background: var(--glass-fill);
  border-inline-end: 1px solid var(--color-border);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

body #header.header .navmenu a {
  border-radius: var(--radius-control);
  min-height: 2.75rem;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}

html[dir] body #header.header .navmenu a:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--color-border);
  color: var(--primary-hover);
  box-shadow: inset 0 1px 0 #fff, 0 3px 10px rgba(15, 23, 42, 0.05);
}
html[dir] body #header.header .navmenu a.active {
  background: var(--color-primary-soft);
  color: var(--primary-hover);
  border-color: transparent;
  box-shadow: none;
}
html[dir] body #header.header .navmenu a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: none;
}
body #header.header .logo {
  max-width: 100%;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-control);
  transition: background-color 180ms ease;
}
body #header.header .logo:hover { background: rgba(255, 255, 255, 0.75); }
body #header.header .logo img,
body #header.header .logo:hover img,
body #header.header .logo .sitename,
body #header.header .logo:hover .sitename {
  transform: none;
  filter: none;
  box-shadow: none;
  animation: none;
}
body #header.header .logo .sitename {
  min-width: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: normal;
  text-wrap: balance;
  background: none;
  color: var(--primary-hover);
  -webkit-text-fill-color: currentColor;
}
html[lang="en"] body #header.header .logo .sitename {
  white-space: nowrap;
  text-wrap: nowrap;
}
html[lang="fa"] body #header.header .logo .sitename {
  font-size: 1rem;
  font-family: var(--persian-font);
  direction: rtl;
}

/* Light frosted glass; keep the existing blue identity and dark readable text. */
body.index-page #hero .hero-content {
  padding: clamp(1rem, 1.5vw, 1.375rem);
  gap: var(--space-3);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-panel);
  background: var(--glass-hero-fill);
  color: var(--color-text);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
}

body.index-page #hero .hero-title {
  font-size: clamp(1.75rem, 2.5vw, 2.5rem);
  line-height: 1.25;
  overflow-wrap: normal;
  word-break: normal;
  color: var(--primary-hover);
  -webkit-text-fill-color: var(--primary-hover);
  background: none;
  text-shadow: none;
  animation: none;
  margin-block: var(--space-2);
}
body.index-page #hero .hero-title span { overflow-wrap: normal; word-break: normal; }
body.index-page #hero :is(.hero-role, .hero-subtitle) { color: var(--color-text); font-size: 1rem; margin-block: 0; }
body.index-page #hero .hero-badge { background: rgba(255, 255, 255, 0.65); color: var(--color-text); border-color: var(--color-border); box-shadow: none; }
body.index-page #hero .hero-badge .badge-text { color: var(--color-text); }
body.index-page #hero .hero-actions { gap: var(--space-3); flex-direction: row !important; flex-wrap: wrap; margin-block-start: var(--space-2); }
body.index-page #hero .hero-actions .btn { padding: 0.65rem 0.85rem; min-height: 2.75rem; }
body.index-page #hero .btn-outline-light {
  color: var(--primary-hover);
  background: rgba(255, 255, 255, 0.65);
  border-color: var(--color-border);
}
body.index-page #hero .btn-outline-light:hover { background: #ffffff; }

/* A single surface recipe shared by existing reusable components. */
body :is(.article-teaser, .service-catalog-card,
  .skill-group, .testimonial-card, .contact-card,
  .contact .form-container) {
  background: var(--glass-fill);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: background-color var(--duration-fast), box-shadow var(--duration-fast),
    border-color var(--duration-fast);
}

body .article-teaser .portfolio-info { padding: var(--space-6); }
body .article-teaser-title { line-height: 1.45; }
body .article-teaser-excerpt { line-height: 1.75; color: var(--color-text); }
body .services .service-item.service-catalog-card { padding: var(--space-6); }
body .services #service-catalog { gap: var(--space-6); }

@media (hover: hover) and (pointer: fine) {
  body :is(.services .service-item.service-catalog-card,
    .testimonial-card, .contact-card):hover {
    background: var(--glass-fill-hover);
    border-color: var(--primary);
    box-shadow: var(--glass-highlight), var(--glass-shadow-raised);
    transform: none;
  }
}

/* Each article keeps its category colour on the edge and hover elevation. */
body .article-teaser {
  --card-accent: var(--topic, var(--article-primary, var(--primary)));
  transition: border-color 220ms ease, box-shadow 220ms ease, background-color 220ms ease;
}
body .article-teaser:focus-within {
  border-color: var(--card-accent);
  box-shadow: var(--glass-highlight), 0 10px 30px color-mix(in srgb, var(--card-accent) 20%, transparent);
}
@media (hover: hover) and (pointer: fine) {
  body .article-teaser:hover {
    border-color: var(--card-accent);
    box-shadow: var(--glass-highlight), 0 10px 30px color-mix(in srgb, var(--card-accent) 20%, transparent);
    transform: none;
  }
}

/* Crisp portrait, quiet glass ring: no glow, shimmer, or oversized zoom. */
body #header.header .profile-img {
  isolation: isolate;
  width: 6.5rem;
  height: 6.5rem;
  flex: 0 0 6.5rem;
}
body #header.header .profile-img::before,
body #header.header .profile-img::after { content: none; }
body #header.header .profile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  transform: none;
  opacity: 1;
  filter: none;
  animation: none;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.1);
  transition: box-shadow 180ms ease, border-color 180ms ease;
}
body #header.header .profile-img:hover img,
body #header.header .profile-img:focus-within img {
  transform: none;
  filter: none;
  border-color: var(--primary);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.16);
}

/* Grid/flex children must be allowed to shrink around long addresses/titles. */
body .contact-main-grid > *,
body .contact :is(.contact-info-section, .contact-form-section, .form-container,
  .contact-cards-grid, .contact-card, .card-content, .form-row, .form-group) {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
body .contact .contact-card { width: 100%; transform: none; }
body .contact .contact-card:hover { transform: none; }
body .contact .card-content { flex: 1 1 0; gap: 0.35rem; }
body .contact .card-icon { flex-shrink: 0; }
body .contact .contact-methods,
body .contact .form-container {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.5rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--glass-fill);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}
body .contact .contact-form-section {
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}
body .contact .contact-form-section::before { content: none; }
body .contact .contact-cards-grid { gap: 0; }
body .contact .contact-card,
body .contact .contact-card:hover {
  padding: 1rem 0;
  gap: 0.85rem;
  align-items: flex-start;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body .contact .card-icon,
body .contact .card-icon:hover {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.15rem 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--primary-hover);
  box-shadow: none;
  transform: none;
  font-size: 1.3rem;
}
body .contact .card-icon::before,
body .contact .contact-card::before,
body .contact .contact-link::before { content: none; }
body .contact .contact-link,
body .contact .contact-link:hover {
  align-self: flex-start;
  min-width: 0;
  max-width: 100%;
  padding: 0.2rem 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  transform: none;
  line-height: 1.6;
}
body .contact .contact-link span { min-width: 0; overflow-wrap: anywhere; }
body .contact .contact-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
body .contact .location-info {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
body .contact .location-info::before { content: none; }
body .contact .location-card {
  margin: 0;
  padding: 1.25rem 0 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body .contact .location-card::before,
body .contact .form-container::before,
body .contact .php-email-form::before { content: none; }
body .contact .php-email-form {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
body .contact .form-header {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  text-align: start;
}
body .contact :is(.contact-link, .contact-item a) { overflow-wrap: anywhere; word-break: normal; }
body .contact :is(input, textarea, select, iframe) { min-width: 0; max-width: 100%; box-sizing: border-box; }
.article-page aside.article-toc :is(nav, ul, li, a, a > span) {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.article-page aside.article-toc .article-nav-item a {
  width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
  min-height: 2.75rem;
}
.article-page aside.article-toc .article-nav-item a > span { flex: 1 1 0; }
.article-page aside.article-toc .article-toc-list { padding: 0.25rem; }
@media (min-width: 1024px) {
  /* The nav, rather than its nested list, must shrink inside the sticky panel. */
  .article-page aside.article-toc .article-toc-title { flex: 0 0 auto; }
  .article-page aside.article-toc .article-toc-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--article-primary) transparent;
    scrollbar-gutter: stable;
  }
  .article-page aside.article-toc .article-toc-list {
    max-height: none;
    overflow: visible;
  }
}
.article-page aside.article-toc .article-toc-nav:focus-visible {
  outline: 2px solid var(--article-primary);
  outline-offset: 2px;
}
@media (max-width: 767px) {
  body .contact-main-grid { grid-template-columns: minmax(0, 1fr); }
}

body :is(.article-chip, .article-tag) { min-height: 2.75rem; }
body :is(.btn, .article-share-btn, .article-chip, .article-tag):active {
  box-shadow: none;
  transform: translateY(1px);
}
body :is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 4px;
}
body #hero :is(a, button):focus-visible { outline-color: var(--primary); }
body #footer :is(a, button):focus-visible { outline-color: #ffffff; }
body :is(button, input, select, textarea):disabled,
body .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
body :is(input, textarea, select):focus-visible { outline-offset: 2px; }

body :is(.menu-toggle, .scroll-top) {
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

/* Article reading surfaces stay opaque; only the title panel uses glass. */
.article-page [lang="fa"],
.article-page [lang="fa"] :is(h1, h2, h3, h4, p) {
  font-family: var(--persian-font);
}
.article-page .article-hero-layout {
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background: var(--glass-fill);
  border: 1px solid var(--article-border);
  border-radius: 1.75rem;
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.article-page .article-hero .article-title { line-height: 1.25; text-wrap: balance; }
.article-page .article-hero .article-excerpt { color: var(--article-text); line-height: 1.8; }
.article-page .article-body {
  background: var(--article-surface);
  border-radius: var(--radius-panel);
  padding: clamp(1.25rem, 4vw, 3rem);
  box-shadow: var(--glass-shadow);
}
.article-page .article-body p { margin-block-end: var(--space-5); }
.article-page .article-body :is(h2, h3, h4) { scroll-margin-block-start: 5rem; }
.article-page .article-body pre {
  max-width: 100%;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
  background: var(--article-code-bg);
  color: var(--article-code-text);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  line-height: 1.75;
  tab-size: 2;
}
.article-page .article-body pre code { color: inherit; background: none; }
.article-page .article-table-wrap { border-radius: var(--radius-md); }
.article-page .article-body table { width: 100%; line-height: 1.7; }
.article-page .article-body :is(th, td) {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--article-border);
  vertical-align: top;
}
.article-page .article-body th { background: var(--article-surface-muted); color: var(--article-text); }
.article-page .article-body tbody tr:nth-child(even) { background: var(--article-background); }
.article-page .article-related { margin-block-start: var(--space-12); }

body #footer.footer { padding-block: var(--space-12) var(--space-6); }
body #footer .footer-main { gap: var(--space-8); }
body #footer .footer-bottom { margin-block-start: var(--space-8); padding-block-start: var(--space-6); }
body #footer p { line-height: 1.8; }
body #footer a { text-underline-offset: 0.25em; }
body #footer a:hover { text-decoration: underline; }

@media (max-width: 1199px) {
  body #header.header.dark-background { background: var(--glass-fill-hover); }
  body #header.header.header-show .navmenu li { animation: none; opacity: 1; transform: none; }
}
@media (max-width: 767px) {
  body.index-page #hero .hero-content { border-radius: var(--radius-panel); padding: var(--space-4); }
  body.index-page #hero .hero-actions { flex-wrap: wrap; }
  body.index-page #hero .hero-actions .btn { flex: 1 1 9rem; white-space: normal; }
  body .article-teaser .portfolio-info,
  body .services .service-item.service-catalog-card { padding: var(--space-5); }
  .article-page .article-hero-layout { padding: var(--space-5); }
}

/* Opaque defaults remain readable when blur is unavailable or unwanted. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass-fill: #ffffff; --glass-fill-hover: #ffffff; --glass-hero-fill: #ffffff; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass-fill: #ffffff; --glass-fill-hover: #ffffff; --glass-hero-fill: #ffffff; --glass-blur: none; }
  body.index-page #hero .hero-content { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
/* Content must remain visible even if AOS fails or has not observed it yet. */
body.index-page [data-aos][data-aos],
body.article-page [data-aos][data-aos] {
  opacity: 1;
  transform: none !important;
  filter: none !important;
  transition: none !important;
  pointer-events: auto !important;
}
/* Observer starts the entry animation only when a block enters the viewport.
   Nothing is hidden while waiting: unsupported JS/observers leave readable UI. */
body .meetaj-scroll-reveal {
  animation: meetaj-scroll-enter 640ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes meetaj-scroll-enter {
  from { opacity: 0.16; translate: 0 18px; }
  to { opacity: 1; translate: 0 0; }
}

/* Expertise panels use the same geometry instead of mismatched pills/rows. */
body.index-page .about-domain-grid { align-items: stretch; gap: 1rem; }
body.index-page .about-domain {
  padding: 1.4rem 1.15rem;
  min-width: 0;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-panel);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}
body.index-page .about-domain h4 { margin-block-end: 1rem; font-size: 0.95rem; line-height: 1.5; }
body.index-page .about-domain-label,
html[dir="rtl"] body.index-page .about-domain-label {
  padding: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  gap: 0.5rem;
  min-height: 1.5rem;
  color: var(--color-text);
}
body.index-page .about-domain-icon {
  background: none;
  border-radius: 0;
  width: 1.15rem;
  height: 1.15rem;
  font-size: 1.05rem;
  color: var(--expertise-accent);
}
body.index-page .about-domain li,
html[dir="rtl"] body.index-page .about-domain li {
  padding: 0.3rem 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.7;
  gap: 0.55rem;
}
body.index-page .about-domain li::before { width: 0.25rem; height: 0.25rem; flex-basis: 0.25rem; margin-top: 0.7em; }
body.index-page .about-domain:hover { border-color: var(--glass-edge); background: rgba(255, 255, 255, 0.82); }
body.index-page .about-domain li:hover { background: none; }
body.index-page .about-domains { margin-block-start: 3rem; }
body.index-page .about-secondary { margin-block-start: 1.5rem; gap: 1.5rem; }
body.index-page .about-secondary :is(.about-values, .about-philosophy, .about-quote) {
  padding: clamp(1.25rem, 2.5vw, 2rem);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-panel);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}
body.index-page .hero + .about.about-premium :is(.about-values, .about-philosophy) {
  background: rgba(255, 255, 255, 0.72);
}
body.index-page .about-quote {
  background: rgba(255, 255, 255, 0.62);
  color: var(--color-text);
  border-inline-start: 3px solid var(--primary) !important;
}
body.index-page .about-quote p { font-size: clamp(1.05rem, 1.5vw, 1.25rem); line-height: 1.85; }
body.index-page .about-quote footer { color: var(--primary-hover); }
body.index-page .about-value-list { gap: 1.5rem; }
body.index-page .about-facts { gap: 0.75rem; }
body.index-page .about-facts > div { border-radius: var(--radius-md); padding: 0.9rem 1rem; }

@media (min-width: 1200px) {
  body.index-page .about-domain-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 768px) and (max-width: 1199px) {
  body.index-page .about-domain-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  body.index-page .about-domain-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.index-page .about-domain { padding: 1rem; }
  body.index-page .about-domain h4 { font-size: 0.8rem; }
  body.index-page .about-domain-label { gap: 0.35rem; overflow-wrap: normal; }
  body.index-page .about-domain-icon { width: 1rem; height: 1rem; font-size: 0.9rem; }
  body.index-page .about-domain:last-child { grid-column: 1 / -1; }
  body.index-page .about-secondary { grid-template-columns: minmax(0, 1fr); }
  body.index-page .about-quote { grid-column: auto; grid-row: auto; }
}
@media (max-width: 359px) {
  body.index-page .about-domain-grid { grid-template-columns: minmax(0, 1fr); }
  body.index-page .about-domain:last-child ul { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body *, body *::before, body *::after {
    animation: none !important;
    transition: none !important;
  }
  body [data-aos] { opacity: 1 !important; transform: none !important; }
}
