/* Forgetful Fish — custom card frame + gallery.
   Our own card layout (title bar + mana pips, art, type bar, rules text box,
   P/T, attribution footer); not a copy of the published card images. */

.ff-cards { width: 100%; }

.ff-cards__header {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 0.4rem;
}

.ff-cards__title {
	margin: 0;
	font-size: clamp(1.4rem, 3vw, 1.9rem);
}

.ff-cards__back {
	margin-left: auto;
	font-size: 0.85rem;
	color: var(--dark_blue);
	text-decoration: none;
}
.ff-cards__back:hover { text-decoration: underline; }

.ff-cards__summary {
	margin: 0 0 1rem;
	font-size: 0.9rem;
	color: color-mix(in srgb, var(--default) 55%, transparent);
}

.ff-cards__empty {
	padding: 2.5rem 1.5rem;
	text-align: center;
	color: color-mix(in srgb, var(--default) 55%, transparent);
	border: 1px dashed color-mix(in srgb, var(--default) 25%, transparent);
	border-radius: var(--radius-md);
}

/* Card-style selector (minimalist | retro). */
.ff-cards__styles {
	display: inline-flex;
	gap: 0;
	margin: 0 0 1rem;
	border: 1px solid color-mix(in srgb, var(--default) 30%, transparent);
	border-radius: var(--radius-md);
	overflow: hidden;
}
.ff-style-btn {
	appearance: none;
	border: 0;
	background: none;
	color: var(--default);
	font: inherit;
	font-size: 0.85rem;
	padding: 0.35rem 0.9rem;
	cursor: pointer;
}
.ff-style-btn + .ff-style-btn {
	border-left: 1px solid color-mix(in srgb, var(--default) 30%, transparent);
}
.ff-style-btn:hover { background: color-mix(in srgb, var(--default) 8%, transparent); }
.ff-style-btn.is-active {
	background: var(--dark_blue);
	color: #fff;
}

.ff-card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
	gap: 1rem;
}
.ff-card-grid[hidden] { display: none; }

/* Retro pre-rasterized card image (transparent PNG with its own rounded
   corners). */
.ff-retro-img {
	width: 100%;
	aspect-ratio: 744 / 1045;
	object-fit: contain;
	display: block;
}

/* Pre-rasterized card image (used in the deck/reveal overlay). Carries both a
   light and a dark variant as CSS vars; only the active theme's image loads. */
.ff-card-img {
	width: 100%;
	aspect-ratio: 2.5 / 3.5;
	background-image: var(--ff-card-light);
	background-size: contain;
	background-position: center;
	background-repeat: no-repeat;
	/* The images already have their own rounded corners — an extra
	   border-radius here would clip into them. */
}
html[data-theme="dark"] .ff-card-img { background-image: var(--ff-card-dark); }

/* ── Card frame ───────────────────────────────────────────────────────── */
.ff-card-proxy {
	display: flex;
	flex-direction: column;
	aspect-ratio: 2.5 / 3.5;   /* standard MTG card ratio */
	border-radius: 12px;
	overflow: hidden;
	background: var(--contents);
	color: var(--default);     /* self-contained: don't rely on page body colour */
	border: 1px solid color-mix(in srgb, var(--default) 16%, transparent);
	box-shadow: var(--shadow-md);
	font-size: 0.8rem;
}

/* Title bar / type bar / footer keep their content height; art + text box
   share the rest so the card stays at the fixed ratio. */
.ff-card-proxy__titlebar,
.ff-card-proxy__typebar,
.ff-card-proxy__footer { flex: 0 0 auto; }

/* Colour-coded frames */
.ff-card-proxy--u    { border-color: #2a6fb0; }
.ff-card-proxy--land { border-color: #6f6350; }
.ff-card-proxy--c    { border-color: color-mix(in srgb, var(--default) 30%, transparent); }

.ff-card-proxy__titlebar {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.42rem 0.55rem;
	color: #fff;
}
.ff-card-proxy--u    .ff-card-proxy__titlebar { background: linear-gradient(180deg, #3a82c9, #2a6fb0); }
.ff-card-proxy--land .ff-card-proxy__titlebar { background: linear-gradient(180deg, #847459, #5e5444); }
.ff-card-proxy--c    .ff-card-proxy__titlebar { background: linear-gradient(180deg, #9aa0a6, #7c8186); }

.ff-card-proxy__name {
	flex: 1;
	min-width: 0;
	font-weight: 700;
	font-size: 0.85rem;
	line-height: 1.15;
	white-space: nowrap;   /* JS shrinks the name to keep it on one line */
	overflow: hidden;
}

.ff-card-proxy__cost {
	display: flex;
	gap: 2px;
	flex-shrink: 0;
}

.ff-card-proxy__art {
	width: 100%;
	flex: 0 0 42%;
	min-height: 0;
	object-fit: cover;
	display: block;
	background: #0b1f38;
}
.ff-card-proxy__art--none {
	background: repeating-linear-gradient(135deg,
		color-mix(in srgb, var(--default) 8%, var(--contents)) 0 8px,
		color-mix(in srgb, var(--default) 4%, var(--contents)) 8px 16px);
}

.ff-card-proxy__typebar {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.3rem 0.55rem;
	background: color-mix(in srgb, var(--default) 9%, var(--contents));
	font-size: 0.74rem;
	font-weight: 600;
}
.ff-card-proxy__type { flex: 1; min-width: 0; }

.ff-card-proxy__qty {
	flex-shrink: 0;
	padding: 0.05rem 0.42rem;
	border-radius: 999px;
	background: color-mix(in srgb, var(--default) 14%, transparent);
	font-size: 0.72rem;
	font-variant-numeric: tabular-nums;
}

.ff-card-proxy__textbox {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	padding: 0.5rem 0.6rem 0.65rem;
	background: color-mix(in srgb, var(--default) 3%, var(--contents));
}
/* A basic land whose only text is its '{T}: Add {mana}' reminder — centre it. */
.ff-card-proxy__textbox--center {
	display: flex;
	align-items: center;
	justify-content: center;
}
.ff-card-proxy__textbox--center .ff-card-proxy__text { text-align: center; }

/* JS (forgetful_fish_cards.js) shrinks this font-size to fit text-heavy
   cards into the fixed-ratio frame; this is the starting size. */
.ff-card-proxy__text { font-size: 0.8rem; }

.ff-card-proxy__line {
	margin: 0 0 0.35rem;
	line-height: 1.32;
}
.ff-card-proxy__line:last-child { margin-bottom: 0; }
/* An unchosen mode of a modal spell, greyed and placed after the chosen one. */
.ff-card-proxy__line--muted { opacity: 0.38; }

.ff-card-proxy__pt {
	position: absolute;
	right: 0.5rem;
	bottom: 0.4rem;
	padding: 0.05rem 0.45rem;
	border-radius: var(--radius-sm);
	background: color-mix(in srgb, var(--default) 12%, var(--contents));
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

/* On creatures, reserve the bottom strip so the rules text (and the
   fit-to-card shrink) never run under the P/T badge. */
.ff-card-proxy--creature .ff-card-proxy__text { padding-bottom: 1.2rem; }

.ff-card-proxy__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.1rem 0.55rem;
	line-height: 1;
	border-top: 1px solid color-mix(in srgb, var(--default) 10%, transparent);
	font-size: 0.66rem;
	color: color-mix(in srgb, var(--default) 48%, transparent);
}
.ff-card-proxy__artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-card-proxy__set { flex-shrink: 0; }

/* ── Mana / symbol pips ───────────────────────────────────────────────── */
.ff-pip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.3em;
	height: 1.3em;
	border-radius: 50%;
	font-size: 0.72em;       /* glyph size; width/height are in this em, so the
	                            circle is ~0.94em of the surrounding text */
	font-weight: 800;
	line-height: 1;
	vertical-align: middle;  /* centre the pip on the line so pip lines align
	                            with plain text lines */
	box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.ff-pip--u       { background: #2a6fb0; color: #fff; }
.ff-pip--w       { background: #f5f0d8; color: #3a3320; }
.ff-pip--b       { background: #2b2a28; color: #d8d4cc; }
.ff-pip--r       { background: #c0392b; color: #fff; }
.ff-pip--g       { background: #2e8b57; color: #fff; }
.ff-pip--c       { background: #b8b3aa; color: #2a2a2a; }
.ff-pip--generic { background: #cbc3b8; color: #2a2a2a; }
.ff-pip--tap     { background: #d9d2c5; color: #2a2a2a; }

/* Icon pip: an image symbol (its art is already a disc), sized to match the
   lettered pips. font-size:1em cancels the .ff-pip glyph scaling so the box is
   measured against the surrounding text. */
.ff-pip--img {
	width: 1.15em;
	height: 1.15em;
	font-size: 1em;
	border-radius: 0;
	background: none;
	box-shadow: none;
	object-fit: contain;
}
