/* ==========================================================================
   NIVAD PHARMED SALAMAT — Product detail pages
   --------------------------------------------------------------------------
   Shared by products/{papilloguard,pneumoconj13,zonaguard,beraksurf,perkinra}.
   Every selector is scoped under .product-detail (the <main> element) or a
   pd- prefixed class, so nothing here can leak into the pages other
   stylesheets own. All colors come from style.css custom properties so the
   light and dark themes both work; layout uses logical properties so the
   EN (ltr) toggle does not break anything.

   Animation contract: main.js's IntersectionObserver toggles .visible on
   .anim elements. Everything animated here is written FINAL-STATE-FIRST:
   the base rules describe the finished drawing, and the keyframes only
   define a `from`. When animations are disabled (reduced motion, no JS via
   the noscript override) the finished state is what renders.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. SECTIONS
   -------------------------------------------------------------------------- */
.product-detail .pd-section { padding: clamp(64px, 8vw, 100px) 0; background: var(--surface); }
.product-detail .pd-section--alt { background: var(--bg); }
.product-detail .pd-section--tight { padding: clamp(40px, 5vw, 64px) 0; }

.product-detail .pd-hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.10);
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
  font-size: 12.5px; font-family: var(--font-h); font-weight: 700;
  padding: 7px 16px; border-radius: 50px; margin-bottom: 16px;
}
.product-detail .pd-hero-tag i { color: var(--cyan-300); }

/* --------------------------------------------------------------------------
   2. TOP BANNER
   The provided banners are light marketing visuals; on the dark theme they
   need a frame so they read as a card, not a hole in the page.
   -------------------------------------------------------------------------- */
.product-detail .pd-banner { padding-block: clamp(28px, 4vw, 48px) 0; background: var(--surface); }
.pd-banner-frame {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  background: var(--surface-2);
  isolation: isolate;
}
.pd-banner-frame::after {
  /* subtle brand tint so the light artwork sits comfortably on both themes */
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,101,126,.05), transparent 30%);
  pointer-events: none;
}
.pd-banner-frame img { width: 100%; height: auto; display: block; }

/* --------------------------------------------------------------------------
   3. INFO CARD GRID
   -------------------------------------------------------------------------- */
.pd-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
  gap: clamp(16px, 2.4vw, 26px);
}
.pd-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 26px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .35s var(--e), box-shadow .35s var(--e), border-color .35s var(--e);
}
.pd-card:hover { transform: translateY(-5px); border-color: rgba(42,192,188,.45); box-shadow: var(--shadow); }
.pd-card-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(20,101,126,.12), rgba(34,211,197,.14));
  color: var(--teal);
  font-size: 20px;
  margin-bottom: 16px;
}
.pd-card h3 {
  font-family: var(--font-h); font-size: 17px; font-weight: 700;
  color: var(--text); margin-bottom: 10px;
}
.pd-card p, .pd-card li { font-size: 14.5px; line-height: 2; color: var(--text-2); }
.pd-card p + p { margin-top: 8px; }
.pd-card--wide { grid-column: 1 / -1; }

/* Check / bullet list */
.pd-list { display: grid; gap: 10px; }
.pd-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.95; color: var(--text-2); }
.pd-list li > i { color: var(--teal); font-size: 14px; margin-top: 7px; flex: 0 0 auto; }
.pd-list li strong { color: var(--petrol); }

/* --------------------------------------------------------------------------
   4. INFOGRAPHIC SHELL
   -------------------------------------------------------------------------- */
.pd-ig {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(22px, 3.2vw, 38px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pd-ig + .pd-ig, .pd-ig + .pd-ig-row, .pd-ig-row + .pd-ig { margin-top: clamp(18px, 2.6vw, 28px); }
.pd-ig-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: clamp(18px, 2.6vw, 28px);
  align-items: stretch;
}
.pd-ig h3 {
  font-family: var(--font-h); font-size: clamp(17px, 2vw, 20px); font-weight: 700;
  color: var(--text); margin-bottom: 6px; text-align: center;
}
.pd-ig-caption { font-size: 13.5px; color: var(--text-3); text-align: center; margin-bottom: 20px; }
.pd-ig-note {
  font-size: 12.5px; color: var(--text-3); text-align: center; margin-top: 18px;
  font-family: var(--font-l);
}
.pd-ig-svgwrap { overflow-x: auto; overscroll-behavior-x: contain; }
.pd-ig-svgwrap > svg { display: block; margin-inline: auto; }
.pd-ig svg text { font-family: var(--font-b); fill: var(--text-2); }
.pd-ig svg .pd-svg-title { font-family: var(--font-h); font-weight: 700; fill: var(--text); }
.pd-ig svg .pd-svg-strong { fill: var(--petrol); font-weight: 700; }

/* --------------------------------------------------------------------------
   5. ANIMATION PRIMITIVES (final-state-first)
   -------------------------------------------------------------------------- */
@keyframes pdDraw   { from { stroke-dashoffset: var(--dash, 900); } }
@keyframes pdDonut  { from { stroke-dasharray: 0 100; } }
@keyframes pdPop    { from { opacity: 0; transform: scale(.35); } }
@keyframes pdFadeUp { from { opacity: 0; transform: translateY(14px); } }
@keyframes pdGrowY  { from { transform: scaleY(0); } }
@keyframes pdGrowX  { from { transform: scaleX(0); } }
@keyframes pdFloat  { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes pdBreathe{ 0%,100% { transform: scale(1); } 50% { transform: scale(1.055); } }
@keyframes pdDashFlow { to { stroke-dashoffset: -26; } }
@keyframes pdBubble {
  0%   { transform: translate(0, 0); opacity: 0; }
  25%  { opacity: .9; }
  100% { transform: translate(var(--dx, 0px), var(--dy, -46px)); opacity: 0; }
}

/* Drawn strokes: solid at rest, drawn-in when the .anim parent reveals. */
.pd-draw { stroke-dasharray: var(--dash, 900); stroke-dashoffset: 0; }
.anim.visible .pd-draw  { animation: pdDraw 1.3s var(--e-out) both; animation-delay: var(--d, 0s); }
.anim.visible .pd-pop   { animation: pdPop .55s var(--e-out) both;  animation-delay: var(--d, 0s); }
.anim.visible .pd-fade  { animation: pdFadeUp .7s var(--e-out) both; animation-delay: var(--d, 0s); }
.anim.visible .pd-grow-y{ animation: pdGrowY 1s var(--e-out) both;  animation-delay: var(--d, 0s); }
.anim.visible .pd-grow-x{ animation: pdGrowX .9s var(--e-out) both; animation-delay: var(--d, 0s); }
svg .pd-pop, svg .pd-grow-y, svg .pd-grow-x, svg .pd-breathe { transform-box: fill-box; transform-origin: center; }
svg .pd-grow-y { transform-origin: center bottom; }
.pd-grow-x, svg .pd-grow-x { transform-origin: var(--gx-origin, center); }
.pd-float { animation: pdFloat 5.5s ease-in-out infinite; }
.pd-breathe { animation: pdBreathe 4.5s ease-in-out infinite; }
.pd-dashflow { stroke-dasharray: 7 6; animation: pdDashFlow 1.1s linear infinite; }
.pd-bubble { animation: pdBubble 3.4s ease-in infinite; animation-delay: var(--d, 0s); transform-box: fill-box; }

@media (prefers-reduced-motion: reduce) {
  .product-detail .pd-float, .product-detail .pd-breathe,
  .product-detail .pd-dashflow, .product-detail .pd-bubble,
  .product-detail .anim.visible .pd-draw, .product-detail .anim.visible .pd-pop,
  .product-detail .anim.visible .pd-fade, .product-detail .anim.visible .pd-grow-y,
  .product-detail .anim.visible .pd-grow-x { animation: none !important; }
  .product-detail .pd-bubble { opacity: 0; }
}

/* --------------------------------------------------------------------------
   6. STAT DONUTS
   -------------------------------------------------------------------------- */
.pd-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: clamp(18px, 3vw, 30px);
  justify-items: center;
}
.pd-donut { text-align: center; max-width: 240px; }
.pd-donut svg { width: clamp(130px, 16vw, 168px); height: auto; margin-inline: auto; }
.pd-donut-track { fill: none; stroke: var(--line-2); stroke-width: 11; }
.pd-donut-val {
  fill: none; stroke: var(--teal); stroke-width: 11; stroke-linecap: round;
  stroke-dasharray: var(--p, 50) 100;
  transform: rotate(-90deg); transform-origin: 60px 60px;
}
.pd-donut--cyan .pd-donut-val { stroke: var(--cyan-400); }
.pd-donut--petrol .pd-donut-val { stroke: var(--petrol); }
.anim.visible .pd-donut-val { animation: pdDonut 1.5s var(--e-out) both; animation-delay: var(--d, 0s); }
.pd-donut-num {
  font-family: var(--font-h); font-weight: 700; font-size: 26px;
  fill: var(--text); text-anchor: middle; dominant-baseline: central;
}
.pd-donut-cap { margin-top: 12px; font-size: 13.5px; line-height: 1.9; color: var(--text-2); }
.pd-donut-cap strong { color: var(--petrol); display: block; font-family: var(--font-h); }

/* Big-number stat tiles */
.pd-stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 16px; }
.pd-stat-tile {
  text-align: center; padding: 24px 16px;
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line); border-radius: var(--r);
}
.pd-stat-tile .pd-stat-num {
  font-family: var(--font-h); font-weight: 700; font-size: clamp(26px, 3.4vw, 36px);
  color: var(--petrol); line-height: 1.4; display: block;
}
.pd-stat-tile .pd-stat-label { font-size: 13.5px; color: var(--text-2); line-height: 1.9; }
.pd-stat-tile i { color: var(--teal); font-size: 20px; margin-bottom: 10px; display: inline-block; }

/* --------------------------------------------------------------------------
   7. DOSE SCHEDULE TIMELINE (HTML, RTL-native)
   -------------------------------------------------------------------------- */
.pd-sched { display: grid; gap: 26px; }
.pd-sched-row {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 24px 74px;
}
.pd-sched-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--font-h); font-weight: 700; font-size: 15.5px; color: var(--text);
  margin-bottom: 34px;
}
.pd-sched-head i { color: var(--teal); }
.pd-sched-head .pd-sched-badge {
  margin-inline-start: auto;
  background: rgba(42,192,188,.14); color: var(--petrol);
  border: 1px solid rgba(42,192,188,.3);
  font-size: 12.5px; padding: 4px 13px; border-radius: 50px;
}
.pd-track { position: relative; height: 4px; margin-inline: 30px; }
.pd-track-line {
  position: absolute; inset: 0;
  border-radius: 4px;
  background: linear-gradient(var(--gx-dir, -90deg), var(--petrol), var(--cyan-400));
  transform-origin: var(--gx-origin, right center);
}
html[dir="ltr"] .pd-track-line { --gx-dir: 90deg; --gx-origin: left center; }
.pd-dose {
  position: absolute; top: -7px; /* centers the 18px dot on the 4px track */
  inset-inline-start: var(--x, 0%);
  display: grid; justify-items: center; gap: 6px;
  text-align: center; width: 84px; margin-inline-start: -42px;
}
.pd-dose-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--cyan-400);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 3px rgba(42,192,188,.35);
}
.pd-dose b { font-family: var(--font-h); font-size: 13px; color: var(--text); font-weight: 700; white-space: nowrap; }
.pd-dose small { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* --------------------------------------------------------------------------
   8. FLOW DIAGRAM (HTML nodes + animated SVG arrows)
   -------------------------------------------------------------------------- */
.pd-flow {
  display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center;
  gap: 6px 4px;
}
.pd-flow-node {
  flex: 1 1 150px; max-width: 220px; min-width: 140px;
  display: grid; align-content: start; justify-items: center; gap: 10px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 14px;
}
.pd-flow-node i, .pd-flow-node .pd-flow-glyph { font-size: 22px; color: var(--teal); }
.pd-flow-node .pd-flow-glyph svg { width: 34px; height: 34px; display: block; }
.pd-flow-node b { font-family: var(--font-h); font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.7; }
.pd-flow-node span { font-size: 12.5px; color: var(--text-3); line-height: 1.8; }
.pd-flow-node--good { border-color: rgba(42,192,188,.5); background: linear-gradient(160deg, rgba(42,192,188,.10), var(--surface-2)); }
.pd-flow-node--bad  { border-color: rgba(229,72,77,.35); }
.pd-flow-node--bad i { color: #E5484D; }
html[data-theme="dark"] .pd-flow-node--bad { border-color: rgba(255,138,142,.3); }
html[data-theme="dark"] .pd-flow-node--bad i { color: #FF8A8E; }
.pd-flow-arrow { flex: 0 0 auto; display: grid; place-items: center; padding-inline: 2px; }
.pd-flow-arrow svg { width: 40px; height: 22px; }
.pd-flow-arrow svg path { stroke: var(--teal); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* the shaft flows, the head stays put */
.pd-flow-arrow .pd-arrow-head { stroke-dasharray: none; animation: none; }
html[dir="rtl"] .pd-flow-arrow svg { transform: scaleX(-1); }
.pd-flow-label {
  flex-basis: 100%; text-align: center; font-size: 13px; color: var(--text-3);
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   9. STORAGE / COLD CHAIN (thermometer)
   -------------------------------------------------------------------------- */
.pd-storage {
  display: grid; grid-template-columns: minmax(150px, 220px) 1fr;
  gap: clamp(22px, 4vw, 44px); align-items: center;
}
.pd-thermo svg { width: 100%; max-width: 190px; height: auto; margin-inline: auto; display: block; }
.pd-thermo-glass { fill: var(--surface-2); stroke: var(--line-2); stroke-width: 2.5; }
.pd-thermo-mercury { fill: var(--cyan-400); }
.pd-thermo-tick { stroke: var(--text-3); stroke-width: 1.6; }
.pd-thermo-range { fill: rgba(42,192,188,.16); stroke: rgba(42,192,188,.5); stroke-width: 1.4; }

/* --------------------------------------------------------------------------
   10. SEROTYPES / PACK GRID
   -------------------------------------------------------------------------- */
.pd-tokens { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.pd-token {
  min-width: 58px; text-align: center;
  background: linear-gradient(150deg, rgba(20,101,126,.10), rgba(34,211,197,.12));
  color: var(--petrol);
  border: 1px solid rgba(20,101,126,.2);
  font-family: var(--font-h); font-weight: 700; font-size: 14px;
  padding: 9px 14px; border-radius: 14px;
}
html[data-theme="dark"] .pd-token { color: var(--cyan-300); border-color: rgba(94,230,218,.24); }

.pd-packs { display: grid; gap: 14px; justify-items: center; }
.pd-pack-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pd-pack-cell {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  color: var(--teal); font-size: 15px;
}
.pd-pack-tag {
  align-self: center;
  font-size: 12.5px; color: var(--text-3); font-family: var(--font-l); white-space: nowrap;
}

/* --------------------------------------------------------------------------
   11. WHY-US BAND
   -------------------------------------------------------------------------- */
.pd-why { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 18px; }
.pd-why-item {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px 20px; box-shadow: var(--shadow-xs);
}
.pd-why-item i { color: var(--cyan-400); font-size: 20px; margin-top: 5px; flex: 0 0 auto; }
.pd-why-item b { display: block; font-family: var(--font-h); font-size: 15px; color: var(--text); margin-bottom: 4px; }
.pd-why-item p { font-size: 13.5px; color: var(--text-2); line-height: 1.9; margin: 0; }

/* --------------------------------------------------------------------------
   12. CROSS NAVIGATION
   -------------------------------------------------------------------------- */
.pd-crossnav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.pd-nav-link {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 20px;
  transition: var(--tr-fast);
  color: var(--text-2);
  min-width: 0;
}
.pd-nav-link:hover { border-color: var(--teal); transform: translateY(-3px); box-shadow: var(--shadow-sm); color: var(--text); }
.pd-nav-link i { color: var(--teal); flex: 0 0 auto; }
.pd-nav-link--next { justify-content: flex-end; }
.pd-nav-link--prev { justify-content: flex-start; }
.pd-nav-link--prev i { transform: scaleX(-1); }
.pd-nav-link small { display: block; font-size: 11.5px; color: var(--text-3); font-family: var(--font-l); }
.pd-nav-link b { display: block; font-family: var(--font-h); font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-nav-link > span { min-width: 0; }
.pd-nav-link--all { align-self: center; }

/* --------------------------------------------------------------------------
   13. RESPONSIVE — 900px matches mobile.css's breakpoint; the same rules are
   restated under html[data-view="mobile"] for the forced-mobile view, where
   no width media query can fire.
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .pd-storage { grid-template-columns: 1fr; }
  .pd-thermo { order: -1; }
  .pd-crossnav { grid-template-columns: 1fr 1fr; }
  .pd-nav-link--all { grid-column: 1 / -1; order: 2; justify-content: center; }
  .pd-sched-row { padding-inline: 14px; }
  .pd-track { margin-inline: 26px; }
  .pd-dose b { font-size: 12px; }
  .pd-flow-node { min-width: 124px; }
  .pd-banner-frame { border-radius: var(--r); }
}
html[data-view="mobile"] .pd-storage { grid-template-columns: 1fr; }
html[data-view="mobile"] .pd-thermo { order: -1; }
html[data-view="mobile"] .pd-crossnav { grid-template-columns: 1fr 1fr; }
html[data-view="mobile"] .pd-nav-link--all { grid-column: 1 / -1; order: 2; justify-content: center; }
html[data-view="mobile"] .pd-sched-row { padding-inline: 14px; }
html[data-view="mobile"] .pd-track { margin-inline: 26px; }
html[data-view="mobile"] .pd-dose b { font-size: 12px; }
html[data-view="mobile"] .pd-flow-node { min-width: 124px; }
html[data-view="mobile"] .pd-banner-frame { border-radius: var(--r); }

@media (max-width: 640px) {
  .pd-flow { flex-direction: column; align-items: stretch; }
  .pd-flow-node { max-width: none; }
  .pd-flow-arrow svg { transform: rotate(90deg); }
}
html[data-view="mobile"] .pd-flow { flex-direction: column; align-items: stretch; }
html[data-view="mobile"] .pd-flow-node { max-width: none; }
html[data-view="mobile"] .pd-flow-arrow svg { transform: rotate(90deg); }

@media (max-width: 480px) {
  .pd-crossnav { grid-template-columns: 1fr; }
  .pd-nav-link--prev, .pd-nav-link--next { justify-content: space-between; }
}
