/* ============================================================
   PERC Rule Calculator Dedicated Stylesheet
   Scope: .perc- Namespace
   Design System: Navy (#1D3557), Red/Crimson (#E63946), Emerald (#10B981), Amber (#F59E0B)
   Typography: Lexend (headings) & Inter (body)
   ============================================================ */

/* Hero & Section Layout */
.perc-hero {
  padding: 36px 0 60px;
  background: #f8fafc;
  color: #1e293b;
}

.perc-hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 992px) {
  .perc-hero-grid {
    grid-template-columns: 1.12fr 0.88fr;
    align-items: start;
  }
}

/* Breadcrumbs */
.perc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
  margin-bottom: 14px;
}

.perc-breadcrumb a {
  color: #1d3557;
  text-decoration: none;
  font-weight: 500;
}

.perc-breadcrumb a:hover {
  color: #e63946;
  text-decoration: underline;
}

/* Badges */
.perc-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.perc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 11px/1 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border-radius: 9999px;
  background: #eff6ff;
  color: #1d4ed8;
}

.perc-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2563eb;
  animation: percPulse 1.8s infinite;
}

@keyframes percPulse {
  0% { transform: scale(0.95); opacity: 0.9; }
  50% { transform: scale(1.35); opacity: 0.4; }
  100% { transform: scale(0.95); opacity: 0.9; }
}

.perc-reviewed-tag {
  font-size: 12.5px;
  color: #64748b;
  font-weight: 500;
}

/* Typography */
.perc-title {
  font-family: 'Lexend', sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin: 0 0 10px;
}

.perc-title .accent {
  color: #e63946;
}

.perc-lead {
  font-size: 14.5px;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 18px;
}

/* Core Clinical Callout Alert */
.perc-rule-alert {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #16a34a;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  color: #166534;
  line-height: 1.55;
  margin-bottom: 20px;
}

.perc-rule-alert strong {
  color: #14532d;
}

/* Stats Row */
.perc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.perc-stat-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.perc-stat-val {
  font-family: 'Lexend', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #1d3557;
  line-height: 1.2;
}

.perc-stat-val.green {
  color: #16a34a;
}

.perc-stat-val.red {
  color: #dc2626;
}

.perc-stat-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.perc-disclaimer {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.55;
  background: #f1f5f9;
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid #94a3b8;
}

/* ============================================================
   CALCULATOR CARD & CONTROLS
   ============================================================ */
.perc-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.perc-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 2px solid #f1f5f9;
}

.perc-card-head span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #e63946;
  letter-spacing: 0.06em;
}

.perc-card-head h2 {
  font-family: 'Lexend', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 2px 0 0;
}

.perc-card-head b {
  background: #eff6ff;
  color: #1e40af;
  font: 700 11px/1 'Inter', sans-serif;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 99px;
}

/* Gestalt Safety Check Bar */
.perc-gestalt-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.perc-gestalt-title {
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.perc-gestalt-desc {
  font-size: 12px;
  color: #78350f;
  line-height: 1.45;
  margin-bottom: 10px;
}

.perc-gestalt-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.perc-gestalt-btn {
  border: 1px solid #d97706;
  background: #ffffff;
  color: #92400e;
  font: 600 12px 'Inter', sans-serif;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.perc-gestalt-btn.is-active {
  background: #d97706;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

/* Presets Bar */
.perc-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
}

.perc-presets span {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  margin-right: 2px;
}

.perc-preset-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 9px;
  font: 600 11px 'Inter', sans-serif;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.perc-preset-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Live Vitals Fast-Entry Row */
.perc-vitals-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 18px;
}

.perc-vital-field label {
  display: block;
  font: 700 10.5px 'Inter', sans-serif;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.perc-vital-field input {
  width: 100%;
  padding: 7px 10px;
  font: 700 13px 'Inter', sans-serif;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  box-sizing: border-box;
}

.perc-vital-field input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.perc-vital-field small {
  display: block;
  font-size: 10px;
  color: #64748b;
  margin-top: 3px;
}

/* The 8 Criteria Checklist */
.perc-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.perc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.perc-item:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.perc-item.is-checked {
  background: #fff7ed;
  border-color: #f97316;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.08);
}

.perc-checkbox-box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s ease;
  background: #ffffff;
}

.perc-item.is-checked .perc-checkbox-box {
  background: #f97316;
  border-color: #f97316;
  color: #ffffff;
}

.perc-checkbox-box svg {
  width: 13px;
  height: 13px;
  stroke: #ffffff;
  stroke-width: 3;
  fill: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.perc-item.is-checked .perc-checkbox-box svg {
  opacity: 1;
}

.perc-item-text {
  flex: 1;
  min-width: 0;
}

.perc-item-text strong {
  display: block;
  font: 700 13px/1.35 'Lexend', sans-serif;
  color: #1e293b;
}

.perc-item.is-checked .perc-item-text strong {
  color: #9a3412;
}

.perc-item-text small {
  display: block;
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.35;
}

.perc-tag {
  font: 800 11px 'Lexend', sans-serif;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  flex-shrink: 0;
}

.perc-item.is-checked .perc-tag {
  background: #ffedd5;
  color: #c2410c;
}

/* ============================================================
   RESULTS BOX
   ============================================================ */
.perc-result-card {
  border-radius: 16px;
  padding: 22px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  transition: all 0.25s ease;
}

.perc-result-card.is-negative {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-color: #22c55e;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.12);
}

.perc-result-card.is-positive {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #f97316;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.12);
}

.perc-result-card.is-not-low-risk {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #ef4444;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.12);
}

.perc-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.perc-score-badge {
  font: 800 14px 'Lexend', sans-serif;
  padding: 5px 12px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.is-negative .perc-score-badge {
  background: #dcfce7;
  color: #15803d;
}

.is-positive .perc-score-badge {
  background: #ffedd5;
  color: #c2410c;
}

.is-not-low-risk .perc-score-badge {
  background: #fee2e2;
  color: #b91c1c;
}

.perc-prob-stat {
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.perc-result-headline {
  font-family: 'Lexend', sans-serif;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 10px;
}

.is-negative .perc-result-headline {
  color: #15803d;
}

.is-positive .perc-result-headline {
  color: #c2410c;
}

.is-not-low-risk .perc-result-headline {
  color: #b91c1c;
}

.perc-result-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: #334155;
  margin: 0 0 16px;
}

.perc-action-callout {
  background: #ffffff;
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
}

.perc-action-callout strong {
  display: block;
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  margin-bottom: 4px;
}

.is-negative .perc-action-callout strong {
  color: #15803d;
}

.is-positive .perc-action-callout strong {
  color: #c2410c;
}

.is-not-low-risk .perc-action-callout strong {
  color: #b91c1c;
}

.perc-action-callout p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #475569;
}

/* Card Action Buttons */
.perc-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.perc-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  font: 600 12.5px 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.perc-btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.perc-btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.perc-btn-primary {
  background: #1d3557;
  color: #ffffff;
}

.perc-btn-primary:hover {
  background: #162942;
}

/* ============================================================
   EDITORIAL SILO & SIDEBAR LAYOUT
   ============================================================ */
.perc-editorial {
  padding: 48px 0 72px;
  background: #ffffff;
}

.perc-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 36px;
  align-items: start;
}

@media (max-width: 991px) {
  .perc-content-grid {
    grid-template-columns: 1fr;
  }
}

.perc-main-article {
  min-width: 0;
  font-size: 15px;
  line-height: 1.7;
  color: #334155;
}

.perc-main-article h2 {
  font-family: 'Lexend', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin: 40px 0 16px;
  line-height: 1.3;
  padding-bottom: 8px;
  border-bottom: 2px solid #f1f5f9;
}

.perc-main-article h2:first-of-type {
  margin-top: 0;
}

.perc-main-article h3 {
  font-family: 'Lexend', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #1d3557;
  margin: 24px 0 10px;
}

.perc-main-article p {
  margin: 0 0 16px;
}

.perc-main-article ul, .perc-main-article ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

.perc-main-article li {
  margin-bottom: 8px;
}

/* Hyperlinks Standard */
.text-link, .perc-main-article p a, .perc-main-article li a, .perc-main-article td a {
  color: #e63946 !important;
  text-decoration: underline !important;
  text-decoration-color: rgba(230, 57, 70, 0.45) !important;
  text-underline-offset: 3px !important;
  text-decoration-thickness: 1.5px !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

.text-link:hover, .perc-main-article p a:hover, .perc-main-article li a:hover, .perc-main-article td a:hover {
  color: #c0303c !important;
  text-decoration-color: #c0303c !important;
}

/* Tables */
.perc-table-wrap {
  overflow-x: auto;
  margin: 24px 0 32px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.perc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
  background: #ffffff;
}

.perc-table th {
  background: #f8fafc;
  color: #1e293b;
  font: 700 12.5px 'Lexend', sans-serif;
  padding: 12px 16px;
  border-bottom: 2px solid #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.perc-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  line-height: 1.55;
  color: #334155;
}

.perc-table tr:hover td {
  background: #f8fafc;
}

/* Infographic Card */
.perc-infographic-card {
  margin: 32px 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
}

.perc-infographic-card img {
  width: 100%;
  height: auto;
  display: block;
}

.perc-infographic-card figcaption {
  font-size: 12.5px;
  color: #64748b;
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  line-height: 1.5;
  font-style: italic;
}

/* Case Scenarios Grid */
.perc-cases-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 24px 0 32px;
}

@media (min-width: 768px) {
  .perc-cases-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.perc-case-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
}

.perc-case-tag {
  font: 700 10.5px 'Inter', sans-serif;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
  display: inline-block;
  margin-bottom: 8px;
}

.perc-case-box h3 {
  font-size: 16px;
  margin: 0 0 10px;
  color: #0f172a;
}

.perc-case-box p {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.perc-case-results {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.perc-case-results div {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 3px 0;
}

/* FAQs */
.perc-faqs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0 36px;
}

.perc-faq-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  transition: all 0.2s ease;
}

.perc-faq-item[open] {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.perc-faq-item summary {
  font-family: 'Lexend', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #1d3557;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.perc-faq-item summary::-webkit-details-marker {
  display: none;
}

.perc-faq-item summary::after {
  content: '+';
  font-size: 18px;
  font-weight: 600;
  color: #64748b;
  margin-left: 12px;
}

.perc-faq-item[open] summary::after {
  content: '−';
  color: #e63946;
}

.perc-faq-item p {
  font-size: 13.5px;
  line-height: 1.65;
  color: #475569;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

/* References */
.perc-references-list {
  font-size: 12.5px;
  line-height: 1.65;
  color: #64748b;
  padding-left: 20px;
}

.perc-references-list li {
  margin-bottom: 10px;
}

/* Author Card */
.author-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 32px;
}

.author-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d3557 0%, #3b6cc1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 17px 'Lexend', sans-serif;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(29, 53, 87, 0.2);
}

.author-name {
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
  color: #1d3557;
  font-size: 15px;
}

.author-name a {
  color: #1d3557;
  text-decoration: none;
}

.author-name a:hover {
  color: #e63946;
  text-decoration: underline;
}

.author-title {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #e63946;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.author-card p {
  font-size: 12.5px;
  line-height: 1.6;
  color: #475569;
  margin: 0;
}

/* Sticky Sidebar Components */
.sticky-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 80px;
}

@media (max-width: 991px) {
  .sticky-sidebar {
    position: static;
  }
}

.sidebar-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.sidebar-section-title {
  font-family: 'Lexend', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #1d3557;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f1f5f9;
  letter-spacing: -0.01em;
}

.health-directory {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.health-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.health-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateX(3px);
}

.health-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 11.5px 'Lexend', sans-serif;
  flex-shrink: 0;
}

.health-item strong {
  display: block;
  font: 700 12.5px 'Lexend', sans-serif;
  color: #1d3557;
  line-height: 1.3;
}

.health-item p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #64748b;
  line-height: 1.35;
}

/* Print Optimization */
@media print {
  .site-header, footer, .perc-actions, .perc-presets, .sticky-sidebar {
    display: none !important;
  }
  .perc-hero, .perc-editorial {
    padding: 0 !important;
    background: #ffffff !important;
  }
  .perc-card, .perc-infographic-card {
    border: none !important;
    box-shadow: none !important;
  }
}
