/* Blueprint trading card (D25), shared by every page that shows one:
   the home card stack (homyles.css) and the About page profile card popover (aboutyles.css).
   Moved here from homyles.css in task 2.1, unchanged except the two additions
   marked "2.1" (.card-holder and the data-label footer labels).

   USING THE CARD: put it inside a .card-holder (or any element with
   container-type: inline-size that is exactly the card's width). See .card-holder below for why */

/* 2.1: the card's wrapper. Inside the card, cqi measures the CARD (the card is a container).
   But the card's OWN styles (its inset border rings and grid background) measure the
   nearest ANCESTOR container. Without one, cqi falls back to the viewport width and the
   border rings turn ~30px thick on a desktop. The home stack (.card-stack) already is
   such a container; any other page wraps the card in this */
.card-holder {
  container-type: inline-size;
}

/* =========================================================
   BLUEPRINT CARD: a CAD drawing sheet as a trading card.
   - 63:88 is the standard trading-card ratio
   - container-type makes the card a container, so cqi (1% of the card's
     width) scales every font and gap: the card looks the same at any size
   - palette colours only (pine, --color-blueprint*), chosen per theme by --card-paper below.
     The linework is the same pale ink on both: 6.9:1 on pine, 9.1:1 on blue
   - each part is placed with position: absolute and % of the card, like a print layout
   ========================================================= */
.bp-card {
  /* The card's paper colour, set in ONE place (owner's pick, D25): pine like the footer by day,
     blueprint blue at night. light-dark() follows color-scheme, so the night theme
     (Lantern, which forces "dark") gets the blue */
  --card-paper: light-dark(var(--color-pine), var(--color-blueprint));
  container-type: inline-size;
  position: relative;
  display: block;
  aspect-ratio: 63 / 88;
  border-radius: 2.5%;
  color: var(--color-blueprint-ink);
  font-family: var(--font-mono);
  text-decoration: none;
  /* Two thin line grids (horizontal + vertical) over the blueprint blue */
  background:
    linear-gradient(rgb(255 255 255 / 0.09) 1px, transparent 1px) 0 0 / 5cqi 5cqi,
    linear-gradient(90deg, rgb(255 255 255 / 0.09) 1px, transparent 1px) 0 0 / 5cqi 5cqi,
    var(--card-paper);
  /* Inset shadows draw the border: a solid line, a paper-coloured gap, then a faint inner line */
  box-shadow:
    0 0 0 0.5cqi var(--color-blueprint-ink) inset,
    0 0 0 2.2cqi var(--card-paper) inset,
    0 0 0 2.6cqi rgb(234 242 255 / 0.6) inset,
    0 10px 26px rgb(0 0 0 / 0.3);
  transition: transform var(--speed) ease;
}

.bp-card:hover {
  transform: translateY(-4px);
}

/* Same fix as the hero buttons: keep the card's own colour and show a ring */
.bp-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  color: var(--color-blueprint-ink);
  text-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .bp-card {
    transition: none;
  }
}

.bp-card > * {
  position: absolute;
  left: 5%;
  right: 5%;
}

/* Title bar: tool | name | card number */
.card-top {
  top: 3.5%;
  height: 9%;
  display: flex;
  align-items: center;
  gap: 3cqi;
  padding: 0 3cqi;
  border-bottom: 0.4cqi solid var(--color-blueprint-ink);
}

.card-name {
  flex: 1;
  overflow: hidden;
  font-size: 4.8cqi;
  font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-align: center;
  text-overflow: ellipsis;             /* a very long name ends in "…" instead of breaking the bar */
  text-transform: uppercase;
  white-space: nowrap;
}

.card-tool,
.card-number {
  padding: 0.5cqi 1.2cqi;
  border: 0.3cqi solid var(--color-blueprint-ink);
  font-size: max(0.5rem, 3.2cqi);
  font-weight: 700;
}

/* Art window: dashed frame and two corner crop marks, like a drawing's viewport */
.card-art {
  top: 13.5%;
  height: 46%;
  overflow: hidden;
  outline: 0.3cqi dashed rgb(234 242 255 / 0.5);
  outline-offset: -2cqi;
}

.card-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4cqi 4cqi 4cqi 20cqi;       /* the left padding leaves room for the stat column */
}

.card-art::before,
.card-art::after {
  content: "";
  position: absolute;
  width: 6cqi;
  height: 6cqi;
  border: 0.5cqi solid var(--color-blueprint-ink);
}

.card-art::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.card-art::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* Stat column down the left of the art */
.card-stats {
  position: absolute;
  top: 6%;
  bottom: 6%;
  left: 0;
  width: 17cqi;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  border-right: 0.3cqi solid rgb(234 242 255 / 0.6);
}

.card-stat {
  display: grid;
  justify-items: center;
  line-height: 1;
}

.card-icon { font-size: 5cqi; }
.card-stat b { font-size: 4.6cqi; }
.card-stat small {
  font-size: max(0.4375rem, 2.5cqi);
  letter-spacing: 0.05em;
  opacity: 0.85;
  text-transform: uppercase;
}

.card-type {
  top: 59.5%;
  height: 5.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-block: 0.3cqi solid var(--color-blueprint-ink);
  font-size: max(0.5rem, 3cqi);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-text {
  top: 65%;
  height: 22%;
  display: flex;
  flex-direction: column;
  gap: 1.5cqi;
  padding: 2.5cqi 4cqi;
  font-size: max(0.6875rem, 3.4cqi);   /* never below 11px, however small the card (H1) */
  line-height: 1.3;
}

.card-desc { font-family: var(--font-body); }
.card-flavor { font-style: italic; opacity: 0.8; }

/* READABLE ON SMALL CARDS (H1). Everything on the card scales with its width (cqi),
   so on a phone the text shrank to 6–7px. max(floor, scaled) picks whichever is bigger:
   big cards keep their proportions, small ones stop at a readable size.
   Bigger text needs room, so a narrow card drops its flavor line (the description stays).
   20rem = the width where the 11px floor takes over from 3.4cqi */
@container (width < 20rem) {
  .card-flavor { display: none; }
}

/* Footer = an engineering drawing's title block: REV | DIFFICULTY | DATE.
   The small labels come from ::before, so they're decoration, not content */
.card-foot {
  bottom: 3%;
  height: 9%;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  border: 0.4cqi solid var(--color-blueprint-ink);
}

.card-foot > * {
  position: relative;
  display: grid;
  place-items: center;
  padding-top: max(0.5rem, 2.2cqi);   /* room under the small label, even on a small card */
  font-size: 4.4cqi;
  font-weight: 700;
}

.card-foot > * + * {
  border-left: 0.3cqi solid var(--color-blueprint-ink);
}

.card-foot > *::before {
  position: absolute;
  top: 0.6cqi;
  left: 1.2cqi;
  font-size: max(0.4375rem, 1.9cqi);
  font-weight: 400;
  opacity: 0.75;
}

.card-rev::before { content: "REV"; }
.card-difficulty::before { content: "DIFFICULTY"; }
.card-date::before { content: "DATE"; }
/* The foot cells are grids, so the filled stars and the .star-empty span are two grid items:
   grid-auto-flow: column keeps them on one line, justify-content centres the pair */
.card-difficulty { grid-auto-flow: column; justify-content: center; font-size: 3.6cqi; letter-spacing: 0.1em; }
.star-empty { opacity: 0.35; }         /* faint, so 3 stars out of 5 reads as 3, not 5 */

/* 2.1: a card can name its own footer cells, e.g. <span data-label="SINCE">2019</span>.
   attr() reads the attribute into the ::before text. It beats the fixed labels above
   (an attribute selector counts like a class, so this selector is more specific) */
.card-foot > [data-label]::before { content: attr(data-label); }
