/* Powerlifting-specific styles */
:root {
    --pl-red: #E52E00;
    --pl-red-light: rgba(229, 46, 0, 0.1);
    --pl-gold: #D4A017;
    --pl-gold-light: rgba(212, 160, 23, 0.1);
    --pl-green: #2E8B57;
    --pl-green-light: rgba(46, 139, 87, 0.1);
    --text-meta: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
    :root {
        --pl-red: #FF451A;
        --pl-red-light: rgba(255, 69, 26, 0.12);
        --pl-gold: #F0C040;
        --pl-gold-light: rgba(240, 192, 64, 0.1);
        --pl-green: #4ADE80;
        --pl-green-light: rgba(74, 222, 128, 0.1);
        --text-meta: var(--text-secondary);
    }
}

[data-theme="dark"] {
    --pl-red: #FF451A;
    --pl-red-light: rgba(255, 69, 26, 0.12);
    --pl-gold: #F0C040;
    --pl-gold-light: rgba(240, 192, 64, 0.1);
    --pl-green: #4ADE80;
    --pl-green-light: rgba(74, 222, 128, 0.1);
    --text-meta: var(--text-secondary);
}

[data-theme="light"] {
    --pl-red: #E52E00;
    --pl-red-light: rgba(229, 46, 0, 0.1);
    --pl-gold: #D4A017;
    --pl-gold-light: rgba(212, 160, 23, 0.1);
    --pl-green: #2E8B57;
    --pl-green-light: rgba(46, 139, 87, 0.1);
    --text-meta: var(--text-secondary);
}

/* Reset global style conflicts */
.pl-back,
.pl-instagram,
.pl-coach-handle,
.pl-badge,
.card-link,
.pl-gallery img,
.pl-attempts,
.pl-attempts *,
.pl-stat,
.pl-injury-item,
.pl-comp-card,
.pl-phase,
.pl-phase-body,
.pl-coach {
    border-bottom: none;
}
.pl-back:hover,
.pl-instagram:hover,
.pl-coach-handle:hover {
    border-bottom: none;
}

.powerlifting-shell {
    width: min(1040px, calc(100% - 40px));
    margin: 0 auto;
    padding: 48px 0 72px;
}

/* Back link */
.pl-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-meta);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: color 0.2s;
}
.pl-back:hover { color: var(--accent); }

/* Hero */
.pl-hero {
    padding: 2.5rem 0 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}
.pl-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 2rem;
    align-items: center;
}
.pl-hero-copy {
    min-width: 0;
}
.pl-hero h1 {
    font-size: 2.8rem;
    letter-spacing: -0.03em;
    margin: 0 0 0.3rem;
}
.pl-hero .pl-tagline {
    color: var(--text-meta);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}
.pl-hero .pl-instagram {
    color: var(--pl-red);
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
}
.pl-hero .pl-instagram:hover { text-decoration: underline; }
.pl-hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.4rem;
}
.pl-site-link,
.pl-secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.4rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    text-decoration: none;
    border-bottom: none;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.pl-site-link {
    background: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
}
.pl-secondary-link {
    color: var(--pl-red);
    border: 1px solid var(--pl-red);
    background: var(--pl-red-light);
}
.pl-site-link:hover,
.pl-secondary-link:hover {
    transform: translateY(-1px);
    border-bottom: none;
}
.pl-hero-media {
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.14);
}
.pl-hero-media img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: center;
}

/* Stats row */
.pl-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 3rem;
}
.pl-stat {
    background: var(--pl-red-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.2rem 1rem;
    text-align: center;
}
.pl-stat .pl-stat-value {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--pl-red);
    line-height: 1.1;
}
.pl-stat .pl-stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-meta);
    margin-top: 0.3rem;
    font-family: 'IBM Plex Mono', monospace;
}

/* Competition Card */
.pl-comp-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.8rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}
.pl-comp-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--pl-red), var(--pl-gold));
}
.pl-comp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}
.pl-comp-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    margin-top: 0;
}
.pl-comp-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-meta);
}
.pl-comp-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.pl-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.03em;
}
.pl-badge-ipf {
    background: var(--pl-gold-light);
    color: var(--pl-gold);
    border: 1px solid var(--pl-gold);
}
.pl-badge-whites {
    background: var(--pl-green-light);
    color: var(--pl-green);
    border: 1px solid var(--pl-green);
}
.pl-badge-raw {
    background: var(--pl-red-light);
    color: var(--pl-red);
    border: 1px solid var(--pl-red);
}

/* Attempt table */
.pl-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.pl-attempts {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.pl-attempts th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-meta);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.pl-attempts td {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.pl-attempts tr:last-child td { border-bottom: none; }
.pl-attempts .pl-lift-name {
    color: var(--accent);
    font-weight: 600;
}
.pl-attempts .pl-pr {
    color: var(--pl-gold);
    font-weight: 600;
}
.pl-attempts .pl-attempt-good::after {
    content: ' ✓';
    color: var(--pl-green);
}

/* Score row */
.pl-scores {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}
.pl-score-item {
    text-align: center;
}
.pl-score-val {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 1rem;
}
.pl-score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-meta);
    font-family: 'IBM Plex Mono', monospace;
}

/* Section titles — override global h2 border */
.pl-section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    margin-top: 0;
    letter-spacing: -0.02em;
    border-bottom: none;
    display: block;
    padding-bottom: 0;
}
.pl-chart-container {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 3rem;
}
.pl-chart {
    width: 100%;
    height: 300px;
    position: relative;
}
.pl-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Journey Timeline */
.pl-timeline {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 3rem;
}
.pl-timeline::before {
    content: '';
    position: absolute;
    left: 0.45rem;
    top: 0.3rem;
    bottom: 0.3rem;
    width: 2px;
    background: var(--border);
}
.pl-phase {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 1rem;
}
.pl-phase::before {
    content: '';
    position: absolute;
    left: -1.55rem;
    top: 0.35rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--pl-red);
    border: 2px solid var(--bg);
}
.pl-phase-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}
.pl-phase-time {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-meta);
    margin-bottom: 0.5rem;
}
.pl-phase-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-meta);
}
.pl-phase-body strong {
    color: var(--text);
}
.pl-phase.highlight::before {
    background: var(--pl-gold);
    box-shadow: 0 0 0 3px var(--pl-gold-light);
}

/* Injury section */
.pl-injuries {
    margin-bottom: 3rem;
}
.pl-injury-grid {
    display: grid;
    gap: 0.8rem;
}
.pl-injury-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    margin-left: 0;
    margin-bottom: 0;
}
.pl-injury-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pl-injury-dot.resolved { background: var(--pl-green); }
.pl-injury-dot.managed { background: var(--pl-gold); }
.pl-injury-dot.resolving { background: var(--pl-red); }
.pl-injury-name {
    font-weight: 600;
    flex: 1;
}
.pl-injury-status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-meta);
}

/* Coach */
.pl-coach {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.pl-coach-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-meta);
}
.pl-coach-name {
    font-weight: 600;
    font-size: 1.1rem;
}
.pl-coach-handle {
    color: var(--pl-red);
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
}
.pl-coach-handle:hover { text-decoration: underline; }

/* Gallery */
.pl-gallery {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.8rem;
    margin-bottom: 3rem;
}
.pl-gallery figure {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
}
.pl-gallery figure:nth-child(1),
.pl-gallery figure:nth-child(4) {
    grid-column: span 6;
}
.pl-gallery figure:nth-child(2),
.pl-gallery figure:nth-child(3),
.pl-gallery figure:nth-child(5),
.pl-gallery figure:nth-child(6) {
    grid-column: span 3;
}
.pl-gallery img {
    width: 100%;
    cursor: zoom-in;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 4 / 3;
}
.pl-gallery img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.pl-gallery figcaption {
    padding: 0.75rem 0.9rem;
    color: var(--text-meta);
    font-size: 0.82rem;
    line-height: 1.45;
}

/* Responsive */
@media (max-width: 820px) {
    .pl-hero-inner {
        grid-template-columns: 1fr;
    }
    .pl-hero h1 {
        font-size: 2.35rem;
    }
    .pl-gallery figure,
    .pl-gallery figure:nth-child(1),
    .pl-gallery figure:nth-child(2),
    .pl-gallery figure:nth-child(3),
    .pl-gallery figure:nth-child(4),
    .pl-gallery figure:nth-child(5),
    .pl-gallery figure:nth-child(6) {
        grid-column: span 6;
    }
}
@media (max-width: 600px) {
    .powerlifting-shell {
        width: min(100% - 28px, 1040px);
        padding-top: 28px;
    }
    .pl-stats { grid-template-columns: repeat(2, 1fr); }
    .pl-scores { grid-template-columns: repeat(2, 1fr); }
    .pl-hero h1 { font-size: 2rem; }
    .pl-comp-header { flex-direction: column; gap: 0.5rem; }
    .pl-comp-card { padding: 1.2rem; }
    .pl-gallery {
        grid-template-columns: 1fr;
    }
    .pl-gallery figure,
    .pl-gallery figure:nth-child(1),
    .pl-gallery figure:nth-child(2),
    .pl-gallery figure:nth-child(3),
    .pl-gallery figure:nth-child(4),
    .pl-gallery figure:nth-child(5),
    .pl-gallery figure:nth-child(6) {
        grid-column: span 1;
    }
}
