/* ============================================================
   PrimeDope Base Styles
   Imports tokens. Sets the document foundation.
   Load this once — all other stylesheets build on top of it.
   ============================================================ */


/* ----------------------------------------------------------
   RESET
---------------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Dot texture — visible in margins, fades toward bottom of page */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.07) 1px, transparent 1px);
  background-size: 20px 20px;
  -webkit-mask-image:
    linear-gradient(to right,
      rgba(0,0,0,1) 0%,
      rgba(0,0,0,0.5) 15%,
      rgba(0,0,0,0.12) 30%,
      rgba(0,0,0,0.12) 70%,
      rgba(0,0,0,0.5) 85%,
      rgba(0,0,0,1) 100%
    ),
    linear-gradient(to bottom,
      rgba(0,0,0,1) 0%,
      rgba(0,0,0,1) 60%,
      rgba(0,0,0,0) 85%
    );
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right,
      rgba(0,0,0,1) 0%,
      rgba(0,0,0,0.5) 15%,
      rgba(0,0,0,0.12) 30%,
      rgba(0,0,0,0.12) 70%,
      rgba(0,0,0,0.5) 85%,
      rgba(0,0,0,1) 100%
    ),
    linear-gradient(to bottom,
      rgba(0,0,0,1) 0%,
      rgba(0,0,0,1) 60%,
      rgba(0,0,0,0) 85%
    );
  mask-composite: intersect;
}

::selection {
  background: var(--color-accent-subtle);
  color: var(--color-text-primary);
}

img, video, svg {
  display: block;
  max-width: 100%;
}

a:not([class]) {
  color: var(--color-accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color var(--transition-fast);
}

a:not([class]):hover {
  color: var(--color-accent-hover);
  text-decoration-thickness: 2px;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

ol, ul {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
  text-wrap: balance;
}


/* ----------------------------------------------------------
   TYPE SCALE — Base classes
   Use these directly or as reference for component styles.
---------------------------------------------------------- */

.text-display {
  font-family: var(--font-serif);
  font-size: var(--text-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.text-h1 {
  font-family: var(--font-serif);
  font-size: var(--text-h1);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.text-h2 {
  font-family: var(--font-serif);
  font-size: var(--text-h2);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}

.text-h3 {
  font-family: var(--font-serif);
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-normal);
}

.text-body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
}

.text-small {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  line-height: var(--leading-data);
}

.text-label {
  font-family: var(--font-sans);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.text-data {
  font-family: var(--font-serif);
  font-size: var(--text-small);
}


/* ----------------------------------------------------------
   LAYOUT UTILITIES
---------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--max-width-full);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.container--content {
  max-width: var(--max-width-content);
}

.container--narrow {
  max-width: var(--max-width-narrow);
}


/* ----------------------------------------------------------
   DIVIDERS
   Heavy top rule is a PrimeDope pattern from the existing
   component library — worth keeping. Signals editorial intent.
---------------------------------------------------------- */

.rule {
  border: none;
  border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, white);
  margin: var(--space-6) 0;
}

.rule--heavy {
  border-top: 2px solid var(--color-text-primary);
}

.rule--accent {
  border-top: 2px solid var(--color-accent);
}


/* ----------------------------------------------------------
   SHARED COMPONENT: .pd-table
   Data tables. Serif numbers, sans labels, left-aligned.
   Wrap in .pd-table-wrap for horizontal scroll on mobile.
---------------------------------------------------------- */

.pd-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pd-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-6);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.75) 0%, var(--color-surface) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.pd-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

.pd-table th {
  font-family: var(--font-sans);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-secondary);
  text-align: left;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid rgba(78, 8, 22, 0.18);
  background: rgba(255,255,255,0.3);
  white-space: nowrap;
}

.pd-table td {
  font-family: var(--font-serif);
  font-size: var(--text-small);
  color: var(--color-text-primary);
  padding: var(--space-3);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.72);
}

/* First column: label style (sans) */
.pd-table td:first-child {
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
}

.pd-table tbody tr + tr td {
  border-top: 1px solid rgba(57, 52, 47, 0.08);
}

.pd-table tbody tr:nth-child(even) td {
  background: rgba(236, 233, 227, 0.72);
}

/* Modifiers */
.pd-table--zebra tbody tr:nth-child(even) td { background: var(--color-surface-2); }
.pd-table--right-data th:not(:first-child),
.pd-table--right-data td:not(:first-child) { text-align: right; }

/* Semantic cell colors */
.pd-table .positive { color: var(--color-positive); }
.pd-table .danger   { color: var(--color-danger); }
.pd-table .warning  { color: var(--color-warning); }
.pd-table .muted    { color: var(--color-text-muted); }

/* Highlighted row variants */
.pd-table .highlight td { background: rgba(107, 31, 42, 0.06); font-weight: var(--weight-semibold); }
.pd-table .row-positive td { background: var(--color-positive-subtle); }
.pd-table .row-danger td { background: var(--color-danger-subtle); }

/* Row hover — subtle accent tint across all table types */
.pd-table tbody tr:hover td,
.pd-calc__table tbody tr:hover td,
.pd-calc__summary tr:hover td,
.pd-prose tbody tr:hover td {
  background: var(--color-accent-subtle);
}


/* ----------------------------------------------------------
   SHARED COMPONENT: .pd-section
   Top-border section divider with h2 header.
---------------------------------------------------------- */

.pd-section {
  border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, white);
  padding: var(--space-7) 0;
}

.pd-section__inner {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.pd-section h2 {
  font-family: var(--font-serif);
  font-size: var(--text-h2);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-5);
  line-height: var(--leading-snug);
}

@media (max-width: 640px) {
  .pd-section__inner { padding: 0 var(--space-4); }
}

/* Alternating section tint — every other section gets recessed bg */
.pd-section:nth-of-type(even) {
  background: var(--color-surface-2);
  border-top-color: color-mix(in srgb, var(--color-border-heavy) 82%, white);
}

/* First content section gets accent top rule */
.pd-section:first-of-type {
  border-top: 2px solid var(--color-accent);
}

/* Card-contained section variant — inset with elevation */
.pd-section--card .pd-section__inner {
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}

/* Full-bleed recessed variant — fills edge to edge */
.pd-section--recessed {
  background: var(--color-surface-2);
}


/* ----------------------------------------------------------
   SHARED COMPONENT: .pd-faq
   Accordion using native <details>. No JavaScript.
---------------------------------------------------------- */

.pd-faq {
  max-width: var(--max-width-content);
}

.pd-faq details {
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 70%, white);
}

.pd-faq details:first-child {
  border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, white);
}

.pd-faq summary {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  padding: var(--space-4) 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: color var(--transition-fast), background var(--transition-fast);
  border-radius: var(--radius-sm);
}

.pd-faq summary:hover {
  color: var(--color-accent-text);
  background: var(--color-surface-2);
}
.pd-faq summary::-webkit-details-marker { display: none; }

.pd-faq summary::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: var(--weight-regular);
  color: var(--color-text-muted);
  flex-shrink: 0;
  margin-left: var(--space-4);
  transition: color var(--transition-fast);
}

.pd-faq details[open] summary { color: var(--color-accent-text); }
.pd-faq details[open] summary::after { content: '\2212'; color: var(--color-accent-text); }

.pd-faq .pd-faq__answer {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
  padding-bottom: var(--space-5);
}


/* ----------------------------------------------------------
   SHARED COMPONENT: .pd-cta
   Primary and secondary button states.
---------------------------------------------------------- */

.pd-cta.pd-cta {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-on-dark);
  background: linear-gradient(180deg, #8A2835 0%, #4A0E18 100%);
  text-decoration: none;
  border: none;
  border-radius: var(--radius-btn);
  padding: 14px 28px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 6px 14px rgba(107, 31, 42, 0.32);
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  letter-spacing: 0.01em;
  box-shadow: 0 1px 3px rgba(107, 31, 42, 0.25), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.pd-cta.pd-cta:hover {
  background: linear-gradient(180deg, #9C2E3D 0%, #3A0710 100%);
  color: var(--color-text-on-dark);
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.32),
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 10px 24px rgba(107, 31, 42, 0.42);
  transform: translateY(-1px);
}

.pd-cta.pd-cta:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 2px 4px rgba(107, 31, 42, 0.2);
}

.pd-cta.pd-cta--secondary {
  background: var(--color-surface);
  color: var(--color-accent-text);
  border: 1.5px solid var(--color-accent);
  padding: 12.5px 28px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 3px rgba(26, 26, 26, 0.08);
}

.pd-cta.pd-cta--secondary:hover {
  background: var(--color-accent-subtle);
  color: var(--color-accent-text);
  border-color: var(--color-accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 6px 16px rgba(107, 31, 42, 0.18);
  transform: translateY(-1px);
}

.pd-cta.pd-cta--secondary:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 1px 2px rgba(107, 31, 42, 0.12);
}


/* ----------------------------------------------------------
   SHARED COMPONENT: .pd-masthead
   Editorial paper band between the burgundy header and the
   hero. Cream strip with a crisp hairline top (reads against
   burgundy) and a soft hairline bottom (reads against any hero
   variant — light, dark burgundy, near-black). Identical on
   every template so the nav-to-content transition never drifts.
   .pd-masthead__inner is hidden — legacy templates still render
   category/type/updated spans that we don't want visible.
---------------------------------------------------------- */
.pd-masthead {
  background: var(--color-bg);
  height: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid var(--color-border-heavy);
  margin-bottom: 0;
  position: relative;
  z-index: var(--z-base);
}
.pd-masthead__inner {
  display: none;
}


/* ----------------------------------------------------------
   SHARED COMPONENT: .pd-hero
   Variants: default (light), --dark (burgundy), --learn (near-black), --room (light + accent stripe)
---------------------------------------------------------- */

/* Base */
.pd-hero              { position: relative; overflow: hidden; padding: var(--space-7) 0 var(--space-6); background: var(--color-surface-2); }
.pd-hero__inner       { position: relative; z-index: 1; max-width: var(--max-width-content); margin: 0 auto; padding: 0 var(--space-6); }
.pd-hero h1           { font-family: var(--font-serif); font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); line-height: 1.12; color: var(--color-text-primary); margin-bottom: var(--space-3); }
.pd-hero__cred        { font-family: var(--font-sans); font-size: var(--text-small); color: var(--color-text-muted); letter-spacing: var(--tracking-wide); margin-bottom: var(--space-4); }
.pd-hero__cred span   { margin: 0 var(--space-2); opacity: 0.5; }
.pd-hero__desc        { font-family: var(--font-sans); font-size: var(--text-body); color: var(--color-text-secondary); line-height: var(--leading-normal); max-width: 640px; margin: 0; }

/* Watermark (background image positioned behind content) */
.pd-hero__watermark {
  position: absolute; top: 0; right: 0; bottom: 0; left: 30%;
  opacity: 0.18; pointer-events: none; overflow: hidden; z-index: 0;
  filter: grayscale(1);
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 85%);
  mask-image: linear-gradient(to left, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 85%);
}

/* Dark + Learn shared */
.pd-hero--dark,
.pd-hero--learn                    { border-bottom: none; }
.pd-hero--dark h1,
.pd-hero--learn h1                 { color: var(--color-text-on-dark); }
.pd-hero--dark .pd-hero__cred,
.pd-hero--learn .pd-hero__cred     { color: rgba(255,255,255,0.4); }
.pd-hero--dark .pd-hero__cred span,
.pd-hero--learn .pd-hero__cred span { opacity: 0.3; }
.pd-hero--dark .pd-hero__desc,
.pd-hero--learn .pd-hero__desc     { font-family: var(--font-serif); font-size: 1.05rem; color: rgba(255,255,255,0.45); line-height: 1.6; font-style: italic; }

/* Bottom edge gradient (dark + learn) */
.pd-hero--dark::after,
.pd-hero--learn::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 20%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.08) 80%, transparent 100%);
}

/* Dark (burgundy) — dot pattern fading from top-right.
   The .pd-masthead paper band above carries the divider; no
   top border here so the hero starts cleanly against it. */
.pd-hero--dark {
  background: var(--color-bg-dark);
}
.pd-hero--dark::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  -webkit-mask-image: radial-gradient(ellipse at 80% 25%, rgba(0,0,0,0.9) 0%, transparent 55%);
  mask-image: radial-gradient(ellipse at 80% 25%, rgba(0,0,0,0.9) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}

/* Learn (near-black) — larger padding, bigger h1, grid texture fading from top-right */
.pd-hero--learn                    { background: var(--color-text-primary); padding: var(--space-8) 0 var(--space-7); }
.pd-hero--learn h1                 { font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.05; }
.pd-hero--learn::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-image: linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 85% 20%, rgba(0,0,0,0.8) 0%, transparent 55%);
  mask-image: radial-gradient(ellipse at 85% 20%, rgba(0,0,0,0.8) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}

/* Responsive */
@media (max-width: 640px) {
  .pd-hero__inner     { padding: 0 var(--space-4); }
  .pd-hero__watermark { left: 20%; opacity: 0.1; }
}


/* ----------------------------------------------------------
   CHARTS — Universal chart standards
   Shared container, legend, and explainer styles for every
   Chart.js and canvas visualization on the site.
   Pairs with static/js/pd-charts.js.
---------------------------------------------------------- */

/* Container — wraps the <canvas> element */
.pd-chart-wrap {
  position: relative;
  height: 360px;
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-border) 84%, white);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

/* Legend / key — sits below the chart */
.pd-chart-legend {
  display: flex;
  gap: var(--space-4) var(--space-6);
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-border) 84%, white);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.pd-chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

.pd-chart-swatch {
  width: 24px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Swatch variants — match pd-charts.js color tokens */
.pd-chart-swatch--ev       { background: var(--color-chart-ev); }
.pd-chart-swatch--ci70     { background: var(--color-chart-ci70); }
.pd-chart-swatch--ci95     { background: var(--color-chart-ci95); }
.pd-chart-swatch--ci997    { background: rgba(134, 239, 172, 0.35); }
.pd-chart-swatch--best     { background: var(--color-chart-best); }
.pd-chart-swatch--worst    { background: var(--color-chart-worst); }
.pd-chart-swatch--sample   { background: var(--color-chart-sample); }
.pd-chart-swatch--observed { background: var(--color-chart-observed); }
.pd-chart-swatch--profit   { background: var(--color-chart-profit); }
.pd-chart-swatch--drawdown { background: var(--color-chart-drawdown); height: 6px; opacity: 0.5; }

/* Explainer prose — sits below the legend */
.pd-chart-explainer {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
  margin-top: var(--space-3);
}

/* Responsive */
@media (max-width: 640px) {
  .pd-chart-wrap { height: 280px; padding: var(--space-3); }
  .pd-chart-legend { padding: var(--space-3) var(--space-4); gap: var(--space-3) var(--space-5); }
}


/* ----------------------------------------------------------
   PROSE — Article body typography
   Apply to any container that renders markdown/HTML content.
   Three-tier spacing: H2 (major) > H3 (sub) > paragraph.
   ---------------------------------------------------------- */

.pd-prose {
  width: 100%;
  max-width: var(--max-width-content);
  overflow-wrap: break-word;
}

/* H2: major section — accent text, hairline rule above, wide breathing room */
.pd-prose h1,
.pd-prose h2 {
  font-family: var(--font-serif);
  font-weight: var(--weight-bold);
  color: var(--color-accent-text);
  line-height: var(--leading-snug);
  border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, white);
  padding-top: var(--space-5);
  margin-top: var(--space-9);
  margin-bottom: var(--space-4);
}

.pd-prose h1 { font-size: var(--text-h1); }
.pd-prose h2 { font-size: var(--text-h2); }

/* First heading in block or after section-rule — no rule or top margin */
.pd-prose > h1:first-child,
.pd-prose > h2:first-child,
.pd-prose > .section-rule + h2 {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* .section-rule-label removed -- use plain headings */

/* H3: subsection — clear gap above (3x paragraph spacing) */
.pd-prose h3 {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-top: var(--space-7);
  margin-bottom: var(--space-3);
}

.pd-prose p {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: var(--color-text-primary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
  text-wrap: pretty;
}

.pd-prose strong { font-weight: var(--weight-semibold); }

.pd-prose a:not([class]) {
  color: var(--color-accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pd-prose a:not([class]):hover { color: var(--color-accent-hover); }

.pd-prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-surface-2);
  padding: 1px var(--space-1);
  border-radius: 2px;
}

.pd-prose pre {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  line-height: 1.5;
  margin-bottom: var(--space-5);
}

.pd-prose blockquote {
  margin: var(--space-5) 0;
  padding: var(--space-4) var(--space-5);
  background: var(--color-accent-subtle);
}

.pd-prose blockquote p {
  color: var(--color-text-secondary);
  margin-bottom: 0;
}

.pd-prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-small);
}

.pd-prose thead th {
  font-weight: var(--weight-semibold);
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 2px solid var(--color-accent);
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
}

.pd-prose tbody td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 70%, white);
  color: var(--color-text-primary);
}

.pd-prose tbody td:first-child {
  color: var(--color-text-secondary);
}

.pd-prose ul,
.pd-prose ol {
  margin: 0 0 var(--space-4) var(--space-5);
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-relaxed);
}

.pd-prose ul { list-style: disc; }
.pd-prose ol { list-style: decimal; }
.pd-prose li { margin-bottom: var(--space-2); }

.pd-prose hr {
  border: none;
  border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, white);
  margin: var(--space-7) 0;
}

/* When hr precedes a heading, the heading already has its own rule and spacing */
.pd-prose hr + h1,
.pd-prose hr + h2 {
  border-top: none;
  margin-top: var(--space-5);
  padding-top: 0;
}

.pd-prose img {
  max-width: 100%;
  height: auto;
}


/* ----------------------------------------------------------
   YOUTUBE — Facade + placeholder
   Privacy-friendly YouTube embed with thumbnail facade.
   Available on any page (learn, editorial, guides, etc.)
---------------------------------------------------------- */

.pd-yt-placeholder {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #2A2A2A;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.pd-yt-placeholder__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pd-yt-placeholder__icon svg { opacity: 0.3; }

.pd-yt-placeholder__label {
  font-family: var(--font-sans);
  font-size: var(--text-label);
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.pd-yt-facade {
  position: relative;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pd-yt-facade::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.15);
  transition: background var(--transition-fast);
}

.pd-yt-facade:hover::before { background: rgba(0,0,0,0.05); }

.pd-yt-facade__play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 68px; height: 48px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1;
}

.pd-yt-facade__info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1;
}

.pd-yt-facade__title {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  color: #fff;
}

.pd-yt-facade__channel {
  font-family: var(--font-sans);
  font-size: var(--text-label);
  color: rgba(255,255,255,0.7);
}

.pd-yt-facade__duration {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-family: var(--font-sans);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  padding: 2px var(--space-2);
  border-radius: 2px;
  z-index: 1;
}


/* ----------------------------------------------------------
   SHARED COMPONENT: .pd-room-card
   Room spotlight cards used across calculator, article,
   and learn pages. 3-col grid → 1-col on mobile.
---------------------------------------------------------- */

.pd-room-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-top: var(--space-5);
}

.pd-room-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.82) 0%, rgba(248,247,244,0.96) 100%);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  box-shadow: 0 18px 32px rgba(57, 52, 47, 0.06);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.pd-room-card:hover {
  box-shadow: 0 22px 40px rgba(57, 52, 47, 0.1);
  transform: translateY(-2px);
}

.pd-room-card__name {
  font-family: var(--font-serif);
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-3);
}

.pd-room-card__hook {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  color: var(--color-accent-text);
  margin-bottom: var(--space-3);
}

.pd-room-card__positioning {
  font-size: var(--text-small);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-4);
}

.pd-room-card__actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.pd-room-card__cta {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  color: var(--color-accent-text);
  text-decoration: none;
  border: 1px solid var(--color-accent-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  text-align: center;
  transition: all var(--transition-fast);
}

.pd-room-card__cta:hover {
  background: var(--color-accent);
  color: var(--color-text-on-dark);
  border-color: var(--color-accent);
}

.pd-room-card__cta--primary {
  background: var(--color-accent);
  color: var(--color-text-on-dark);
  border-color: var(--color-accent);
}

.pd-room-card__cta--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.pd-room-card__cta--secondary {
  font-size: var(--text-label);
  font-weight: var(--weight-regular);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
  padding: var(--space-1) var(--space-3);
}

.pd-room-card__cta--secondary:hover {
  color: var(--color-accent-text);
  border-color: var(--color-accent-border);
  background: transparent;
}

/* Stats grid — shared across rooms-hub and room-comparison card variants */
.pd-room-card__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid rgba(57, 52, 47, 0.08);
  border-bottom: 1px solid rgba(57, 52, 47, 0.08);
  margin-bottom: var(--space-4);
  width: 100%;
}

.pd-room-card__stat-label {
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  display: block;
}

.pd-room-card__stat-value {
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  overflow-wrap: break-word;
}

@media (max-width: 768px) {
  .pd-room-cards { grid-template-columns: 1fr; }
  .pd-room-card__stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .pd-room-card__stats { grid-template-columns: 1fr; }
}


/* ----------------------------------------------------------
   SHARED COMPONENT: .pd-cards
   Playing card rendering for _cards.html macros.
   Used by hand-rankings, holdem-rules, and any poker content.
---------------------------------------------------------- */

.pd-cards__card {
  width: 60px;
  height: 84px;
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-border) 84%, white);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: relative;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.pd-cards__card--red { color: var(--color-danger); }
.pd-cards__card:not(.pd-cards__card--red) { color: var(--color-text-primary); }

.pd-cards__card--hl {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent), 0 2px 8px rgba(107,31,42,0.15);
}

.pd-cards__card:not(.pd-cards__card--hl) {
  border-color: color-mix(in srgb, var(--color-border) 84%, white);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  background: var(--color-bg, #F8F7F4);
}

.pd-cards__corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.pd-cards__corner--tl {
  top: 4px;
  left: 5px;
}

.pd-cards__corner--br {
  bottom: 4px;
  right: 5px;
  transform: rotate(180deg);
}

.pd-cards__rank {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.pd-cards__card--wide .pd-cards__rank {
  font-size: 11px;
  letter-spacing: -0.5px;
}

.pd-cards__suit-sm {
  font-size: 10px;
  line-height: 1;
  margin-top: -1px;
}

.pd-cards__center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  line-height: 1;
}

/* Hand display -- fan rotation */
.pd-cards__hand {
  display: inline-flex;
  padding: 8px 12px 12px;
  cursor: default;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.pd-cards__hand:hover {
  transform: translateY(-2px);
}

.pd-cards__hand .pd-cards__card { margin-left: -18px; }
.pd-cards__hand .pd-cards__card:first-child { margin-left: 0; }
.pd-cards__hand .pd-cards__card--hl + .pd-cards__card:not(.pd-cards__card--hl) { margin-left: 6px; }

.pd-cards__hand .pd-cards__card:nth-child(1) { transform: rotate(-3deg); z-index: 1; }
.pd-cards__hand .pd-cards__card:nth-child(2) { transform: rotate(-1.5deg); z-index: 2; }
.pd-cards__hand .pd-cards__card:nth-child(3) { transform: rotate(0deg); z-index: 3; }
.pd-cards__hand .pd-cards__card:nth-child(4) { transform: rotate(1.5deg); z-index: 4; }
.pd-cards__hand .pd-cards__card:nth-child(5) { transform: rotate(3deg); z-index: 5; }

/* Board display -- flat row, no rotation */
.pd-cards__board {
  display: inline-flex;
  gap: var(--space-2);
  padding: 8px 0;
}

/* Hole cards -- flat, bigger */
.pd-cards__hole {
  display: inline-flex;
  gap: var(--space-2);
  padding: 8px 0;
}

.pd-cards__hole .pd-cards__card {
  width: 70px;
  height: 100px;
}

.pd-cards__hole .pd-cards__rank { font-size: 15px; }
.pd-cards__hole .pd-cards__card--wide .pd-cards__rank { font-size: 13px; }
.pd-cards__hole .pd-cards__suit-sm { font-size: 12px; }
.pd-cards__hole .pd-cards__center { font-size: 26px; }

/* Mobile card scaling */
@media (max-width: 640px) {
  .pd-cards__card {
    width: 46px;
    height: 64px;
  }
  .pd-cards__rank { font-size: 11px; }
  .pd-cards__card--wide .pd-cards__rank { font-size: 9px; }
  .pd-cards__suit-sm { font-size: 8px; }
  .pd-cards__center { font-size: 17px; }
  .pd-cards__hand .pd-cards__card { margin-left: -14px; }
  .pd-cards__hand .pd-cards__card--hl + .pd-cards__card:not(.pd-cards__card--hl) { margin-left: 4px; }
  .pd-cards__hand .pd-cards__card:nth-child(1) { transform: rotate(-1.5deg); }
  .pd-cards__hand .pd-cards__card:nth-child(2) { transform: rotate(-0.75deg); }
  .pd-cards__hand .pd-cards__card:nth-child(3) { transform: rotate(0deg); }
  .pd-cards__hand .pd-cards__card:nth-child(4) { transform: rotate(0.75deg); }
  .pd-cards__hand .pd-cards__card:nth-child(5) { transform: rotate(1.5deg); }
  /* Hole cards flat on mobile too */
}

/* Casino board -- 5-slot layout like a real table felt */
.pd-cards__casino-board {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-positive);
  border-radius: var(--radius-md);
  border: 5px solid #3d2b1f;
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.1);
}

.pd-cards__slot {
  width: 74px;
  height: 104px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.pd-cards__slot--empty {
  border: 2px dashed rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.08);
}

.pd-cards__slot--dealt {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cards inside casino board are bigger */
.pd-cards__casino-board .pd-cards__card {
  width: 70px;
  height: 100px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.pd-cards__casino-board .pd-cards__rank {
  font-size: 15px;
}

.pd-cards__casino-board .pd-cards__card--wide .pd-cards__rank {
  font-size: 13px;
}

.pd-cards__casino-board .pd-cards__suit-sm {
  font-size: 12px;
}

.pd-cards__casino-board .pd-cards__center {
  font-size: 26px;
}

@media (max-width: 640px) {
  .pd-cards__casino-board {
    gap: var(--space-1);
    padding: var(--space-3);
    border-width: 4px;
  }
  .pd-cards__slot {
    width: 54px;
    height: 76px;
  }
  .pd-cards__casino-board .pd-cards__card {
    width: 50px;
    height: 72px;
  }
  .pd-cards__casino-board .pd-cards__rank { font-size: 12px; }
  .pd-cards__casino-board .pd-cards__card--wide .pd-cards__rank { font-size: 10px; }
  .pd-cards__casino-board .pd-cards__suit-sm { font-size: 9px; }
  .pd-cards__casino-board .pd-cards__center { font-size: 20px; }
}


/* ----------------------------------------------------------
   LOGO SYSTEM
   Three-tier shared logo container for operator/room/network logos.
   Replaces 13 bespoke per-page classes. Canvas source PNGs are
   aspect-matched (wide logos get wide canvases) so object-fit:
   contain renders each logo at its natural proportion within the
   slot. The --dark modifier stays available for future
   white-on-transparent logos even though no current logo uses it.
---------------------------------------------------------- */

.pd-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.pd-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.pd-logo--hero {
  width: 320px;
  height: 96px;
}

.pd-logo--standard {
  width: 200px;
  height: 56px;
}

.pd-logo--compact {
  width: 140px;
  height: 40px;
}

/* Left-align logos inside table cells so rows share a common left edge */
td .pd-logo {
  justify-content: flex-start;
}

/* Text fallback when a room has no logo image — shares the .pd-logo slot */
.logo-text {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Responsive scaling on small screens so .pd-logo--standard fits mobile grids */
@media (max-width: 768px) {
  .pd-logo--hero {
    width: 240px;
    height: 72px;
  }
  .pd-logo--standard {
    width: 140px;
    height: 44px;
  }
}

.pd-logo--dark {
  background: var(--color-text-primary);
  padding: 4px;
  border-radius: 2px;
}


/* ----------------------------------------------------------
   REDUCED MOTION
   Respect user preference for minimal animation.
---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
