Template:Resource card/styles.css: Difference between revisions

Current answers. Practical procedures. Reliable reference.
Jump to navigation Jump to search
Redesign pass 2: drop full border (accent rail + elevated surface instead), bigger padding/type, real hover interaction, custom arrow icon, wider single-card max-width
Make standalone resource cards full width
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:
   rather than introducing a second colour system.
   rather than introducing a second colour system.


   2026-08-07 SECOND PASS: dropped the full 1px border around the card --
   2026-08-07 POLISH PASS: kept the pass-2 approach (no full border,
   hierarchy now comes from an elevated surface tone (--edfm-surface-3,
   elevated surface + accent rail + corner-cut, custom arrow icon) and
   one step brighter than the article surface) plus the accent rail and
  refined it rather than redesigning it --
   corner-cut alone, per "stop using a border around everything". More
   - stronger internal hierarchy between the resource name and its
   generous padding, a real hover interaction (small lift + brighter
    expanded full name (full name now reads as a small technical label:
   surface + stronger accent, ~150ms, honours prefers-reduced-motion via
    smaller, uppercase, letter-spaced, more separated vertically)
  the global rule in Common.css), tags visually separated from the
   - the corner-cut is now paired with a small filled accent triangle
   description by their own rule instead of just a margin, and single
    right at the notch so the motif actually registers instead of
   (non-grid) cards get a deliberate ~760px max width instead of the
    blending into the dark background at a glance
   previous 640px, which read as an arbitrary half-width leftover rather
   - hover stays in the cyan family (brighter cyan + thicker rail)
   than an intentional size.
    instead of swapping to orange, since these cards are "reference/
    link" content and cyan is that tier's colour throughout the rest of
    the site -- swapping hue on hover sent a mixed signal
   - hover shadow reduced (was a bit heavy for "extremely subtle")
  - keyboard focus still gets a clear indicator via the site-wide
    `a:focus-visible` outline rule in Common.css on the card's own link;
    :focus-within (which would have mirrored the full :hover treatment
    onto the card itself) is NOT used here because TemplateStyles'
    selector sanitizer rejects it -- confirmed by testing, not assumed
 
   The single/two/N-up column behaviour is NOT hard-coded per section --
   it falls out of .edfm-resource-grid's `repeat(auto-fit, minmax(...))`
  automatically: a lone card in a grid becomes the one available track
  and fills it (full width), two cards split evenly, more wrap onto
  additional rows. Tools and Resources now wraps every resource-card
  section in this container (including the previously-standalone single
   ones), not just the multi-card ones -- see that page's wikitext, not
   this file, for that change.


   The linked resource name reuses the site's normal external-link colour
   The linked resource name reuses the site's normal external-link colour
   (from MediaWiki:Common.css's `.mw-parser-output a.external` rule)
   (from MediaWiki:Common.css's `.mw-parser-output a.external` rule)
   rather than redefining it here, per "use the site's link/accent system,
   rather than redefining it here, per "use the site's link/accent system,
   not bright orange for every name" -- only the external-link *icon* is
   not bright orange for every name". */
  swapped for a custom arrow glyph, positioned consistently regardless of
  name length. */
.edfm-resource {
.edfm-resource {
position: relative;
position: relative;
background: var( --edfm-surface-3 );
background: var( --edfm-surface-3 );
border-left: 3px solid var( --edfm-cyan );
border-left: 3px solid var( --edfm-cyan );
padding: 1.4em 1.6em;
padding: 1.5em 1.75em;
margin: 1.4em 0;
margin: 1.4em 0;
clip-path: polygon( 0 0, calc( 100% - 10px ) 0, 100% 10px, 100% 100%, 0 100% );
clip-path: polygon( 0 0, calc( 100% - 14px ) 0, 100% 14px, 100% 100%, 0 100% );
max-width: 760px;
width: 100%;
max-width: none;
box-sizing: border-box;
box-sizing: border-box;
transition: background-color 0.15s ease, border-left-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
transition: background-color 0.15s ease, border-left-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
/* The one recurring EDFM shape motif on this component: a small filled
  triangle sitting exactly in the clipped corner, echoing the logo's
  angular geometry. Low opacity, cyan by default so it doesn't compete
  with the orange-reserved-for-navigation rule; single technique, not
  layered with anything else. */
.edfm-resource::before {
content: '';
position: absolute;
top: 0;
right: 0;
width: 14px;
height: 14px;
background: linear-gradient( 135deg, transparent 50%, var( --edfm-cyan ) 50% );
opacity: 0.6;
/* Note: no pointer-events here -- TemplateStyles' sanitizer doesn't
  allow that property. Not needed in practice: this sits in the
  card's empty top-right corner, past where the name/link text runs,
  so there's nothing under it to intercept clicks from. */
transition: opacity 0.15s ease, background-color 0.15s ease;
}
}
.edfm-resource:hover {
.edfm-resource:hover {
background: var( --edfm-surface-4 );
background: var( --edfm-surface-4 );
border-left-color: var( --edfm-orange );
border-left-color: var( --edfm-cyan );
border-left-width: 4px;
transform: translateY( -2px );
transform: translateY( -2px );
box-shadow: 0 6px 16px rgba( 0, 0, 0, 0.35 );
box-shadow: 0 3px 8px rgba( 0, 0, 0, 0.25 );
}
.edfm-resource:hover::before {
opacity: 1;
}
.edfm-resource:hover .edfm-resource-name a.external {
color: var( --edfm-link-external-hover );
}
}
.edfm-resource-head {
.edfm-resource-head {
Line 44: Line 87:
flex-wrap: wrap;
flex-wrap: wrap;
column-gap: 0.7em;
column-gap: 0.7em;
row-gap: 0.15em;
row-gap: 0.3em;
}
}
.edfm-resource-name {
.edfm-resource-name {
Line 51: Line 94:
  literally here to match --edfm-mono in MediaWiki:Common.css. */
  literally here to match --edfm-mono in MediaWiki:Common.css. */
font-family: 'JetBrains Mono', 'Fira Code', Consolas, 'SF Mono', Menlo, 'Courier New', monospace;
font-family: 'JetBrains Mono', 'Fira Code', Consolas, 'SF Mono', Menlo, 'Courier New', monospace;
font-size: 1.1rem;
font-size: 1.05rem;
font-weight: 700;
font-weight: 700;
letter-spacing: 0.02em;
letter-spacing: 0.02em;
Line 72: Line 115:
font-weight: 400;
font-weight: 400;
}
}
/* Full/expanded name now reads as its own small technical label rather
  than a slightly-smaller second name sitting right next to the first --
  uppercase, letter-spaced, on its own line by default (the flex-wrap
  above naturally drops it to a second line whenever the name + full
  name don't both fit on one, and forcing it here keeps that behaviour
  consistent instead of depending on available width). */
.edfm-resource-fullname {
.edfm-resource-fullname {
flex-basis: 100%;
color: var( --edfm-text-dim );
color: var( --edfm-text-dim );
font-size: 0.82em;
font-size: 0.72rem;
letter-spacing: 0.02em;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
}
.edfm-resource-desc {
.edfm-resource-desc {
margin: 0.6em 0 0 0;
margin: 0.7em 0 0 0;
color: var( --edfm-text-muted );
color: var( --edfm-text-muted );
font-size: 1rem;
font-size: 1rem;
Line 87: Line 139:
flex-wrap: wrap;
flex-wrap: wrap;
gap: 0.5em;
gap: 0.5em;
margin-top: 1em;
margin-top: 1.1em;
padding-top: 0.9em;
padding-top: 0.9em;
border-top: 1px solid var( --edfm-border-soft );
border-top: 1px solid var( --edfm-border-soft );
Line 102: Line 154:
}
}


/* Optional wrapper for placing up to a few cards side by side on wide
/* Wrapping container for resource cards -- used for EVERY resource-card
   screens. Not tied to Template:Resource card specifically -- any page
   section on a page, not just multi-card ones (see the note up top): a
   can drop `<div class="edfm-resource-grid">...</div>` around a run of
   lone card becomes the grid's one track and spans full width, two split
   cards (or anything else). Equal-height rows via grid's default
   evenly, more wrap onto further rows, all from the same rule. Equal-
  align-items:stretch plus height:100% on the card, so cards with
  height rows via grid's default align-items:stretch plus height:100% on
  slightly different description lengths still line up. Cards should
  the card, so cards with slightly different description lengths still
  never visually touch -- a deliberately generous 1.4rem (~22px) gap. */
  line up. Cards should never visually touch -- a deliberately generous
  1.4rem (~22px) gap. */
.edfm-resource-grid {
.edfm-resource-grid {
display: grid;
display: grid;
Line 123: Line 176:
.edfm-resource {
.edfm-resource {
max-width: none;
max-width: none;
padding: 1.2em 1.3em;
padding: 1.3em 1.4em;
}
}
}
}

Latest revision as of 19:26, 10 August 2026

/* Resource card component -- compact reference card for third-party
   tools/sites/services (see Template:Resource card). Uses the site's
   existing --edfm-* design tokens (defined once in MediaWiki:Common.css)
   rather than introducing a second colour system.

   2026-08-07 POLISH PASS: kept the pass-2 approach (no full border,
   elevated surface + accent rail + corner-cut, custom arrow icon) and
   refined it rather than redesigning it --
   - stronger internal hierarchy between the resource name and its
     expanded full name (full name now reads as a small technical label:
     smaller, uppercase, letter-spaced, more separated vertically)
   - the corner-cut is now paired with a small filled accent triangle
     right at the notch so the motif actually registers instead of
     blending into the dark background at a glance
   - hover stays in the cyan family (brighter cyan + thicker rail)
     instead of swapping to orange, since these cards are "reference/
     link" content and cyan is that tier's colour throughout the rest of
     the site -- swapping hue on hover sent a mixed signal
   - hover shadow reduced (was a bit heavy for "extremely subtle")
   - keyboard focus still gets a clear indicator via the site-wide
     `a:focus-visible` outline rule in Common.css on the card's own link;
     :focus-within (which would have mirrored the full :hover treatment
     onto the card itself) is NOT used here because TemplateStyles'
     selector sanitizer rejects it -- confirmed by testing, not assumed

   The single/two/N-up column behaviour is NOT hard-coded per section --
   it falls out of .edfm-resource-grid's `repeat(auto-fit, minmax(...))`
   automatically: a lone card in a grid becomes the one available track
   and fills it (full width), two cards split evenly, more wrap onto
   additional rows. Tools and Resources now wraps every resource-card
   section in this container (including the previously-standalone single
   ones), not just the multi-card ones -- see that page's wikitext, not
   this file, for that change.

   The linked resource name reuses the site's normal external-link colour
   (from MediaWiki:Common.css's `.mw-parser-output a.external` rule)
   rather than redefining it here, per "use the site's link/accent system,
   not bright orange for every name". */
.edfm-resource {
	position: relative;
	background: var( --edfm-surface-3 );
	border-left: 3px solid var( --edfm-cyan );
	padding: 1.5em 1.75em;
	margin: 1.4em 0;
	clip-path: polygon( 0 0, calc( 100% - 14px ) 0, 100% 14px, 100% 100%, 0 100% );
	width: 100%;
	max-width: none;
	box-sizing: border-box;
	transition: background-color 0.15s ease, border-left-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
/* The one recurring EDFM shape motif on this component: a small filled
   triangle sitting exactly in the clipped corner, echoing the logo's
   angular geometry. Low opacity, cyan by default so it doesn't compete
   with the orange-reserved-for-navigation rule; single technique, not
   layered with anything else. */
.edfm-resource::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	width: 14px;
	height: 14px;
	background: linear-gradient( 135deg, transparent 50%, var( --edfm-cyan ) 50% );
	opacity: 0.6;
	/* Note: no pointer-events here -- TemplateStyles' sanitizer doesn't
	   allow that property. Not needed in practice: this sits in the
	   card's empty top-right corner, past where the name/link text runs,
	   so there's nothing under it to intercept clicks from. */
	transition: opacity 0.15s ease, background-color 0.15s ease;
}
.edfm-resource:hover {
	background: var( --edfm-surface-4 );
	border-left-color: var( --edfm-cyan );
	border-left-width: 4px;
	transform: translateY( -2px );
	box-shadow: 0 3px 8px rgba( 0, 0, 0, 0.25 );
}
.edfm-resource:hover::before {
	opacity: 1;
}
.edfm-resource:hover .edfm-resource-name a.external {
	color: var( --edfm-link-external-hover );
}
.edfm-resource-head {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	column-gap: 0.7em;
	row-gap: 0.3em;
}
.edfm-resource-name {
	/* TemplateStyles' CSS sanitizer rejects var() specifically inside
	   font-family (even though it's otherwise valid CSS) -- spelled out
	   literally here to match --edfm-mono in MediaWiki:Common.css. */
	font-family: 'JetBrains Mono', 'Fira Code', Consolas, 'SF Mono', Menlo, 'Courier New', monospace;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	overflow-wrap: anywhere;
}
/* Swap the default MediaWiki external-link icon for a bigger, consistently
   -aligned arrow that reads clearly at this larger name size. Core sets
   the default icon via `.mw-parser-output a.external` at (0,2,1)
   specificity (two classes + a tag); matching that shape here (plus the
   card's own class, so it's scoped to just this component) keeps the
   override unambiguous rather than depending on stylesheet order. */
.edfm-resource-name a.external {
	background-image: none !important;
	padding-right: 0 !important;
}
.edfm-resource-name a.external::after {
	content: '\2197';
	display: inline-block;
	margin-left: 0.3em;
	font-weight: 400;
}
/* Full/expanded name now reads as its own small technical label rather
   than a slightly-smaller second name sitting right next to the first --
   uppercase, letter-spaced, on its own line by default (the flex-wrap
   above naturally drops it to a second line whenever the name + full
   name don't both fit on one, and forcing it here keeps that behaviour
   consistent instead of depending on available width). */
.edfm-resource-fullname {
	flex-basis: 100%;
	color: var( --edfm-text-dim );
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.edfm-resource-desc {
	margin: 0.7em 0 0 0;
	color: var( --edfm-text-muted );
	font-size: 1rem;
	line-height: 1.6;
}
.edfm-resource-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
	margin-top: 1.1em;
	padding-top: 0.9em;
	border-top: 1px solid var( --edfm-border-soft );
}
.edfm-resource-tag {
	font-family: 'JetBrains Mono', 'Fira Code', Consolas, 'SF Mono', Menlo, 'Courier New', monospace;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var( --edfm-text-dim );
	background: var( --edfm-surface-2 );
	padding: 0.2em 0.6em;
}

/* Wrapping container for resource cards -- used for EVERY resource-card
   section on a page, not just multi-card ones (see the note up top): a
   lone card becomes the grid's one track and spans full width, two split
   evenly, more wrap onto further rows, all from the same rule. Equal-
   height rows via grid's default align-items:stretch plus height:100% on
   the card, so cards with slightly different description lengths still
   line up. Cards should never visually touch -- a deliberately generous
   1.4rem (~22px) gap. */
.edfm-resource-grid {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 300px, 1fr ) );
	gap: 1.4rem;
}
.edfm-resource-grid .edfm-resource {
	max-width: none;
	margin: 0;
	height: 100%;
}

@media ( max-width: 640px ) {
	.edfm-resource {
		max-width: none;
		padding: 1.3em 1.4em;
	}
}