/**
 * Playing Card Styles
 *
 * Base styles for poker playing cards.
 * Feature-specific card sizing overrides remain in page CSS files.
 *
 * Uses CSS variables from variables.css:
 * --card-width, --card-height, --card-font (base)
 * --card-ref-width, --card-ref-height, --card-ref-font (canonical for scaling)
 * --card-sm-*, --card-md-*, --card-lg-* (size tiers)
 */

/* Base Playing Card */
.playing-card {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.3em;
    padding: 0.2em;
    font-weight: bold;
    width: var(--card-width);
    height: var(--card-height);
    box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: var(--card-font);
}

.card-rank {
    font-size: 1.4em;
    line-height: 1;
    text-align: center;
    font-weight: 800;
    /* line-height:1 still reserves the font's full ascender space above the
       rank's cap-height, and the suit SVGs carry a little slack of their own
       inside the viewBox, so a naively centered rank+suit pair sits off the
       card's true center. This margin cancels the difference.
       Measured, not guessed: rank ink from a canvas raster scan of the actual
       glyph, baseline from a zero-height inline probe, suit ink from the root
       svg getBBox() (must be the root -- spade and club put part of their ink
       in a sibling polygon, so measuring only the <path> reads short and
       inflates the bottom gap). At -0.06em the ink midpoint lands within
       ~0.3px of the card center on all four size tiers and on the card-picker
       variants that shrink the suit to 1.2/1.3em. Re-measure the same way if
       the rank or suit font-size changes. */
    margin-top: -0.06em;
}

.card-suit {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    line-height: 1;
    margin-top: 1px;
}

.card-suit svg {
    display: block;
    width: 0.85em;
    height: 0.85em;
}

/* ---------------------------------------------------------------------
   Classic variant (.card-classic)
   ---------------------------------------------------------------------
   Real-card look: a small rank+suit index in the TOP-LEFT corner plus one
   large suit pip in the centre. Markup differs from the base card -- it
   needs a .card-corner wrapper (rank + mini suit) and a .card-pip (large
   centre suit):

     <span class="playing-card red card-classic">
       <span class="card-corner">
         <span class="card-rank">2</span>
         <span class="card-suit">{suit svg}</span>
       </span>
       <span class="card-pip">{suit svg}</span>
     </span>

   Because the identity sits in the small top-left corner, a fan can overlap
   even tighter than the left-index variant while every card stays readable,
   and a fully visible card still reads as a normal playing card.

   Honors --card-width / --card-font; no new sizes. Experimental: previewed
   in the design system only, not wired into any feature.
   --------------------------------------------------------------------- */
.playing-card.card-classic {
    position: relative;
    justify-content: flex-end;   /* drop the pip to the bottom... */
    align-items: flex-end;       /* ...and into the bottom-right corner */
    padding: 0 0.14em 0.14em 0;
}

.card-classic .card-corner {
    position: absolute;
    top: 0.16em;
    left: 0.18em;
    display: flex;
    flex-direction: column;
    align-items: flex-start;   /* rank and mini suit both flush to the left edge,
                                   not centered relative to each other's width */
    line-height: 1;
    gap: 0.04em;
}

.card-classic .card-corner .card-rank {
    font-size: 0.82em;
    line-height: 0.8;
    letter-spacing: -0.05em;
    /* Reset the base .card-rank ascender-correction margin -- that fix targets
       the big centered rank+suit pair on a normal card. The corner index is
       absolutely positioned via .card-corner's own `top`, so the inherited
       negative margin was pulling it up past the card edge instead. */
    margin-top: 0;
}

/* Reset the base .card-suit 1.3em so the mini corner suit is sized off the
   card font, not the inflated suit font -- otherwise the index reads oversized. */
.card-classic .card-corner .card-suit {
    font-size: 1em;
    margin-top: 0.06em;
}

.card-classic .card-corner .card-suit svg {
    width: 0.68em;
    height: 0.68em;
}

.card-classic .card-pip {
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-classic .card-pip svg {
    display: block;
    width: 1.55em;
    height: 1.55em;
}

/* Card colors */
.playing-card.red {
    color: var(--suit-red);
}

.playing-card.black {
    color: var(--suit-black);
}

/* Transform-scaled card wrapper - renders at canonical size, scales to target */
.card-scaled {
    display: inline-block;
    transform-origin: top left;
    vertical-align: top;
}

.card-scaled .playing-card {
    width: var(--card-ref-width);
    height: var(--card-ref-height);
    font-size: var(--card-ref-font);
}

/* Cards section container */
.cards-section {
    margin-bottom: 15px;
}

/* Street Row Layout (Preflop, Flop, Turn, River) */
.street-row {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--street-bg);
    border-radius: 6px;
    gap: 8px;
}

.street-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--label-street);
}

.street-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.street-cards {
    display: flex;
    gap: 4px;
}

.street-action {
    flex: 1;
    font-size: 0.85rem;
    color: white;
    line-height: 1.5;
}

.street-pot {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
    padding: 6px 8px;
    border-radius: 4px;
}
