/*
 * بخش «محصولات» صفحه اصلی: فهرست محصولات + پنل جزئیات (Master–Detail)
 * پنل جزئیات پس‌زمینه‌ای به رنگ خانواده محصول دارد (ایزوسیانات‌ها، پیش‌پلیمرها، حدواسط‌ها، اسیدها)
 * با شبکه مولکولی متحرک، هاله نور و حلقه بنزنی چرخان. رنگ‌ها با @property نرم عوض می‌شوند.
 * این فایل پیش از home.css بارگذاری می‌شود.
 */

/* ---------------------------------------------------------------- رنگ‌های قابل انیمیشن */
@property --pd-a { syntax: '<color>'; inherits: true; initial-value: #0a6f7a; }
@property --pd-b { syntax: '<color>'; inherits: true; initial-value: #05323b; }
@property --pd-c { syntax: '<color>'; inherits: true; initial-value: #3fd2c7; }

.pd-section { --pd-time: 7s; }

/* رنگ هر خانواده: a = روشن، b = تیره، c = هاله */
.pd-stage, .pd-tab { --pd-a: #0a6f7a; --pd-b: #05323b; --pd-c: #3fd2c7; }
.pd-stage[data-family="prepolymers"], .pd-tab[data-family="prepolymers"] { --pd-a: #9a6a1b; --pd-b: #33210a; --pd-c: #f6c560; }
.pd-stage[data-family="intermediates"], .pd-tab[data-family="intermediates"] { --pd-a: #3159a6; --pd-b: #0f1c47; --pd-c: #82b4ff; }
.pd-stage[data-family="acids"], .pd-tab[data-family="acids"] { --pd-a: #a03f4f; --pd-b: #3a111b; --pd-c: #ff9d8f; }

/* ---------------------------------------------------------------- سرتیتر */
.pd-section .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.pd-more { font-size: 13px; font-weight: 600; color: var(--brand); padding-bottom: 4px; border-bottom: 2px solid var(--gold-soft); transition: color .2s, border-color .2s; white-space: nowrap; }
.pd-more:hover { color: var(--gold); border-color: var(--brand); }
.pd-more span, .pd-btn-main span { display: inline-block; transition: transform .25s; }
html[dir="ltr"] .pd-more span, html[dir="ltr"] .pd-btn-main span { transform: scaleX(-1); }

/* ---------------------------------------------------------------- چیدمان */
.pd-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 26px; align-items: stretch; }

/* ---------------------------------------------------------------- فهرست محصولات */
.pd-list { display: flex; flex-direction: column; gap: 6px; max-height: 560px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; margin: -4px; scrollbar-width: thin; scrollbar-color: #c9dad5 transparent; }
.pd-tab { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; overflow: hidden; transition: background .3s, border-color .3s, box-shadow .3s, padding .3s; }
.pd-tab::before { content: ''; position: absolute; inset-block: 11px; inset-inline-start: 0; width: 4px; border-radius: 4px; background: linear-gradient(var(--gold-soft), var(--gold)); transform: scaleY(0); transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.pd-tab:hover { background: #fff; border-color: #dce8e4; }
.pd-tab.is-active { background: #fff; border-color: #cfe0da; box-shadow: 0 12px 30px #0b4b5516; padding-inline-start: 22px; }
.pd-tab.is-active::before { transform: scaleY(1); }
.pd-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pd-tab-no { font: 600 12px/1 Arial, sans-serif; color: #93a9a8; display: inline-flex; align-items: center; gap: 7px; transition: color .3s; }
/* نقطه رنگ خانواده کنار شماره */
.pd-tab-no::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--pd-a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pd-a) 18%, transparent); }
.pd-tab.is-active .pd-tab-no { color: var(--pd-a); }
.pd-tab-name { font-size: 14px; font-weight: 600; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-tab-code { font: 600 11px/1 Arial, sans-serif; color: var(--brand); background: #eef5f2; border-radius: 999px; padding: 5px 9px; white-space: nowrap; }
.pd-tab.is-active .pd-tab-code { background: color-mix(in srgb, var(--pd-a) 12%, #fff); color: var(--pd-a); }

/* نوار پیشرفت نمایش خودکار */
.pd-tab-bar { position: absolute; inset-inline: 22px 16px; bottom: 5px; height: 2px; border-radius: 2px; overflow: hidden; opacity: 0; transition: opacity .3s; }
.pd-tab-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--gold-soft), var(--gold)); transform: scaleX(0); transform-origin: left; }
html[dir="rtl"] .pd-tab-bar::after { transform-origin: right; }
.pd-tab.is-timing .pd-tab-bar { opacity: 1; background: #edf3f1; }
.pd-tab.is-timing .pd-tab-bar::after { animation: pd-progress var(--pd-time) linear forwards; }

/* ---------------------------------------------------------------- صحنه (پنل جزئیات) */
.pd-stage { position: relative; isolation: isolate; overflow: hidden; min-height: 540px; border-radius: 28px; color: #fff; background: radial-gradient(130% 140% at 12% 0%, var(--pd-a) 0%, var(--pd-b) 64%); box-shadow: 0 34px 70px -28px #04303a80, inset 0 0 0 1px #ffffff14; transition: --pd-a .9s ease, --pd-b .9s ease, --pd-c .9s ease; }
html[dir="ltr"] .pd-stage { background: radial-gradient(130% 140% at 88% 0%, var(--pd-a) 0%, var(--pd-b) 64%); }

.pd-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
/* شبکه شش‌ضلعی با «اتم‌های» طلایی در رأس‌ها؛ با حرکت آرام یک کاشی کامل، حلقه بی‌درز است */
.pd-lattice { position: absolute; inset: -110px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.14' stroke-width='1'%3E%3Cpath d='M28 66L0 50V16L28 0l28 16v34L28 66v34'/%3E%3Cpath d='M28 0v34L0 50v34l28 16 28-16V50L28 34'/%3E%3C/g%3E%3Cg fill='%23ead59c' fill-opacity='.5'%3E%3Ccircle cx='28' cy='0' r='1.7'/%3E%3Ccircle cx='0' cy='16' r='1.7'/%3E%3Ccircle cx='56' cy='16' r='1.7'/%3E%3Ccircle cx='28' cy='34' r='1.7'/%3E%3Ccircle cx='0' cy='50' r='1.7'/%3E%3Ccircle cx='56' cy='50' r='1.7'/%3E%3Ccircle cx='28' cy='66' r='1.7'/%3E%3Ccircle cx='0' cy='84' r='1.7'/%3E%3Ccircle cx='56' cy='84' r='1.7'/%3E%3Ccircle cx='28' cy='100' r='1.7'/%3E%3C/g%3E%3C/svg%3E"); background-size: 56px 100px; animation: pd-drift 50s linear infinite; -webkit-mask-image: radial-gradient(75% 90% at 16% 55%, #000 0%, #0008 45%, transparent 80%); mask-image: radial-gradient(75% 90% at 16% 55%, #000 0%, #0008 45%, transparent 80%); }
html[dir="ltr"] .pd-lattice { -webkit-mask-image: radial-gradient(75% 90% at 84% 55%, #000 0%, #0008 45%, transparent 80%); mask-image: radial-gradient(75% 90% at 84% 55%, #000 0%, #0008 45%, transparent 80%); }
/* هاله رنگی پشت تصویر و هاله طلایی گوشه مقابل */
.pd-glow { position: absolute; width: 560px; height: 560px; inset-inline-end: -140px; top: -170px; border-radius: 50%; background: radial-gradient(circle, var(--pd-c) 0%, transparent 66%); opacity: .34; animation: pd-breathe 9s ease-in-out infinite alternate; }
.pd-bg::after { content: ''; position: absolute; width: 420px; height: 420px; inset-inline-start: -160px; bottom: -220px; border-radius: 50%; background: radial-gradient(circle, #d9c38b 0%, transparent 65%); opacity: .2; }
/* حلقه بنزنی بزرگ و چرخان */
.pd-molecule { position: absolute; width: 380px; height: 380px; inset-inline-end: -70px; bottom: -120px; opacity: .13; fill: none; stroke: #fff; stroke-width: 2; }
.pd-mol-inner { stroke-dasharray: 6 7; }
.pd-mol-spin { transform-box: view-box; transform-origin: 50% 50%; animation: pd-spin 80s linear infinite; }
.pd-atom { fill: #ead59c; stroke: none; transform-box: fill-box; transform-origin: center; animation: pd-pulse 3.2s ease-in-out infinite; }
.pd-atom:nth-of-type(2) { animation-delay: -1s; }
.pd-atom:nth-of-type(3) { animation-delay: -2s; }

/* ---------------------------------------------------------------- پنل یک محصول */
.pd-panel { position: relative; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); align-items: center; gap: 34px; min-height: 540px; padding: 46px 50px; }
.pd-panel[hidden] { display: none; }

/* ورود پله‌ای محتوا هنگام تعویض محصول */
.pd-copy > * { animation: pd-rise .75s cubic-bezier(.2, .75, .2, 1) both; }
.pd-copy > :nth-child(2) { animation-delay: .06s; }
.pd-copy > :nth-child(3) { animation-delay: .12s; }
.pd-copy > :nth-child(4) { animation-delay: .17s; }
.pd-copy > :nth-child(5) { animation-delay: .22s; }
.pd-copy > :nth-child(6) { animation-delay: .27s; }
.pd-copy > :nth-child(7) { animation-delay: .32s; }
.pd-copy > :nth-child(8) { animation-delay: .37s; }

.pd-kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.pd-family { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: #ffffff1c; border: 1px solid #ffffff38; font-size: 12px; font-weight: 600; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pd-family::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--pd-c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pd-c) 30%, transparent), 0 0 14px var(--pd-c); }
.pd-index { font: 12px/1 Arial, sans-serif; letter-spacing: 3px; color: #ffffff99; }

/* کد درشت با درخشش طلایی گذرا */
.pd-code { display: block; width: fit-content; max-width: 100%; font: 800 clamp(44px, 5.2vw, 74px)/1.08 Arial, Helvetica, sans-serif; letter-spacing: -1px; overflow-wrap: anywhere; background: linear-gradient(100deg, #fff 35%, #f1dca3 50%, #fff 65%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: pd-rise .75s cubic-bezier(.2, .75, .2, 1) .06s both, pd-shine 7s ease-in-out 1s infinite; }
.pd-name { margin: 10px 0 2px; font-size: 22px; font-weight: 700; line-height: 1.7; color: #fff; }
.pd-latin { display: block; width: fit-content; font: 13px/1.6 Arial, sans-serif; color: #ffffffad; }
.pd-summary { margin: 16px 0 0; max-width: 560px; font-size: 14px; line-height: 2.05; color: #e4f0ef; }

.pd-apps { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.pd-apps li { padding: 6px 13px; border-radius: 999px; background: #ffffff14; border: 1px solid #ffffff2e; font-size: 12px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); transition: background .25s, transform .25s; animation: pd-chip .5s cubic-bezier(.2, .75, .2, 1) both; }
.pd-apps li:nth-child(2) { animation-delay: .25s; }
.pd-apps li:nth-child(3) { animation-delay: .3s; }
.pd-apps li:nth-child(4) { animation-delay: .35s; }
.pd-apps li:nth-child(5) { animation-delay: .4s; }
.pd-apps li:nth-child(6) { animation-delay: .45s; }
.pd-apps li:first-child { animation-delay: .2s; }
.pd-apps li:hover { background: #ffffff2a; transform: translateY(-2px); }

.pd-specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; max-width: 560px; margin: 20px 0 0; }
.pd-specs > div { position: relative; overflow: hidden; padding: 12px 15px; border-radius: 14px; background: linear-gradient(160deg, #ffffff22, #ffffff07); border: 1px solid #ffffff2b; }
.pd-specs > div::after { content: ''; position: absolute; inset-block: 0; width: 40%; inset-inline-start: -60%; background: linear-gradient(90deg, transparent, #ffffff1f, transparent); animation: pd-sweep 5s ease-in-out 1.2s infinite; }
.pd-specs dt { font-size: 11px; color: #ffffffa8; }
.pd-specs dd { width: fit-content; margin: 4px 0 0; font: 700 18px/1.3 Arial, sans-serif; color: #fff; }

.pd-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.pd-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: 12px; border: 1px solid #ffffff4d; background: #ffffff10; color: #fff; font-size: 13px; font-weight: 600; transition: background .25s, color .25s, transform .25s, box-shadow .25s; }
.pd-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pd-btn:hover, .pd-btn:focus-visible { background: #fff; color: var(--pd-b); transform: translateY(-2px); }
.pd-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.pd-btn-main { border-color: transparent; background: linear-gradient(135deg, #ecd9a2, var(--gold)); color: #2c2107; box-shadow: 0 10px 26px -8px #d9c38b99; }
.pd-btn-main:hover, .pd-btn-main:focus-visible { background: #fff; color: #2c2107; box-shadow: 0 14px 30px -8px #0006; }
.pd-btn-main:hover span { transform: translateX(-4px); }
html[dir="ltr"] .pd-btn-main:hover span { transform: scaleX(-1) translateX(-4px); }

/* ---------------------------------------------------------------- تصویر محصول در قاب گرد */
.pd-visual { position: relative; justify-self: center; width: min(100%, 330px); aspect-ratio: 1; animation: pd-pop .9s cubic-bezier(.2, .8, .2, 1.05) .1s both; }
.pd-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed #ffffff5c; animation: pd-spin 45s linear infinite; }
.pd-ring-2 { inset: -24px; border: 1px solid #ffffff1c; animation: none; }
.pd-orbit { position: absolute; inset: -24px; border-radius: 50%; animation: pd-spin 14s linear infinite; }
.pd-orbit i { position: absolute; top: -6px; left: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%; background: #ecd9a2; box-shadow: 0 0 0 6px #d9c38b33, 0 0 22px #ecd9a2; }
.pd-frame { position: absolute; inset: 20px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: radial-gradient(circle at 30% 25%, #ffffff33, #ffffff08 70%); border: 6px solid #ffffff1a; box-shadow: 0 30px 60px -12px #0008, inset 0 0 0 1px #ffffff33; }
.pd-frame img { width: 100%; height: 100%; object-fit: cover; animation: pd-zoom 14s ease-in-out infinite alternate; }
.pd-frame::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(200deg, transparent 45%, var(--pd-b) 125%); opacity: .6; pointer-events: none; }
/* محصول بدون تصویر: کد روی همان شبکه مولکولی */
.pd-frame-code { position: relative; z-index: 1; font: 800 clamp(30px, 3.4vw, 46px)/1 Arial, sans-serif; color: #fff; text-shadow: 0 6px 24px #0006; padding: 0 18px; text-align: center; overflow-wrap: anywhere; }
.pd-frame:has(.pd-frame-code) { background: radial-gradient(circle at 30% 25%, #ffffff40, #ffffff0a 70%), var(--pd-a); }

/* ---------------------------------------------------------------- انیمیشن‌ها */
@keyframes pd-progress { to { transform: scaleX(1); } }
@keyframes pd-drift { to { transform: translate(56px, 100px); } }
@keyframes pd-breathe { from { transform: scale(.9); opacity: .26; } to { transform: scale(1.08); opacity: .42; } }
@keyframes pd-spin { to { transform: rotate(360deg); } }
@keyframes pd-pulse { 50% { transform: scale(1.5); opacity: .6; } }
@keyframes pd-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pd-chip { from { opacity: 0; transform: translateY(8px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes pd-pop { from { opacity: 0; transform: scale(.82) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes pd-zoom { from { transform: scale(1.04); } to { transform: scale(1.16); } }
@keyframes pd-shine { 0%, 55% { background-position: 100% 0; } 100% { background-position: -50% 0; } }
@keyframes pd-sweep { 0%, 60% { inset-inline-start: -60%; } 100% { inset-inline-start: 130%; } }

/* ---------------------------------------------------------------- واکنش‌گرا */
@media (max-width: 1100px) {
  .pd-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 18px; }
  .pd-panel { padding: 38px 34px; gap: 24px; }
  .pd-tab-code { display: none; }
}

/* تبلت و موبایل: فهرست به نوار افقی بالای پنل تبدیل می‌شود */
@media (max-width: 900px) {
  .pd-layout { grid-template-columns: 1fr; }
  .pd-list { flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; padding-bottom: 8px; }
  .pd-tab { flex: 0 0 auto; width: auto; grid-template-columns: auto auto; padding: 11px 15px; scroll-snap-align: start; background: #fff; border-color: #e1ebe7; }
  .pd-tab.is-active { padding-inline-start: 15px; }
  .pd-tab::before { inset-block: auto 0; inset-inline: 14px; width: auto; height: 3px; transform: scaleX(0); }
  .pd-tab.is-active::before { transform: scaleX(1); }
  .pd-tab-bar { display: none; }
}

@media (max-width: 700px) {
  .pd-section .section-heading { align-items: center; }
  .pd-stage { min-height: 0; border-radius: 22px; }
  .pd-panel { grid-template-columns: 1fr; min-height: 0; padding: 30px 22px 28px; gap: 20px; }
  .pd-visual { order: -1; width: 190px; }
  .pd-ring-2, .pd-orbit { inset: -14px; }
  .pd-code { font-size: 42px; }
  .pd-name { font-size: 18px; }
  .pd-summary { font-size: 13px; }
  .pd-molecule { width: 240px; height: 240px; }
  .pd-btn { flex: 1 1 auto; justify-content: center; }
}

/* کاهش حرکت: همه انیمیشن‌های تزئینی خاموش */
@media (prefers-reduced-motion: reduce) {
  .pd-section *, .pd-section *::before, .pd-section *::after { animation: none !important; transition: none !important; }
  .pd-code { color: #fff; background: none; }
}
