/*! THE INDIAN PHARMACIST — V342.5 Mobile-First Editorial Design System
 * Light Default + Explicit Dark Toggle | WCAG 2.2 AA | Real Breakpoints | Clean Intrinsic Reflow */
:root {
  --tip-navy: #0B1F3A;
  --tip-navy-mid: #16325B;
  --tip-teal: #0F766E;
  --tip-teal-hover: #0C5C56;
  --tip-bg: #F9F8F5;
  --tip-surface: #FFFFFF;
  --tip-surface-alt: #F2F5F8;
  --tip-ink: #0F172A;
  --tip-ink-muted: #475569;
  --tip-border: #D5DEE8;
  --tip-ok-bg: #ECFDF5;
  --tip-ok-ink: #065F46;
  --tip-warn-bg: #FFFBEB;
  --tip-warn-ink: #92400E;
  --tip-alert-bg: #FEF2F2;
  --tip-alert-ink: #991B1B;
  --tip-radius: 6px;
  --tip-shadow: 0 1px 3px rgba(11, 31, 58, 0.06);
  --tip-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tip-font-serif: Georgia, "Times New Roman", Cambria, serif;
}

/* Light mode is default for new visitors; dark mode activated explicitly via toggle */
:root[data-theme="dark"] {
  --tip-bg: #0B1320;
  --tip-surface: #111C2E;
  --tip-surface-alt: #18263D;
  --tip-ink: #F1F5F9;
  --tip-ink-muted: #CBD5E1;
  --tip-border: #2A3F5F;
  --tip-teal: #2DD4BF;
  --tip-teal-hover: #5EEAD4;
  --tip-ok-bg: #064E3B;
  --tip-ok-ink: #A7F3D0;
  --tip-warn-bg: #451A03;
  --tip-warn-ink: #FDE68A;
  --tip-alert-bg: #450A0A;
  --tip-alert-ink: #FECACA;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body.tip-v342 {
  margin: 0;
  background: var(--tip-bg);
  color: var(--tip-ink);
  font-family: var(--tip-font-sans);
  font-size: 17px;       /* Part B3 mobile body target: 16–18px */
  line-height: 1.65;
  overflow-wrap: break-word;
}
img, svg, table { max-width: 100%; }
a { color: var(--tip-teal); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--tip-teal-hover); }
:focus-visible { outline: 3px solid var(--tip-teal); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.tip-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Masthead & Mobile-First Navigation (Part C1) */
.tip-header {
  background: var(--tip-navy);
  color: #FFFFFF;
  border-bottom: 3px solid var(--tip-teal);
}
.tip-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}
.tip-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #FFFFFF;
  text-decoration: none;
  min-width: 0;
}
.tip-brand:hover { color: #FFFFFF; text-decoration: none; }
.tip-brand img { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; background: #fff; }
.tip-brand-title { font-size: 17px; font-weight: 700; letter-spacing: 0.02em; line-height: 1.2; }
.tip-brand-sub { font-size: 13.5px; color: #CBD5E1; }

.tip-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tip-nav-desktop { display: none; align-items: center; gap: 4px; }
.tip-nav-desktop a {
  color: #E2E8F0;
  font-size: 15.5px; /* Part B3: 15–16px */
  font-weight: 500;
  padding: 10px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--tip-radius);
}
.tip-nav-desktop a:hover, .tip-nav-desktop a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  text-decoration: none;
}

.tip-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 600;
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--tip-radius);
  cursor: pointer;
}
.tip-icon-btn:hover { background: rgba(255, 255, 255, 0.2); }

.tip-mobile-drawer {
  background: var(--tip-navy-mid);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding: 12px 16px 18px;
}
.tip-mobile-drawer[hidden] { display: none; }
.tip-mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.tip-mobile-nav-list a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 600;
  color: #F8FAFC;
  border-radius: var(--tip-radius);
  background: rgba(255, 255, 255, 0.04);
}
.tip-mobile-nav-list a:hover, .tip-mobile-nav-list a[aria-current="page"] {
  background: var(--tip-teal);
  color: #FFFFFF;
  text-decoration: none;
}

/* Part D: Brand-Led Sandwich Homepage Hero */
.tip-hero {
  background: var(--tip-surface);
  border-bottom: 1px solid var(--tip-border);
  padding: 28px 0 30px;
}
.tip-hero-overline {
  font-size: 13.5px; /* >= 13px floor */
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tip-teal);
  margin: 0 0 8px;
}
.tip-hero-h1 {
  font-family: var(--tip-font-serif);
  font-size: clamp(34px, 8.5vw, 40px); /* Part B3 Mobile: 34–40px */
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--tip-navy);
}
:root[data-theme="dark"] .tip-hero-h1 { color: #F8FAFC; }
.tip-hero-tagline {
  font-family: var(--tip-font-serif);
  font-style: italic;
  font-size: 19px;
  color: var(--tip-teal);
  margin: 0 0 10px;
}
.tip-hero-sub {
  font-size: 17px;
  color: var(--tip-ink-muted);
  max-width: 66ch;
  margin: 0 0 22px;
}

/* Interior Page Typography (Part B3) */
.tip-page-h1 {
  font-family: var(--tip-font-serif);
  font-size: 32px; /* Part B3 Mobile: 30–36px */
  line-height: 1.18;
  margin: 0 0 10px;
  color: var(--tip-ink);
}
.tip-h2 {
  font-family: var(--tip-font-serif);
  font-size: 25px; /* Part B3 Mobile: 24–28px */
  line-height: 1.25;
  margin: 0 0 10px;
  color: var(--tip-ink);
}
.tip-h3 {
  font-size: 20.5px; /* Part B3 Mobile: 20–23px */
  line-height: 1.3;
  margin: 0 0 8px;
  color: var(--tip-ink);
}
.tip-label { font-size: 13.5px; font-weight: 700; color: var(--tip-ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* Universal Search Interface (Part E4) */
.tip-search-box { position: relative; width: 100%; max-width: 840px; }
.tip-search-row {
  display: flex;
  align-items: stretch;
  background: var(--tip-surface);
  border: 2px solid var(--tip-navy-mid);
  border-radius: var(--tip-radius);
}
.tip-search-row:focus-within { border-color: var(--tip-teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18); }
.tip-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 14px 16px;
  font-size: 17px;
  background: transparent;
  color: var(--tip-ink);
  min-height: 54px;
}
.tip-search-input:focus { outline: none; }
.tip-search-clear {
  border: 0;
  background: transparent;
  color: var(--tip-ink-muted);
  font-size: 15px;
  font-weight: 600;
  padding: 0 16px;
  min-height: 48px;
  cursor: pointer;
}
.tip-search-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tip-filter-chip {
  border: 1px solid var(--tip-border);
  background: var(--tip-surface-alt);
  color: var(--tip-ink);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 13px;
  min-height: 42px;
  border-radius: 4px;
  cursor: pointer;
}
.tip-filter-chip[aria-pressed="true"] {
  background: var(--tip-navy);
  color: #FFFFFF;
  border-color: var(--tip-navy);
}

.tip-sr-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 60px;
  z-index: 50;
  background: var(--tip-surface);
  border: 1px solid var(--tip-border);
  border-radius: var(--tip-radius);
  box-shadow: 0 14px 32px rgba(11, 31, 58, 0.16);
  max-height: 440px;
  overflow-y: auto;
}
.tip-sr-item {
  display: block;
  padding: 13px 16px;
  border-bottom: 1px solid var(--tip-border);
  color: var(--tip-ink);
}
.tip-sr-item:hover, .tip-sr-item.is-active { background: var(--tip-surface-alt); text-decoration: none; }
.tip-sr-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tip-sr-name { font-size: 16.5px; font-weight: 700; color: var(--tip-ink); }
.tip-sr-meta { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tip-sr-sub { font-size: 14.5px; color: var(--tip-ink-muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.tip-sr-brand { color: var(--tip-ok-ink); font-weight: 700; }
.tip-sr-hist { color: var(--tip-warn-ink); font-weight: 600; }
.tip-sr-empty, .tip-sr-error { padding: 16px; font-size: 15.5px; color: var(--tip-ink-muted); }

/* Status Badges (Part B3: 13–14px) */
.tip-badge {
  display: inline-block;
  font-size: 13.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  line-height: 1.3;
}
.tip-b-pub { background: var(--tip-ok-bg); color: var(--tip-ok-ink); }
.tip-b-pending { background: var(--tip-warn-bg); color: var(--tip-warn-ink); }
.tip-b-type { background: var(--tip-surface-alt); color: var(--tip-ink-muted); border-color: var(--tip-border); }

/* Varied Editorial Homepage Sections (Part D3) */
.tip-section { padding: 30px 0; border-bottom: 1px solid var(--tip-border); }
.tip-section-alt { background: var(--tip-surface); }
.tip-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tip-grid-dest { display: grid; grid-template-columns: 1fr; gap: 16px; }
.tip-editorial-row { display: grid; grid-template-columns: 1fr; gap: 18px; }
.tip-dest-block {
  background: var(--tip-surface);
  border: 1px solid var(--tip-border);
  border-left: 4px solid var(--tip-navy);
  border-radius: var(--tip-radius);
  padding: 18px 20px;
}
.tip-dest-block p { margin: 0 0 12px; color: var(--tip-ink-muted); }
.tip-list-clean { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.tip-list-clean li { padding-bottom: 8px; border-bottom: 1px solid var(--tip-border); }
.tip-list-clean li:last-child { border-bottom: 0; padding-bottom: 0; }
.tip-list-clean a { font-weight: 600; font-size: 16px; }

/* Non-cramped Governance Metrics (Part D4) */
.tip-metrics-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}
.tip-metric-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 16px;
  background: var(--tip-surface);
  border: 1px solid var(--tip-border);
  border-radius: var(--tip-radius);
}
.tip-metric-num { font-size: 24px; font-weight: 700; color: var(--tip-navy); min-width: 74px; }
:root[data-theme="dark"] .tip-metric-num { color: var(--tip-teal); }
.tip-metric-desc { font-size: 15px; color: var(--tip-ink-muted); }

/* Part C3 & F: Dual Responsive Reference Library (Mobile Cards vs Desktop Table) */
.tip-az-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.tip-az-btn {
  min-width: 38px;
  min-height: 40px;
  border: 1px solid var(--tip-border);
  background: var(--tip-surface);
  color: var(--tip-ink);
  border-radius: 4px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.tip-az-btn.is-active { background: var(--tip-teal); color: #FFFFFF; border-color: var(--tip-teal); }

.tip-lib-cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
.tip-lib-card {
  background: var(--tip-surface);
  border: 1px solid var(--tip-border);
  border-left: 4px solid var(--tip-teal);
  border-radius: var(--tip-radius);
  padding: 16px;
}
.tip-lib-card-title { font-size: 19px; font-weight: 700; margin: 0 0 10px; line-height: 1.3; }
.tip-lib-dl { display: grid; gap: 8px; margin: 0 0 12px; }
.tip-lib-dl div { display: grid; gap: 2px; }
.tip-lib-dl dt { font-size: 13.5px; font-weight: 700; color: var(--tip-ink-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.tip-lib-dl dd { margin: 0; font-size: 15.5px; color: var(--tip-ink); }
.tip-lib-table-wrap { display: none; }

.tip-table { width: 100%; border-collapse: collapse; font-size: 15.5px; /* Part B3: 15–16px */ }
.tip-table th, .tip-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--tip-border); vertical-align: top; }
.tip-table th { background: var(--tip-surface-alt); font-size: 13.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--tip-ink); }
.tip-table tr:hover td { background: var(--tip-surface-alt); }

.tip-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.tip-btn, .tip-btn-sm {
  border: 1px solid var(--tip-border);
  background: var(--tip-surface);
  color: var(--tip-ink);
  padding: 10px 16px;
  min-height: 46px;
  border-radius: var(--tip-radius);
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
}
.tip-btn-sm { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.tip-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Footer */
.tip-footer {
  background: var(--tip-navy);
  color: #CBD5E1;
  padding: 32px 0;
  font-size: 15px;
  margin-top: 28px;
}
.tip-footer a { color: #99F6E4; }
.tip-footer-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }

/* === REAL RESPONSIVE BREAKPOINTS (Part C) === */
@media (min-width: 640px) {
  .tip-wrap { padding: 0 22px; }
  .tip-metrics-list { grid-template-columns: repeat(2, 1fr); }
  .tip-footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  body.tip-v342 { font-size: 17.5px; }
  .tip-grid-dest { grid-template-columns: repeat(2, 1fr); }
  .tip-editorial-row { grid-template-columns: 1.25fr 1fr; }
}

@media (min-width: 960px) {
  /* Switch Reference Library from mobile cards to desktop structured table */
  .tip-lib-cards { display: none; }
  .tip-lib-table-wrap {
    display: block;
    overflow-x: auto;
    border: 1px solid var(--tip-border);
    border-radius: var(--tip-radius);
    background: var(--tip-surface);
  }
}

@media (min-width: 1024px) {
  body.tip-v342 { font-size: 18px; } /* Part B3 Desktop body: 17–19px */
  .tip-nav-desktop { display: flex; }
  #tip-menu-toggle, #tip-mobile-drawer { display: none !important; }
  .tip-hero { padding: 40px 0 42px; }
  .tip-hero-h1 { font-size: 52px; }  /* Part B3 Desktop H1: 48–58px */
  .tip-page-h1 { font-size: 44px; }  /* Part B3 Desktop Page H1: 40–48px */
  .tip-h2 { font-size: 30px; }       /* Part B3 Desktop H2: 28–34px */
  .tip-h3 { font-size: 23px; }       /* Part B3 Desktop H3: 21–25px */
  .tip-footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tip-bg: #0B1320; --tip-surface: #111C2E; --tip-surface-alt: #18263D;
    --tip-ink: #F1F5F9; --tip-ink-muted: #CBD5E1; --tip-border: #2A3F5F;
    --tip-teal: #2DD4BF; --tip-teal-hover: #5EEAD4;
  }
}
