/* infobox shortcode (layouts/shortcodes/infobox.html) styling for the "stack" and "cards"
   variants. The "table" variant was tried and rejected - no real post uses it, no CSS here.
   See README.md's Infobox section for the schema and usage.

   Per-platform colors are --ib-* custom properties set once per platform class and consumed
   generically via var(--ib-*) below, inherited to descendants automatically. */
.infobox.htb-table{
     --ib-bg:#121725; --ib-bg-alt:#0c111d; --ib-accent:#9fef00; --ib-accent-border:#9fef00; --ib-text:#e8ecf2;
}
.infobox.thm-table{
     --ib-bg:#212c42; --ib-bg-alt:#151c2b; --ib-accent:#a3ea2a; --ib-accent-border:#a3ea2a; --ib-text:#f9f9fb; --ib-title:var(--ib-text); --ib-label:#b5c2d8;
}
.infobox.csl-table{
     --ib-bg:#1a1a1a; --ib-bg-alt:#111; --ib-accent:#f2c230; --ib-accent-border:#f2c230; --ib-text:#eee;
}

.infobox{ margin:16px auto; max-width:100%; width:fit-content; background:var(--ib-bg); color:var(--ib-text); font-size:13px; }
/* space-between splits the header into two groups: boxIcon+title at the start
   (.infobox-title-group - its own nested flex so those two stay adjacent to each other), os
   pinned to the far right. With no os it's just the one group, unaffected. */
.infobox-stack-header, .infobox-cards-header{ position:relative; display:flex; align-items:center; justify-content:space-between; gap:8px; background:var(--ib-bg-alt); color:var(--ib-title, var(--ib-accent)); padding:8px 12px; font-family:var(--mono); font-weight:700; text-transform:uppercase; font-size:12px; letter-spacing:.04em; }
.infobox-title-group{ display:flex; align-items:center; gap:8px; }
/* Solid full-width line (not the sidebar's .card + .card::before faded-edge technique - that
   one's color stop is centered at 50% for a symmetric fade; this one's was pinned at 0%, so
   it was bright at the left edge and faded away completely before reaching the right edge
   instead of spanning the full width), using each platform's own --ib-accent-border so
   htb/thm/csl each get their own accent color instead of sharing one border color. */
.infobox-stack-header::after, .infobox-cards-header::after{ content:""; position:absolute; left:0px; right:0px; bottom:0; height:1px; background:var(--ib-accent-border); }
.infobox-stack-header a, .infobox-cards-header a{ color:inherit; }
.infobox-box-icon{ width:20px; height:20px; flex-shrink:0; }
/* .article-content prefix needed for specificity: pages/single.css's .article-content
   a{text-decoration:underline} ties with a bare .infobox a here and loads after it. */
.article-content .infobox a{ text-decoration:none; }

/* stack: one column, full-width fields - most mobile-robust, a chart gets the whole width. */
.infobox--stack{ width:100%; max-width:420px; }
.infobox-row{ display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 12px; }
.infobox-label{ flex-shrink:0; }
.infobox-value{ text-align:right; }
.infobox-row--chart{ flex-direction:column; align-items:stretch; }
.infobox-row--chart .infobox-value{ text-align:left; padding-left:1em; padding-right:1em; }
/* Only a makers row ever puts a link in .infobox-value/.infobox-stat-value, so this safely
   targets just the maker's name - bold/accent-colored, name-only (no badge, see README.md). */
.infobox-value a, .infobox-stat-value a{ color:var(--ib-accent); font-weight:600; }
/* A blood badge's name can be a link too (infobox-row-value's optional .link) - higher
   specificity than the rule above so it wins: inherit the badge's own dark text color instead
   of accent-green, which would clash against these badges' blue/red backgrounds. Bold instead
   of underlined - the diff-badge's own pill already reads as an interactive-looking element. */
.infobox-value .diff-badge a, .infobox-stat-value .diff-badge a{ color:inherit; font-weight:700; text-decoration:none; }
/* topRow (stack variant only) - up to 3 fields across the top of the box as a
   label-above/value-below grid (reusing cards' own .infobox-stat cell, below) instead of each
   one being its own full-width row. Cell count is whatever topRow's own length is - 3 is the
   expected case, the grid just reflows for fewer. No border/gap between cells - see the
   no-internal-borders note below .infobox-stat. */
.infobox-toprow{ display:grid; grid-template-columns:repeat(3, 1fr); }
.infobox-toprow .infobox-stat{ padding:8px 10px; }
/* Top-level `os` field, header only (infobox.html's infobox-title) - pinned to the header's
   far right by .infobox-stack-header's own space-between, so no margin needed here. Name first,
   icon after (matches how a plain row shows value-then-icon); the reused .infobox-value class
   needs its own reset here since inside the header it would otherwise inherit that bar's own
   bold/uppercase/accent styling instead of reading like a normal row value. */
.infobox-os{ display:inline-flex; align-items:center; gap:4px; }
.infobox-os .infobox-value{ color:var(--ib-text); font-weight:400; text-transform:none; letter-spacing:normal; }
.infobox-os-icon{ height:14px; flex-shrink:0; }

/* cards: every field, Maker included, in a fixed 2-column stat grid. */
.infobox--cards{ width:100%; max-width:480px; }
.infobox-grid{ display:grid; grid-template-columns:repeat(2, 1fr); }
/* No border/gap between rows, cells, or the chart - every internal divider (border-bottom on
   .infobox-row, the grid-gap-as-border trick here and in .infobox-toprow, .infobox-chart's own
   border-top) was removed per request; only padding separates one field from the next now. */
.infobox-stat{ background:var(--ib-bg); padding:10px 12px; display:flex; flex-direction:column; gap:4px; }
/* An odd field count leaves the last item alone in the final row. :last-child:nth-child(odd)
   is pure position - that item spans both columns as a label-left/value-right row instead of
   leaving an empty cell beside it. Never triggers on an even count. Scoped to .infobox-grid
   specifically (cards' fixed 2-col grid) - .infobox-stat is reused by .infobox-toprow (stack's
   own, up-to-3-col grid) too, where this same rule would wrongly fire on a 3-item row (3 is
   odd) and yank the last cell out of the grid entirely. */
.infobox-grid .infobox-stat:last-child:nth-child(odd){ grid-column:1 / -1; flex-direction:row; justify-content:space-between; align-items:center; gap:12px; }
/* Classic row and stat labels use the platform accent unless it supplies a separate label color. */
.infobox-label, .infobox-stat-label{ font-family:var(--mono); font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--ib-label, var(--ib-accent)); }
.infobox-stat-value{ color:var(--ib-text); }
.infobox-chart{ padding:10px 12px; }
.infobox-chart .infobox-stat-label{ display:block; margin-bottom:6px; }

/* Matches the platform's own box instead of the default light .chart-container card, for a
   chart embedded via infobox's chart:htb/thm/csl fence variant (render-codeblock.html). Height
   is cut down from the global .chart-container default (320px, showcase-shortcodes.css) - with
   the legend/axis labels stripped out (radar_chart/bar_chart in fetch_machine_info.py), a chart
   embedded in the stack variant doesn't need that much vertical room and was making the whole
   box read as one long column. Scoped to these three classes only, so every other post's own
   chart fences (showcase/reference posts) keep the default size. */
.chart-container.chart-container--htb, .chart-container.chart-container--thm, .chart-container.chart-container--csl{
     background:var(--ib-bg-alt);
     border:none;
     height:180px;
}

/* Refined stack layout, used by default on Hack The Box. */
.infobox--refined{
     --ib-muted:color-mix(in srgb, var(--ib-text) 76%, var(--ib-bg));
     --ib-inset:clamp(12px, 4vw, 20px);
     max-width:500px;
     font:400 14px/1.5 var(--font);
     overflow-wrap:anywhere;
}
.infobox--refined .infobox-stack-header{
     flex-wrap:wrap;
     padding:14px var(--ib-inset);
     font:700 20px/1.25 var(--font);
     text-transform:none;
     letter-spacing:normal;
}
.infobox--refined .infobox-stack-header::after{ content:none; }
.infobox--refined .infobox-title-group{ min-width:0; }
.infobox--refined .infobox-box-icon{ width:28px; height:28px; object-fit:contain; }
.infobox--refined .infobox-os{ font-size:14px; }
.infobox--refined .infobox-label,
.infobox--refined .infobox-stat-label{
     color:var(--ib-muted);
     font:500 13px/1.4 var(--font);
     text-transform:none;
     letter-spacing:normal;
}
.infobox--refined .infobox-toprow{
     grid-template-columns:none;
     grid-template-rows:auto auto;
     grid-auto-flow:column;
     grid-auto-columns:minmax(0, 1fr);
     gap:8px;
     padding:12px var(--ib-inset);
     background:color-mix(in srgb, var(--ib-bg) 95%, var(--ib-text));
}
.infobox--refined .infobox-toprow .infobox-stat{
     display:grid;
     grid-row:span 2;
     grid-template-rows:subgrid;
     row-gap:4px;
     background:none;
     padding:0;
}
.infobox--refined .infobox-toprow .infobox-stat-label{ align-self:end; }
.infobox--refined .infobox-stat-value{ font-weight:600; font-variant-numeric:tabular-nums; }
.infobox--refined .infobox-row{
     display:grid;
     grid-template-columns:minmax(0, 2fr) minmax(0, 3fr);
     align-items:start;
     padding:8px var(--ib-inset);
}
.infobox--refined .infobox-row:not(.infobox-row--chart) > .infobox-label{ padding-top:2px; }
.infobox--refined .infobox-row > .infobox-value{ text-align:left; }
.infobox--refined .diff-badge{
     display:inline-block;
     max-width:100%;
     padding:2px 7px;
     font-size:inherit;
}
.infobox--refined .diff-badge.blood-user{ --ib-blood:#83cce2; }
.infobox--refined .diff-badge.blood-root{ --ib-blood:#ff9494; }
.infobox--refined .diff-badge:is(.blood-user, .blood-root){
     background:color-mix(in srgb, var(--ib-blood) 12%, var(--ib-bg));
     color:var(--ib-blood);
     font-size:13px;
}
.infobox--refined .infobox-blood-time{
     display:inline-block;
     max-width:100%;
     color:var(--ib-muted);
     font-weight:400;
     font-variant-numeric:tabular-nums;
}
.article-content .infobox--refined :is(.infobox-value, .infobox-stat-value) a{ text-decoration:none; }
.article-content .infobox--refined a:focus-visible{ outline:2px solid currentColor; outline-offset:2px; }
.infobox--refined .infobox-row--chart{
     grid-template-columns:minmax(0, 1fr);
     gap:4px;
     padding-block:12px;
     background:var(--ib-bg-alt);
}
.infobox--refined .infobox-row--chart .infobox-label{ color:var(--ib-text); font-weight:600; }
.infobox--refined .infobox-row--chart .infobox-value{ padding:0; }
.infobox--refined .infobox-row--chart .chart-container{
     background:transparent;
     margin:0;
     padding:4px 0 0;
}

@media(max-width:768px){
     .infobox--refined .infobox-row--chart .chart-container{
          width:85%;
          height:153px;
          margin-inline:auto;
          overflow:clip;
     }
}

@media(max-width:360px){
     .infobox--refined .infobox-toprow{ column-gap:4px; }
     .infobox--refined .infobox-stat-value{ font-size:13px; }
}
