/* Portfolio refinement: readable project evidence within the existing identity. */
:root { --pf-section-space: clamp(64px, 7vw, 96px); }

/* Content is available immediately; functional dialogs keep their own behavior. */
body .wow,
body :is(.hero-sub-title, .hero-title, .hero-content-box .lead, .hero-tech-stack,
    .hero-content-box .button-box, .hero-content-box > .social-icons, .hero-visual) {
    visibility: visible !important;
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
}
body :is(.status-dot, .availability-pulse) { animation: none; box-shadow: none; }
body :is(.hero-section, .hero-visual, .hero-image-box)::before,
body :is(.hero-section, .hero-visual, .hero-image-box)::after,
body .funfact-item::after,
body .portfolio-box .image-box::before,
body .portfolio-box .image-box::after,
body .portfolio-box .content-box::after,
body :is(.expertise-card, .experience-card, .certificate-card)::before {
    display: none !important;
}

/* Solid headings and a consistent reading measure. */
html[data-theme] body :is(.hero-title, .section-title) {
    background: none;
    background-clip: border-box;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: currentColor;
    color: var(--pf-text);
    font-weight: 650;
    letter-spacing: -0.025em;
}
html[data-language="fa"] body :is(.hero-title, .section-title) { letter-spacing: 0; }
html[data-theme] body .section-header {
    display: block;
    width: 100%;
    max-width: 760px;
    margin-inline: 0 !important;
    margin-bottom: 32px !important;
    text-align: start !important;
}
html[data-theme] body .section-header .section-title {
    display: block;
    width: auto;
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    line-height: 1.4;
    text-align: start;
}
html[data-theme] body .section-header p {
    max-width: 68ch;
    margin: 12px 0 0;
    color: var(--pf-text-soft);
    font-size: 1rem;
    line-height: 1.85;
    text-align: start;
}
body :is(.resume-description, .expertise-card__description) {
    color: var(--pf-text-soft);
    font-size: 1rem;
    line-height: 1.8;
}

/* The introduction is a concise profile, with a straightforward portrait. */
html[data-theme] body .hero-section {
    min-height: auto;
    padding: clamp(132px, 12vw, 164px) 0 56px;
    background: var(--pf-bg);
}
html[data-theme] body .hero-title {
    max-width: 720px;
    margin-bottom: 20px;
    font-size: clamp(2.2rem, 4.2vw, 3.65rem);
    line-height: 1.2;
}
html[data-language="fa"] body .hero-title { line-height: 1.5; }
body .hero-sub-title {
    color: var(--pf-text-soft) !important;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}
body .hero-content-box .lead { max-width: 62ch; color: var(--pf-text-soft); font-size: 1.0625rem; }
body .hero-content-box .button-box { margin-top: 24px; }
html[data-theme] body .hero-image-box img,
html[data-theme] body .hero-image-box img:hover {
    border: 1px solid var(--pf-border);
    border-radius: 16px;
    box-shadow: none;
    transform: none;
}
body .hero-company-link,
body .company-reference__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    color: var(--pf-accent);
    font-size: 1rem;
    font-weight: 550;
    text-decoration: underline;
    text-underline-offset: 5px;
    text-decoration-thickness: 1px;
}
body .hero-company-link {
    display: inline-block;
    max-width: 100%;
    margin-top: 12px;
    padding-block: 8px;
    line-height: 1.75;
    text-wrap: pretty;
}
body :is(.hero-company-link, .company-reference__link):hover { color: var(--pf-text); }
body .hero-section .funfact-area {
    max-width: 760px;
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--pf-border);
}
body .hero-section .funfact-area > .row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
html[data-language] body .funfact-item {
    min-height: 0;
    padding: 0;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 12px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
}
html[data-language] body .funfact-item .number { font-size: 1.5rem; font-weight: 650; letter-spacing: 0; }
html[data-language] body .funfact-item .text { font-size: 0.875rem; line-height: 1.6; }
body :is(.stat-index, .expertise-card__index) { display: none; }

/* Projects stay prominent; their action is a button rather than an invisible overlay. */
body .company-reference {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 32px;
    margin: 28px 0 0;
    padding-block: 16px;
    border-block: 1px solid var(--pf-border);
}
body .company-reference p { max-width: 65ch; margin: 0; color: var(--pf-text-soft); font-size: 1rem; }
body .portfolio-box { width: 100%; padding-top: 0; gap: 24px; }
body .portfolio-box .portfolio-item,
body .portfolio-box .portfolio-item:is(:hover, :focus-within) {
    border: 1px solid var(--pf-border);
    border-radius: 16px;
    background: var(--pf-surface);
    box-shadow: none;
    cursor: default;
    transform: none !important;
}
html[data-theme] body .portfolio-box .content-box {
    background: transparent;
    border-top: 0;
    padding: 20px 22px !important;
}
html[data-theme] body .portfolio-box .portfolio-item .content-box .portfolio-title { font-size: 1.35rem; font-weight: 650; line-height: 1.5; }
html[data-theme] body .portfolio-box .portfolio-item .content-box > p {
    display: block;
    max-height: none;
    overflow: visible;
    -webkit-line-clamp: unset;
    color: var(--pf-text-soft);
    font-size: 1rem;
    line-height: 1.8;
}
body .project-media-caption {
    margin: 0;
    padding: 8px 22px 0;
    color: var(--pf-muted);
    font-size: 0.875rem;
    line-height: 1.6;
}
body .portfolio-box .portfolio-item .portfolio-link.project-details-button {
    position: static;
    inset: auto;
    z-index: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    gap: 8px;
    width: fit-content;
    height: auto;
    min-height: 44px;
    max-width: calc(100% - 44px);
    margin: 0 22px 22px;
    padding: 10px 16px;
    border: 1px solid var(--pf-border-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--pf-accent);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 550;
    line-height: 1.5;
    text-align: center;
    cursor: pointer;
}
body .portfolio-box .portfolio-item .content-box .project-details-button { margin: 18px 0 0; max-width: 100%; }
body .portfolio-box .portfolio-item .project-details-button:hover { background: var(--pf-surface-hover); }
body .portfolio-box .portfolio-item .project-details-button:focus-visible { outline-offset: 4px; }
body .portfolio-box .image-box img,
body .portfolio-box .portfolio-item:hover .image-box img { transform: none; filter: none; transition: none; }

/* Service rows retain their detail dialogs, with explicit actions and quieter feedback. */
body .services-widget { border-radius: 16px; background: none; }
html[data-language] body .services-widget .service-item {
    display: grid;
    grid-template-columns: minmax(190px, 0.85fr) minmax(0, 1.4fr) auto;
    align-items: center;
    gap: 24px;
    min-height: 0;
    padding: 22px !important;
    background: transparent !important;
    box-shadow: none;
    transform: none;
}
html[data-language] body .services-widget .service-item:is(:hover, .current) {
    background: transparent !important;
    box-shadow: none;
    transform: none;
}
body .services-widget .service-item::before,
body .services-widget .service-item::after { display: none; }
body .services-widget .service-item .left-box,
body .services-widget .service-item .right-box { width: auto !important; padding: 0; }
body .services-widget .service-item .number { display: none; }
body .services-widget .service-item .right-box p { margin: 0; color: var(--pf-text-soft) !important; font-size: 1rem; }
body .services-widget .service-item .service-link {
    position: static;
    inset: auto;
    z-index: auto;
    width: fit-content;
    height: auto;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--pf-border);
    border-radius: 10px;
    background: transparent;
    color: var(--pf-accent);
    font-size: 0.9375rem;
    font-weight: 550;
    line-height: 1.5;
}
body .services-widget .service-item .service-link:hover { background: var(--pf-surface-hover); }
body .services-widget .service-item .service-link:focus-visible { outline-offset: 4px; }
body :is(.project-details-button, .service-link, .hero-company-link, .company-reference__link):focus-visible {
    outline: 2px solid var(--pf-accent) !important;
    outline-offset: 4px;
    box-shadow: none;
}

/* Credentials and technologies read as information, not promotional badges. */
body :is(.expertise-card, .experience-card, .certificate-card),
body :is(.expertise-card, .experience-card, .certificate-card):hover {
    border-color: var(--pf-border);
    border-radius: 14px;
    background: var(--pf-surface);
    box-shadow: none;
    transform: none;
}
body :is(.expertise-card__icon, .certificate-card__icon),
body :is(.expertise-card:hover .expertise-card__icon, .certificate-card:hover .certificate-card__icon) {
    border: 0;
    background: none;
    color: var(--pf-accent);
    box-shadow: none;
    transform: none;
}
body :is(.expertise-tech, .resume-tech, .hero-tech-stack > *, .portfolio-box .project-tags span) {
    border: 1px solid var(--pf-border);
    border-radius: 6px;
    background: transparent;
    color: var(--pf-text-soft);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}
body :is(.resume-date, .resume-group__eyebrow) { border: 0; border-radius: 0; padding-inline: 0; background: none; color: var(--pf-muted); }
body :is(.award-badge, .project-award) { border-color: var(--pf-border); border-radius: 6px; background: none; font-size: 0.8125rem; font-weight: 550; }
body .certificate-card__context { border: 0; border-radius: 0; padding: 0; background: none; }
body .resume-group__header h3 { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 650; }
body .portfolio_navigation .navigation_item .project,
body .portfolio_navigation .navigation_item .project:hover { background: transparent; box-shadow: none; transform: none; }
body .portfolio_navigation .nav_project .title::after { display: none; }
body :is(.tj-btn-primary, .tj-btn-secondary, .social-icons li a):hover { transform: none; box-shadow: none; }
body .hero-content-box .button-box .tj-btn-primary::after { display: none; }
html[data-theme] body .tj-header-area .container > .row > .header-shell { background: var(--pf-surface); box-shadow: none; backdrop-filter: none; }

@media (max-width: 991px) {
    html[data-language] body .services-widget .service-item { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; }
    body .services-widget .service-item .right-box { grid-column: 1; }
    body .services-widget .service-item .service-link { grid-column: 2; grid-row: 1 / 3; }
}
@media (max-width: 575px) {
    html[data-theme] body .hero-section { padding-top: 118px; padding-bottom: 40px; }
    html[data-theme] body .hero-title { font-size: 2.1rem; }
    body .hero-section .funfact-area > .row { gap: 12px; }
    html[data-language] body .funfact-item { flex-direction: column !important; align-items: flex-start !important; gap: 4px; }
    html[data-language] body .services-widget .service-item { grid-template-columns: minmax(0, 1fr); padding: 20px !important; gap: 12px; }
    body .services-widget .service-item .service-link { grid-column: auto; grid-row: auto; margin-top: 4px; }
    body .company-reference { align-items: flex-start; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto !important; }
    body :is(.project-details-button, .service-link, .hero-company-link, .company-reference__link) { transition: none; }
}

/* Foreground tokens must remain distinct from the legacy background palette. */
:root { --tj-text-body: var(--pf-text-soft); }
html[data-theme="light"],
html:not([data-theme]) body.light-mode {
    --pf-accent: #08758e;
    --pf-accent-rgb: 8, 117, 142;
    --pf-muted: #5e6b81;
}

/* All project and service dialogs share the same semantic foregrounds. */
html[data-theme] body .popup_content_area :is(
    .service_details, .service_details_content, .portfolio_info, .portfolio_description,
    .portfolio_story_approach, .desc, .story_content, .approach_content, p, li
) { color: var(--pf-text-soft); }
html[data-theme] body .popup_content_area :is(h1, h2, h3, h4, h5, h6, .title, strong, b, .en-title) {
    color: var(--pf-text);
}
html[data-theme] body .popup_content_area .portfolio_info_items .info_item .key {
    color: var(--pf-muted);
}
html[data-theme] body .popup_content_area .portfolio_info_items .info_item .value {
    color: var(--pf-text);
}
html[data-theme] body .popup_content_area .highlight-text,
html[data-theme] body .popup_content_area .pro-list li::before,
html[data-theme] body .popup_content_area .feature-list li i {
    color: var(--pf-accent);
}
html[data-theme] body .popup_content_area a {
    color: var(--pf-accent);
    text-decoration-color: currentColor;
}
html[data-theme] body .popup_content_area a:is(:hover, :focus-visible) {
    color: var(--pf-text);
}
html[data-theme] body .popup_content_area .portfolio_navigation {
    background: var(--pf-bg-elevated);
    color: var(--pf-text-soft);
}
html[data-theme] body .popup_content_area .portfolio_navigation .label {
    color: var(--pf-muted);
}
html[data-theme] body .popup_content_area .portfolio_navigation .project :is(.title, i) {
    color: var(--pf-text);
}
html[data-theme] body .popup_content_area .portfolio_navigation .project:is(:hover, :focus-visible) .title {
    color: var(--pf-accent);
}
body .popup_content_area :is(a, button):focus-visible {
    outline: 2px solid var(--pf-accent) !important;
    outline-offset: 3px;
}

/* Magnific's fixed wrapper scrolls; its inner container must not scroll again. */
.mfp-wrap.popup-mfp {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.mfp-wrap.popup-mfp .mfp-container {
    position: relative;
    height: auto;
    min-height: 100%;
    overflow: visible;
    padding-block: clamp(24px, 5vh, 64px);
}
html[data-theme] body .popup_content_area .mfp-close {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--pf-border-strong);
    background: var(--pf-surface);
    color: var(--pf-text);
    font-size: 28px;
    line-height: 42px;
    opacity: 1;
    backdrop-filter: none;
    transform: none;
}
html[data-theme] body .popup_content_area .mfp-close:hover {
    background: var(--pf-surface-hover);
    color: var(--pf-text);
    transform: none;
}

/* Keep one usable, neutral scrollbar rather than the template's purple track. */
:is(html, body, .mfp-wrap.popup-mfp, .popup-mfp .mfp-container, .modal, .modal-body, textarea) {
    scrollbar-width: auto;
    scrollbar-color: var(--pf-muted) var(--pf-bg-elevated);
}
:is(html, body, .mfp-wrap.popup-mfp, .popup-mfp .mfp-container, .modal, .modal-body, textarea)::-webkit-scrollbar {
    width: 10px;
    height: 10px;
    background: var(--pf-bg-elevated);
}
:is(html, body, .mfp-wrap.popup-mfp, .popup-mfp .mfp-container, .modal, .modal-body, textarea)::-webkit-scrollbar-thumb {
    border: 2px solid var(--pf-bg-elevated);
    border-radius: 999px;
    background: var(--pf-muted);
    box-shadow: none;
}
:is(html, body, .mfp-wrap.popup-mfp, .popup-mfp .mfp-container, .modal, .modal-body, textarea)::-webkit-scrollbar-corner {
    background: var(--pf-bg-elevated);
}

/* Bootstrap contact dialogs live outside main and need the same theme handling. */
html[data-theme] body .contact_modal :is(.modal-body, .modal-body p, .phone-copy-status) {
    color: var(--pf-text-soft);
}
html[data-theme] body .contact_modal :is(.modal-title, .modal-title strong, .phone-choice strong) {
    color: var(--pf-text);
}
body .contact_modal .modal-header .close {
    display: grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--pf-border-strong);
    background: var(--pf-surface);
    color: var(--pf-text);
    opacity: 1;
}
body .contact_modal .modal-header .close:hover {
    background: var(--pf-surface-hover);
    color: var(--pf-text);
}
body .contact_modal .modal-footer .btn {
    background: var(--pf-gradient);
    color: var(--pf-accent-ink);
}
body .contact_modal .modal-footer .btn:is(:hover, :focus-visible) {
    color: var(--pf-accent-ink);
}
html[data-theme="light"] body .form-status:is(.is-error, [data-state="error"]),
html:not([data-theme]) body.light-mode .form-status:is(.is-error, [data-state="error"]) {
    color: #b4233b;
}
html[data-theme="light"] .tj-footer-area,
html:not([data-theme]) body.light-mode .tj-footer-area {
    --pf-muted: #58657a;
}

/* One centered footer identity; keep the tagline visible on small screens. */
body .footer-logo-box .brand-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    text-align: center;
}
body .footer-logo-box .brand-copy {
    justify-items: center;
    gap: 4px;
    text-align: center;
    line-height: 1.6;
}
body .footer-logo-box .brand-copy strong { font-size: 1rem; }
body .footer-logo-box .brand-copy small {
    display: block;
    font-size: .875rem;
    letter-spacing: 0;
}
body .footer-logo-box .brand-link:focus-visible {
    outline: 2px solid var(--pf-accent);
    outline-offset: 6px;
    border-radius: 4px;
}
body .footer-menu ul { gap: 8px 20px; }
body .footer-menu ul li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px;
    line-height: 1.6;
    text-align: center;
}
@media (max-width: 575px) {
    body .footer-menu ul {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    body .footer-menu ul li a { width: 100%; }
}

/* Work is presented as readable case studies, with evidence beside the subject. */
body .work-index { border-top: 1px solid var(--pf-border); }
body .work-case {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: clamp(24px, 4vw, 56px);
    padding-block: clamp(28px, 4vw, 48px);
    border-bottom: 1px solid var(--pf-border);
    align-items: start;
}
body .work-case__media { margin: 0; }
body .work-case__media img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 12px;
}
body .work-case__media figcaption {
    margin-top: 8px;
    color: var(--pf-muted);
    font-size: .8125rem;
    line-height: 1.7;
}
html[data-theme] body .work-case__content h3 {
    margin: 0;
    color: var(--pf-text);
    font-size: clamp(1.35rem, 2.4vw, 1.9rem);
    font-weight: 650;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
body .work-case__category { margin: 6px 0 22px; color: var(--pf-muted); font-size: .9375rem; }
body .work-case__facts { margin: 0; }
body .work-case__facts > div { margin-bottom: 16px; }
body .work-case__facts dt { margin-bottom: 4px; color: var(--pf-text); font-weight: 600; font-size: .9375rem; }
body .work-case__facts dd { margin: 0; color: var(--pf-text-soft); font-size: 1rem; line-height: 1.8; max-width: 65ch; }
body .work-case__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 20px; }
body .work-details,
body .work-evidence-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    font-family: inherit;
    font-size: .9375rem;
    font-weight: 550;
    line-height: 1.7;
    color: var(--pf-accent);
    transition: background-color 150ms ease, color 150ms ease;
}
body .work-details { padding: 10px 16px; border: 1px solid var(--pf-border-strong); border-radius: 8px; background: transparent; }
body .work-evidence-link { padding-block: 8px; text-decoration: underline; text-underline-offset: 4px; }
body .work-details:hover { background: var(--pf-surface-hover); }
body .work-evidence-link:hover { color: var(--pf-text); }
body :is(.work-details, .work-evidence-link):focus-visible { outline: 2px solid var(--pf-accent); outline-offset: 4px; }

/* Dates describe a project-based practice, without repeated job-card framing. */
body .career-timeline { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--pf-border); }
body .career-timeline > li { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 24px; padding-block: 24px; border-bottom: 1px solid var(--pf-border); }
body .career-timeline__date { color: var(--pf-muted); font-size: .9375rem; font-weight: 500; padding-top: 4px; text-align: start; }
html[data-theme] body .career-timeline h4 { color: var(--pf-text); font-size: 1.1875rem; font-weight: 600; line-height: 1.6; margin: 0 0 8px; }
body .career-timeline p { max-width: 75ch; color: var(--pf-text-soft); line-height: 1.85; margin: 0; }
body .resume-group--experience { margin-bottom: 56px; }
body .skill-domains { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
body .skill-domain { padding-block: 24px; border-top: 1px solid var(--pf-border); }
html[data-theme] body .skill-domain h3 { margin: 0 0 8px; color: var(--pf-text); font-size: 1.25rem; font-weight: 600; line-height: 1.6; }
body .skill-domain p { color: var(--pf-text-soft); line-height: 1.8; max-width: 65ch; margin-bottom: 16px; }
body .skill-domain__tools { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
body .skill-domain__tools li { color: var(--pf-muted); font-size: .875rem; line-height: 1.8; }
body .certificate-card { padding: 24px; gap: 12px; box-shadow: none; }
body .certificate-card__identity h4 { font-size: 1.125rem; line-height: 1.7; }
body .certificate-card .resume-description { margin: 0; font-size: .9375rem; }
body .certificate-card__context { padding: 12px 0; background: none; border-radius: 0; }
body .certificate-card__icon { width: 36px; height: 36px; min-width: 36px; font-size: 1.125rem; border: 0; background: none; box-shadow: none; }
@media (max-width: 767px) {
    body .work-case { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-block: 28px; }
    body .work-case__category { margin-bottom: 18px; }
    body .career-timeline > li { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-block: 20px; }
    body .skill-domains { grid-template-columns: minmax(0, 1fr); gap: 0; }
    body .certificate-card { padding: 20px; }
    body .work-case__actions { gap: 8px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    body :is(.work-details, .work-evidence-link) { transition: none; }
}
