/**
 * Preflop Edge — Base Stylesheet (build-002)
 * Shared presentational rules layered on top of tokens.css.
 * Load order: tokens.css → pe-base.css → page-specific styles
 */

/* === Self-hosted fonts === */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/inter-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/inter-700.ttf') format('truetype');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/jbmono-400.ttf') format('truetype');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/jbmono-500.ttf') format('truetype');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/jbmono-700.ttf') format('truetype');
}

/* === Navigation === */
.pe-nav {
  height: var(--pe-nav-height);
  background: var(--pe-bg-elevated);
  border-bottom: 1px solid var(--pe-border);
  display: flex;
  align-items: center;
  padding: 0 var(--pe-sp-4);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pe-nav-brand {
  display: flex;
  align-items: center;
  gap: var(--pe-sp-2);
  color: var(--pe-accent);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--pe-fs-lg);
  letter-spacing: -0.01em;
}

.pe-nav-brand:hover { color: var(--pe-accent-bright); }

.pe-logo {
  flex-shrink: 0;
}

.pe-nav-brand-text {
  background: linear-gradient(135deg, var(--pe-accent), var(--pe-accent-bright));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pe-nav-links {
  display: flex;
  gap: var(--pe-sp-1);
  margin-left: auto;
}

.pe-nav-link {
  color: var(--pe-text-muted);
  text-decoration: none;
  font-size: var(--pe-fs-base);
  font-weight: 500;
  padding: var(--pe-sp-2) var(--pe-sp-3);
  border-radius: var(--pe-radius-sm);
  transition: color var(--pe-transition), background var(--pe-transition);
}

.pe-nav-link:hover {
  color: var(--pe-text);
  background: var(--pe-surface);
}

.pe-nav-link.active {
  color: var(--pe-accent);
  background: rgba(212,175,55,.1);
}

/* === Hero === */
.pe-hero {
  text-align: center;
  padding: var(--pe-sp-8) var(--pe-sp-4) var(--pe-sp-5);
}

.pe-hero h1 {
  font-size: var(--pe-fs-3xl);
  color: var(--pe-accent-bright);
  text-shadow: 0 2px 12px rgba(212,175,55,.15);
  letter-spacing: -0.025em;
  font-weight: 700;
}

.pe-hero .subtitle {
  color: var(--pe-text-muted);
  font-size: var(--pe-fs-md);
  margin-top: var(--pe-sp-2);
}

/* === Section cards === */
.pe-section {
  background: var(--pe-surface);
  border-radius: var(--pe-radius-lg);
  padding: var(--pe-sp-5);
  margin-bottom: var(--pe-sp-4);
  box-shadow: var(--pe-shadow);
  border: 1px solid var(--pe-border);
}

.pe-section h2 {
  color: var(--pe-accent);
  font-size: var(--pe-fs-lg);
  margin-bottom: var(--pe-sp-3);
  padding-bottom: var(--pe-sp-2);
  border-bottom: 1px solid var(--pe-border);
  font-weight: 600;
}

.pe-section p {
  color: var(--pe-text-muted);
  line-height: 1.7;
  margin-bottom: var(--pe-sp-2);
}

.pe-section p strong { color: var(--pe-text); }
.pe-section ul { padding-left: var(--pe-sp-5); color: var(--pe-text-muted); line-height: 1.8; }
.pe-section ul li { margin-bottom: var(--pe-sp-1); }
.pe-section ul li strong { color: var(--pe-text); }

/* === Tier badges === */
.pe-tier-badge,
.tier-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--pe-radius-sm);
  font-weight: 700;
  font-size: var(--pe-fs-xs);
  color: #fff;
  letter-spacing: 0.5px;
}

/* === Tier table === */
.tier-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--pe-sp-3) 0;
  font-size: var(--pe-fs-base);
}

.tier-table th {
  background: var(--pe-bg-elevated);
  color: var(--pe-accent);
  padding: var(--pe-sp-3);
  text-align: left;
  border-bottom: 2px solid var(--pe-accent-dim);
  font-weight: 600;
}

.tier-table td {
  padding: var(--pe-sp-3);
  border-bottom: 1px solid var(--pe-border);
  color: var(--pe-text-muted);
}

.tier-table tr:hover { background: rgba(212,175,55,.04); }

/* === Buttons === */
.pe-btn {
  display: inline-block;
  padding: var(--pe-sp-2) var(--pe-sp-5);
  border-radius: var(--pe-radius);
  border: 1px solid var(--pe-border-strong);
  background: var(--pe-surface);
  color: var(--pe-text);
  font-family: var(--pe-font-ui);
  font-size: var(--pe-fs-base);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--pe-transition);
}
.pe-btn:hover { background: var(--pe-surface-hover); border-color: var(--pe-accent-dim); }
.pe-btn-primary {
  background: linear-gradient(135deg, var(--pe-accent), var(--pe-accent-bright));
  color: #000;
  border-color: var(--pe-accent);
  font-weight: 700;
}
.pe-btn-primary:hover { transform: scale(1.02); }

/* === Footer === */
.pe-footer {
  text-align: center;
  color: var(--pe-text-dim);
  font-size: var(--pe-fs-sm);
  margin-top: var(--pe-sp-6);
  padding: var(--pe-sp-4) var(--pe-sp-4) var(--pe-sp-8);
}

/* === Mono numerics === */
.mono, code, .grid-val, .grid-hand, td.numeric {
  font-family: var(--pe-font-mono);
  font-variant-numeric: tabular-nums;
}

/* === Print === */
@media print {
  .pe-nav, .print-btn, .install-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .pe-section { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* === Mobile === */
@media (max-width: 640px) {
  .pe-container { padding: var(--pe-sp-2); }
  .pe-section { padding: var(--pe-sp-3); }
  .pe-nav-links { gap: var(--pe-sp-1); }
  .pe-nav-link { padding: var(--pe-sp-1) var(--pe-sp-2); font-size: var(--pe-fs-sm); }
  .pe-nav-brand-text { font-size: var(--pe-fs-md); }
  .pe-hero h1 { font-size: var(--pe-fs-2xl); }
}

/* === Build-003: Mobile-first grid + bottom sheet === */

/* Segmented opponent buttons */
.opp-buttons {
  display: inline-flex;
  gap: 2px;
  background: var(--pe-bg-elevated);
  border: 1px solid var(--pe-border);
  border-radius: var(--pe-radius);
  padding: 2px;
}
.opp-btn {
  background: transparent;
  color: var(--pe-text-muted);
  border: none;
  padding: var(--pe-sp-1) var(--pe-sp-3);
  font-family: var(--pe-font-mono);
  font-size: var(--pe-fs-sm);
  font-weight: 600;
  cursor: pointer;
  border-radius: calc(var(--pe-radius) - 2px);
  transition: all 0.15s ease;
  min-width: 32px;
}
.opp-btn:hover { color: var(--pe-text); }
.opp-btn.active {
  background: var(--pe-accent);
  color: var(--pe-bg);
  font-weight: 700;
}

/* Mobile grid: compact cells, no scroll */
@media (max-width: 480px) {
  .grid-table { font-size: 10px; }
  .grid-table th { font-size: 9px; padding: 1px; }
  .grid-table td { width: min(7vw, 36px); height: min(7vw, 36px); padding: 0; }
  .grid-cell { padding: 1px; text-align: center; }
  .grid-hand { font-size: 9px; display: block; }
  .grid-vs1 { font-size: 8px; display: block; opacity: 0.7; }
  .opp-control { flex-direction: column; gap: var(--pe-sp-2); }
  .opp-buttons { flex-wrap: wrap; justify-content: center; }
  .opp-btn { min-width: 36px; padding: 6px 10px; font-size: var(--pe-fs-md); }
}

/* Bottom sheet (detail panel) */
.detail-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--pe-surface);
  border-top: 2px solid var(--pe-accent);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  padding: var(--pe-sp-4);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1000;
}
.detail-panel.show { transform: translateY(0); }

.detail-sheet-inner { position: relative; }
.detail-sheet-handle {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--pe-border);
  border-radius: 2px;
}
.detail-close {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: var(--pe-text-muted);
  font-size: var(--pe-fs-xl);
  cursor: pointer;
  padding: 4px 8px;
}
.detail-close:hover { color: var(--pe-text); }
.detail-grade {
  margin-top: var(--pe-sp-3);
  padding: var(--pe-sp-2) var(--pe-sp-3);
  background: var(--pe-bg-elevated);
  border-left: 3px solid var(--pe-accent);
  border-radius: 4px;
  font-size: var(--pe-fs-sm);
  color: var(--pe-text-muted);
}

/* Desktop: detail panel as side card */
@media (min-width: 769px) {
  .detail-panel {
    position: static;
    transform: none;
    transition: opacity 0.2s;
    max-height: none;
    border: 1px solid var(--pe-border);
    border-radius: var(--pe-radius);
    box-shadow: var(--pe-shadow);
    opacity: 0;
    pointer-events: none;
  }
  .detail-panel.show { opacity: 1; pointer-events: auto; }
  .detail-sheet-handle, .detail-close { display: none; }
}

/* Backdrop for mobile bottom sheet */
.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 999;
}
.detail-backdrop.show { opacity: 1; pointer-events: auto; }

/* Nav auth slot — build-211 */
.pe-nav { justify-content: space-between; }
.pe-nav-auth { display: flex; gap: 0.5rem; align-items: center; margin-left: auto; }
@media (max-width: 600px) {
  .pe-nav-auth .pe-nav-link { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
}
